0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-01 19:32:42 +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){ handleInject : function(injectText){
const text = ( const text = (
this.isText() && this.props.brew.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'); const lines = text.split('\n');

View File

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