diff --git a/src/store/page/page-element.ts b/src/store/page/page-element.ts index 22ed7b1ab..1697bf9ac 100644 --- a/src/store/page/page-element.ts +++ b/src/store/page/page-element.ts @@ -443,22 +443,14 @@ export class PageElement { } } - (async () => { - const coercedValue = property ? await property.coerceValue(value) : value; - if (path) { - const rootPropertyValue = this.propertyValues.get(id) || {}; - ObjectPath.set<{}, PropertyValue>(rootPropertyValue, path, coercedValue); - this.propertyValues.set(id, deepAssign({}, rootPropertyValue)); - } else { - this.propertyValues.set(id, coercedValue); - } - })().catch(reason => { - console.log( - `Failed to coerce property value of property '${id}' of pattern '${ - this.patternId - }': ${reason}` - ); - }); + const coercedValue = property ? property.coerceValue(value) : value; + if (path) { + const rootPropertyValue = this.propertyValues.get(id) || {}; + ObjectPath.set<{}, PropertyValue>(rootPropertyValue, path, coercedValue); + this.propertyValues.set(id, deepAssign({}, rootPropertyValue)); + } else { + this.propertyValues.set(id, coercedValue); + } } /** diff --git a/src/store/styleguide/property/asset-property.ts b/src/store/styleguide/property/asset-property.ts index 2dba1f3a8..dd50f9be7 100644 --- a/src/store/styleguide/property/asset-property.ts +++ b/src/store/styleguide/property/asset-property.ts @@ -83,7 +83,7 @@ export class AssetProperty extends Property { * @inheritdoc */ // tslint:disable-next-line:no-any - public async coerceValue(value: any): Promise { + public coerceValue(value: any): any { if (typeof value === 'string') { return value; } diff --git a/src/store/styleguide/property/boolean-property.ts b/src/store/styleguide/property/boolean-property.ts index 882c49d42..07ed478b6 100644 --- a/src/store/styleguide/property/boolean-property.ts +++ b/src/store/styleguide/property/boolean-property.ts @@ -20,7 +20,7 @@ export class BooleanProperty extends Property { * @inheritdoc */ // tslint:disable-next-line:no-any - public async coerceValue(value: any): Promise { + public coerceValue(value: any): any { return value === true || value === 'true' || value === 1; } diff --git a/src/store/styleguide/property/enum-property.ts b/src/store/styleguide/property/enum-property.ts index 299b35177..c3ee405e5 100644 --- a/src/store/styleguide/property/enum-property.ts +++ b/src/store/styleguide/property/enum-property.ts @@ -33,7 +33,7 @@ export class EnumProperty extends Property { * @inheritdoc */ // tslint:disable-next-line:no-any - public async coerceValue(value: any): Promise { + public coerceValue(value: any): any { if (value === null || value === undefined || value === '') { return; } diff --git a/src/store/styleguide/property/number-array-property.ts b/src/store/styleguide/property/number-array-property.ts index bc1b01a1b..2fdeb60ea 100644 --- a/src/store/styleguide/property/number-array-property.ts +++ b/src/store/styleguide/property/number-array-property.ts @@ -21,7 +21,7 @@ export class NumberArrayProperty extends Property { * @inheritdoc */ // tslint:disable-next-line:no-any - public async coerceValue(value: any): Promise { + public coerceValue(value: any): any { // tslint:disable-next-line:no-any return this.coerceArrayValue(value, (element: any) => parseFloat(value)); } diff --git a/src/store/styleguide/property/number-property.ts b/src/store/styleguide/property/number-property.ts index 0a5df3a7b..7bf3a0c3e 100644 --- a/src/store/styleguide/property/number-property.ts +++ b/src/store/styleguide/property/number-property.ts @@ -21,7 +21,7 @@ export class NumberProperty extends Property { * @inheritdoc */ // tslint:disable-next-line:no-any - public async coerceValue(value: any): Promise { + public coerceValue(value: any): any { const result: number = parseFloat(value); return isNaN(result) ? undefined : result; } diff --git a/src/store/styleguide/property/object-property.ts b/src/store/styleguide/property/object-property.ts index 4fc160c59..bdb52bf82 100644 --- a/src/store/styleguide/property/object-property.ts +++ b/src/store/styleguide/property/object-property.ts @@ -26,7 +26,7 @@ export class ObjectProperty extends Property { * @inheritdoc */ // tslint:disable-next-line:no-any - public async coerceValue(value: any): Promise { + public coerceValue(value: any): any { if (value === null || value === undefined || value === '') { return undefined; } diff --git a/src/store/styleguide/property/pattern-property.ts b/src/store/styleguide/property/pattern-property.ts index 576e867e0..1e1eaeef2 100644 --- a/src/store/styleguide/property/pattern-property.ts +++ b/src/store/styleguide/property/pattern-property.ts @@ -28,7 +28,7 @@ export class PatternProperty extends Property { * @inheritdoc */ // tslint:disable-next-line:no-any - public async coerceValue(value: any): Promise { + public coerceValue(value: any): any { // Page elements coerce their properties themselves return value; } diff --git a/src/store/styleguide/property/property.ts b/src/store/styleguide/property/property.ts index c539d27f6..23ccb72ae 100644 --- a/src/store/styleguide/property/property.ts +++ b/src/store/styleguide/property/property.ts @@ -120,7 +120,7 @@ export abstract class Property { * @param callback A callback to be called with the resulting, property-compatible value. */ // tslint:disable-next-line:no-any - public abstract coerceValue(value: any): Promise; + public abstract coerceValue(value: any): any; /** * Converts a given value into the form required by the component's props' property. diff --git a/src/store/styleguide/property/string-array-property.ts b/src/store/styleguide/property/string-array-property.ts index 22d3d3267..b68ce4fd6 100644 --- a/src/store/styleguide/property/string-array-property.ts +++ b/src/store/styleguide/property/string-array-property.ts @@ -22,7 +22,7 @@ export class StringArrayProperty extends Property { * @inheritdoc */ // tslint:disable-next-line:no-any - public async coerceValue(value: any): Promise { + public coerceValue(value: any): any { // tslint:disable-next-line:no-any return this.coerceArrayValue(value, (element: any) => String(value)); } diff --git a/src/store/styleguide/property/string-property.ts b/src/store/styleguide/property/string-property.ts index 9e3c0013e..af4c4cd44 100644 --- a/src/store/styleguide/property/string-property.ts +++ b/src/store/styleguide/property/string-property.ts @@ -26,7 +26,7 @@ export class StringProperty extends Property { * @inheritdoc */ // tslint:disable-next-line:no-any - public async coerceValue(value: any): Promise { + public coerceValue(value: any): any { if (value === null || value === undefined || value === '') { return ''; } else { diff --git a/src/styleguide/renderer/highlight-area.ts b/src/styleguide/renderer/highlight-area.ts index 6e5e9d8cc..b5a44620d 100644 --- a/src/styleguide/renderer/highlight-area.ts +++ b/src/styleguide/renderer/highlight-area.ts @@ -50,7 +50,6 @@ export class HighlightArea { width: clientRect.width }; - console.log('Scrolled into view'); element.scrollIntoView({ behavior: 'smooth', block: 'center',