MOBILE-3814 glossary: Fix RTE not recovering saved text in offline

main
Pau Ferrer Ocaña 2022-03-15 13:34:50 +01:00
parent 8cf41088a8
commit 1ef14477fa
2 changed files with 7 additions and 5 deletions

View File

@ -34,7 +34,7 @@
<ion-list *ngIf="!isSearch && entries && entries.offlineEntries.length > 0">
<ion-item-divider>
<ion-label>
<h2>{{ 'addon.mod_glossary.entriestobesynced' | translate }}</h2>
<h2 class="big">{{ 'addon.mod_glossary.entriestobesynced' | translate }}</h2>
</ion-label>
</ion-item-divider>
<ion-item *ngFor="let entry of entries.offlineEntries" (click)="entries.select(entry)" detail="false" button
@ -51,7 +51,7 @@
<ng-container *ngFor="let entry of entries.onlineEntries; let index = index">
<ion-item-divider *ngIf="getDivider && showDivider(entry, entries.onlineEntries[index - 1])">
<ion-label>
<h2>{{ getDivider!(entry) }}</h2>
<h2 class="big">{{ getDivider!(entry) }}</h2>
</ion-label>
</ion-item-divider>

View File

@ -40,6 +40,7 @@ import { CoreEventFormActionData, CoreEventObserver, CoreEvents, CoreSingleTimeE
import { CoreEditorOffline } from '../../services/editor-offline';
import { CoreComponentsRegistry } from '@singletons/components-registry';
import { CoreLoadingComponent } from '@components/loading/loading';
import { CoreScreen } from '@services/screen';
/**
* Component to display a rich text editor if enabled.
@ -150,7 +151,7 @@ export class CoreEditorRichTextEditorComponent implements OnInit, AfterContentIn
*/
ngOnInit(): void {
this.canScanQR = CoreUtils.canScanQR();
this.isPhone = Platform.is('mobile') && !Platform.is('tablet');
this.isPhone = CoreScreen.isMobile;
this.toolbarHidden = this.isPhone;
this.direction = Platform.isRTL ? 'rtl' : 'ltr';
}
@ -161,6 +162,8 @@ export class CoreEditorRichTextEditorComponent implements OnInit, AfterContentIn
async ngAfterContentInit(): Promise<void> {
this.rteEnabled = await CoreDomUtils.isRichTextEditorEnabled();
await this.waitLoadingsDone();
// Setup the editor.
this.editorElement = this.editor?.nativeElement as HTMLDivElement;
this.setContent(this.control?.value);
@ -175,8 +178,6 @@ export class CoreEditorRichTextEditorComponent implements OnInit, AfterContentIn
// Use paragraph on enter.
document.execCommand('DefaultParagraphSeparator', false, 'p');
await this.waitLoadingsDone();
this.maximizeEditorSize();
this.setListeners();
@ -1052,6 +1053,7 @@ export class CoreEditorRichTextEditorComponent implements OnInit, AfterContentIn
*/
protected async windowResized(): Promise<void> {
await CoreDomUtils.waitForResizeDone();
this.isPhone = CoreScreen.isMobile;
this.maximizeEditorSize();
this.updateToolbarButtons();