forked from Shinonome/dots-hyprland
ai chat: make messages copyable
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import "root:/modules/common/functions/icons.js" as Icons
|
||||
import "root:/services/"
|
||||
import "root:/modules/common"
|
||||
import "root:/modules/common/widgets"
|
||||
import "root:/modules/common/functions/icons.js" as Icons
|
||||
import Qt5Compat.GraphicalEffects
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
@@ -123,17 +123,30 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
StyledText { // Message
|
||||
TextEdit { // Message
|
||||
id: messageText
|
||||
Layout.fillWidth: true
|
||||
Layout.margins: messagePadding
|
||||
readOnly: true
|
||||
selectByMouse: true
|
||||
|
||||
font.family: Appearance.font.family.reading
|
||||
font.hintingPreference: Font.PreferNoHinting // Prevent weird bold text
|
||||
font.pixelSize: Appearance.font.pixelSize.small
|
||||
wrapMode: Text.WordWrap
|
||||
color: messageData.thinking ? Appearance.colors.colSubtext : Appearance.colors.colOnLayer1
|
||||
textFormat: Text.MarkdownText
|
||||
text: messageData.thinking ? qsTr("Waiting for response...") : root.messageData.content
|
||||
|
||||
Keys.onPressed: (event) => {
|
||||
if (event.key === Qt.Key_Control) { // Prevent de-select
|
||||
event.accepted = true
|
||||
}
|
||||
if ((event.key === Qt.Key_C) && event.modifiers == Qt.ControlModifier) {
|
||||
messageText.copy()
|
||||
event.accepted = true
|
||||
}
|
||||
}
|
||||
|
||||
onLinkActivated: (link) => {
|
||||
Qt.openUrlExternally(link)
|
||||
|
||||
Reference in New Issue
Block a user