diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-11-13 22:51:59 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-11-13 22:51:59 -0500 |
commit | ebb6b2827d0496303852f524a551592295dd0040 (patch) | |
tree | a3e6dff7036ba83e436941b0b0e96c89311eb0f8 /assets/js/src | |
parent | 527a1677a0578e479302e1f80b127e177ed915e9 (diff) |
Replace SimpleMDE with custom Markdown editor
Diffstat (limited to 'assets/js/src')
-rw-r--r-- | assets/js/src/Markdown.js | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/assets/js/src/Markdown.js b/assets/js/src/Markdown.js deleted file mode 100644 index 11673eec..00000000 --- a/assets/js/src/Markdown.js +++ /dev/null @@ -1,59 +0,0 @@ -Kanboard.Markdown = function(app) { - this.app = app; - this.editor = null; -}; - -Kanboard.Markdown.prototype.onPopoverOpened = function() { - this.listen(); -}; - -Kanboard.Markdown.prototype.onPopoverClosed = function() { - this.listen(); -}; - -Kanboard.Markdown.prototype.listen = function() { - var editors = $(".markdown-editor"); - - if (this.editor) { - this.destroy(); - } - - if (editors.length > 0) { - this.show(editors[0]); - } -}; - -Kanboard.Markdown.prototype.destroy = function() { - var cm = this.editor.codemirror; - var wrapper = cm.getWrapperElement(); - - for (var item in ["toolbar", "statusbar", "sideBySide"]) { - if (this.editor.gui[item]) { - wrapper.parentNode.removeChild(this.editor.gui[item]); - } - } - - cm.toTextArea(); - this.editor = null; -}; - -Kanboard.Markdown.prototype.show = function(textarea) { - var toolbar = ["bold", "italic", "strikethrough", "heading", "|", "unordered-list", "ordered-list", "link", "|", "code", "table"]; - - this.editor = new SimpleMDE({ - element: textarea, - status: false, - toolbarTips: false, - autoDownloadFontAwesome: false, - spellChecker: false, - autosave: { - enabled: false - }, - forceSync: true, - blockStyles: { - italic: "_" - }, - toolbar: textarea.hasAttribute("data-markdown-editor-disable-toolbar") ? false : toolbar, - placeholder: textarea.getAttribute("placeholder") - }); -}; |