fix scroll height and prose line breaks in rich output
- Loader delegate: set explicit height from item.implicitHeight so ListView can calculate correct contentHeight for scrolling - Prose sub-blocks: escape HTML, convert newlines to <br> before linkifying paths (RichText ignores bare newlines)
This commit is contained in:
parent
9e10bf30db
commit
0783c7dda3
|
|
@ -393,6 +393,7 @@ ApplicationWindow {
|
|||
|
||||
delegate: Loader {
|
||||
width: chatList.width
|
||||
height: item ? item.implicitHeight : 0
|
||||
property var block: model
|
||||
sourceComponent: {
|
||||
switch (blockType) {
|
||||
|
|
@ -499,8 +500,13 @@ ApplicationWindow {
|
|||
// --- Chat block delegates ---
|
||||
|
||||
function linkifyPaths(text) {
|
||||
// Escape HTML entities first
|
||||
let escaped = text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>')
|
||||
// Convert newlines to <br>
|
||||
escaped = escaped.replace(/\n/g, '<br>')
|
||||
// Match /absolute/path or /absolute/path:line
|
||||
return text.replace(/(\/[\w\-.\/]+(?::\d+)?)/g, '<a href="file://$1">$1</a>')
|
||||
escaped = escaped.replace(/(\/[\w\-.\/]+(?::\d+)?)/g, '<a href="file://$1">$1</a>')
|
||||
return escaped
|
||||
}
|
||||
|
||||
Component {
|
||||
|
|
|
|||
Reference in New Issue