From 31c348baff13c4e2ae357753a32e83ca91b22c00 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sat, 21 Aug 2021 11:37:01 +1200 Subject: [PATCH] Handle `brew.style` being `undefined` when inject snippets. --- client/homebrew/editor/editor.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index d43ae7c61..ce18aa689 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -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();