diff --git a/imports/NeoChat/Component/ChatTextInput.qml b/imports/NeoChat/Component/ChatTextInput.qml index d92488747..0e7e4cee3 100644 --- a/imports/NeoChat/Component/ChatTextInput.qml +++ b/imports/NeoChat/Component/ChatTextInput.qml @@ -110,8 +110,8 @@ ToolBar { selectByMouse: true readOnly: true wrapMode: Label.Wrap - selectedTextColor: "white" textFormat: Text.RichText + selectedTextColor: "white" } } @@ -133,7 +133,6 @@ ToolBar { keyNavigationWraps: true delegate: Control { - property string autoCompleteText: modelData.displayName ? ("" + modelData.displayName + ":") : modelData.unicode property string displayText: modelData.displayName ?? modelData.unicode property bool isEmoji: modelData.unicode != null readonly property bool highlighted: autoCompleteListView.currentIndex == index @@ -147,7 +146,7 @@ ToolBar { width: Kirigami.Units.gridUnit height: Kirigami.Units.gridUnit visible: isEmoji - text: autoCompleteText + text: displayText font.family: "Emoji" font.pointSize: 20 verticalAlignment: Text.AlignVCenter @@ -177,7 +176,7 @@ ToolBar { anchors.fill: parent onClicked: { autoCompleteListView.currentIndex = index - documentHandler.replaceAutoComplete(autoCompleteText) + documentHandler.replaceAutoComplete(displayText) } } } @@ -255,9 +254,7 @@ ToolBar { Layout.fillWidth: true - wrapMode: Text.Wrap - textFormat: TextEdit.RichText placeholderText: i18n("Write your message...") topPadding: 0 bottomPadding: 0 @@ -298,7 +295,7 @@ ToolBar { Keys.onReturnPressed: { if (isAutoCompleting) { - documentHandler.replaceAutoComplete(autoCompleteListView.currentItem.autoCompleteText) + documentHandler.replaceAutoComplete(autoCompleteListView.currentItem.displayText) isAutoCompleting = false; return; } @@ -353,7 +350,7 @@ ToolBar { autoAppeared = false; } - documentHandler.replaceAutoComplete(autoCompleteListView.currentItem.autoCompleteText) + documentHandler.replaceAutoComplete(autoCompleteListView.currentItem.displayText) } onTextChanged: { @@ -390,7 +387,7 @@ ToolBar { } function postMessage() { - documentHandler.postMessage(attachmentPath, replyEventID); + documentHandler.postMessage(inputField.text, attachmentPath, replyEventID); clearAttachment(); currentRoom.markAllMessagesAsRead(); clear(); diff --git a/src/chatdocumenthandler.cpp b/src/chatdocumenthandler.cpp index eb4128b7d..b9fabf82d 100644 --- a/src/chatdocumenthandler.cpp +++ b/src/chatdocumenthandler.cpp @@ -167,13 +167,13 @@ QVariantMap ChatDocumentHandler::getAutocompletionInfo() }; } -void ChatDocumentHandler::postMessage(const QString &attachementPath, const QString &replyEventId) const +void ChatDocumentHandler::postMessage(const QString &text, const QString &attachementPath, const QString &replyEventId) const { if (!m_room || !m_document) { return; } - QString cleanedText = m_document->textDocument()->toMarkdown(); + QString cleanedText = text; cleanedText = cleanedText.trimmed(); diff --git a/src/chatdocumenthandler.h b/src/chatdocumenthandler.h index 6c1ef431c..5e7c413e6 100644 --- a/src/chatdocumenthandler.h +++ b/src/chatdocumenthandler.h @@ -51,7 +51,7 @@ public: [[nodiscard]] NeoChatRoom *room() const; void setRoom(NeoChatRoom *room); - Q_INVOKABLE void postMessage(const QString &attachementPath, const QString &replyEventId) const; + Q_INVOKABLE void postMessage(const QString &text, const QString &attachementPath, const QString &replyEventId) const; /// This function will look at the current QTextCursor and determine if there /// is the posibility to autocomplete it.