|
|
@ -105,8 +105,8 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async sendEvent(event){
|
|
|
|
async sendEvent(event){
|
|
|
|
if (!event.content.body.trim()) return;
|
|
|
|
if (!event.content.body.trim()) return;
|
|
|
|
await matrix.sendEvent(this.event, this.roomId, this.replyTo);
|
|
|
|
if (this.replyTo) this.setReplyTo(this.replyTo);
|
|
|
|
//await matrix.sendEvent(new Proxy(this.event, this.eventProxy), this.roomId, this.replyTo);
|
|
|
|
matrix.sendEvent(new Proxy(this.event, this.eventProxyHandler), this.roomId);
|
|
|
|
event.content.body = '';
|
|
|
|
event.content.body = '';
|
|
|
|
this.resetAttachment();
|
|
|
|
this.resetAttachment();
|
|
|
|
this.resetReplyTo();
|
|
|
|
this.resetReplyTo();
|
|
|
@ -125,6 +125,11 @@ export default {
|
|
|
|
matrix.client.sendTyping(this.roomId, true, timeout+100);
|
|
|
|
matrix.client.sendTyping(this.roomId, true, timeout+100);
|
|
|
|
setTimeout(()=>this.waitForSendTyping=false, timeout);
|
|
|
|
setTimeout(()=>this.waitForSendTyping=false, timeout);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
setReplyTo(event){
|
|
|
|
|
|
|
|
this.event.content['m.relates_to'] = {
|
|
|
|
|
|
|
|
'm.in_reply_to': event
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
resizeMessageBanner(){
|
|
|
|
resizeMessageBanner(){
|
|
|
|
let id = this.$refs.newMessageInput;
|
|
|
|
let id = this.$refs.newMessageInput;
|
|
|
|
id.style.height = '1.25rem';
|
|
|
|
id.style.height = '1.25rem';
|
|
|
@ -177,12 +182,14 @@ export default {
|
|
|
|
mimetype: file.type,
|
|
|
|
mimetype: file.type,
|
|
|
|
url: window.URL.createObjectURL(file),
|
|
|
|
url: window.URL.createObjectURL(file),
|
|
|
|
blob: blob || await this.readFile(file),
|
|
|
|
blob: blob || await this.readFile(file),
|
|
|
|
|
|
|
|
filename: file.name,
|
|
|
|
file
|
|
|
|
file
|
|
|
|
};
|
|
|
|
};
|
|
|
|
this.event.content = {
|
|
|
|
this.event.content = {
|
|
|
|
body: file.name,
|
|
|
|
body: file.name,
|
|
|
|
msgtype: this.attachment.msgtype,
|
|
|
|
msgtype: this.attachment.msgtype,
|
|
|
|
mimetype: this.attachment.mimetype
|
|
|
|
mimetype: this.attachment.mimetype,
|
|
|
|
|
|
|
|
filename: file.name
|
|
|
|
};
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
resetAttachment(){
|
|
|
|
resetAttachment(){
|
|
|
@ -212,7 +219,7 @@ export default {
|
|
|
|
body: '',
|
|
|
|
body: '',
|
|
|
|
msgtype: 'm.text',
|
|
|
|
msgtype: 'm.text',
|
|
|
|
'm.relates_to': {
|
|
|
|
'm.relates_to': {
|
|
|
|
'm.in_reply_to': this.replyTo
|
|
|
|
'm.in_reply_to': undefined
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -224,10 +231,10 @@ export default {
|
|
|
|
isRecording: false,
|
|
|
|
isRecording: false,
|
|
|
|
recBlob: undefined,
|
|
|
|
recBlob: undefined,
|
|
|
|
attachment: undefined,
|
|
|
|
attachment: undefined,
|
|
|
|
eventProxy: {
|
|
|
|
eventProxyHandler: {
|
|
|
|
set: ()=>{},
|
|
|
|
set: () => true,
|
|
|
|
get: (target, key) => {
|
|
|
|
get: (target, key) => {
|
|
|
|
if (typeof target[key] === 'object') return new Proxy(target[key], this.eventProxy);
|
|
|
|
if (typeof target[key] === 'object') return new Proxy(Object.assign({}, target[key]), this.eventProxyHandler);
|
|
|
|
return target[key];
|
|
|
|
return target[key];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|