@editorjs/warning

1.4.0 • Public • Published

Warning Tool

Provides Warning Block for the CodeX Editor. Block has title and message. It can be used, for example, for editorials notifications or appeals.

Installation

Get the package

yarn add @editorjs/warning

Include module at your application

import Warning from '@editorjs/warning';

Optionally, you can load this tool from CDN JsDelivr CDN

Usage

Add a new Tool to the tools property of the CodeX Editor initial config.

var editor = CodexEditor({
  ...
  
  tools: {
    ...
    warning: Warning,
  },
  
  ...
});

Or init Warning Tool with additional settings

var editor = CodexEditor({
  ...
  
  tools: {
    ...
    warning: {
      class: Warning,
      inlineToolbar: true,
      shortcut: 'CMD+SHIFT+W',
      config: {
        titlePlaceholder: 'Title',
        messagePlaceholder: 'Message',
      },
    },
  },
  
  ...
});

Config Params

Field Type Description
titlePlaceholder string Warning Tool's title placeholder
messagePlaceholder string Warning Tool's message placeholder

Output data

Field Type Description
title string warning's title
message string warning's message
{
    "type" : "warning",
    "data" : {
        "title" : "Note:",
        "message" : "Avoid using this method just for lulz. It can be very dangerous opposite your daily fun stuff."
    }
}

Dependents (73)

Package Sidebar

Install

npm i @editorjs/warning

Weekly Downloads

8,974

Version

1.4.0

License

MIT

Unpacked Size

12.2 kB

Total Files

7

Last publish

Collaborators

  • codex-team