0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-09 09:22:38 +00:00

Changed shortcut to CTRL + /, fixed icon

This commit is contained in:
Trevor Buckner
2021-08-08 22:13:23 -04:00
parent 37d11ec303
commit 86184f8595
3 changed files with 22 additions and 24 deletions

View File

@@ -115,10 +115,10 @@ module.exports = [
}, },
{ {
name : 'Add Comment', 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 gen : dedent`\n
<!-- Add a comment to your code here. Hotkey Ctrl/Cmd \\ --> <!-- This is a comment that will not be rendered into your brew. Hotkey (Ctrl/Cmd + /). -->
\n` `
}, },
] ]
}, },

View File

@@ -102,11 +102,9 @@ module.exports = [
}, },
{ {
name : 'Add Comment', name : 'Add Comment',
icon : 'fas fa-comment-code', /* might need to be fa-solid fa-comment-code --not sure, Gazook */ icon : 'fas fa-code',
gen : dedent`\n gen : `\n<!-- This is a comment that will not be rendered into your brew. Hotkey (Ctrl/Cmd + /). -->\n\n`
<!-- Add a comment to your code here. Hotkey Ctrl/Cmd \\ --> }
\n`
},
] ]
}, },

View File

@@ -47,20 +47,20 @@ 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-M' : this.makeSpan, 'Ctrl-M' : this.makeSpan,
'Cmd-M' : this.makeSpan, 'Cmd-M' : this.makeSpan,
'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-M' : this.makeSpan, 'Ctrl-M' : this.makeSpan,
'Cmd-M' : this.makeSpan, 'Cmd-M' : this.makeSpan,
'Ctrl-\\' : this.makeComment, 'Ctrl-/' : this.makeComment,
'Cmd-\\' : this.makeComment, 'Cmd-/' : this.makeComment,
} }
}); });
@@ -98,10 +98,10 @@ const CodeEditor = createClass({
makeComment : function() { makeComment : function() {
const selection = this.codeMirror.getSelection(), t = selection.slice(0, 4) === '<!--' && selection.slice(-3) === '-->'; const selection = this.codeMirror.getSelection(), t = selection.slice(0, 4) === '<!--' && selection.slice(-3) === '-->';
this.codeMirror.replaceSelection(t ? selection.slice(4, -3) : `<!-- ${selection}-->`, 'around'); this.codeMirror.replaceSelection(t ? selection.slice(4, -3) : `<!-- ${selection} -->`, 'around');
if(selection.length === 0){ if(selection.length === 0){
const cursor = this.codeMirror.getCursor(); 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 });
} }
}, },