summaryrefslogtreecommitdiffstats
path: root/public
diff options
context:
space:
mode:
authorCherrg <michael@gnehr.de>2019-07-07 06:22:04 +0200
committertechknowlogick <techknowlogick@gitea.io>2019-07-07 00:22:04 -0400
commit1b85b248e42a9d45d4dc278d399ddab3edcedfdb (patch)
tree3cfa102c2de24120bb9cb642aadd14169ae3a681 /public
parented676f91b31f54d02bf096d4830483a96e1fd309 (diff)
downloadgitea-1b85b248e42a9d45d4dc278d399ddab3edcedfdb.tar.gz
gitea-1b85b248e42a9d45d4dc278d399ddab3edcedfdb.zip
wiki - editor - add buttons 'inline code', 'empty checkbox', 'checked checkbox' (#7243)
* wiki - editor - add buttons 'inline code', 'add empty checkbox', 'add checked checkbox' affects #5436 Signed-off-by: Michael Gnehr <michael@gnehr.de> * add missing 'set focus' after insert with buttons Signed-off-by: Michael Gnehr <michael@gnehr.de> * consistent usage of let/const in added code
Diffstat (limited to 'public')
-rw-r--r--public/js/index.js35
1 files changed, 34 insertions, 1 deletions
diff --git a/public/js/index.js b/public/js/index.js
index 22e4f9d419..ef8a1093ad 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -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"]