mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-09-04 01:54:49 +00:00
Improved markdown support:
* Correctly displays inline code blocks with syntax highlighting turned on as well as markdown at the same time * Adds a context menu item for toggling markdown on and off which also which essentially turns on/off all text processing * Uses QTextDocument::MarkdownNoHTML to handle markdown in QTextDocument which allows display of html tags like normal, but unfortunately does not allow display of markdown tables as markdown Signed-off-by: Adam Treat <treat.adam@gmail.com>
This commit is contained in:
@@ -824,7 +824,7 @@ Rectangle {
|
||||
id: tapHandler
|
||||
onTapped: function(eventPoint, button) {
|
||||
var clickedPos = myTextArea.positionAt(eventPoint.position.x, eventPoint.position.y);
|
||||
var success = responseText.tryCopyAtPosition(clickedPos);
|
||||
var success = textProcessor.tryCopyAtPosition(clickedPos);
|
||||
if (success)
|
||||
copyCodeMessage.open();
|
||||
}
|
||||
@@ -862,16 +862,24 @@ Rectangle {
|
||||
myTextArea.deselect()
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
text: textProcessor.shouldProcessText ? qsTr("Disable markdown") : qsTr("Enable markdown")
|
||||
height: enabled ? implicitHeight : 0
|
||||
onTriggered: {
|
||||
textProcessor.shouldProcessText = !textProcessor.shouldProcessText;
|
||||
myTextArea.text = value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ResponseText {
|
||||
id: responseText
|
||||
ChatViewTextProcessor {
|
||||
id: textProcessor
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
responseText.setLinkColor(theme.linkColor);
|
||||
responseText.setHeaderColor(name === qsTr("Response: ") ? theme.darkContrast : theme.lightContrast);
|
||||
responseText.textDocument = textDocument
|
||||
textProcessor.setLinkColor(theme.linkColor);
|
||||
textProcessor.setHeaderColor(name === qsTr("Response: ") ? theme.darkContrast : theme.lightContrast);
|
||||
textProcessor.textDocument = textDocument
|
||||
}
|
||||
|
||||
Accessible.role: Accessible.Paragraph
|
||||
|
Reference in New Issue
Block a user