MOBILE-2693 data: Fix options of checkbox/multimenu fields

main
Albert Gasset 2018-10-17 14:23:50 +02:00
parent f233dbf5b4
commit 9d6c8312e8
2 changed files with 4 additions and 4 deletions

View File

@ -40,7 +40,7 @@ export class AddonModDataFieldCheckboxComponent extends AddonModDataFieldPluginC
return;
}
this.options = this.field.param1.split('\n').map((option) => {
this.options = this.field.param1.split(/\r?\n/).map((option) => {
return { key: option, value: option };
});
@ -67,7 +67,7 @@ export class AddonModDataFieldCheckboxComponent extends AddonModDataFieldPluginC
* @param {any} value New value to be set.
*/
protected updateValue(value: any): void {
this.value = value;
this.value = value || {};
this.value.content = value && value.content && value.content.split('##').join('<br>');
}
}

View File

@ -40,7 +40,7 @@ export class AddonModDataFieldMultimenuComponent extends AddonModDataFieldPlugin
return;
}
this.options = this.field.param1.split('\n').map((option) => {
this.options = this.field.param1.split(/\r?\n/).map((option) => {
return { key: option, value: option };
});
@ -67,7 +67,7 @@ export class AddonModDataFieldMultimenuComponent extends AddonModDataFieldPlugin
* @param {any} value New value to be set.
*/
protected updateValue(value: any): void {
this.value = value;
this.value = value || {};
this.value.content = value && value.content && value.content.split('##').join('<br>');
}
}