1.0.0 • Published 1 year ago

@ympact.dev/editorjs-clear-formatting v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Clear formatting tool for Editor.js

Basic clear formatting tool for Editor.js.

Installation

Get the package

yarn add @ympact.dev/editorjs-clear-formatting

Include module at your application

import ClearFormatting from '@ympact.dev/editorjs-clear-formatting';

Usage

Add a new Tool to the tools property of the Editor. The clear formatting will be included in the inline toolbar of all block tools in case the inlineToolbar setting of the block tool is not set. To explicitly include it in a block tool use : inlineToolbar: ['clearFormatting']

var editor = new EditorJS({
  ...

  tools: {
    ...
    clearFormatting:{
      class: ClearFormatting
      config: {
        shortcut: null,
        closeOnClick: false,
        icon: `<svg>...</svg>`
      }
    },
  }

  ...
});

Config Params

FieldTypeDefaultDescription
shortcutstringnullSet a shortcut for this tool (ie CTRL+W).
closeOnClickbooleanfalseWhether the inline toolbar should be closed when clicking on the clear formatting tool.
iconstringCustomize the icon for the tool.

Output data

The clear formatting tool does not output any data. It clears all existing formatting within the selection.

Roadmap

v1.0

  • Simple clearing of formatting within selection
  • Keep track of newly inserted formatting from other tools while inline toolbar is visible for selection

v2.0

  • More advanced clearing using boundaries