From 31c348baff13c4e2ae357753a32e83ca91b22c00 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sat, 21 Aug 2021 11:37:01 +1200 Subject: [PATCH 1/2] 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(); From 04b2421793c9378799f31fd13550168e6b2dfb5f Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sat, 28 Aug 2021 11:03:47 +1200 Subject: [PATCH 2/2] Update client/homebrew/editor/editor.jsx Co-authored-by: Trevor Buckner --- client/homebrew/editor/editor.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index ce18aa689..5f6a70493 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -70,7 +70,7 @@ const Editor = createClass({ handleInject : function(injectText){ const text = ( this.isText() && this.props.brew.text || - this.isStyle() && (this.props.brew.style || DEFAULT_STYLE_TEXT) + this.isStyle() && (this.props.brew.style ?? DEFAULT_STYLE_TEXT) ); const lines = text.split('\n');