1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Fix duplicating array item in visual json editor

This commit is contained in:
Nick O'Leary 2020-02-07 10:45:45 +00:00
parent 1e8d695311
commit 797da3bc8e
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -106,7 +106,7 @@
options.push({id:"red-ui-editor-type-json-menu-duplicate", icon:"fa fa-copy", label:RED._("jsonEditor.duplicate"),onselect:function(){ options.push({id:"red-ui-editor-type-json-menu-duplicate", icon:"fa fa-copy", label:RED._("jsonEditor.duplicate"),onselect:function(){
var newKey = item.key; var newKey = item.key;
if (item.parent.type === 'array') { if (item.parent.type === 'array') {
newKey = parent.children.length; newKey = item.parent.children.length;
} else { } else {
var m = /^(.*?)(-(\d+))?$/.exec(newKey); var m = /^(.*?)(-(\d+))?$/.exec(newKey);
var usedKeys = {}; var usedKeys = {};