mirror of
https://github.com/element-hq/element-web.git
synced 2024-12-04 13:15:58 +03:00
Merge pull request #1173 from matrix-org/luke/fix-rte-forgets-me
Strip out "/me" after committing to RTE history
This commit is contained in:
commit
72eed70a84
1 changed files with 8 additions and 8 deletions
|
@ -581,14 +581,6 @@ export default class MessageComposerInput extends React.Component {
|
||||||
let sendHtmlFn = this.client.sendHtmlMessage;
|
let sendHtmlFn = this.client.sendHtmlMessage;
|
||||||
let sendTextFn = this.client.sendTextMessage;
|
let sendTextFn = this.client.sendTextMessage;
|
||||||
|
|
||||||
if (contentText.startsWith('/me')) {
|
|
||||||
contentText = contentText.substring(4);
|
|
||||||
// bit of a hack, but the alternative would be quite complicated
|
|
||||||
if (contentHTML) contentHTML = contentHTML.replace(/\/me ?/, '');
|
|
||||||
sendHtmlFn = this.client.sendHtmlEmote;
|
|
||||||
sendTextFn = this.client.sendEmoteMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.state.isRichtextEnabled) {
|
if (this.state.isRichtextEnabled) {
|
||||||
this.historyManager.addItem(
|
this.historyManager.addItem(
|
||||||
contentHTML ? contentHTML : contentText,
|
contentHTML ? contentHTML : contentText,
|
||||||
|
@ -599,6 +591,14 @@ export default class MessageComposerInput extends React.Component {
|
||||||
this.historyManager.addItem(contentText, 'markdown');
|
this.historyManager.addItem(contentText, 'markdown');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (contentText.startsWith('/me')) {
|
||||||
|
contentText = contentText.substring(4);
|
||||||
|
// bit of a hack, but the alternative would be quite complicated
|
||||||
|
if (contentHTML) contentHTML = contentHTML.replace(/\/me ?/, '');
|
||||||
|
sendHtmlFn = this.client.sendHtmlEmote;
|
||||||
|
sendTextFn = this.client.sendEmoteMessage;
|
||||||
|
}
|
||||||
|
|
||||||
let sendMessagePromise;
|
let sendMessagePromise;
|
||||||
if (contentHTML) {
|
if (contentHTML) {
|
||||||
sendMessagePromise = sendHtmlFn.call(
|
sendMessagePromise = sendHtmlFn.call(
|
||||||
|
|
Loading…
Reference in a new issue