diff --git a/src/components/ErrorBoundary.js b/src/components/ErrorBoundary.js index e30154cf..35fbd1a2 100644 --- a/src/components/ErrorBoundary.js +++ b/src/components/ErrorBoundary.js @@ -41,8 +41,8 @@ class ErrorBoundary extends Component { ? "Something went wrong in component '{{type}}'. {{error}}" : "Something went wrong with the component type."; const text = replaceData(i18n[errorMsg], { - type: type && type.toString(), - error: this.state.error && this.state.error.toString() + type: type?.toString(), + error: this.state.error?.toString() }); return ( diff --git a/src/components/MegadraftEditor.js b/src/components/MegadraftEditor.js index d0b079e8..43ac644b 100644 --- a/src/components/MegadraftEditor.js +++ b/src/components/MegadraftEditor.js @@ -403,7 +403,7 @@ export default class MegadraftEditor extends Component { }; const input = control.querySelector("[type=text]"); - input && input.focus(); + input?.focus(); control.scrollIntoView({ block: "center" }); window.scroll(0, window.scrollY - control.clientHeight / 2); diff --git a/src/components/Toolbar.js b/src/components/Toolbar.js index 46558caf..695fbfa9 100644 --- a/src/components/Toolbar.js +++ b/src/components/Toolbar.js @@ -67,7 +67,7 @@ export default class Toolbar extends Component { case "custom": { key = "custom-" + position; toggle = () => item.action(this.props.editorState, this.props.onChange); - active = item.active && item.active(this.props.editorState); + active = item.active?.(this.props.editorState); break; } case "inline": { @@ -239,7 +239,7 @@ export default class Toolbar extends Component { error: null }, () => { - this.props.draft && this.props.draft.focus(); + this.props.draft?.focus(); } ); }