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();
|
||||||
|
if (parentNode.type === 'object') {
|
||||||
var existingFieldNames = parentNode.getFieldNames();
|
var existingFieldNames = parentNode.getFieldNames();
|
||||||
clone.field = util.findUniqueName(node.field, existingFieldNames);
|
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();
|
||||||
|
if (node.parent.type === 'object') {
|
||||||
var existingFieldNames = node.parent.getFieldNames();
|
var existingFieldNames = node.parent.getFieldNames();
|
||||||
clone.field = util.findUniqueName(node.field, existingFieldNames);
|
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