From 1ed432300523982df466a786d446e4e03b0e0820 Mon Sep 17 00:00:00 2001 From: zeripath Date: Sat, 1 Feb 2020 20:24:58 +0000 Subject: [PATCH] Add button to revert SimpleMDE to plain textarea (#10099) (#10102) --- web_src/js/index.js | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/web_src/js/index.js b/web_src/js/index.js index 619ca74e52..d7abfa2ff1 100644 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -1362,7 +1362,16 @@ function initWikiForm() { }, '|', 'unordered-list', 'ordered-list', '|', 'link', 'image', 'table', 'horizontal-rule', '|', - 'clean-block', 'preview', 'fullscreen', 'side-by-side'] + 'clean-block', 'preview', 'fullscreen', 'side-by-side', '|', + { + name: 'revert-to-textarea', + action(e) { + e.toTextArea(); + }, + className: 'fa fa-file', + title: 'Revert to simple textarea', + }, + ] }); $(simplemde.codemirror.getInputField()).addClass('js-quick-submit'); @@ -1466,7 +1475,16 @@ function setSimpleMDE($editArea) { 'code', 'quote', '|', 'unordered-list', 'ordered-list', '|', 'link', 'image', 'table', 'horizontal-rule', '|', - 'clean-block', 'preview', 'fullscreen', 'side-by-side'] + 'clean-block', 'preview', 'fullscreen', 'side-by-side', '|', + { + name: 'revert-to-textarea', + action(e) { + e.toTextArea(); + }, + className: 'fa fa-file', + title: 'Revert to simple textarea', + }, + ] }); return true; @@ -1488,7 +1506,16 @@ function setCommentSimpleMDE($editArea) { 'code', 'quote', '|', 'unordered-list', 'ordered-list', '|', 'link', 'image', 'table', 'horizontal-rule', '|', - 'clean-block'] + 'clean-block', '|', + { + name: 'revert-to-textarea', + action(e) { + e.toTextArea(); + }, + className: 'fa fa-file', + title: 'Revert to simple textarea', + }, + ] }); simplemde.codemirror.setOption('extraKeys', { Enter: () => {