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:
@@ -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');
|
||||
|
||||
@@ -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`
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user