Fixed duplicate and remove of the action menu of multiple selected nodes not working

This commit is contained in:
jos 2018-10-17 15:26:05 +02:00
parent 7d2d669191
commit e08250c3cb
2 changed files with 7 additions and 5 deletions

View File

@ -9,6 +9,8 @@ https://github.com/josdejong/jsoneditor
bar is disabled.
- Fixed #589: the path in the navigation bar is not updated
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

View File

@ -502,7 +502,7 @@ treemode._onChange = function () {
this._debouncedValidate();
if (this.treePath) {
const selectedNode = this.selection
var selectedNode = this.selection
? this.node.findNodeByInternalPath(this.selection.path)
: this.multiselection
? this.multiselection.nodes[0]
@ -1645,7 +1645,7 @@ treemode._createTable = function () {
*/
treemode.showContextMenu = function (anchor, onClose) {
var items = [];
var editor = this;
var selectedNodes = this.multiselection.nodes.slice();
// create duplicate button
items.push({
@ -1653,7 +1653,7 @@ treemode.showContextMenu = function (anchor, onClose) {
title: translate('duplicateTitle'),
className: 'jsoneditor-duplicate',
click: function () {
Node.onDuplicate(editor.multiselection.nodes);
Node.onDuplicate(selectedNodes );
}
});
@ -1663,12 +1663,12 @@ treemode.showContextMenu = function (anchor, onClose) {
title: translate('removeTitle'),
className: 'jsoneditor-remove',
click: function () {
Node.onRemove(editor.multiselection.nodes);
Node.onRemove(selectedNodes);
}
});
var menu = new ContextMenu(items, {close: onClose});
menu.show(anchor, editor.frame);
menu.show(anchor, this.frame);
};
/**