Handle `brew.style` being `undefined` when injecting snippets.
This commit is contained in:
Trevor Buckner authored and GitHub committed 2021-08-27 19:35:05 -04:00
commit 539b52ecbd
1 file changed
+4 -1
+4 -1
View File
@@ -68,7 +68,10 @@ const Editor = createClass({
}, },
handleInject : function(injectText){ 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 lines = text.split('\n');
const cursorPos = this.refs.codeEditor.getCursorPosition(); const cursorPos = this.refs.codeEditor.getCursorPosition();