Skip to content

Commit

Permalink
wiki - editor - add buttons 'inline code', 'add empty checkbox', 'add…
Browse files Browse the repository at this point in the history
… checked checkbox'

affects go-gitea#5436

Signed-off-by: Michael Gnehr <michael@gnehr.de>
  • Loading branch information
Cherrg committed Jun 18, 2019
1 parent 2d09765 commit 4270310
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion public/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,37 @@ function initWikiForm() {
spellChecker: false,
toolbar: ["bold", "italic", "strikethrough", "|",
"heading-1", "heading-2", "heading-3", "heading-bigger", "heading-smaller", "|",
"code", "quote", "|",
{
name: "code-inline",
action: function(e){
let cm = e.codemirror;
var selection = cm.getSelection();
cm.replaceSelection("`" + selection + "`");
if (!selection) {
var cursorPos = cm.getCursor();
cm.setCursor(cursorPos.line, cursorPos.ch - 1);
}
},
className: "fa fa-angle-right",
title: "Add Inline Code",
},"code", "quote", "|", {
name: "checkbox-empty",
action: function(e){
let cm = e.codemirror;
cm.replaceSelection("\n- [ ] " + cm.getSelection());
},
className: "fa fa-square-o",
title: "Add Checkbox (empty)",
},
{
name: "checkbox-checked",
action: function(e){
let cm = e.codemirror;
cm.replaceSelection("\n- [x] " + cm.getSelection());
},
className: "fa fa-check-square-o",
title: "Add Checkbox (checked)",
}, "|",
"unordered-list", "ordered-list", "|",
"link", "image", "table", "horizontal-rule", "|",
"clean-block", "preview", "fullscreen"]
Expand Down

0 comments on commit 4270310

Please sign in to comment.