mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-35649] Viewer renderer wait until subsequent renderers will finish (#10924)
* [AAE-35649] Viewer renderer wait until particular renderers are done * [AAE-35649] Add docs and unit test coverage * [AAE-35649] Add missing space
This commit is contained in:
@@ -15,8 +15,22 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, Input, ComponentRef, OnInit, ViewChild, ViewContainerRef, OnDestroy, OnChanges } from '@angular/core';
|
||||
import {
|
||||
Component,
|
||||
Input,
|
||||
ComponentRef,
|
||||
OnInit,
|
||||
ViewChild,
|
||||
ViewContainerRef,
|
||||
OnDestroy,
|
||||
OnChanges,
|
||||
EventEmitter,
|
||||
Output,
|
||||
DestroyRef,
|
||||
inject
|
||||
} from '@angular/core';
|
||||
import { ExtensionService } from '../../services/extension.service';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-preview-extension',
|
||||
@@ -43,6 +57,11 @@ export class PreviewExtensionComponent implements OnInit, OnChanges, OnDestroy {
|
||||
@Input()
|
||||
extension: string;
|
||||
|
||||
@Output()
|
||||
contentLoaded = new EventEmitter<void>();
|
||||
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
|
||||
private componentRef: ComponentRef<any>;
|
||||
|
||||
constructor(private extensionService: ExtensionService) {}
|
||||
@@ -73,11 +92,15 @@ export class PreviewExtensionComponent implements OnInit, OnChanges, OnDestroy {
|
||||
|
||||
private updateInstance() {
|
||||
if (this.componentRef?.instance) {
|
||||
const instance = this.componentRef.instance;
|
||||
this.componentRef.setInput('url', this.url);
|
||||
this.componentRef.setInput('extension', this.extension);
|
||||
this.componentRef.setInput('nodeId', this.nodeId);
|
||||
|
||||
instance.url = this.url;
|
||||
instance.extension = this.extension;
|
||||
instance.nodeId = this.nodeId;
|
||||
if (this.componentRef.instance?.contentLoaded) {
|
||||
this.componentRef.instance.contentLoaded.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
|
||||
this.contentLoaded.emit();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user