From 5b90fa99f45447126c2757f530387162baffc9fa Mon Sep 17 00:00:00 2001 From: rhenck <richard.henck@iqb.hu-berlin.de> Date: Wed, 12 Jan 2022 21:24:23 +0100 Subject: [PATCH] Make InputElement labe optional and remove it from cloze children Cloze elements are displayed inline and have no way to show a label. --- projects/common/models/uI-element.ts | 2 +- .../common/ui-elements/drop-list-simple/drop-list-simple.ts | 2 ++ .../ui-elements/textfield-simple/text-field-simple-element.ts | 2 ++ projects/common/ui-elements/toggle-button/toggle-button.ts | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/projects/common/models/uI-element.ts b/projects/common/models/uI-element.ts index 97d423067..6d8e9a236 100644 --- a/projects/common/models/uI-element.ts +++ b/projects/common/models/uI-element.ts @@ -62,7 +62,7 @@ export abstract class UIElement { } export abstract class InputElement extends UIElement { - label: string; + label?: string; value: InputElementValue; required: boolean; requiredWarnMessage: string; diff --git a/projects/common/ui-elements/drop-list-simple/drop-list-simple.ts b/projects/common/ui-elements/drop-list-simple/drop-list-simple.ts index c47501ca8..c04b847ea 100644 --- a/projects/common/ui-elements/drop-list-simple/drop-list-simple.ts +++ b/projects/common/ui-elements/drop-list-simple/drop-list-simple.ts @@ -23,6 +23,8 @@ export class DropListSimpleElement extends InputElement implements FontElement, this.fontProps = initFontElement(serializedElement); this.surfaceProps = initSurfaceElement(serializedElement); + delete this.label; + this.value = serializedElement.value as string[] || []; this.height = serializedElement.height || 100; this.surfaceProps.backgroundColor = diff --git a/projects/common/ui-elements/textfield-simple/text-field-simple-element.ts b/projects/common/ui-elements/textfield-simple/text-field-simple-element.ts index b06fb7899..4f9423257 100644 --- a/projects/common/ui-elements/textfield-simple/text-field-simple-element.ts +++ b/projects/common/ui-elements/textfield-simple/text-field-simple-element.ts @@ -18,6 +18,8 @@ export class TextFieldSimpleElement extends InputElement implements FontElement, this.fontProps = initFontElement(serializedElement); this.surfaceProps = initSurfaceElement(serializedElement); + delete this.label; + this.height = serializedElement.height || 25; } } diff --git a/projects/common/ui-elements/toggle-button/toggle-button.ts b/projects/common/ui-elements/toggle-button/toggle-button.ts index e950a0cdd..65029def7 100644 --- a/projects/common/ui-elements/toggle-button/toggle-button.ts +++ b/projects/common/ui-elements/toggle-button/toggle-button.ts @@ -21,6 +21,8 @@ export class ToggleButtonElement extends InputElement implements FontElement, Su this.fontProps = initFontElement(serializedElement); this.surfaceProps = initSurfaceElement(serializedElement); + delete this.label; + this.height = serializedElement.height as number || 25; this.surfaceProps.backgroundColor = serializedElement.surfaceProps?.backgroundColor as string || -- GitLab