@@ -1160,7 +1160,37 @@ function initWikiForm() {
1160
1160
spellChecker : false ,
1161
1161
toolbar : [ "bold" , "italic" , "strikethrough" , "|" ,
1162
1162
"heading-1" , "heading-2" , "heading-3" , "heading-bigger" , "heading-smaller" , "|" ,
1163
- "code" , "quote" , "|" ,
1163
+ {
1164
+ name : "code-inline" ,
1165
+ action : function ( e ) {
1166
+ let cm = e . codemirror ;
1167
+ var selection = cm . getSelection ( ) ;
1168
+ cm . replaceSelection ( "`" + selection + "`" ) ;
1169
+ if ( ! selection ) {
1170
+ var cursorPos = cm . getCursor ( ) ;
1171
+ cm . setCursor ( cursorPos . line , cursorPos . ch - 1 ) ;
1172
+ }
1173
+ } ,
1174
+ className : "fa fa-angle-right" ,
1175
+ title : "Add Inline Code" ,
1176
+ } , "code" , "quote" , "|" , {
1177
+ name : "checkbox-empty" ,
1178
+ action : function ( e ) {
1179
+ let cm = e . codemirror ;
1180
+ cm . replaceSelection ( "\n- [ ] " + cm . getSelection ( ) ) ;
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
+ } ,
1191
+ className : "fa fa-check-square-o" ,
1192
+ title : "Add Checkbox (checked)" ,
1193
+ } , "|" ,
1164
1194
"unordered-list" , "ordered-list" , "|" ,
1165
1195
"link" , "image" , "table" , "horizontal-rule" , "|" ,
1166
1196
"clean-block" , "preview" , "fullscreen" ]
0 commit comments