Browse Source

Update how setTargetValue handles partial values

pull/5678/head
Artur Arseniev 2 years ago
parent
commit
7c532ec089
  1. 13
      src/trait_manager/model/Trait.ts

13
src/trait_manager/model/Trait.ts

@ -161,11 +161,6 @@ export default class Trait extends Model<TraitProperties> {
} }
this.setTargetValue(value, valueOpts); this.setTargetValue(value, valueOpts);
if (partial === false) {
this.setTargetValue('');
this.setTargetValue(value);
}
} }
/** /**
@ -320,10 +315,14 @@ export default class Trait extends Model<TraitProperties> {
} }
} }
const props = { [name]: valueToSet };
// This is required for the UndoManager to properly detect changes
props.__p = opts.avoidStore ? null : undefined;
if (this.changeProp) { if (this.changeProp) {
component.set(name, valueToSet, opts); component.set(props, opts);
} else { } else {
component.addAttributes({ [name]: valueToSet }, opts); component.addAttributes(props, opts);
} }
} }

Loading…
Cancel
Save