mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-24 18:32:41 +00:00
Add optional overwrite protection
This commit is contained in:
@@ -75,7 +75,7 @@ const Editor = createClass({
|
||||
},
|
||||
|
||||
handleInject : function(injectText){
|
||||
this.refs.codeEditor?.injectText(injectText);
|
||||
this.refs.codeEditor?.injectText(injectText, false);
|
||||
},
|
||||
|
||||
handleViewChange : function(newView){
|
||||
|
||||
@@ -229,8 +229,12 @@ const CodeEditor = createClass({
|
||||
this.codeMirror.replaceSelection('\n\\page\n\n', 'end');
|
||||
},
|
||||
|
||||
injectText : function(injectText) {
|
||||
this.codeMirror.replaceSelection(injectText, 'around');
|
||||
injectText : function(injectText, overwrite=true) {
|
||||
const cm = this.codeMirror;
|
||||
if(!overwrite) {
|
||||
cm.setCursor(cm.getCursor('from'));
|
||||
}
|
||||
cm.replaceSelection(injectText, 'around');
|
||||
},
|
||||
|
||||
makeUnderline : function() {
|
||||
|
||||
Reference in New Issue
Block a user