Skip to content

Commit

Permalink
fix: solve the replaceChild problem
Browse files Browse the repository at this point in the history
This solves a problem of `replaceChild` argument not being a child
of supposed parent. Related to changes in VDOM in reaction to focus.
  • Loading branch information
barmac committed Sep 22, 2023
1 parent 501acdd commit ad15824
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -266,3 +266,7 @@
.dmn-decision-table-container .cell-editor .cm-scroller {
line-height: normal;
}

.dmn-decision-table-container .cell-editor .feel-editor.focussed > :nth-child(2) {
display: none;
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,22 @@ class FeelEditor extends Component {
}

render() {
if (this.state.focussed) {
return <LiteralExpression
{ ...this.props }
autoFocus={ true }
onBlur={ this.onBlur }
/>;
}

return <div onClick={ this.onFocus }>
const { focussed } = this.state;
const className = `feel-editor${focussed ? ' focussed' : ''}`;

// TODO(@barmac): display only a single editor;
// required to workaround "replaceChild" error
return <div className={ className } onClick={ this.onFocus }>
{ focussed &&
<LiteralExpression
{ ...this.props }
autoFocus={ true }
onBlur={ this.onBlur }
/>
}
<ContentEditable
{ ...this.props }
onInput={ () => {} }
onFocus={ this.onFocus }
/>
</div>;
Expand Down Expand Up @@ -207,7 +212,7 @@ class TableCellEditor extends Component {
&& <div className="description-indicator"></div>
}
<Editor
className={ isScript ? 'script-editor' : null }
className={ isScript ? 'script-editor' : '' }
ctrlForNewline={ true }
onInput={ onChange }
value={ value }
Expand Down

0 comments on commit ad15824

Please sign in to comment.