From 4ecb148c192d39a2fc25ddf33b88c371059a7011 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Fri, 13 Dec 2019 12:30:07 +0100 Subject: [PATCH] MOBILE-3213 ios: Fix RTE toolbar in iOS 12+ --- src/components/rich-text-editor/rich-text-editor.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/components/rich-text-editor/rich-text-editor.ts b/src/components/rich-text-editor/rich-text-editor.ts index 83d4baaef..d4367e509 100644 --- a/src/components/rich-text-editor/rich-text-editor.ts +++ b/src/components/rich-text-editor/rich-text-editor.ts @@ -180,18 +180,19 @@ export class CoreRichTextEditorComponent implements AfterContentInit, OnDestroy if (this.platform.is('android')) { // In Android we ignore the keyboard height because it is not part of the web view. height = this.domUtils.getContentHeight(this.content) - this.getSurroundingHeight(this.element); - } else if (this.platform.is('ios') && this.kbHeight > 0) { - // Keyboard open in iOS. - // In this case, the header disappears or is scrollable, so we need to adjust the calculations. + } else if (this.platform.is('ios') && this.kbHeight > 0 && this.platform.version().major < 12) { + // Keyboard open in iOS 11 or previous. The window height changes when the keyboard is open. height = window.innerHeight - this.getSurroundingHeight(this.element); if (this.element.getBoundingClientRect().top < 40) { // In iOS sometimes the editor is placed below the status bar. Move the scroll a bit so it doesn't happen. window.scrollTo(window.scrollX, window.scrollY - 40); } + } else { // Header is fixed, use the content to calculate the editor height. height = this.domUtils.getContentHeight(this.content) - this.kbHeight - this.getSurroundingHeight(this.element); + } if (height > this.minHeight) { @@ -549,12 +550,14 @@ export class CoreRichTextEditorComponent implements AfterContentInit, OnDestroy } /** - * Hide the toolbar. + * Hide the toolbar in phone mode. */ hideToolbar($event: any): void { this.stopBubble($event); - this.toolbarHidden = true; + if (this.isPhone) { + this.toolbarHidden = true; + } } /**