diff --git a/src/UI/Components/Board/BoardCommon.tsx b/src/UI/Components/Board/BoardCommon.tsx index dc3141fec..61158c910 100644 --- a/src/UI/Components/Board/BoardCommon.tsx +++ b/src/UI/Components/Board/BoardCommon.tsx @@ -239,8 +239,8 @@ export class BoardRePosBlock extends React.Component { } else if (k === 'count' && this.props.option.boardRelative === BrRelativePos.Div) { - this.countInputEl.focus(); - this.countInputEl.setSelectionRange(0, this.spaceSizeInputEl.value.length); + this.countInputEl?.focus(); + this.countInputEl?.setSelectionRange(0, this.spaceSizeInputEl.value.length); } }; private handleChangePos = (e) => @@ -261,8 +261,8 @@ export class BoardRePosBlock extends React.Component { } else { - this.countInputEl.focus(); - this.countInputEl.setSelectionRange(0, this.spaceSizeInputEl.value.length); + this.countInputEl?.focus(); + this.countInputEl?.setSelectionRange(0, this.spaceSizeInputEl.value.length); } }, 0); }; @@ -298,8 +298,7 @@ export class BoardRePosBlock extends React.Component { { setTimeout(() => { - if (this.countInputEl) - this.countInputEl.focus(); + this.countInputEl?.focus(); }, 0); } render()