From bd8f8de6048150cc0dd1841b3ea3d5c35ab36879 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Mon, 5 Jul 2021 15:53:34 +0200 Subject: [PATCH] MOBILE-3320 rte: Update buttons when orientation changes --- .../rich-text-editor/rich-text-editor.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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 f5929ad96..d6c44f5b1 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 @@ -256,7 +256,7 @@ export class CoreEditorRichTextEditorComponent implements OnInit, AfterContentIn ); }); - this.resizeFunction = this.maximizeEditorSize.bind(this); + this.resizeFunction = this.windowResized.bind(this); window.addEventListener('resize', this.resizeFunction!); // Start observing the target node for configured mutations @@ -285,8 +285,6 @@ export class CoreEditorRichTextEditorComponent implements OnInit, AfterContentIn * @return Resolved with calculated editor size. */ protected async maximizeEditorSize(): Promise { - await CoreUtils.wait(100); - const contentVisibleHeight = await CoreDomUtils.getContentHeight(this.content); if (contentVisibleHeight <= 0) { @@ -1075,6 +1073,16 @@ export class CoreEditorRichTextEditorComponent implements OnInit, AfterContentIn } } + /** + * Window resized. + */ + protected async windowResized(): Promise { + await CoreDomUtils.waitForResizeDone(); + + this.maximizeEditorSize(); + this.updateToolbarButtons(); + } + /** * User entered the page that contains the component. */