Skip to content
Snippets Groups Projects
Commit 63fc058e authored by rhenck's avatar rhenck
Browse files

[editor] Fix cloze dropList properties references

Do not change the underlying temp object, but instead use an new object 
reference.
This avoids changing references to objects of other elements.
parent 5bcf68f0
No related branches found
No related tags found
No related merge requests found
...@@ -30,10 +30,9 @@ export class ElementModelPropertiesComponent { ...@@ -30,10 +30,9 @@ export class ElementModelPropertiesComponent {
constructor(public unitService: UnitService) { } constructor(public unitService: UnitService) { }
addOption(property: string, value: string): void { addOption(property: string, value: string): void {
(this.combinedProperties[property] as string[]).push(value);
this.updateModel.emit({ this.updateModel.emit({
property: property, property: property,
value: [...this.combinedProperties[property] as string[]] value: [...(this.combinedProperties[property] as string[]), value]
}); });
} }
...@@ -55,13 +54,10 @@ export class ElementModelPropertiesComponent { ...@@ -55,13 +54,10 @@ export class ElementModelPropertiesComponent {
} }
addDropListOption(value: string): void { addDropListOption(value: string): void {
const id = this.unitService.getNewValueID(); this.updateModel.emit({
if (this.combinedProperties.value) { property: 'value',
this.combinedProperties.value.push({ stringValue: value, id: id }); value: [...this.combinedProperties.value, { stringValue: value, id: this.unitService.getNewValueID() }]
} else { });
this.combinedProperties.value = [{ stringValue: value, id: id }];
}
this.updateModel.emit({ property: 'value', value: this.combinedProperties.value });
} }
async editDropListOption(optionIndex: number): Promise<void> { async editDropListOption(optionIndex: number): Promise<void> {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment