Provides Warning Block for the CodeX Editor. Block has title and message. It can be used, for example, for editorials notifications or appeals.
Get the package
npm i --save-dev @editorjs/warning
Include module at your application
const Warning = require('@editorjs/warning');
- Upload folder
dist
from repository - Add
dist/bundle.js
file to your page.
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>
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',
},
},
},
...
});
Field | Type | Description |
---|---|---|
titlePlaceholder | string |
Warning Tool's title placeholder |
messagePlaceholder | string |
Warning Tool's message placeholder |
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."
}
}