Browse Source

Use undefined for statefule components.

pull/387/head
Sebastian Stehle 7 years ago
parent
commit
2b384c3e7e
  1. 4
      src/Squidex/app/framework/angular/forms/code-editor.component.ts
  2. 10
      src/Squidex/app/shared/components/geolocation-editor.component.ts
  3. 4
      src/Squidex/app/shared/components/rich-editor.component.ts

4
src/Squidex/app/framework/angular/forms/code-editor.component.ts

@ -29,7 +29,7 @@ export const SQX_CODE_EDITOR_CONTROL_VALUE_ACCESSOR: any = {
providers: [SQX_CODE_EDITOR_CONTROL_VALUE_ACCESSOR], providers: [SQX_CODE_EDITOR_CONTROL_VALUE_ACCESSOR],
changeDetection: ChangeDetectionStrategy.OnPush changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class CodeEditorComponent extends StatefulControlComponent<any, string> implements AfterViewInit { export class CodeEditorComponent extends StatefulControlComponent<undefined, string> implements AfterViewInit {
private valueChanged = new Subject(); private valueChanged = new Subject();
private aceEditor: any; private aceEditor: any;
private value: string; private value: string;
@ -44,7 +44,7 @@ export class CodeEditorComponent extends StatefulControlComponent<any, string> i
constructor(changeDetector: ChangeDetectorRef, constructor(changeDetector: ChangeDetectorRef,
private readonly resourceLoader: ResourceLoaderService private readonly resourceLoader: ResourceLoaderService
) { ) {
super(changeDetector, {}); super(changeDetector, undefined);
} }
public writeValue(obj: string) { public writeValue(obj: string) {

10
src/Squidex/app/shared/components/geolocation-editor.component.ts

@ -35,7 +35,7 @@ interface Geolocation {
providers: [SQX_GEOLOCATION_EDITOR_CONTROL_VALUE_ACCESSOR], providers: [SQX_GEOLOCATION_EDITOR_CONTROL_VALUE_ACCESSOR],
changeDetection: ChangeDetectionStrategy.OnPush changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class GeolocationEditorComponent extends StatefulControlComponent<any, Geolocation> implements AfterViewInit { export class GeolocationEditorComponent extends StatefulControlComponent<undefined, Geolocation> implements AfterViewInit {
private readonly isGoogleMaps: boolean; private readonly isGoogleMaps: boolean;
private marker: any; private marker: any;
private map: any; private map: any;
@ -72,9 +72,9 @@ export class GeolocationEditorComponent extends StatefulControlComponent<any, Ge
private readonly formBuilder: FormBuilder, private readonly formBuilder: FormBuilder,
private readonly uiOptions: UIOptions private readonly uiOptions: UIOptions
) { ) {
super(changeDetector, {}); super(changeDetector, undefined);
this.isGoogleMaps = uiOptions.get('map.type'); this.isGoogleMaps = uiOptions.get('map.type') !== 'OSM';
} }
public writeValue(obj: any) { public writeValue(obj: any) {
@ -92,7 +92,7 @@ export class GeolocationEditorComponent extends StatefulControlComponent<any, Ge
public setDisabledState(isDisabled: boolean): void { public setDisabledState(isDisabled: boolean): void {
super.setDisabledState(isDisabled); super.setDisabledState(isDisabled);
if (!this.snapshot.isGoogleMaps) { if (!this.isGoogleMaps) {
this.setDisabledStateOSM(isDisabled); this.setDisabledStateOSM(isDisabled);
} else { } else {
this.setDisabledStateGoogle(isDisabled); this.setDisabledStateGoogle(isDisabled);
@ -258,7 +258,7 @@ export class GeolocationEditorComponent extends StatefulControlComponent<any, Ge
} }
private updateMarker(zoom: boolean, fireEvent: boolean) { private updateMarker(zoom: boolean, fireEvent: boolean) {
if (!this.snapshot.isGoogleMaps) { if (!this.isGoogleMaps) {
this.updateMarkerOSM(zoom); this.updateMarkerOSM(zoom);
} else { } else {
this.updateMarkerGoogle(zoom); this.updateMarkerGoogle(zoom);

4
src/Squidex/app/shared/components/rich-editor.component.ts

@ -40,7 +40,7 @@ const ImageTypes = [
providers: [SQX_RICH_EDITOR_CONTROL_VALUE_ACCESSOR], providers: [SQX_RICH_EDITOR_CONTROL_VALUE_ACCESSOR],
changeDetection: ChangeDetectionStrategy.OnPush changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class RichEditorComponent extends StatefulControlComponent<any, string> implements AfterViewInit, OnDestroy { export class RichEditorComponent extends StatefulControlComponent<undefined, string> implements AfterViewInit, OnDestroy {
private tinyEditor: any; private tinyEditor: any;
private tinyInitTimer: any; private tinyInitTimer: any;
private value: string; private value: string;
@ -58,7 +58,7 @@ export class RichEditorComponent extends StatefulControlComponent<any, string> i
private readonly assetUploader: AssetUploaderState, private readonly assetUploader: AssetUploaderState,
private readonly resourceLoader: ResourceLoaderService private readonly resourceLoader: ResourceLoaderService
) { ) {
super(changeDetector, {}); super(changeDetector, undefined);
} }
public ngOnDestroy() { public ngOnDestroy() {

Loading…
Cancel
Save