Skip to content

Latest commit

 

History

History

changes

slate-helpers

A set of helper and utility functions for Slate editors.

Usage

This repository is maintain in a monorepo see packages in packages folder.

Helper packages

Blocks

@canner/slate-constant

npm version

Shared slate type variables.

@canner/slate-helper-block-adddata

npm version

fn(change: Change, data: Object) => Change

Add additional data to block, this could be useful in implement things like align.

@canner/slate-helper-block-quote

npm version

fn(change: Change, options: Object) => Change

This plugin is based on https://github.com/GitbookIO/slate-edit-blockquote, will wrapped block quote if the selection is not within a blockquote, otherwise unwrapped it.

@canner/slate-helper-block-cleardatabykey

npm version

fn(change: Change, dataKey: String) => Change

This remove a data key that stores in current block type

@canner/slate-helper-block-list

npm version

fn(change: Change, options: Object) => Change

This plugin is based on https://github.com/GitbookIO/slate-edit-list/, will wrap to block list, if it's wrapped unwrap it.

Inlines

@canner/slate-helper-inline-adddata

npm version

fn(change: Change, data: Object) => Change

Add additional data to inline, this could be useful in implement things like align.

@canner/slate-helper-inline-links

npm version

fn(change: Change, type: String, options: Object) => Change

insert a link with options.href settings, wrapped inline if the selection is expanded, and unwrap if it is a link.

Marks

@canner/slate-helper-mark-addoverwrite

npm version

fn(change: Change, options: Object) => Change

If the selected marks have type that is equal to options.type, will be removed the original one and add a new mark with the option settings.

@canner/slate-helper-mark-removeall

npm version

fn(change: Change) => Change

Remove all marks in the selection.

@canner/slate-helper-mark-removetype

npm version

fn(change: Change, type: String) => Change

Remove specific mark type in the selection.

Maintainer

chilijung

License

MIT © Canner