Fix duplicate not working for arrays anymore
This commit is contained in:
parent
6ccf5c651d
commit
19a625fa6e
|
@ -123,8 +123,10 @@ function History (editor) {
|
||||||
var nodes = params.paths.map(findNode);
|
var nodes = params.paths.map(findNode);
|
||||||
nodes.forEach(function (node) {
|
nodes.forEach(function (node) {
|
||||||
var clone = node.clone();
|
var clone = node.clone();
|
||||||
var existingFieldNames = parentNode.getFieldNames();
|
if (parentNode.type === 'object') {
|
||||||
clone.field = util.findUniqueName(node.field, existingFieldNames);
|
var existingFieldNames = parentNode.getFieldNames();
|
||||||
|
clone.field = util.findUniqueName(node.field, existingFieldNames);
|
||||||
|
}
|
||||||
parentNode.insertAfter(clone, afterNode);
|
parentNode.insertAfter(clone, afterNode);
|
||||||
afterNode = clone;
|
afterNode = clone;
|
||||||
});
|
});
|
||||||
|
|
|
@ -3508,8 +3508,10 @@ Node.onDuplicate = function(nodes) {
|
||||||
var afterNode = lastNode;
|
var afterNode = lastNode;
|
||||||
var clones = nodes.map(function (node) {
|
var clones = nodes.map(function (node) {
|
||||||
var clone = node.clone();
|
var clone = node.clone();
|
||||||
var existingFieldNames = node.parent.getFieldNames();
|
if (node.parent.type === 'object') {
|
||||||
clone.field = util.findUniqueName(node.field, existingFieldNames);
|
var existingFieldNames = node.parent.getFieldNames();
|
||||||
|
clone.field = util.findUniqueName(node.field, existingFieldNames);
|
||||||
|
}
|
||||||
parent.insertAfter(clone, afterNode);
|
parent.insertAfter(clone, afterNode);
|
||||||
afterNode = clone;
|
afterNode = clone;
|
||||||
return clone;
|
return clone;
|
||||||
|
|
Loading…
Reference in New Issue