mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
show send errors in UI
This commit is contained in:
parent
5a90b4673b
commit
f7f9129b8b
@ -66,7 +66,16 @@ export default class RoomViewModel extends EventEmitter {
|
|||||||
|
|
||||||
sendMessage(message) {
|
sendMessage(message) {
|
||||||
if (message) {
|
if (message) {
|
||||||
this._room.sendEvent("m.room.message", {msgtype: "m.text", body: message});
|
try {
|
||||||
|
this._room.sendEvent("m.room.message", {msgtype: "m.text", body: message});
|
||||||
|
} catch (err) {
|
||||||
|
console.error(`room.sendMessage(): ${err.message}:\n${err.stack}`);
|
||||||
|
this._timelineError = err;
|
||||||
|
this.emit("change", "error");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,9 @@ export default class MessageComposer extends TemplateView {
|
|||||||
|
|
||||||
_onKeyDown(event) {
|
_onKeyDown(event) {
|
||||||
if (event.key === "Enter") {
|
if (event.key === "Enter") {
|
||||||
this.viewModel.sendMessage(this._input.value);
|
if (this.viewModel.sendMessage(this._input.value)) {
|
||||||
this._input.value = "";
|
this._input.value = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user