0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 20:42:43 +00:00

Fix snippets crashing in empty brew

If this.props.brew.text is an empty string, it will evaluate to `false` and, but since `isStyle()` is also false, `text` is just undefined.
This commit is contained in:
Trevor Buckner
2021-08-31 11:56:48 -04:00
parent 0e5ed35b6c
commit 13ba5ebcc8
2 changed files with 4 additions and 4 deletions

View File

@@ -69,8 +69,8 @@ const Editor = createClass({
handleInject : function(injectText){
const text = (
this.isText() && this.props.brew.text ||
this.isStyle() && (this.props.brew.style ?? DEFAULT_STYLE_TEXT)
this.isText() ? this.props.brew.text :
this.isStyle() ? this.props.brew.style ?? DEFAULT_STYLE_TEXT : ''
);
const lines = text.split('\n');

View File

@@ -43,8 +43,8 @@ module.exports = [
{{wide
Everything in here will be extra wide. Tables, text, everything!
Beware though, CSS columns can behave a bit weird sometimes. You may
have to rely on the automatic column-break rather than \`\column\` if
you mix columns and wide blocks on the same page.
have to manually place column breaks with \`\column\` to make the
surrounding text flow with this wide block the way you want.
}}
\n`
},