Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/editor-js/warning
Warning Tool for CodeX Editor 2.0
https://github.com/editor-js/warning
codex
Last synced: 26 days ago
JSON representation
Warning Tool for CodeX Editor 2.0
- Host: GitHub
- URL: https://github.com/editor-js/warning
- Owner: editor-js
- License: mit
- Created: 2018-10-31T17:35:16.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-03-19T03:54:11.000Z (9 months ago)
- Last Synced: 2024-11-12T18:49:56.243Z (about 1 month ago)
- Topics: codex
- Language: JavaScript
- Homepage:
- Size: 292 KB
- Stars: 25
- Watchers: 2
- Forks: 31
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-editorjs - @editorjs/warning
README
![](https://badgen.net/badge/CodeX%20Editor/v2.0/blue)
# Warning Tool
Provides Warning Block for the [CodeX Editor](https://ifmo.su/editor). Block has title and message. It can be used, for example, for editorials notifications or appeals.
![](assets/2d7b7bc1-ac46-4020-89c9-390d1a7297e2.jpg)
## Installation
Get the package
```shell
yarn add @editorjs/warning
```Include module at your application
```javascript
import Warning from '@editorjs/warning';
```Optionally, you can load this tool from CDN [JsDelivr CDN](https://cdn.jsdelivr.net/npm/@editorjs/warning@latest)
## Usage
Add a new Tool to the `tools` property of the CodeX Editor initial config.
```javascript
var editor = CodexEditor({
...
tools: {
...
warning: Warning,
},
...
});
```Or init Warning Tool with additional settings
```javascript
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|```json
{
"type" : "warning",
"data" : {
"title" : "Note:",
"message" : "Avoid using this method just for lulz. It can be very dangerous opposite your daily fun stuff."
}
}
```