Fixed #589: when deleting or moving a node, the navigation bar is not updated with the correct path

This commit is contained in:
jos 2018-10-17 13:40:48 +02:00
parent b45993ccd5
commit 37e609d4d8
2 changed files with 21 additions and 0 deletions

View File

@ -3,6 +3,12 @@
https://github.com/josdejong/jsoneditor https://github.com/josdejong/jsoneditor
## not yet released, version 5.24.8
- Fixed #589: when deleting or moving a node, the navigation bar
is not updated with the correct path.
## 2018-10-08, version 5.24.7 ## 2018-10-08, version 5.24.7
- Fix #582: parse error annotations not always up to date in - Fix #582: parse error annotations not always up to date in

View File

@ -501,6 +501,21 @@ treemode._onChange = function () {
// validate JSON schema (if configured) // validate JSON schema (if configured)
this._debouncedValidate(); this._debouncedValidate();
if (this.treePath) {
const selectedNode = this.selection
? this.node.findNodeByInternalPath(this.selection.path)
: this.multiselection
? this.multiselection.nodes[0]
: undefined;
if (selectedNode) {
this._updateTreePath(selectedNode.getNodePath())
}
else {
this.treePath.reset()
}
}
// trigger the onChange callback // trigger the onChange callback
if (this.options.onChange) { if (this.options.onChange) {
try { try {