From 7c31f5f0bdb6075ad88992eab1f2f97da6e4c055 Mon Sep 17 00:00:00 2001 From: a1012112796 <1012112796@qq.com> Date: Fri, 18 Sep 2020 10:42:42 +0800 Subject: [PATCH] Add the checkbox quick button to the comment tool bar also Just copy it from the WIKI tool bar :) Signed-off-by: a1012112796 <1012112796@qq.com> --- web_src/js/index.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/web_src/js/index.js b/web_src/js/index.js index 3f714874ae1a2..415db385b39e6 100644 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -1484,7 +1484,26 @@ function setCommentSimpleMDE($editArea) { spellChecker: false, toolbar: ['bold', 'italic', 'strikethrough', '|', 'heading-1', 'heading-2', 'heading-3', 'heading-bigger', 'heading-smaller', '|', - 'code', 'quote', '|', + 'code', 'quote', '|', { + name: 'checkbox-empty', + action(e) { + const cm = e.codemirror; + cm.replaceSelection(`\n- [ ] ${cm.getSelection()}`); + cm.focus(); + }, + className: 'fa fa-square-o', + title: 'Add Checkbox (empty)', + }, + { + name: 'checkbox-checked', + action(e) { + const cm = e.codemirror; + cm.replaceSelection(`\n- [x] ${cm.getSelection()}`); + cm.focus(); + }, + className: 'fa fa-check-square-o', + title: 'Add Checkbox (checked)', + }, '|', 'unordered-list', 'ordered-list', '|', 'link', 'image', 'table', 'horizontal-rule', '|', 'clean-block', '|',