diff --git a/Helpers/TextFormatter.js b/Helpers/TextFormatter.js
new file mode 100644
index 00000000..36f0b375
--- /dev/null
+++ b/Helpers/TextFormatter.js
@@ -0,0 +1,34 @@
+.pragma library
+
+/**
+ * Wrap text in a nicely styled HTML container for display
+ * @param {string} text - The text to display
+ * @returns {string} HTML string
+ */
+function wrapTextForDisplay(text) {
+ // Escape HTML special characters
+ const escapeHtml = (s) =>
+ s.replace(/&/g, "&")
+ .replace(//g, ">")
+ .replace(/"/g, """)
+ .replace(/'/g, "'");
+
+ return `
+
+${escapeHtml(text)}
+
+`;
+}
diff --git a/Modules/Panels/Launcher/ClipboardPreview.qml b/Modules/Panels/Launcher/ClipboardPreview.qml
index 3c8e188a..7b9ee16e 100644
--- a/Modules/Panels/Launcher/ClipboardPreview.qml
+++ b/Modules/Panels/Launcher/ClipboardPreview.qml
@@ -4,6 +4,7 @@ import QtQuick.Controls
import qs.Commons
import qs.Widgets
import qs.Services.Keyboard
+import "../../../Helpers/TextFormatter.js" as TextFormatter
Item {
id: previewPanel
@@ -35,7 +36,7 @@ Item {
} else {
loadingFullContent = true;
ClipboardService.decode(currentItem.clipboardId, function(content) {
- fullContent = content;
+ fullContent = TextFormatter.wrapTextForDisplay(content);
loadingFullContent = false;
});
}
@@ -116,6 +117,9 @@ Item {
text: fullContent
readOnly: true
wrapMode: Text.Wrap
+ textFormat: TextArea.RichText // Enable HTML rendering
+ font.pointSize: Style.fontSizeM // Adjust font size for readability
+ color: Color.mOnSurface // Consistent text color
}
}
}