diff --git a/HISTORY.md b/HISTORY.md index 466f05a..1e1f6ca 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -3,6 +3,12 @@ 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 - Fix #582: parse error annotations not always up to date in diff --git a/src/js/treemode.js b/src/js/treemode.js index 08460e8..5e19b12 100644 --- a/src/js/treemode.js +++ b/src/js/treemode.js @@ -501,6 +501,21 @@ treemode._onChange = function () { // validate JSON schema (if configured) 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 if (this.options.onChange) { try {