@@ -8,7 +8,7 @@ import type {
8
8
IEditorProps ,
9
9
IRenderDefaultEditorParams ,
10
10
} from '@microsoft/logic-apps-shared' ;
11
- import { equals } from '@microsoft/logic-apps-shared' ;
11
+ import { equals , isObject } from '@microsoft/logic-apps-shared' ;
12
12
import { useCallback } from 'react' ;
13
13
14
14
export type CustomTokenFieldProps = Omit < TokenFieldProps , 'editor' | 'editorOptions' > & ICustomEditorAndOptions ;
@@ -26,7 +26,7 @@ export const CustomTokenField = (props: CustomTokenFieldProps) => {
26
26
renderDefaultEditor,
27
27
disabled : props . readOnly ,
28
28
} ;
29
- return < EditorComponent { ...customEditorProps } /> ;
29
+ return EditorComponent ? < EditorComponent { ...customEditorProps } /> : < > < /> ;
30
30
} ;
31
31
32
32
function useRenderDefaultEditor ( tokenFieldProps : Omit < TokenFieldProps , 'editor' | 'editorOptions' | 'value' | 'onValueChange' > ) {
@@ -51,13 +51,15 @@ const customEditorName = 'internal-custom-editor';
51
51
52
52
export type ICustomEditorAndOptions = { editor : typeof customEditorName ; editorOptions : ICustomEditorOptions } ;
53
53
54
- export const isCustomEditor = ( props : { editor ?: string | undefined ; editorOptions ?: unknown } ) : props is ICustomEditorAndOptions => {
54
+ export const isCustomEditor = ( props : { editor ?: string | undefined ; editorOptions ?: any } ) : props is ICustomEditorAndOptions => {
55
55
const { editor, editorOptions } = props ;
56
+
56
57
return (
57
- equals ( editor , customEditorName ) &&
58
- typeof editorOptions === 'object' &&
59
- ! ! editorOptions &&
60
- typeof ( editorOptions as { EditorComponent : unknown } ) . EditorComponent === 'function'
58
+ editorOptions ?. visibility === 'custom' ||
59
+ ( equals ( editor , customEditorName ) &&
60
+ isObject ( editorOptions ) &&
61
+ ! ! editorOptions &&
62
+ typeof ( editorOptions as { EditorComponent : unknown } ) . EditorComponent === 'function' )
61
63
) ;
62
64
} ;
63
65
0 commit comments