From 86184f85954598e403afd3c4218dc56358ca3568 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Sun, 8 Aug 2021 22:13:23 -0400 Subject: [PATCH] Changed shortcut to CTRL + /, fixed icon --- .../editor/snippetbar/snippets/snippets.js | 6 ++-- .../snippetbar/snippetsLegacy/snippets.js | 8 ++--- shared/naturalcrit/codeEditor/codeEditor.jsx | 32 +++++++++---------- 3 files changed, 22 insertions(+), 24 deletions(-) diff --git a/client/homebrew/editor/snippetbar/snippets/snippets.js b/client/homebrew/editor/snippetbar/snippets/snippets.js index 99226832d..b30a96e7c 100644 --- a/client/homebrew/editor/snippetbar/snippets/snippets.js +++ b/client/homebrew/editor/snippetbar/snippets/snippets.js @@ -115,10 +115,10 @@ module.exports = [ }, { name : 'Add Comment', - icon : 'fas fa-comment-code', /* might need to be fa-solid fa-comment-code --not sure, Gazook */ + icon : 'fas fa-code', /* might need to be fa-solid fa-comment-code --not sure, Gazook */ gen : dedent`\n - - \n` + + ` }, ] }, diff --git a/client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js b/client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js index 830e5d194..3ce871d91 100644 --- a/client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js +++ b/client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js @@ -102,11 +102,9 @@ module.exports = [ }, { name : 'Add Comment', - icon : 'fas fa-comment-code', /* might need to be fa-solid fa-comment-code --not sure, Gazook */ - gen : dedent`\n - - \n` - }, + icon : 'fas fa-code', + gen : `\n\n\n` + } ] }, diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index 7af4c12b4..bbfdbfa75 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -47,20 +47,20 @@ 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-M' : this.makeSpan, - 'Cmd-M' : this.makeSpan, - 'Ctrl-B' : this.makeBold, - 'Cmd-B' : this.makeBold, - 'Ctrl-I' : this.makeItalic, - 'Cmd-I' : this.makeItalic, - 'Ctrl-M' : this.makeSpan, - 'Cmd-M' : this.makeSpan, - 'Ctrl-\\' : this.makeComment, - 'Cmd-\\' : this.makeComment, + 'Ctrl-B' : this.makeBold, + 'Cmd-B' : this.makeBold, + 'Ctrl-I' : this.makeItalic, + 'Cmd-I' : this.makeItalic, + 'Ctrl-M' : this.makeSpan, + 'Cmd-M' : this.makeSpan, + 'Ctrl-B' : this.makeBold, + 'Cmd-B' : this.makeBold, + 'Ctrl-I' : this.makeItalic, + 'Cmd-I' : this.makeItalic, + 'Ctrl-M' : this.makeSpan, + 'Cmd-M' : this.makeSpan, + 'Ctrl-/' : this.makeComment, + 'Cmd-/' : this.makeComment, } }); @@ -98,10 +98,10 @@ const CodeEditor = createClass({ makeComment : function() { const selection = this.codeMirror.getSelection(), t = selection.slice(0, 4) === ''; - this.codeMirror.replaceSelection(t ? selection.slice(4, -3) : ``, 'around'); + this.codeMirror.replaceSelection(t ? selection.slice(4, -3) : ``, 'around'); if(selection.length === 0){ const cursor = this.codeMirror.getCursor(); - this.codeMirror.setCursor({ line: cursor.line, ch: cursor.ch - 3 }); + this.codeMirror.setCursor({ line: cursor.line, ch: cursor.ch - 4 }); } },