Use cm.replaceSelection instead of split/join text
This commit is contained in:
1 parent
6ade9925d7
commit
56fde5a448
2 files changed
+5
-13
No files matched your search
@@ -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