0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-27 18:02:42 +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',
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
<!-- Add a comment to your code here. Hotkey Ctrl/Cmd \\ -->
\n`
<!-- This is a comment that will not be rendered into your brew. Hotkey (Ctrl/Cmd + /). -->
`
},
]
},

View File

@@ -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
<!-- Add a comment to your code here. Hotkey Ctrl/Cmd \\ -->
\n`
},
icon : 'fas fa-code',
gen : `\n<!-- This is a comment that will not be rendered into your brew. Hotkey (Ctrl/Cmd + /). -->\n\n`
}
]
},

View File

@@ -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) === '<!--' && 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){
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 });
}
},