Commit 8bf08480 authored by Hamza HRAMCHI's avatar Hamza HRAMCHI
Browse files

FIX #18826 TIME 0:20 document editor: disable buttons/add a loader when saving changes

parent f11207d9
......@@ -4,10 +4,10 @@
<mat-spinner></mat-spinner>
</div>
<app-onlyoffice-viewer *ngIf="editorType === 'onlyoffice'" #onlyofficeViewer style="height:100%;width:100%;" [hideCloseEditor]="true"
[params]="editorOptions" [file]="file" [editMode]="true" (triggerAfterUpdatedDoc)="close()"
[params]="editorOptions" [file]="file" [editMode]="true" [loading]="loading" (triggerAfterUpdatedDoc)="close()"
(triggerCloseEditor)="dialogRef.close('');" (triggerModifiedDocument)="documentIsModified = true"></app-onlyoffice-viewer>
<app-collabora-online-viewer *ngIf="editorType === 'collaboraonline'" #collaboraOnlineViewer style="height:100%;width:100%;" [params]="editorOptions" [file]="file"
[editMode]="true" (triggerAfterUpdatedDoc)="close()"
[editMode]="true" [loading]="loading" (triggerAfterUpdatedDoc)="close()"
(triggerCloseEditor)="dialogRef.close('');" (triggerModifiedDocument)="documentIsModified = true"></app-collabora-online-viewer>
<div *ngIf="editorType === 'office365sharepoint'" class="office-sharepoint-container">
<app-office-sharepoint-viewer #officeSharepointViewer style="height:100%;width:100%;" [params]="editorOptions" [file]="file"
......
......@@ -114,12 +114,15 @@
</ng-container>
<ng-container *ngIf="editInProgress && editor.mode === 'onlyoffice'">
<app-onlyoffice-viewer #onlyofficeViewer style="height:100%;width:100%;" [params]="editor.options" [file]="file"
[editMode]="true" (triggerAfterUpdatedDoc)="triggerEvent.emit()"
[editMode]="true" [loading]="loading" (triggerAfterUpdatedDoc)="triggerEvent.emit()"
(triggerCloseEditor)="closeEditor()" (triggerModifiedDocument)="isDocModified = true"></app-onlyoffice-viewer>
<div *ngIf="loading" class="example-loading-shade">
<mat-spinner style="margin:auto;"></mat-spinner>
</div>
</ng-container>
<ng-container *ngIf="editInProgress && editor.mode === 'collaboraOnline'">
<app-collabora-online-viewer #collaboraOnlineViewer style="height:100%;width:100%;" [params]="editor.options" [file]="file"
[editMode]="true" (triggerAfterUpdatedDoc)="triggerEvent.emit()"
[editMode]="true" [loading]="loading" (triggerAfterUpdatedDoc)="triggerEvent.emit()"
(triggerCloseEditor)="closeEditor()" (triggerModifiedDocument)="isDocModified = true"></app-collabora-online-viewer>
<div *ngIf="collaboraOnlineViewer.isSaving" class="example-loading-shade">
<mat-spinner style="margin:auto;"></mat-spinner>
......@@ -134,12 +137,12 @@
<mat-spinner style="margin:auto;"></mat-spinner>
</div>
</ng-container>
<button mat-fab *ngIf="isDocModified && mode === 'mainDocument' && resId !== null && editor.mode !== 'office365sharepoint'" color="accent"
<button mat-fab *ngIf="isDocModified && mode === 'mainDocument' && resId !== null && editor.mode !== 'office365sharepoint' && !loading" color="accent"
[title]="'lang.saveModifications' | translate" style="position: absolute;z-index: 3;bottom: 40px;right: 60px;"
(click)="saveMainDocument()">
<mat-icon style="height:auto;font-size:20px;" class="fas fa-check"></mat-icon>
</button>
<button mat-fab *ngIf="isDocModified && mode === 'attachment' && editor.mode !== 'office365sharepoint'" color="accent"
<button mat-fab *ngIf="isDocModified && mode === 'attachment' && editor.mode !== 'office365sharepoint' && !loading" color="accent"
[title]="'lang.saveModifications' | translate" style="position: absolute;z-index: 3;bottom: 40px;right: 60px;"
(click)="saveTmpDocument()">
<mat-icon style="height:auto;font-size:20px;" class="fas fa-check"></mat-icon>
......
......@@ -1190,6 +1190,7 @@ export class DocumentViewerComponent implements OnInit, OnDestroy {
}
saveTmpDocument() {
this.loading = true;
return new Promise((resolve) => {
this.getFile().pipe(
tap((data: any) => {
......@@ -1208,6 +1209,7 @@ export class DocumentViewerComponent implements OnInit, OnDestroy {
this.closeEditor();
resolve(true);
}),
finalize(() => this.loading = false),
catchError((err: any) => {
this.notify.handleSoftErrors(err);
resolve(false);
......
<div *ngIf="loading" style="display:block;padding: 10px;">{{'lang.checkCollaboraOnlineServer' | translate}}...</div>
<button class="collaboraOnlineButton_fullscreen" [class.buttonsHide]="hideButtons" [class.fullScreen]="fullscreenMode" mat-mini-fab color="warn"
<button class="collaboraOnlineButton_fullscreen" [disabled]="loading" [class.buttonsHide]="hideButtons" [class.fullScreen]="fullscreenMode" mat-mini-fab color="warn"
[title]="'lang.closeEditor' | translate" (click)="quit()">
<mat-icon class="fa fa-times" style="height:auto;"></mat-icon>
</button>
<button mat-mini-fab class="collaboraOnlineButton_close" [class.buttonsHide]="hideButtons" [class.fullScreen]="fullscreenMode" color="default"
<button mat-mini-fab class="collaboraOnlineButton_close" [disabled]="loading" [class.buttonsHide]="hideButtons" [class.fullScreen]="fullscreenMode" color="default"
[title]="fullscreenMode ? ('lang.closeFullscreen' | translate) : ('lang.openFullscreen' | translate)" (click)="openFullscreen()">
<mat-icon class="fas" [class.fa-expand]="!fullscreenMode" [class.fa-compress]="fullscreenMode" style="height:auto;"></mat-icon>
</button>
<button class="collaboraOnlineButton_hide" [class.buttonsHide]="hideButtons" [class.fullScreen]="fullscreenMode" mat-mini-fab color="default"
<button class="collaboraOnlineButton_hide" [disabled]="loading" [class.buttonsHide]="hideButtons" [class.fullScreen]="fullscreenMode" mat-mini-fab color="default"
[title]="!hideButtons ? ('lang.hideTool' | translate) : ('lang.showTool' | translate)" (click)="hideButtons = !hideButtons">
<mat-icon class="fa fa-arrow-right" style="height:auto;"></mat-icon>
</button>
......
......@@ -21,6 +21,7 @@ export class CollaboraOnlineViewerComponent implements OnInit, AfterViewInit, On
@Input() editMode: boolean = false;
@Input() file: any = {};
@Input() params: any = {};
@Input() loading: boolean = false;
@Output() triggerAfterUpdatedDoc = new EventEmitter<string>();
@Output() triggerCloseEditor = new EventEmitter<string>();
......@@ -28,8 +29,6 @@ export class CollaboraOnlineViewerComponent implements OnInit, AfterViewInit, On
@ViewChild('collaboraFrame', { static: false }) collaboraFrame: any;
loading: boolean = true;
editorConfig: any;
key: number = 0;
isSaving: boolean = false;
......
<div *ngIf="loading" style="display:block;padding: 10px;">{{'lang.checkOnlyofficeServer' | translate}}...</div>
<button *ngIf="!hideCloseEditor" class="onlyofficeButton_fullscreen" [class.buttonsHide]="hideButtons" [class.fullScreen]="fullscreenMode" mat-mini-fab color="warn"
<button *ngIf="!hideCloseEditor" class="onlyofficeButton_fullscreen" [disabled]="loading" [class.buttonsHide]="hideButtons" [class.fullScreen]="fullscreenMode" mat-mini-fab color="warn"
[title]="'lang.closeEditor' | translate" (click)="quit()">
<mat-icon class="fa fa-times" style="height:auto;"></mat-icon>
</button>
<button mat-mini-fab class="onlyofficeButton_close" [class.buttonsHide]="hideButtons" [class.fullScreen]="fullscreenMode" color="default"
<button mat-mini-fab class="onlyofficeButton_close" [disabled]="loading" [class.buttonsHide]="hideButtons" [class.fullScreen]="fullscreenMode" color="default"
[title]="fullscreenMode ? ('lang.closeFullscreen' | translate) : ('lang.openFullscreen' | translate)" (click)="openFullscreen()">
<mat-icon class="fas" [class.fa-expand]="!fullscreenMode" [class.fa-compress]="fullscreenMode" style="height:auto;"></mat-icon>
</button>
<button class="onlyofficeButton_hide" [class.fullScreen]="fullscreenMode" [class.buttonsHide]="hideButtons" mat-mini-fab color="default"
<button class="onlyofficeButton_hide" [disabled]="loading" [class.fullScreen]="fullscreenMode" [class.buttonsHide]="hideButtons" mat-mini-fab color="default"
[title]="!hideButtons ? ('lang.hideTool' | translate) : ('lang.showTool' | translate)" (click)="hideButtons = !hideButtons">
<mat-icon class="fa fa-arrow-right" style="height:auto;"></mat-icon>
</button>
......
......@@ -32,13 +32,12 @@ export class EcplOnlyofficeViewerComponent implements OnInit, AfterViewInit, OnD
@Input() file: any = {};
@Input() params: any = {};
@Input() hideCloseEditor: any = false;
@Input() loading: boolean = false;
@Output() triggerAfterUpdatedDoc = new EventEmitter<string>();
@Output() triggerCloseEditor = new EventEmitter<string>();
@Output() triggerModifiedDocument = new EventEmitter<string>();
loading: boolean = true;
editorConfig: any;
docEditor: any;
key: string = '';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment