fix(moddle-copy): properly copy ids
Related to https://github.com/camunda/camunda-modeler/issues/1410
This commit is contained in:
parent
97e1ad14ba
commit
39d7b9e59b
|
@ -220,9 +220,9 @@ ModdleCopy.prototype.copyProperty = function(property, parent, propertyName) {
|
|||
return;
|
||||
}
|
||||
|
||||
// disallow copying IDs if already assigned
|
||||
if (propertyDescriptor.isId && this._moddle.ids.assigned(property)) {
|
||||
return;
|
||||
// copy id
|
||||
if (propertyDescriptor.isId) {
|
||||
return this._copyId(property, parent);
|
||||
}
|
||||
|
||||
// copy arrays
|
||||
|
@ -263,6 +263,18 @@ ModdleCopy.prototype.copyProperty = function(property, parent, propertyName) {
|
|||
return property;
|
||||
};
|
||||
|
||||
ModdleCopy.prototype._copyId = function(id, element) {
|
||||
|
||||
// disallow if already taken
|
||||
if (this._moddle.ids.assigned(id)) {
|
||||
return;
|
||||
} else {
|
||||
|
||||
this._moddle.ids.claim(id, element);
|
||||
return id;
|
||||
}
|
||||
};
|
||||
|
||||
// helpers //////////
|
||||
|
||||
export function getPropertyNames(descriptor, keepDefaultProperties) {
|
||||
|
|
Loading…
Reference in New Issue