MOBILE-3814 rte: Do not hide toolbar when clicked inside element
parent
4dcceee3e2
commit
7cbf59df2d
|
@ -110,7 +110,7 @@
|
|||
</button>
|
||||
</ion-slide>
|
||||
<ion-slide *ngIf="isPhone">
|
||||
<button [title]="'core.editor.hidetoolbar' | translate" (click)="hideToolbar($event)" (keyup)="hideToolbar($event)"
|
||||
<button [title]="'core.editor.hidetoolbar' | translate" (click)="hideToolbar($event, true)" (keyup)="hideToolbar($event, true)"
|
||||
(mousedown)="downAction($event)" (keydown)="downAction($event)">
|
||||
<ion-icon name="fas-times" aria-hidden="true"></ion-icon>
|
||||
</button>
|
||||
|
|
|
@ -177,8 +177,6 @@ export class CoreEditorRichTextEditorComponent implements OnInit, AfterContentIn
|
|||
this.editorElement.oninput = this.onChange.bind(this);
|
||||
this.editorElement.onkeydown = this.moveCursor.bind(this);
|
||||
|
||||
await CoreDomUtils.waitToBeVisible(this.editorElement);
|
||||
|
||||
// Use paragraph on enter.
|
||||
document.execCommand('DefaultParagraphSeparator', false, 'p');
|
||||
|
||||
|
@ -340,7 +338,7 @@ export class CoreEditorRichTextEditorComponent implements OnInit, AfterContentIn
|
|||
return;
|
||||
}
|
||||
|
||||
if (this.isNullOrWhiteSpace(this.editorElement.innerText)) {
|
||||
if (this.isNullOrWhiteSpace(this.editorElement.textContent)) {
|
||||
this.clearText();
|
||||
} else {
|
||||
// The textarea and the form control must receive the original URLs.
|
||||
|
@ -719,8 +717,17 @@ export class CoreEditorRichTextEditorComponent implements OnInit, AfterContentIn
|
|||
|
||||
/**
|
||||
* Hide the toolbar in phone mode.
|
||||
*
|
||||
* @param event Event.
|
||||
* @param force If true it will not check the target of the event.
|
||||
*/
|
||||
hideToolbar(event: Event): void {
|
||||
hideToolbar(event: Event, force = false): void {
|
||||
if (!force && event.target && this.element.contains(event.target as HTMLElement)) {
|
||||
// Do not hide if clicked inside the editor area, except forced.
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.type == 'keyup' && !this.isValidKeyboardKey(<KeyboardEvent>event)) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue