diff --git a/src/core/editor/components/rich-text-editor/core-editor-rich-text-editor.html b/src/core/editor/components/rich-text-editor/core-editor-rich-text-editor.html index fc1a9c683..20faba16e 100644 --- a/src/core/editor/components/rich-text-editor/core-editor-rich-text-editor.html +++ b/src/core/editor/components/rich-text-editor/core-editor-rich-text-editor.html @@ -1,8 +1,8 @@
-
+
- +
@@ -11,78 +11,78 @@
- - - - - - - - - - - - - - -
diff --git a/src/core/editor/components/rich-text-editor/rich-text-editor.ts b/src/core/editor/components/rich-text-editor/rich-text-editor.ts index 865a417d6..a99a15e0c 100644 --- a/src/core/editor/components/rich-text-editor/rich-text-editor.ts +++ b/src/core/editor/components/rich-text-editor/rich-text-editor.ts @@ -625,7 +625,9 @@ export class CoreEditorRichTextEditorComponent implements AfterContentInit, OnDe /** * Show the toolbar. */ - showToolbar(): void { + showToolbar($event: Event): void { + this.stopBubble($event); + this.editorElement.focus(); this.toolbarHidden = false; } @@ -640,6 +642,19 @@ export class CoreEditorRichTextEditorComponent implements AfterContentInit, OnDe event.stopPropagation(); } + /** + * When a button is clicked first we should stop event propagation, but it has some cases to not. + * + * @param event Event. + */ + mouseDownAction(event: Event): void { + const selection = window.getSelection().toString(); + // When RTE is focused with a range selection the stopBubble will not fire click. + if (!this.rteEnabled || document.activeElement != this.editorElement || selection == '') { + this.stopBubble(event); + } + } + /** * Method that shows the next toolbar buttons. */ @@ -710,7 +725,7 @@ export class CoreEditorRichTextEditorComponent implements AfterContentInit, OnDe * Update highlighted toolbar styles. */ updateToolbarStyles = (): void => { - const node = document.getSelection().focusNode; + const node = window.getSelection().focusNode; if (!node) { return; } diff --git a/src/theme/format-text.scss b/src/theme/format-text.scss index 8365e7363..fb9ea382d 100644 --- a/src/theme/format-text.scss +++ b/src/theme/format-text.scss @@ -1,4 +1,12 @@ /** Styles to match web platform */ +ion-app.app-root core-format-text { + ul { + padding-left: 1rem; + } + ul, ol { + -webkit-padding-start: 15px; + } +} ion-app.app-root core-format-text, ion-app.app-root .item core-format-text, ion-app.app-root core-rich-text-editor .core-rte-editor { @@ -14,14 +22,10 @@ ion-app.app-root core-rich-text-editor .core-rte-editor { } // Fix lists styles in core-format-text. - ul { - padding-left: 1rem; - } ol { list-style-type: decimal; } ul, ol { - -webkit-padding-start: 15px; ol { list-style-type: lower-latin; }