Skip to content

Commit

Permalink
implement notifyValidationErrors, comment on message prop
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaskikutis committed Dec 17, 2024
1 parent 528d395 commit 8628640
Showing 1 changed file with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import {
IUrlsFieldUserPreferences,
} from 'superdesk-api';
import {ICoveragesValueOperational} from './interfaces';
import {cloneDeep, noop, set} from 'lodash';
import {cloneDeep, set} from 'lodash';
import {extensionBridge} from '../../extension_bridge';
import {IPlanningItem} from '../../../../interfaces';
import {superdesk} from '../../superdesk';

type IProps = IEditorComponentProps<ICoveragesValueOperational, IUrlsFieldConfig, IUrlsFieldUserPreferences>;

Expand All @@ -21,16 +22,29 @@ export class Editor extends React.PureComponent<IProps> {
<Container>
<EditorFieldCoverages
field="coverages"

item={{
// coverages are the main value
coverages: this.props.value,

// related_events are used if available to prefill coverage fields when adding a new coverage
related_events: this.props.item.related_events,
} as IPlanningItem}
// PR-TODO: implement functions below

/**
* It looks like this prop is designed to accept a validation message.
* authoring-react field types don't accept validation messages.
* They are rendered higher in the component tree.
* We do handle it in PlanningEditorStandalone component (on save).
*/
message={{}}
notifyValidationErrors={noop}

notifyValidationErrors={(errors) => {
for (const error of errors) {
superdesk.ui.notify.error(error);
}
}}

onChange={(fieldPath: any, value: any) => {
/**
* sample of arguments:
Expand Down

0 comments on commit 8628640

Please sign in to comment.