Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
barmac committed Sep 15, 2023
1 parent 5951d09 commit 680a6e5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,24 +83,29 @@ class FeelEditor extends Component {
this.state = { focussed: false };

this.onFocus = this.onFocus.bind(this);
this.onBlur = this.onBlur.bind(this);
}

onFocus() {
this.setState({ focussed: true });
}

onBlur() {
this.setState({ focussed: false });
}

render() {
return <div onClick={ this.onFocus }>
{this.state.focussed && (
<LiteralExpression
{ ...this.props }

onBlur={ () => this.setState({ focussed: false }) }
autoFocus={ true }
onBlur={ this.onBlur }
/>
)}
{!this.state.focussed && (
<div onFocus={ this.onFocus } tabIndex="0">
{ this.props.value }
{ this.props.value || this.props.placeholder || '' }
</div>
)}
</div>;
Expand Down Expand Up @@ -201,15 +206,12 @@ class TableCellEditor extends Component {
isString(description)
&& <div className="description-indicator"></div>
}
{
placeholder && !value &&
<span className="cell-editor__placeholder">{ placeholder }</span>
}
<Editor
className={ isScript ? 'script-editor' : null }
ctrlForNewline={ true }
onInput={ onChange }
value={ value }
placeholder={ placeholder }
/>
{
!isDefaultExpressionLanguage && (
Expand Down
4 changes: 4 additions & 0 deletions packages/dmn-js-shared/src/components/LiteralExpression.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ export default class LiteralExpression extends Component {
});

this.node.addEventListener('mousedown', this.handleMouseEvent);

if (this.props.autoFocus) {
this.editor.focus(this.state.value.length);
}
}

componentDidUpdate(prevProps) {
Expand Down

0 comments on commit 680a6e5

Please sign in to comment.