diff options
author | 赵智超 <1012112796@qq.com> | 2020-09-20 07:21:22 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-20 07:21:22 +0800 |
commit | 7f966f316bdd8ceafa089717250d611a5d1ec24c (patch) | |
tree | 665318b73eca1b5e7565ec9d43279db07e621fd3 | |
parent | 355788db46296598748c0742dab72c1eed7dd91f (diff) | |
download | gitea-7f966f316bdd8ceafa089717250d611a5d1ec24c.tar.gz gitea-7f966f316bdd8ceafa089717250d611a5d1ec24c.zip |
Add the checkbox quick button to the comment tool bar also (#12885)
Just copy it from the WIKI tool bar :)
Signed-off-by: a1012112796 <1012112796@qq.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
-rw-r--r-- | web_src/js/index.js | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/web_src/js/index.js b/web_src/js/index.js index 3f714874ae..415db385b3 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', '|', |