Skip to content

Commit 0fcdd49

Browse files
crazyserverdpalou
authored andcommitted
MOBILE-3323 rte: Style draft messages
1 parent 7fa8e6f commit 0fcdd49

File tree

3 files changed

+29
-10
lines changed

3 files changed

+29
-10
lines changed

src/core/editor/components/rich-text-editor/core-editor-rich-text-editor.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="core-rte-editor-container">
1+
<div class="core-rte-editor-container" (click)="focusRTE()" [class.toolbar-hidden]="toolbarHidden">
22
<div [hidden]="!rteEnabled" #editor contenteditable="true" class="core-rte-editor" tappable (focus)="showToolbar()" (longPress)="showToolbar()" (blur)="hideToolbar($event)" [attr.data-placeholder-text]="placeholder" role="textbox">
33
</div>
44

src/core/editor/components/rich-text-editor/rich-text-editor.scss

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,20 @@ ion-app.app-root core-rich-text-editor {
1111
}
1212

1313
.core-rte-editor-container {
14-
height: 100%;
15-
position: relative;
14+
max-height: calc(100% - 46px);
15+
display: flex;
16+
flex-direction: column;
17+
flex-grow: 1;
18+
&.toolbar-hidden {
19+
max-height: 100%;
20+
}
1621

1722
.core-rte-info-message {
18-
position: absolute;
19-
bottom: 0;
20-
padding: 3px;
21-
border: 1px solid $info;
22-
border-radius: 5px;
23+
padding: 5px;
24+
border-top: 1px solid $info;
25+
background: white;
26+
flex-shrink: 1;
27+
font-size: 1.4rem;
2328

2429
.icon {
2530
color: $info;
@@ -33,6 +38,7 @@ ion-app.app-root core-rich-text-editor {
3338
width: 100%;
3439
resize: none;
3540
background-color: $white;
41+
flex-grow: 1;
3642
@include darkmode() {
3743
background-color: $gray-darker;
3844
color: $white;

src/core/editor/components/rich-text-editor/rich-text-editor.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ export class CoreEditorRichTextEditorComponent implements AfterContentInit, OnDe
230230
}
231231

232232
if (height > this.minHeight) {
233-
this.element.style.height = this.domUtils.formatPixelsSize(height);
233+
this.element.style.height = this.domUtils.formatPixelsSize(height - 1);
234234
} else {
235235
this.element.style.height = '';
236236
}
@@ -583,10 +583,23 @@ export class CoreEditorRichTextEditorComponent implements AfterContentInit, OnDe
583583
}
584584
}
585585

586+
/**
587+
* Focus editor when click the area.
588+
*
589+
* @param e Event
590+
*/
591+
focusRTE(e?: Event): void {
592+
if (this.rteEnabled) {
593+
this.editorElement.focus();
594+
} else {
595+
this.textarea.setFocus();
596+
}
597+
}
598+
586599
/**
587600
* Hide the toolbar in phone mode.
588601
*/
589-
hideToolbar($event: any): void {
602+
hideToolbar($event: Event): void {
590603
this.stopBubble($event);
591604

592605
if (this.isPhone) {

0 commit comments

Comments
 (0)