@@ -1158,7 +1158,40 @@ function initWikiForm() {
11581158 spellChecker : false ,
11591159 toolbar : [ "bold" , "italic" , "strikethrough" , "|" ,
11601160 "heading-1" , "heading-2" , "heading-3" , "heading-bigger" , "heading-smaller" , "|" ,
1161- "code" , "quote" , "|" ,
1161+ {
1162+ name : "code-inline" ,
1163+ action : function ( e ) {
1164+ let cm = e . codemirror ;
1165+ let selection = cm . getSelection ( ) ;
1166+ cm . replaceSelection ( "`" + selection + "`" ) ;
1167+ if ( ! selection ) {
1168+ let cursorPos = cm . getCursor ( ) ;
1169+ cm . setCursor ( cursorPos . line , cursorPos . ch - 1 ) ;
1170+ }
1171+ cm . focus ( ) ;
1172+ } ,
1173+ className : "fa fa-angle-right" ,
1174+ title : "Add Inline Code" ,
1175+ } , "code" , "quote" , "|" , {
1176+ name : "checkbox-empty" ,
1177+ action : function ( e ) {
1178+ let cm = e . codemirror ;
1179+ cm . replaceSelection ( "\n- [ ] " + cm . getSelection ( ) ) ;
1180+ cm . focus ( ) ;
1181+ } ,
1182+ className : "fa fa-square-o" ,
1183+ title : "Add Checkbox (empty)" ,
1184+ } ,
1185+ {
1186+ name : "checkbox-checked" ,
1187+ action : function ( e ) {
1188+ let cm = e . codemirror ;
1189+ cm . replaceSelection ( "\n- [x] " + cm . getSelection ( ) ) ;
1190+ cm . focus ( ) ;
1191+ } ,
1192+ className : "fa fa-check-square-o" ,
1193+ title : "Add Checkbox (checked)" ,
1194+ } , "|" ,
11621195 "unordered-list" , "ordered-list" , "|" ,
11631196 "link" , "image" , "table" , "horizontal-rule" , "|" ,
11641197 "clean-block" , "preview" , "fullscreen" ]
0 commit comments