Implement quick edit

This commit is contained in:
Carl Schwan
2021-05-06 16:14:38 +00:00
parent 7b1c5f5aab
commit 0a51c845e6
5 changed files with 62 additions and 3 deletions

View File

@@ -339,6 +339,7 @@ ToolBar {
function postMessage() {
checkForFancyEffectsReason();
if (ChatBoxHelper.hasAttachment) {
// send attachment but don't reset the text
actionsHandler.postMessage("", ChatBoxHelper.attachmentPath,
@@ -347,8 +348,16 @@ ToolBar {
messageSent();
return;
}
actionsHandler.postMessage(inputField.text.trim(), ChatBoxHelper.attachmentPath,
ChatBoxHelper.replyEventId, ChatBoxHelper.editEventId, userAutocompleted);
const re = /^s\/([^\/]*)\/([^\/]*)/;
if (Config.allowQuickEdit && re.test(inputField.text)) {
// send edited messages
actionsHandler.postEdit(inputField.text);
} else {
// send normal message
actionsHandler.postMessage(inputField.text.trim(), ChatBoxHelper.attachmentPath,
ChatBoxHelper.replyEventId, ChatBoxHelper.editEventId, userAutocompleted);
}
currentRoom.markAllMessagesAsRead();
inputField.clear();
inputField.text = Qt.binding(function() {