Provides Quote Blocks for the Editor.js.
Get the package
npm i --save-dev @editorjs/quoteInclude module at your application
constQuote=require('@editorjs/quote');- Upload folder
distfrom repository - Add
dist/bundle.jsfile to your page.
You can load specific version of package from jsDelivr CDN.
https://cdn.jsdelivr.net/npm/@editorjs/quote@latest
Then require this script on page with Editor.js.
<scriptsrc="..."></script>Add a new Tool to the tools property of the Editor.js initial config.
vareditor=EditorJS({
...
tools: {
...
quote: Quote,},
...
});Or init Quote Tool with additional settings
vareditor=EditorJS({
...
tools: {
...
quote: {class: Quote,inlineToolbar: true,shortcut: 'CMD+SHIFT+O',config: {quotePlaceholder: 'Enter a quote',captionPlaceholder: 'Quote\'s author',},},},
...
});| Field | Type | Description |
|---|---|---|
| quotePlaceholder | string | quote's placeholder string |
| captionPlaceholder | string | caption's placeholder string |
You can choose alignment for the quote. It takes no effect while editing, but saved the «alignment» param.
| Field | Type | Description |
|---|---|---|
| text | string | quote's text |
| caption | string | caption or an author |
| alignment | string | left or center |
{
"type" : "quote",
"data" : {
"text" : "The unexamined life is not worth living.",
"caption" : "Socrates",
"alignment" : "left"
}
}
