Skip to content

Commit 7f966f3

Browse files
a1012112796lunnyzeripath
authored
Add the checkbox quick button to the comment tool bar also (#12885)
Just copy it from the WIKI tool bar :) Signed-off-by: a1012112796 <[email protected]> Co-authored-by: Lunny Xiao <[email protected]> Co-authored-by: zeripath <[email protected]>
1 parent 355788d commit 7f966f3

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

web_src/js/index.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1484,7 +1484,26 @@ function setCommentSimpleMDE($editArea) {
14841484
spellChecker: false,
14851485
toolbar: ['bold', 'italic', 'strikethrough', '|',
14861486
'heading-1', 'heading-2', 'heading-3', 'heading-bigger', 'heading-smaller', '|',
1487-
'code', 'quote', '|',
1487+
'code', 'quote', '|', {
1488+
name: 'checkbox-empty',
1489+
action(e) {
1490+
const cm = e.codemirror;
1491+
cm.replaceSelection(`\n- [ ] ${cm.getSelection()}`);
1492+
cm.focus();
1493+
},
1494+
className: 'fa fa-square-o',
1495+
title: 'Add Checkbox (empty)',
1496+
},
1497+
{
1498+
name: 'checkbox-checked',
1499+
action(e) {
1500+
const cm = e.codemirror;
1501+
cm.replaceSelection(`\n- [x] ${cm.getSelection()}`);
1502+
cm.focus();
1503+
},
1504+
className: 'fa fa-check-square-o',
1505+
title: 'Add Checkbox (checked)',
1506+
}, '|',
14881507
'unordered-list', 'ordered-list', '|',
14891508
'link', 'image', 'table', 'horizontal-rule', '|',
14901509
'clean-block', '|',

0 commit comments

Comments
 (0)