diff --git a/client/components/fields/editor/base/text.tsx b/client/components/fields/editor/base/text.tsx index 7376d2622..c2764b070 100644 --- a/client/components/fields/editor/base/text.tsx +++ b/client/components/fields/editor/base/text.tsx @@ -31,6 +31,7 @@ export class EditorFieldText extends React.Component> { const {httpRequestJsonLocal} = superdeskApi; return httpRequestJsonLocal>({ @@ -92,10 +93,22 @@ export class EditorFieldText extends React.Component response._items.map((_item) => _item.value).filter((value) => !!value), (reason) => { console.warn(reason); + return []; } ); } + searchSuggestions(searchString: string, callback: (result: Array) => void) { + const currentValue = get(this.props.item, this.props.field); + + callback(this.state.suggestions.filter( + (name) => name.toLowerCase().includes(searchString) && name.toLowerCase() !== currentValue + )); + + // eslint-disable-next-line no-empty-function + return {cancel: () => {}}; + } + render() { const field = this.props.field; const value = get(this.props.item, field, this.props.defaultValue); @@ -134,6 +147,7 @@ export class EditorFieldText extends React.Component )}