From 19473b345ffc6aef9439c907984303b5e8423828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Fri, 10 May 2024 11:00:09 +0200 Subject: [PATCH] MOBILE-4470 rte: Fix RTE outside ion-item --- .../rich-text-editor/rich-text-editor.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 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 53c21ed2f..80bd0a048 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 @@ -218,11 +218,7 @@ export class CoreEditorRichTextEditorComponent implements OnInit, AfterViewInit, this.deleteDraftOnSubmitOrCancel(); } - const ionItem = this.element.closest('ion-item'); - if (!ionItem) { - return; - } - ionItem.classList.add('item-rte'); + this.setupIonItem(); if (this.editorElement) { const debounceMutation = CoreUtils.debounce(() => { @@ -232,9 +228,19 @@ export class CoreEditorRichTextEditorComponent implements OnInit, AfterViewInit, this.contentObserver = new MutationObserver(debounceMutation); this.contentObserver.observe(this.editorElement, { childList: true, subtree: true, characterData: true }); } + } + + /** + * Setup Ion Item adding classes and managing aria-labelledby. + */ + protected setupIonItem(): void { + const ionItem = this.element.closest('ion-item'); + if (!ionItem) { + return; + } + ionItem.classList.add('item-rte'); const label = ionItem.querySelector('ion-label'); - if (!label) { return; }