Skip to content
Warning Tool for CodeX Editor 2.0
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist Add npmignore (#3) Mar 18, 2019
src Update dependencies (#2) Mar 18, 2019
.gitignore
.npmignore Add npmignore (#3) Mar 18, 2019
LICENSE Initial version Oct 31, 2018
README.md Update The Package Name && Path (#5) Apr 3, 2019
package.json Add npmignore (#3) Mar 18, 2019
webpack.config.js Add npmignore (#3) Mar 18, 2019
yarn.lock

README.md

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

Install via NPM

Get the package

npm i --save-dev @editorjs/warning

Include module at your application

const Warning = require('@editorjs/warning');

Download to your project's source dir

  1. Upload folder dist from repository
  2. Add dist/bundle.js file to your page.

Load from CDN

You can load specific version of package from jsDelivr CDN.

https://cdn.jsdelivr.net/npm/@editorjs/warning@latest

Then require this script on page with CodeX Editor.

<script src="..."></script>

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."
    }
}
You can’t perform that action at this time.