@slate-editor/underline-plugin
v5.1.0
Published
SlateJS underline mark plugin.
Downloads
4,465
Readme
SlateJS underline plugin.
Installation
The @slate-editor/underline-plugin is available as an npm package.
yarn add @slate-editor/underline-plugin
Usage
Here is a quick example to get you started:
import React from 'react'
import { SlateEditor, SlateToolbar, SlateContent } from 'slate-editor'
import { UnderlinePlugin, UnderlineButton } from '@slate-editor/underline-plugin'
const plugins = [
UnderlinePlugin()
]
const SlateRichTextEditor = () => (
<SlateEditor plugins={plugins}>
<SlateToolbar>
<UnderlineButton />
</SlateToolbar>
<SlateContent />
</SlateEditor>
)
export default SlateRichTextEditor
Keyboard Shortcut
| OS | Shortcut | |--------------------------|--------------------------------| | | ⌘ + u | | | ctrl + u |
API
| Name | Description |
|---------------------------|--------------------------------------------------------------------------------|
| UnderlineMark | Component that holds the html that will wrap the content with underline style. |
| UnderlineKeyboardShortcut | Keyboard shortcut file that manipulates onKeyDown
event inside SlateJS. |
| UnderlineUtils | Generic file that holds the util common functions. |
| UnderlineButton | Button component that have behaviour to wrap content with underline style. |
TODO
- Make keyboard shortcut accepts customization