diff --git a/HISTORY.md b/HISTORY.md index bba315a..86b984c 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -14,6 +14,7 @@ https://github.com/josdejong/jsoneditor - Fixed duplicate and remove of the action menu of multiple selected nodes not working. - Fixed not preventing default selection of text when selecting nodes. +- Fixed #595: navigation bar path link not working. ## 2018-10-08, version 5.24.7 diff --git a/src/js/TreePath.js b/src/js/TreePath.js index 06c6646..95d301c 100644 --- a/src/js/TreePath.js +++ b/src/js/TreePath.js @@ -6,10 +6,12 @@ var translate = require('./i18n').translate; /** * Creates a component that visualize path selection in tree based editors * @param {HTMLElement} container + * @param {HTMLElement} root * @constructor */ -function TreePath(container) { +function TreePath(container, root) { if (container) { + this.root = root; this.path = document.createElement('div'); this.path.className = 'jsoneditor-treepath'; container.appendChild(this.path); @@ -59,10 +61,10 @@ TreePath.prototype.setPath = function (pathObjs) { }); }); var menu = new ContextMenu(items); - menu.show(sepEl); + menu.show(sepEl, me.root); }; - me.path.appendChild(sepEl, me.container); + me.path.appendChild(sepEl); } if(idx === pathObjs.length - 1) { diff --git a/src/js/treemode.js b/src/js/treemode.js index bd5ebf7..bde7849 100644 --- a/src/js/treemode.js +++ b/src/js/treemode.js @@ -1081,7 +1081,7 @@ treemode._createFrame = function () { this.navBar.className = 'jsoneditor-navigation-bar nav-bar-empty'; this.frame.appendChild(this.navBar); - this.treePath = new TreePath(this.navBar); + this.treePath = new TreePath(this.navBar, this.frame); this.treePath.onSectionSelected(this._onTreePathSectionSelected.bind(this)); this.treePath.onContextMenuItemSelected(this._onTreePathMenuItemSelected.bind(this)); }