5.2.0-alpha.273b0e7e • Published 6 years ago

@techstacker/tse-bold-plugin v5.2.0-alpha.273b0e7e

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

SlateJS bold plugin.

npm package npm downloads

Installation

The @slate-editor/bold-plugin is available as an npm package.

yarn add @slate-editor/bold-plugin

Usage

Here is a quick example to get you started:

import React from 'react'
import { SlateEditor, SlateToolbar, SlateContent } from 'slate-editor'
import { BoldPlugin, BoldButtonBar } from '@slate-editor/bold-plugin'

const plugins = [
  BoldPlugin()
]

const SlateRichTextEditor = () => (
  <SlateEditor plugins={plugins}>
    <SlateToolbar>
      <BoldButtonBar />
    </SlateToolbar>

    <SlateContent />
  </SlateEditor>
)

export default SlateRichTextEditor

Keyboard Shortcut

OSShortcut
Apple Logo+b
Windows Logo^+b

API

NameDescription
BoldMarkComponent that holds the html that will wrap the content with bold style.
BoldUtilsGeneric file that holds the util common functions.
BoldButtonButton component that have behaviour to wrap content with bold style.
BoldKeyboardShortcutKeyboard shortcut file that manipulates onKeyDown event inside SlateJS.

TODO

  • Make keyboard shortcut accepts customization