MOBILE-3213 ios: Fix RTE toolbar in iOS 12+
parent
5053274a85
commit
4ecb148c19
|
@ -180,18 +180,19 @@ export class CoreRichTextEditorComponent implements AfterContentInit, OnDestroy
|
||||||
if (this.platform.is('android')) {
|
if (this.platform.is('android')) {
|
||||||
// In Android we ignore the keyboard height because it is not part of the web view.
|
// 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);
|
height = this.domUtils.getContentHeight(this.content) - this.getSurroundingHeight(this.element);
|
||||||
} else if (this.platform.is('ios') && this.kbHeight > 0) {
|
} else if (this.platform.is('ios') && this.kbHeight > 0 && this.platform.version().major < 12) {
|
||||||
// Keyboard open in iOS.
|
// Keyboard open in iOS 11 or previous. The window height changes when the keyboard is open.
|
||||||
// In this case, the header disappears or is scrollable, so we need to adjust the calculations.
|
|
||||||
height = window.innerHeight - this.getSurroundingHeight(this.element);
|
height = window.innerHeight - this.getSurroundingHeight(this.element);
|
||||||
|
|
||||||
if (this.element.getBoundingClientRect().top < 40) {
|
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.
|
// 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);
|
window.scrollTo(window.scrollX, window.scrollY - 40);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Header is fixed, use the content to calculate the editor height.
|
// Header is fixed, use the content to calculate the editor height.
|
||||||
height = this.domUtils.getContentHeight(this.content) - this.kbHeight - this.getSurroundingHeight(this.element);
|
height = this.domUtils.getContentHeight(this.content) - this.kbHeight - this.getSurroundingHeight(this.element);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (height > this.minHeight) {
|
if (height > this.minHeight) {
|
||||||
|
@ -549,13 +550,15 @@ export class CoreRichTextEditorComponent implements AfterContentInit, OnDestroy
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hide the toolbar.
|
* Hide the toolbar in phone mode.
|
||||||
*/
|
*/
|
||||||
hideToolbar($event: any): void {
|
hideToolbar($event: any): void {
|
||||||
this.stopBubble($event);
|
this.stopBubble($event);
|
||||||
|
|
||||||
|
if (this.isPhone) {
|
||||||
this.toolbarHidden = true;
|
this.toolbarHidden = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the toolbar.
|
* Show the toolbar.
|
||||||
|
|
Loading…
Reference in New Issue