Simpify the API for ChatDocumentHandler

Simpify the API for ChatDocumentHandler by taking the text item and grabbing everything else needed from there
This commit is contained in:
James Graham
2025-08-11 19:23:40 +01:00
parent 5f7ff209d3
commit bc82ceeb5f
4 changed files with 80 additions and 187 deletions

View File

@@ -125,13 +125,8 @@ QQC2.Control {
ChatDocumentHandler {
id: documentHandler
type: root.chatBarCache.isEditing ? ChatBarType.Edit : ChatBarType.Thread
document: textArea.textDocument
cursorPosition: textArea.cursorPosition
selectionStart: textArea.selectionStart
selectionEnd: textArea.selectionEnd
textItem: textArea
room: root.Message.room
mentionColor: Kirigami.Theme.linkColor
errorColor: Kirigami.Theme.negativeTextColor
}
TextMetrics {
@@ -264,7 +259,7 @@ QQC2.Control {
documentHandler.document;
if (chatBarCache?.isEditing && chatBarCache.relationMessage.length > 0) {
textArea.text = chatBarCache.relationMessage;
documentHandler.updateMentions(textArea.textDocument, chatBarCache.editId);
documentHandler.updateMentions(chatBarCache.editId);
textArea.forceActiveFocus();
textArea.cursorPosition = textArea.text.length;
}