mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-06-05 03:30:03 +00:00
feat(launcher): Integrate TextFormatter for enhanced preview UI
This commit is contained in:
@@ -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, """)
|
||||
.replace(/'/g, "'");
|
||||
|
||||
return `
|
||||
<div style="
|
||||
font-family: 'Fira Code', 'Courier New', monospace;
|
||||
white-space: pre-wrap;
|
||||
background: linear-gradient(135deg, #2c3e50, #34495e);
|
||||
color: #ecf0f1;
|
||||
padding: 16px;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.3);
|
||||
overflow-x: auto;
|
||||
line-height: 1.5;
|
||||
font-size: 14px;
|
||||
border: 1px solid #3d566e;
|
||||
">
|
||||
${escapeHtml(text)}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
Reference in New Issue
Block a user