diff --git a/src/Squidex/app/features/content/pages/content/content-field.component.html b/src/Squidex/app/features/content/pages/content/content-field.component.html index 9b8ed3a6a..36cafd558 100644 --- a/src/Squidex/app/features/content/pages/content/content-field.component.html +++ b/src/Squidex/app/features/content/pages/content/content-field.component.html @@ -2,7 +2,7 @@
- diff --git a/src/Squidex/app/features/content/pages/content/content-field.component.ts b/src/Squidex/app/features/content/pages/content/content-field.component.ts index 7ff344ac7..24fe7fdc2 100644 --- a/src/Squidex/app/features/content/pages/content/content-field.component.ts +++ b/src/Squidex/app/features/content/pages/content/content-field.component.ts @@ -62,7 +62,7 @@ export class ContentFieldComponent implements OnChanges { public isInvalid: Observable; public isDifferent: Observable; - public isTranslateable: boolean; + public isTranslatable: boolean; constructor( private readonly appsState: AppsState, @@ -81,7 +81,7 @@ export class ContentFieldComponent implements OnChanges { } if (changes['fieldForm'] || changes['field'] || changes['languages']) { - this.isTranslateable = this.field.isTranslateable; + this.isTranslatable = this.field.isTranslatable; } if ((changes['fieldForm'] || changes['fieldFormCompare']) && this.fieldFormCompare) { diff --git a/src/Squidex/app/framework/angular/ignore-scrollbar.directive.ts b/src/Squidex/app/framework/angular/ignore-scrollbar.directive.ts index c9d1ec641..ed83fb0fc 100644 --- a/src/Squidex/app/framework/angular/ignore-scrollbar.directive.ts +++ b/src/Squidex/app/framework/angular/ignore-scrollbar.directive.ts @@ -5,7 +5,7 @@ * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. */ -import { AfterViewInit, Directive, ElementRef, OnInit, Renderer2 } from '@angular/core'; +import { AfterViewInit, Directive, ElementRef, HostListener, OnInit, Renderer2 } from '@angular/core'; import { timer } from 'rxjs'; import { ResourceOwner } from '@app/framework/internal'; @@ -24,15 +24,13 @@ export class IgnoreScrollbarDirective extends ResourceOwner implements OnInit, A super(); } - public ngOnInit() { - if (!this.parent) { - this.parent = this.renderer.parentNode(this.element.nativeElement); - } + @HostListener('resize)') + public onResize() { + this.reposition(); + } - this.own( - this.renderer.listen(this.element.nativeElement, 'resize', () => { - this.reposition(); - })); + public ngOnInit() { + this.parent = this.renderer.parentNode(this.element.nativeElement); this.own(timer(100, 100).subscribe(() => this.reposition)); } diff --git a/src/Squidex/app/framework/angular/modals/modal-view.directive.ts b/src/Squidex/app/framework/angular/modals/modal-view.directive.ts index 16a4834d3..68069bc2b 100644 --- a/src/Squidex/app/framework/angular/modals/modal-view.directive.ts +++ b/src/Squidex/app/framework/angular/modals/modal-view.directive.ts @@ -5,7 +5,7 @@ * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. */ -import { Directive, EmbeddedViewRef, Input, OnChanges, OnDestroy, Renderer2, SimpleChanges, TemplateRef, ViewContainerRef } from '@angular/core'; +import { ChangeDetectorRef, Directive, EmbeddedViewRef, Input, OnChanges, OnDestroy, Renderer2, SimpleChanges, TemplateRef, ViewContainerRef } from '@angular/core'; import { Subscription } from 'rxjs'; import { @@ -37,10 +37,11 @@ export class ModalViewDirective implements OnChanges, OnDestroy { public closeAlways = false; constructor( - private readonly templateRef: TemplateRef, + private readonly changeDetector: ChangeDetectorRef, private readonly renderer: Renderer2, - private readonly viewContainer: ViewContainerRef, - private readonly rootView: RootViewComponent + private readonly rootView: RootViewComponent, + private readonly templateRef: TemplateRef, + private readonly viewContainer: ViewContainerRef ) { } @@ -87,6 +88,8 @@ export class ModalViewDirective implements OnChanges, OnDestroy { setTimeout(() => { this.startListening(); }); + + this.changeDetector.detectChanges(); } else if (!isOpen && this.renderedView) { const container = this.getContainer(); const containerIndex = container.indexOf(this.renderedView); @@ -96,6 +99,8 @@ export class ModalViewDirective implements OnChanges, OnDestroy { this.renderedView = null; this.unsubscribeToClick(); + + this.changeDetector.detectChanges(); } } diff --git a/src/Squidex/app/framework/angular/modals/tooltip.directive.ts b/src/Squidex/app/framework/angular/modals/tooltip.directive.ts index 8370d7d5e..85c4036aa 100644 --- a/src/Squidex/app/framework/angular/modals/tooltip.directive.ts +++ b/src/Squidex/app/framework/angular/modals/tooltip.directive.ts @@ -7,15 +7,15 @@ // tslint:disable:directive-selector -import { Directive, ElementRef, Input, OnInit, Renderer2 } from '@angular/core'; +import { Directive, ElementRef, HostListener, Input, Renderer2 } from '@angular/core'; -import { DialogService, ResourceOwner } from '@app/framework/internal'; +import { DialogService } from '@app/framework/internal'; import { Tooltip } from '@app/shared'; @Directive({ selector: '[title]' }) -export class TooltipDirective extends ResourceOwner implements OnInit { +export class TooltipDirective { private titleText: string; @Input() @@ -33,23 +33,20 @@ export class TooltipDirective extends ResourceOwner implements OnInit { private readonly element: ElementRef, private readonly renderer: Renderer2 ) { - super(); } - public ngOnInit() { - const target = this.element.nativeElement; - - this.own( - this.renderer.listen(target, 'mouseenter', () => { - if (this.titleText) { - this.dialogs.tooltip(new Tooltip(target, this.titleText, this.titlePosition)); - } - })); + @HostListener('mouseenter') + public onMouseEnter() { + if (this.titleText) { + this.dialogs.tooltip(new Tooltip(this.element.nativeElement, this.titleText, this.titlePosition)); + } + } - this.own( - this.renderer.listen(this.element.nativeElement, 'mouseleave', () => { - this.dialogs.tooltip(new Tooltip(target, null, this.titlePosition)); - })); + @HostListener('mouseleave') + public onMouseLeave() { + if (this.titleText) { + this.dialogs.tooltip(new Tooltip(this.element.nativeElement, null, this.titlePosition)); + } } private unsetAttribute() { diff --git a/src/Squidex/app/shared/components/markdown-editor.component.ts b/src/Squidex/app/shared/components/markdown-editor.component.ts index 5d862720d..564f0b599 100644 --- a/src/Squidex/app/shared/components/markdown-editor.component.ts +++ b/src/Squidex/app/shared/components/markdown-editor.component.ts @@ -83,8 +83,6 @@ export class MarkdownEditorComponent extends StatefulControlComponent { this.assetsDialog.show(); - - this.detectChanges(); } public ngAfterViewInit() { diff --git a/src/Squidex/app/shared/components/rich-editor.component.ts b/src/Squidex/app/shared/components/rich-editor.component.ts index 12cf3f137..b5417e1c6 100644 --- a/src/Squidex/app/shared/components/rich-editor.component.ts +++ b/src/Squidex/app/shared/components/rich-editor.component.ts @@ -83,8 +83,6 @@ export class RichEditorComponent extends StatefulControlComponent i private showSelector = () => { this.assetsDialog.show(); - - this.detectChanges(); } private getEditorOptions() { diff --git a/src/Squidex/app/shared/services/schemas.service.ts b/src/Squidex/app/shared/services/schemas.service.ts index def8f70d4..2457dc456 100644 --- a/src/Squidex/app/shared/services/schemas.service.ts +++ b/src/Squidex/app/shared/services/schemas.service.ts @@ -136,7 +136,7 @@ export class RootFieldDto extends FieldDto { return this.properties.fieldType === 'String'; } - public get isTranslateable() { + public get isTranslatable() { return this.isLocalizable && this.isString && (this.properties.editor === 'Input' || this.properties.editor === 'Textarea'); }