diff options
| author | Benjamin Southall <applemansigloo@gmail.com> | 2017-09-03 23:17:37 +0900 |
|---|---|---|
| committer | Benjamin Southall <applemansigloo@gmail.com> | 2017-09-03 23:17:37 +0900 |
| commit | f78db77a81994917021dcff4c08e756a3f29c8f2 (patch) | |
| tree | 03449ccffa4aabfadb085ad9344104057e696034 /js/loadquill.js | |
| parent | 9e2f9f49ec9803adfa0249161c8d2188ee0d40ca (diff) | |
Add quill WYSIWIG post editor (experimental)
Diffstat (limited to 'js/loadquill.js')
| -rw-r--r-- | js/loadquill.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/js/loadquill.js b/js/loadquill.js new file mode 100644 index 00000000..f3ce5d53 --- /dev/null +++ b/js/loadquill.js @@ -0,0 +1,44 @@ +if (active_page === "thread" || active_page === "index" || active_page === "ukko") { + +$(document).on("ready", function() { +if (window.Options && Options.get_tab('general')) { + Options.extend_tab("general", + "<fieldset><legend>Editor Dialog </legend>" + + ("<label class='quillc' id='quill'><input type='checkbox' /> Enable Quill WYSIWYG Editor</label>") + + "</fieldset>"); +} + +$('.quillc').on('change', function(){ + var setting = $(this).attr('id'); + + localStorage[setting] = $(this).children('input').is(':checked'); + location.reload(); +}); + +if (!localStorage.quill) { + localStorage.quill = 'false'; +} + +function getSetting(key) { + return (localStorage[key] == 'true'); +} + +if (getSetting('quill')) $('#quill>input').prop('checked', 'checked'); + +function initquill() { + if (!getSetting("quill")) {return;} + var quill = new Quill('#body', { + modules: { + toolbar: [ + [{ header: [1, 2, false] }], + ['bold', 'italic', 'underline'], + ['image', 'code-block'] + ] + }, + placeholder: 'Compose an epic...', + theme: 'snow' // or 'bubble' + }); +} +initquill(); +}); +} |
