Added smart attribute keeping when changing label (#3309)

* Added smart attribute keeping when changing label

* Removed input type check
main
Marci 5 years ago committed by GitHub
parent 4fd57a8950
commit ba8d064b52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -248,6 +248,18 @@
this.label = label;
this.attributes = {};
this.appendDefaultAttributes(label);
// Try to keep old attributes if name matches and old value is still valid
for (const attribute of redoLabel.attributes) {
for (const oldAttribute of undoLabel.attributes) {
if (
attribute.name === oldAttribute.name
&& validateAttributeValue(undoAttributes[oldAttribute.id], attribute)
) {
this.attributes[attribute.id] = undoAttributes[oldAttribute.id];
}
}
}
const redoAttributes = { ...this.attributes };
this.history.do(

Loading…
Cancel
Save