Edit events
This commit is contained in:
parent
24b72cab1e
commit
a4c329100d
2 changed files with 17 additions and 10 deletions
|
|
@ -511,18 +511,12 @@ export default {
|
|||
|
||||
sendMessage() {
|
||||
if (this.currentInput.length > 0) {
|
||||
// Is this an edit?
|
||||
if (this.editedEvent) {
|
||||
console.log("Edit");
|
||||
}
|
||||
|
||||
this.editedEvent = null; //TODO - Is this a good place to reset this?
|
||||
|
||||
util
|
||||
.sendTextMessage(
|
||||
this.$matrix.matrixClient,
|
||||
this.roomId,
|
||||
this.currentInput
|
||||
this.currentInput,
|
||||
this.editedEvent
|
||||
)
|
||||
.then(() => {
|
||||
console.log("Sent message");
|
||||
|
|
@ -531,6 +525,7 @@ export default {
|
|||
console.log("Failed to send:", err);
|
||||
});
|
||||
this.currentInput = "";
|
||||
this.editedEvent = null; //TODO - Is this a good place to reset this?
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -678,6 +673,7 @@ export default {
|
|||
edit(event) {
|
||||
this.editedEvent = event;
|
||||
this.currentInput = event.getContent().body;
|
||||
this.$refs.messageInput.focus();
|
||||
},
|
||||
|
||||
emojiSelected(e) {
|
||||
|
|
|
|||
|
|
@ -113,8 +113,19 @@ class Util {
|
|||
});
|
||||
}
|
||||
|
||||
sendTextMessage(matrixClient, roomId, text) {
|
||||
return this.sendMessage(matrixClient, roomId, "m.room.message", ContentHelpers.makeTextMessage(text));
|
||||
sendTextMessage(matrixClient, roomId, text, editedEvent) {
|
||||
var content = ContentHelpers.makeTextMessage(text);
|
||||
if (editedEvent) {
|
||||
content['m.relates_to'] = {
|
||||
rel_type: 'm.replace',
|
||||
event_id: editedEvent.getId()
|
||||
}
|
||||
content['m.new_content'] = {
|
||||
body: content.body,
|
||||
msgtype: content.msgtype
|
||||
}
|
||||
}
|
||||
return this.sendMessage(matrixClient, roomId, "m.room.message", content);
|
||||
}
|
||||
|
||||
sendQuickReaction(matrixClient, roomId, emoji, event) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue