mirror of https://github.com/vector-im/riot-web
send edit also in n.new_content field
so we can have fallback content in the regular content for clients that don't support edits. Note that we're not reading m.new_content yet as it's going to be a bit of a headache to change this. So for now just sending the edit in both the normal content and the m.new_content subfield, so all events out there already are well-formedpull/21833/head
parent
fd31e793d1
commit
dc21faa240
|
@ -111,18 +111,21 @@ export default class MessageEditor extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
_onSaveClicked = () => {
|
_onSaveClicked = () => {
|
||||||
const content = {
|
const newContent = {
|
||||||
"msgtype": "m.text",
|
"msgtype": "m.text",
|
||||||
"body": textSerialize(this.model),
|
"body": textSerialize(this.model),
|
||||||
|
};
|
||||||
|
if (requiresHtml(this.model)) {
|
||||||
|
newContent.format = "org.matrix.custom.html";
|
||||||
|
newContent.formatted_body = htmlSerialize(this.model);
|
||||||
|
}
|
||||||
|
const content = Object.assign({
|
||||||
|
"m.new_content": newContent,
|
||||||
"m.relates_to": {
|
"m.relates_to": {
|
||||||
"rel_type": "m.replace",
|
"rel_type": "m.replace",
|
||||||
"event_id": this.props.event.getOriginalId(),
|
"event_id": this.props.event.getOriginalId(),
|
||||||
},
|
},
|
||||||
};
|
}, newContent);
|
||||||
if (requiresHtml(this.model)) {
|
|
||||||
content.format = "org.matrix.custom.html";
|
|
||||||
content.formatted_body = htmlSerialize(this.model);
|
|
||||||
}
|
|
||||||
|
|
||||||
const roomId = this.props.event.getRoomId();
|
const roomId = this.props.event.getRoomId();
|
||||||
this.context.matrixClient.sendMessage(roomId, content);
|
this.context.matrixClient.sendMessage(roomId, content);
|
||||||
|
|
Loading…
Reference in New Issue