0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-25 11:52:39 +00:00

Handle brew.style being undefined when inject snippets.

This commit is contained in:
G.Ambatte
2021-08-21 11:37:01 +12:00
parent 519d102a6e
commit 31c348baff

View File

@@ -68,7 +68,10 @@ const Editor = createClass({
},
handleInject : function(injectText){
const text = (this.isText() ? this.props.brew.text : this.props.brew.style);
const text = (
this.isText() && this.props.brew.text ||
this.isStyle() && (this.props.brew.style || DEFAULT_STYLE_TEXT)
);
const lines = text.split('\n');
const cursorPos = this.refs.codeEditor.getCursorPosition();