Skip to content

wiki - editor - add buttons 'inline code', 'empty checkbox', 'checked checkbox' #7243

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion public/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,40 @@ 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;
let selection = cm.getSelection();
cm.replaceSelection("`" + selection + "`");
if (!selection) {
let cursorPos = cm.getCursor();
cm.setCursor(cursorPos.line, cursorPos.ch - 1);
}
cm.focus();
},
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());
cm.focus();
},
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());
cm.focus();
},
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