From f78db77a81994917021dcff4c08e756a3f29c8f2 Mon Sep 17 00:00:00 2001 From: Benjamin Southall Date: Sun, 3 Sep 2017 23:17:37 +0900 Subject: Add quill WYSIWIG post editor (experimental) --- js/loadquill.js | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 js/loadquill.js (limited to 'js/loadquill.js') 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", + "
Editor Dialog " + + ("") + + "
"); +} + +$('.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(); +}); +} -- cgit v1.3