From bec2a7c77abca010522ea920aed1e56374c07839 Mon Sep 17 00:00:00 2001
From: Gazook89 <58999374+Gazook89@users.noreply.github.com>
Date: Sat, 11 Sep 2021 00:12:58 -0500
Subject: [PATCH] add hotkeys for new \page and \column
---
shared/naturalcrit/codeEditor/codeEditor.jsx | 48 ++++++++++++--------
1 file changed, 30 insertions(+), 18 deletions(-)
diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx
index 6d5685cd7..a810bee3a 100644
--- a/shared/naturalcrit/codeEditor/codeEditor.jsx
+++ b/shared/naturalcrit/codeEditor/codeEditor.jsx
@@ -47,24 +47,28 @@ const CodeEditor = createClass({
indentWithTabs : true,
tabSize : 2,
extraKeys : {
- 'Ctrl-B' : this.makeBold,
- 'Cmd-B' : this.makeBold,
- 'Ctrl-I' : this.makeItalic,
- 'Cmd-I' : this.makeItalic,
- 'Ctrl-U' : this.makeUnderline,
- 'Cmd-U' : this.makeUnderline,
- 'Ctrl-.' : this.makeNbsp,
- 'Cmd-.' : this.makeNbsp,
- 'Shift-Ctrl-.' : this.makeSpace,
- 'Shift-Cmd-.' : this.makeSpace,
- 'Shift-Ctrl-,' : this.removeSpace,
- 'Shift-Cmd-,' : this.removeSpace,
- 'Ctrl-M' : this.makeSpan,
- 'Cmd-M' : this.makeSpan,
- 'Shift-Ctrl-M' : this.makeDiv,
- 'Shift-Cmd-M' : this.makeDiv,
- 'Ctrl-/' : this.makeComment,
- 'Cmd-/' : this.makeComment
+ 'Ctrl-B' : this.makeBold,
+ 'Cmd-B' : this.makeBold,
+ 'Ctrl-I' : this.makeItalic,
+ 'Cmd-I' : this.makeItalic,
+ 'Ctrl-U' : this.makeUnderline,
+ 'Cmd-U' : this.makeUnderline,
+ 'Ctrl-.' : this.makeNbsp,
+ 'Cmd-.' : this.makeNbsp,
+ 'Shift-Ctrl-.' : this.makeSpace,
+ 'Shift-Cmd-.' : this.makeSpace,
+ 'Shift-Ctrl-,' : 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,
+ '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() {
const selection = this.codeMirror.getSelection(), t = selection.slice(0, 3) === '' && selection.slice(-4) === '';
this.codeMirror.replaceSelection(t ? selection.slice(3, -4) : `${selection}`, 'around');