0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-14 06:22:40 +00:00

add hotkeys for new \page and \column

This commit is contained in:
Gazook89
2021-09-11 00:12:58 -05:00
parent 389ad1cf17
commit bec2a7c77a

View File

@@ -59,6 +59,10 @@ const CodeEditor = createClass({
'Shift-Cmd-.' : this.makeSpace, 'Shift-Cmd-.' : this.makeSpace,
'Shift-Ctrl-,' : this.removeSpace, 'Shift-Ctrl-,' : this.removeSpace,
'Shift-Cmd-,' : this.removeSpace, 'Shift-Cmd-,' : this.removeSpace,
'Shift-Ctrl-Enter' : this.newColumn,
'Shift-Cmd-Enter' : this.newColumn,
'Ctrl-Enter' : this.newPage,
'Cmd-Enter' : this.newPage,
'Ctrl-M' : this.makeSpan, 'Ctrl-M' : this.makeSpan,
'Cmd-M' : this.makeSpan, 'Cmd-M' : this.makeSpan,
'Shift-Ctrl-M' : this.makeDiv, 'Shift-Ctrl-M' : this.makeDiv,
@@ -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');