feat: Add settings for text format

This commit is contained in:
Petr Mironychev
2025-05-01 00:01:44 +02:00
parent 784529e344
commit 4e05abc7d2
8 changed files with 38 additions and 2 deletions

View File

@ -42,6 +42,7 @@ Rectangle {
}
property int textFontSize: Qt.application.font.pointSize
property int codeFontSize: Qt.application.font.pointSize
property int textFormat: 0
property bool isUserMessage: false
property int messageIndex: -1
@ -174,9 +175,19 @@ Rectangle {
height: implicitHeight + 10
verticalAlignment: Text.AlignVCenter
leftPadding: 10
text: utils.getSafeMarkdownText(itemData.text)
text: textFormat == Text.MarkdownText ? utils.getSafeMarkdownText(itemData.text)
: itemData.text
font.family: root.textFontFamily
font.pointSize: root.textFontSize
textFormat: {
if (root.textFormat == 0) {
return Text.MarkdownText
} else if (root.textFormat == 1) {
return Text.RichText
} else {
return Text.PlainText
}
}
ChatUtils {
id: utils

View File

@ -104,6 +104,7 @@ ChatRootView {
codeFontFamily: root.codeFontFamily
codeFontSize: root.codeFontSize
textFontSize: root.textFontSize
textFormat: root.textFormat
onResetChatToMessage: function(index) {
messageInput.text = model.content

View File

@ -25,7 +25,6 @@ TextEdit {
readOnly: true
selectByMouse: true
wrapMode: Text.WordWrap
textFormat: Text.MarkdownText
selectionColor: palette.highlight
color: palette.text
}