diff --git a/src/components/rich-text-editor/core-rich-text-editor.html b/src/components/rich-text-editor/core-rich-text-editor.html index 7874c0162..c4b96e0fe 100644 --- a/src/components/rich-text-editor/core-rich-text-editor.html +++ b/src/components/rich-text-editor/core-rich-text-editor.html @@ -4,78 +4,78 @@
- - - - - - - - - - - - - - -
diff --git a/src/components/rich-text-editor/rich-text-editor.ts b/src/components/rich-text-editor/rich-text-editor.ts index 45e572d37..44be93408 100644 --- a/src/components/rich-text-editor/rich-text-editor.ts +++ b/src/components/rich-text-editor/rich-text-editor.ts @@ -533,10 +533,8 @@ export class CoreRichTextEditorComponent implements AfterContentInit, OnDestroy * @param {any} $event Event data * @param {string} command Command to execute. */ - protected buttonAction($event: any, command: string): void { - $event.preventDefault(); - $event.stopPropagation(); - this.editorElement.focus(); + buttonAction($event: any, command: string): void { + this.stopBubble($event); if (command) { if (command.includes('|')) { @@ -553,8 +551,9 @@ export class CoreRichTextEditorComponent implements AfterContentInit, OnDestroy /** * Hide the toolbar. */ - hideToolbar(): void { - this.editorElement.focus(); + hideToolbar($event: any): void { + this.stopBubble($event); + this.toolbarHidden = true; } @@ -566,26 +565,38 @@ export class CoreRichTextEditorComponent implements AfterContentInit, OnDestroy this.toolbarHidden = false; } + /** + * Stop event default and propagation. + * + * @param {Event} event Event. + */ + stopBubble(event: Event): void { + event.preventDefault(); + event.stopPropagation(); + } + /** * Method that shows the next toolbar buttons. */ - toolbarNext(): void { + toolbarNext($event: any): void { + this.stopBubble($event); + if (!this.toolbarNextHidden) { const currentIndex = this.toolbarSlides.getActiveIndex() || 0; this.toolbarSlides.slideTo(currentIndex + this.numToolbarButtons); } - this.editorElement.focus(); } /** * Method that shows the previous toolbar buttons. */ - toolbarPrev(): void { + toolbarPrev($event: any): void { + this.stopBubble($event); + if (!this.toolbarPrevHidden) { const currentIndex = this.toolbarSlides.getActiveIndex() || 0; this.toolbarSlides.slideTo(currentIndex - this.numToolbarButtons); } - this.editorElement.focus(); } /**