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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// disallow copying IDs if already assigned
|
// copy id
|
||||||
if (propertyDescriptor.isId && this._moddle.ids.assigned(property)) {
|
if (propertyDescriptor.isId) {
|
||||||
return;
|
return this._copyId(property, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy arrays
|
// copy arrays
|
||||||
|
@ -263,6 +263,18 @@ ModdleCopy.prototype.copyProperty = function(property, parent, propertyName) {
|
||||||
return property;
|
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 //////////
|
// helpers //////////
|
||||||
|
|
||||||
export function getPropertyNames(descriptor, keepDefaultProperties) {
|
export function getPropertyNames(descriptor, keepDefaultProperties) {
|
||||||
|
|
Loading…
Reference in New Issue