Fix redo duplicate not checking for duplicate property names

This commit is contained in:
jos 2019-03-30 14:13:25 +01:00
parent d31917390c
commit 6ccf5c651d
1 changed files with 4 additions and 0 deletions

View File

@ -1,5 +1,7 @@
'use strict'; 'use strict';
var util = require('./util');
/** /**
* @constructor History * @constructor History
* Store action history, enables undo and redo * Store action history, enables undo and redo
@ -121,6 +123,8 @@ 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();
clone.field = util.findUniqueName(node.field, existingFieldNames);
parentNode.insertAfter(clone, afterNode); parentNode.insertAfter(clone, afterNode);
afterNode = clone; afterNode = clone;
}); });