File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ export const ValueNodeWrapper: React.FC<ValueNodeProps> = (props) => {
4545 customNodeDefinitions,
4646 } = props
4747 const { getStyles } = useTheme ( )
48- const { setCurrentlyEditingElement } = useTreeState ( )
48+ const { setCurrentlyEditingElement, setCollapseState } = useTreeState ( )
4949 const [ value , setValue ] = useState < typeof data | CollectionData > (
5050 // Bad things happen when you put a function into useState
5151 typeof data === 'function' ? INVALID_FUNCTION_STRING : data
@@ -133,6 +133,9 @@ export const ValueNodeWrapper: React.FC<ValueNodeProps> = (props) => {
133133 if ( customNode ) {
134134 onEdit ( customNode . defaultValue , path )
135135 setDataType ( type )
136+ // Custom nodes will be instantiated expanded and NOT editing
137+ setCurrentlyEditingElement ( null )
138+ setCollapseState ( { path, collapsed : false } )
136139 } else {
137140 const newValue = convertValue (
138141 value ,
Original file line number Diff line number Diff line change @@ -29,7 +29,6 @@ export interface JsonEditorProps {
2929 restrictAdd ?: boolean | FilterFunction
3030 restrictTypeSelection ?: boolean | DataType [ ] | TypeFilterFunction
3131 restrictDrag ?: boolean | FilterFunction
32- // restrictKeyEdit?: boolean | FilterFunction
3332 searchText ?: string
3433 searchFilter ?: 'key' | 'value' | 'all' | SearchFilterFunction
3534 searchDebounceTime ?: number
You can’t perform that action at this time.
0 commit comments