Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed Jul 12, 2023
1 parent e89cc22 commit 9434c51
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
23 changes: 21 additions & 2 deletions packages/neos-ui-editors/src/EditorEnvelope/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ReactMarkdown from 'react-markdown';
import omit from 'lodash.omit';

import Label from '@neos-project/react-ui-components/src/Label/';
import {Tooltip} from '@neos-project/react-ui-components';
import {IconButton, Tooltip} from '@neos-project/react-ui-components';
import I18n from '@neos-project/neos-ui-i18n';
import {neos} from '@neos-project/neos-ui-decorators';

Expand All @@ -19,7 +19,8 @@ import {Icon} from '@neos-project/react-ui-components';
}))
export default class EditorEnvelope extends PureComponent {
state = {
showHelpMessage: false
showHelpMessage: false,
hasImplausibleValue: false
};

static defaultProps = {
Expand Down Expand Up @@ -66,6 +67,18 @@ export default class EditorEnvelope extends PureComponent {
renderEditorComponent() {
const editorDefinition = this.getEditorDefinition();

if (this.state.hasImplausibleValue) {
return <div>
<div className={style['envelope--invalid']}>invalid Value in editor {JSON.stringify(this.props.value)}</div>;
<IconButton onClick={() => {
this.props.commit('');
this.setState({
hasImplausibleValue: false
})

Check failure on line 77 in packages/neos-ui-editors/src/EditorEnvelope/index.js

View workflow job for this annotation

GitHub Actions / Code style

Missing semicolon
}} icon='x'>Reset</IconButton>

Check failure on line 78 in packages/neos-ui-editors/src/EditorEnvelope/index.js

View workflow job for this annotation

GitHub Actions / Code style

Unexpected usage of singlequote
</div>;
}

if (editorDefinition && editorDefinition.component) {
const EditorComponent = editorDefinition && editorDefinition.component;

Expand All @@ -82,6 +95,12 @@ export default class EditorEnvelope extends PureComponent {
<EditorComponent className={classNames}
id={this.generateIdentifier()}
renderHelpIcon={this.renderHelpIcon}
onImplausibleValue={(lieblingsWert) => {

Check failure on line 98 in packages/neos-ui-editors/src/EditorEnvelope/index.js

View workflow job for this annotation

GitHub Actions / Code style

Unexpected parentheses around single function argument

Check failure on line 98 in packages/neos-ui-editors/src/EditorEnvelope/index.js

View workflow job for this annotation

GitHub Actions / Code style

'lieblingsWert' is defined but never used. Allowed unused args must match /^_$/
this.setState({
hasImplausibleValue: true
})

Check failure on line 101 in packages/neos-ui-editors/src/EditorEnvelope/index.js

View workflow job for this annotation

GitHub Actions / Code style

Missing semicolon
}}

{...restProps} />
);
}
Expand Down
4 changes: 4 additions & 0 deletions packages/neos-ui-editors/src/Editors/SelectBox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ export default class SelectBoxEditor extends PureComponent {
render() {
const {options} = this.props;

if (this.props.value) {
this.props.onImplausibleValue();
}

if (options.dataSourceIdentifier || options.dataSourceUri) {
return <DataSourceBasedSelectBoxEditor {...this.props}/>;
}
Expand Down

0 comments on commit 9434c51

Please sign in to comment.