Skip to content

Commit 8860c9c

Browse files
authored
Merge pull request element-hq#2082 from aviraldg/feature-rte-formatbar
Formatting toolbar for RTE message composer.
2 parents 31dd49f + d833c76 commit 8860c9c

29 files changed

Lines changed: 487 additions & 7 deletions

‎src/components/views/context_menus/MessageContextMenu.js‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ module.exports = React.createClass({
8484
if (this.props.onFinished) this.props.onFinished();
8585
},
8686

87+
onQuoteClick: function () {
88+
console.log(this.props.mxEvent);
89+
dis.dispatch({
90+
action: 'quote',
91+
event: this.props.mxEvent,
92+
});
93+
},
94+
8795
render: function() {
8896
var eventStatus = this.props.mxEvent.status;
8997
var resendButton;
@@ -141,6 +149,12 @@ module.exports = React.createClass({
141149
</div>
142150
);
143151

152+
const quoteButton = (
153+
<div className="mx_MessageContextMenu_field" onClick={this.onQuoteClick}>
154+
Quote
155+
</div>
156+
);
157+
144158
return (
145159
<div>
146160
{resendButton}
@@ -149,6 +163,7 @@ module.exports = React.createClass({
149163
{viewSourceButton}
150164
{unhidePreviewButton}
151165
{permalinkButton}
166+
{quoteButton}
152167
</div>
153168
);
154169
}

‎src/skins/vector/css/matrix-react-sdk/views/elements/RichText.css‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,20 @@
2020
.mx_Markdown_ITALIC {
2121
font-style: italic;
2222
}
23+
24+
.mx_Markdown_CODE {
25+
padding: .2em 0;
26+
margin: 0;
27+
font-size: 85%;
28+
background-color: rgba(0,0,0,.04);
29+
border-radius: 3px;
30+
}
31+
32+
.mx_Markdown_HR {
33+
display: block;
34+
background: #e7e7e7;
35+
}
36+
37+
.mx_Markdown_STRIKETHROUGH {
38+
text-decoration: line-through;
39+
}

‎src/skins/vector/css/matrix-react-sdk/views/rooms/MessageComposer.css‎

Lines changed: 75 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,31 @@ limitations under the License.
5757
.mx_MessageComposer_input {
5858
flex: 1;
5959
vertical-align: middle;
60-
min-height: 60px;
61-
max-height: 120px;
6260
display: flex;
63-
align-items: center;
64-
overflow: auto;
61+
flex-direction: column;
62+
min-height: 60px;
63+
justify-content: center;
64+
align-items: flex-start;
6565
font-size: 14px;
6666
margin-right: 6px;
6767
}
68-
.mx_MessageComposer_input_rte {
69-
border-top: 2px solid #76cfa6; /* placeholder RTE indicator */
68+
69+
.mx_MessageComposer_input_empty .public-DraftEditorPlaceholder-root {
70+
display: none;
7071
}
7172

7273
.mx_MessageComposer_input .DraftEditor-root {
74+
width: 100%;
7375
flex: 1;
76+
max-height: 120px;
77+
overflow: auto;
78+
}
79+
80+
.mx_MessageComposer_input blockquote {
81+
color: rgb(119, 119, 119);
82+
margin: 0 0 16px;
83+
padding: 0 15px;
84+
border-left: 4px solid rgb(221, 221, 221);
7485
}
7586

7687
.mx_MessageComposer_input textarea {
@@ -88,7 +99,8 @@ limitations under the License.
8899
color: #454545;
89100
background-color: #fff;
90101
font-size: 14px;
91-
102+
max-height: 120px;
103+
overflow: auto;
92104
/* needed for FF */
93105
font-family: 'Open Sans', Arial, Helvetica, Sans-Serif;
94106
}
@@ -122,3 +134,59 @@ limitations under the License.
122134
pointer-events: none;
123135
}
124136

137+
.mx_MessageComposer_formatting {
138+
cursor: pointer;
139+
margin: 0 11px;
140+
}
141+
142+
.mx_MessageComposer_formatbar_wrapper {
143+
width: 100%;
144+
background-color: #f7f7f7;
145+
box-shadow: inset 0 1px 0 0 rgba(0, 0, 0, 0.08);
146+
}
147+
148+
.mx_MessageComposer_formatbar {
149+
margin: auto;
150+
max-width: 960px;
151+
display: flex;
152+
153+
height: 30px;
154+
155+
box-sizing: border-box;
156+
padding-left: 62px;
157+
158+
flex-direction: row;
159+
align-items: center;
160+
font-size: 10px;
161+
color: #888;
162+
}
163+
164+
.mx_MessageComposer_formatbar * {
165+
margin-right: 4px;
166+
}
167+
168+
.mx_MessageComposer_format_button,
169+
.mx_MessageComposer_formatbar_cancel,
170+
.mx_MessageComposer_formatbar_markdown {
171+
cursor: pointer;
172+
}
173+
174+
.mx_MessageComposer_format_button_disabled {
175+
cursor: not-allowed;
176+
opacity: 0.5;
177+
}
178+
179+
.mx_MessageComposer_formatbar_cancel {
180+
margin-right: 22px;
181+
}
182+
183+
.mx_MessageComposer_formatbar_markdown {
184+
margin-right: 64px;
185+
}
186+
187+
.mx_MessageComposer_input_markdownIndicator {
188+
cursor: pointer;
189+
height: 10px;
190+
padding: 4px 4px 4px 0;
191+
opacity: 0.8;
192+
}
569 Bytes
Loading
Lines changed: 29 additions & 0 deletions
Loading
1.06 KB
Loading
1.51 KB
Loading
483 Bytes
Loading
Lines changed: 14 additions & 0 deletions
Loading
906 Bytes
Loading

0 commit comments

Comments
 (0)