Skip to content

Commit 4813e1c

Browse files
committed
Don't keep editing if new type is not primitive
1 parent 558888d commit 4813e1c

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,6 +1238,7 @@ This component is heavily inspired by [react-json-view](https://github.com/mac-s
12381238
12391239
## Changelog
12401240
1241+
- **1.28.2**: When switching data type, only keep editing if new type is primitive ([#216](https://github.com/CarlosNZ/json-edit-react/issues/216))
12411242
- **1.28.1**: Fix left padding of root node when value is primitive ([#214](https://github.com/CarlosNZ/json-edit-react/issues/214))
12421243
- **1.28.0**:
12431244
- (Optional) tooltips for icons ([#211](https://github.com/CarlosNZ/json-edit-react/pull/211))

src/ValueNodeWrapper.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ export const ValueNodeWrapper: React.FC<ValueNodeProps> = (props) => {
200200
// that won't match the custom node condition any more
201201
customNodeData?.CustomNode ? translate('DEFAULT_STRING', nodeData) : undefined
202202
)
203+
if (!['string', 'number', 'boolean'].includes(type)) setCurrentlyEditingElement(null)
203204
onEdit(newValue, path).then((error) => {
204205
if (error) {
205206
onError({ code: 'UPDATE_ERROR', message: error }, newValue as JsonData)

0 commit comments

Comments
 (0)