MOBILE-3320 rte: Update buttons when orientation changes

main
Dani Palou 2021-07-05 15:53:34 +02:00
parent 3ab857ee90
commit bd8f8de604
1 changed files with 11 additions and 3 deletions

View File

@ -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<number> {
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<void> {
await CoreDomUtils.waitForResizeDone();
this.maximizeEditorSize();
this.updateToolbarButtons();
}
/**
* User entered the page that contains the component.
*/