mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-09 13:42:38 +00:00
add hotkeys for new \page and \column
This commit is contained in:
@@ -47,24 +47,28 @@ const CodeEditor = createClass({
|
|||||||
indentWithTabs : true,
|
indentWithTabs : true,
|
||||||
tabSize : 2,
|
tabSize : 2,
|
||||||
extraKeys : {
|
extraKeys : {
|
||||||
'Ctrl-B' : this.makeBold,
|
'Ctrl-B' : this.makeBold,
|
||||||
'Cmd-B' : this.makeBold,
|
'Cmd-B' : this.makeBold,
|
||||||
'Ctrl-I' : this.makeItalic,
|
'Ctrl-I' : this.makeItalic,
|
||||||
'Cmd-I' : this.makeItalic,
|
'Cmd-I' : this.makeItalic,
|
||||||
'Ctrl-U' : this.makeUnderline,
|
'Ctrl-U' : this.makeUnderline,
|
||||||
'Cmd-U' : this.makeUnderline,
|
'Cmd-U' : this.makeUnderline,
|
||||||
'Ctrl-.' : this.makeNbsp,
|
'Ctrl-.' : this.makeNbsp,
|
||||||
'Cmd-.' : this.makeNbsp,
|
'Cmd-.' : this.makeNbsp,
|
||||||
'Shift-Ctrl-.' : this.makeSpace,
|
'Shift-Ctrl-.' : this.makeSpace,
|
||||||
'Shift-Cmd-.' : this.makeSpace,
|
'Shift-Cmd-.' : this.makeSpace,
|
||||||
'Shift-Ctrl-,' : this.removeSpace,
|
'Shift-Ctrl-,' : this.removeSpace,
|
||||||
'Shift-Cmd-,' : this.removeSpace,
|
'Shift-Cmd-,' : this.removeSpace,
|
||||||
'Ctrl-M' : this.makeSpan,
|
'Shift-Ctrl-Enter' : this.newColumn,
|
||||||
'Cmd-M' : this.makeSpan,
|
'Shift-Cmd-Enter' : this.newColumn,
|
||||||
'Shift-Ctrl-M' : this.makeDiv,
|
'Ctrl-Enter' : this.newPage,
|
||||||
'Shift-Cmd-M' : this.makeDiv,
|
'Cmd-Enter' : this.newPage,
|
||||||
'Ctrl-/' : this.makeComment,
|
'Ctrl-M' : this.makeSpan,
|
||||||
'Cmd-/' : this.makeComment
|
'Cmd-M' : this.makeSpan,
|
||||||
|
'Shift-Ctrl-M' : this.makeDiv,
|
||||||
|
'Shift-Cmd-M' : this.makeDiv,
|
||||||
|
'Ctrl-/' : this.makeComment,
|
||||||
|
'Cmd-/' : this.makeComment
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -115,6 +119,14 @@ const CodeEditor = createClass({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
newColumn : function() {
|
||||||
|
this.codeMirror.replaceSelection('\n\\column\n\n', 'end');
|
||||||
|
},
|
||||||
|
|
||||||
|
newPage : function() {
|
||||||
|
this.codeMirror.replaceSelection('\n\\page\n\n', 'end');
|
||||||
|
},
|
||||||
|
|
||||||
makeUnderline : function() {
|
makeUnderline : function() {
|
||||||
const selection = this.codeMirror.getSelection(), t = selection.slice(0, 3) === '<u>' && selection.slice(-4) === '</u>';
|
const selection = this.codeMirror.getSelection(), t = selection.slice(0, 3) === '<u>' && selection.slice(-4) === '</u>';
|
||||||
this.codeMirror.replaceSelection(t ? selection.slice(3, -4) : `<u>${selection}</u>`, 'around');
|
this.codeMirror.replaceSelection(t ? selection.slice(3, -4) : `<u>${selection}</u>`, 'around');
|
||||||
|
|||||||
Reference in New Issue
Block a user