Fixed #595: navigation bar path link not working

This commit is contained in:
jos 2018-10-24 21:58:56 +02:00
parent 07b341546e
commit 67ef58bef3
3 changed files with 7 additions and 4 deletions

View File

@ -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

View File

@ -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) {

View File

@ -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));
}