fix(moddle-copy): properly copy ids

Related to https://github.com/camunda/camunda-modeler/issues/1410
This commit is contained in:
Maciej Barelkowski 2021-10-20 11:17:52 +02:00 committed by Maciej Barelkowski
parent 97e1ad14ba
commit 39d7b9e59b
1 changed files with 15 additions and 3 deletions

View File

@ -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) {