You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-07 10:46:24 +03:00
Strip out "/me" after committing to RTE history
So that history can include emotes Fixes https://github.com/vector-im/riot-web/issues/4472
This commit is contained in:
@@ -548,14 +548,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,
|
||||||
@@ -566,6 +558,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(
|
||||||
|
|||||||
Reference in New Issue
Block a user