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