Quill plugin fix.

Just making it work. It seems to be working fine on my end,
but user-defined toolbar options are not implemented yet.

The plugin now loads all toolbar options by default.
See: var toolbarOptions
This commit is contained in:
Hakim Zulkufli 2017-04-30 19:08:46 +08:00
parent aebaed2a8c
commit 84aa89a861
1 changed files with 32 additions and 14 deletions

View File

@ -56,7 +56,7 @@ class pluginQuill extends Plugin {
$html .= '<input name="autosave" id="jsautosave" type="checkbox" value="1" '.($this->getDbField('autosave')?'checked':'').'>';
$html .= '<label class="forCheckbox" for="jsautosave">'.$Language->get('Autosave').'</label>';
$html .= '</div>';
$html .= '<div>';
$html .= '<input type="hidden" name="spellChecker" value="0">';
$html .= '<input name="spellChecker" id="jsspellChecker" type="checkbox" value="1" '.($this->getDbField('spellChecker')?'checked':'').'>';
@ -72,25 +72,43 @@ class pluginQuill extends Plugin {
global $Language;
$html = '';
if( $this->enabled() ) {
// Load CSS and JS only on Controllers in array.
if(in_array($layout['controller'], $this->loadWhenController))
{
$html .= '
<script>
var quill = new Quill("#editor-container", {
modules: {
toolbar: [
[{ header: [1, 2, false] }],
["bold", "italic", "underline"],
["image"]
]
},
placeholder: "asd",
theme: "snow"
});
var toolbarOptions = [
["bold", "italic", "underline", "strike"], // toggled buttons
["blockquote", "code-block"],
[{ "header": 1 }, { "header": 2 }], // custom button values
[{ "list": "ordered"}, { "list": "bullet" }],
[{ "script": "sub"}, { "script": "super" }], // superscript/subscript
[{ "indent": "-1"}, { "indent": "+1" }], // outdent/indent
[{ "direction": "rtl" }], // text direction
[{ "size": ["small", false, "large", "huge"] }], // custom dropdown
[{ "header": [1, 2, 3, 4, 5, 6, false] }],
[{ "color": [] }, { "background": [] }], // dropdown with defaults from theme
[{ "font": [] }],
[{ "align": [] }],
["clean"] // remove formatting button
];
var quill = new Quill("#jscontent", {
modules: {
toolbar: toolbarOptions
},
placeholder: "Compose an epic...",
theme: "snow"
});
</script>
';
}
return $html;
}
}
}