Skip to content
Snippets Groups Projects
Commit 38c21eb9 authored by jojohoch's avatar jojohoch
Browse files

Remove position properties from checkbox to be compatible as cloze child

parent 8089684d
No related branches found
No related tags found
No related merge requests found
Pipeline #52645 passed
......@@ -6,7 +6,7 @@ import { ElementComponent } from 'common/directives/element-component.directive'
import { CheckboxComponent } from 'common/components/input-elements/checkbox.component';
import { AnswerScheme, AnswerSchemeValue } from 'common/models/elements/answer-scheme-interfaces';
import {
BasicStyles, PositionProperties, PropertyGroupGenerators, PropertyGroupValidators
BasicStyles, PropertyGroupGenerators, PropertyGroupValidators
} from 'common/models/elements/property-group-interfaces';
import { environment } from 'common/environment';
import { InstantiationEror } from 'common/util/errors';
......@@ -14,14 +14,12 @@ import { InstantiationEror } from 'common/util/errors';
export class CheckboxElement extends InputElement implements CheckboxProperties {
type: UIElementType = 'checkbox';
crossOutChecked: boolean = false;
position: PositionProperties;
styling: BasicStyles;
constructor(element?: CheckboxProperties) {
super(element);
if (element && isValid(element)) {
this.crossOutChecked = element.crossOutChecked;
this.position = { ...element.position };
this.styling = { ...element.styling };
} else {
if (environment.strictInstantiation) {
......@@ -32,7 +30,6 @@ export class CheckboxElement extends InputElement implements CheckboxProperties
width: 215,
...element?.dimensions
});
this.position = PropertyGroupGenerators.generatePositionProps(element?.position);
this.styling = PropertyGroupGenerators.generateBasicStyleProps(element?.styling);
}
}
......@@ -71,13 +68,11 @@ export class CheckboxElement extends InputElement implements CheckboxProperties
export interface CheckboxProperties extends InputElementProperties {
crossOutChecked: boolean;
position: PositionProperties;
styling: BasicStyles;
}
function isValid(blueprint?: CheckboxProperties): boolean {
if (!blueprint) return false;
return blueprint.crossOutChecked !== undefined &&
PropertyGroupValidators.isValidPosition(blueprint.position) &&
PropertyGroupValidators.isValidBasicStyles(blueprint.styling);
}
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