Fixed duplicate and remove of the action menu of multiple selected nodes not working
This commit is contained in:
parent
7d2d669191
commit
e08250c3cb
|
@ -9,6 +9,8 @@ https://github.com/josdejong/jsoneditor
|
||||||
bar is disabled.
|
bar is disabled.
|
||||||
- Fixed #589: the path in the navigation bar is not updated
|
- Fixed #589: the path in the navigation bar is not updated
|
||||||
when deleting a node.
|
when deleting a node.
|
||||||
|
- Fixed duplicate and remove of the action menu of multiple selected
|
||||||
|
nodes not working.
|
||||||
|
|
||||||
|
|
||||||
## 2018-10-08, version 5.24.7
|
## 2018-10-08, version 5.24.7
|
||||||
|
|
|
@ -502,7 +502,7 @@ treemode._onChange = function () {
|
||||||
this._debouncedValidate();
|
this._debouncedValidate();
|
||||||
|
|
||||||
if (this.treePath) {
|
if (this.treePath) {
|
||||||
const selectedNode = this.selection
|
var selectedNode = this.selection
|
||||||
? this.node.findNodeByInternalPath(this.selection.path)
|
? this.node.findNodeByInternalPath(this.selection.path)
|
||||||
: this.multiselection
|
: this.multiselection
|
||||||
? this.multiselection.nodes[0]
|
? this.multiselection.nodes[0]
|
||||||
|
@ -1645,7 +1645,7 @@ treemode._createTable = function () {
|
||||||
*/
|
*/
|
||||||
treemode.showContextMenu = function (anchor, onClose) {
|
treemode.showContextMenu = function (anchor, onClose) {
|
||||||
var items = [];
|
var items = [];
|
||||||
var editor = this;
|
var selectedNodes = this.multiselection.nodes.slice();
|
||||||
|
|
||||||
// create duplicate button
|
// create duplicate button
|
||||||
items.push({
|
items.push({
|
||||||
|
@ -1653,7 +1653,7 @@ treemode.showContextMenu = function (anchor, onClose) {
|
||||||
title: translate('duplicateTitle'),
|
title: translate('duplicateTitle'),
|
||||||
className: 'jsoneditor-duplicate',
|
className: 'jsoneditor-duplicate',
|
||||||
click: function () {
|
click: function () {
|
||||||
Node.onDuplicate(editor.multiselection.nodes);
|
Node.onDuplicate(selectedNodes );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1663,12 +1663,12 @@ treemode.showContextMenu = function (anchor, onClose) {
|
||||||
title: translate('removeTitle'),
|
title: translate('removeTitle'),
|
||||||
className: 'jsoneditor-remove',
|
className: 'jsoneditor-remove',
|
||||||
click: function () {
|
click: function () {
|
||||||
Node.onRemove(editor.multiselection.nodes);
|
Node.onRemove(selectedNodes);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var menu = new ContextMenu(items, {close: onClose});
|
var menu = new ContextMenu(items, {close: onClose});
|
||||||
menu.show(anchor, editor.frame);
|
menu.show(anchor, this.frame);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue