mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-26 00:52:48 +00:00
Use cm.replaceSelection instead of split/join text
This commit is contained in:
@@ -229,6 +229,10 @@ const CodeEditor = createClass({
|
||||
this.codeMirror.replaceSelection('\n\\page\n\n', 'end');
|
||||
},
|
||||
|
||||
injectText : function(injectText) {
|
||||
this.codeMirror.replaceSelection(injectText, 'around');
|
||||
},
|
||||
|
||||
makeUnderline : function() {
|
||||
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');
|
||||
|
||||
Reference in New Issue
Block a user