fix: remove format on text

Fixes #1771
This commit is contained in:
Richard Ramos 2021-02-08 08:38:55 -04:00 committed by Iuri Matias
parent 4050a40c8f
commit 21176f702f
2 changed files with 14 additions and 1 deletions

View File

@ -298,10 +298,16 @@ StackLayout {
if (msg.length > 0){
msg = chatInput.interpretMessage(msg)
chatsModel.sendMessage(msg, chatInput.isReply ? SelectedMessage.messageId : "", Utils.isOnlyEmoji(msg) ? Constants.emojiType : Constants.messageType, false);
chatInput.textInput.text = "";
chatInput.textInput.textFormat = TextEdit.PlainText;
if(event) event.accepted = true
chatInput.messageSound.stop()
Qt.callLater(chatInput.messageSound.play);
Qt.callLater(function(){
chatInput.textInput.clear();
chatInput.textInput.textFormat = TextEdit.RichText;
});
}
}

View File

@ -194,6 +194,12 @@ Rectangle {
// we can only get it in the `released` event
if (paste) {
paste = false;
// Remove format
const cursor = messageInputField.cursorPosition;
messageInputField.text = Emoji.parse(chatsModel.plainText(Emoji.deparse(messageInputField.text)));
messageInputField.cursorPosition = cursor;
interrogateMessage();
}
@ -207,6 +213,7 @@ Rectangle {
function interrogateMessage() {
const text = chatsModel.plainText(Emoji.deparse(messageInputField.text));
var words = text.split(' ');
let madeChanges = false