From 1ef14477fa935d8ee218328493940ad8326a1ee7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Tue, 15 Mar 2022 13:34:50 +0100 Subject: [PATCH] MOBILE-3814 glossary: Fix RTE not recovering saved text in offline --- .../components/index/addon-mod-glossary-index.html | 4 ++-- .../components/rich-text-editor/rich-text-editor.ts | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/addons/mod/glossary/components/index/addon-mod-glossary-index.html b/src/addons/mod/glossary/components/index/addon-mod-glossary-index.html index b32270973..4f544012e 100644 --- a/src/addons/mod/glossary/components/index/addon-mod-glossary-index.html +++ b/src/addons/mod/glossary/components/index/addon-mod-glossary-index.html @@ -34,7 +34,7 @@ -

{{ 'addon.mod_glossary.entriestobesynced' | translate }}

+

{{ 'addon.mod_glossary.entriestobesynced' | translate }}

-

{{ getDivider!(entry) }}

+

{{ getDivider!(entry) }}

diff --git a/src/core/features/editor/components/rich-text-editor/rich-text-editor.ts b/src/core/features/editor/components/rich-text-editor/rich-text-editor.ts index eb4010db4..66b451146 100644 --- a/src/core/features/editor/components/rich-text-editor/rich-text-editor.ts +++ b/src/core/features/editor/components/rich-text-editor/rich-text-editor.ts @@ -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 { 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 { await CoreDomUtils.waitForResizeDone(); + this.isPhone = CoreScreen.isMobile; this.maximizeEditorSize(); this.updateToolbarButtons();