mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-07-06 09:51:14 +02:00
feat: Improve quote format with guillemets and styling
- Changed quote format to: @[Username]: »quoted text« - Added processQuotes() to detect and style »text« patterns - Quote styling: italic, gray background, left border - Different styling for own messages vs others Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -782,7 +782,7 @@ function quoteTo(username, content) {
|
||||
quotedText = truncated + '...';
|
||||
}
|
||||
|
||||
input.value = `@[${username}] "${quotedText}" `;
|
||||
input.value = `@[${username}]: »${quotedText}« `;
|
||||
updateCharCounter();
|
||||
input.focus();
|
||||
}
|
||||
|
||||
@@ -18,7 +18,10 @@ function processMessageContent(content) {
|
||||
// 1. Convert @[Username] mentions to badges
|
||||
processed = processMentions(processed);
|
||||
|
||||
// 2. Convert URLs to links (and images to thumbnails)
|
||||
// 2. Convert »quoted text« to styled quotes
|
||||
processed = processQuotes(processed);
|
||||
|
||||
// 3. Convert URLs to links (and images to thumbnails)
|
||||
processed = processUrls(processed);
|
||||
|
||||
return processed;
|
||||
@@ -40,6 +43,20 @@ function processMentions(text) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert »quoted text« to styled quote blocks
|
||||
* @param {string} text - HTML-escaped text
|
||||
* @returns {string} - Text with styled quotes
|
||||
*/
|
||||
function processQuotes(text) {
|
||||
// Match »...« pattern (guillemets)
|
||||
const quotePattern = /»([^«]+)«/g;
|
||||
|
||||
return text.replace(quotePattern, (_match, quoted) => {
|
||||
return `<span class="quote-text">»${quoted}«</span>`;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert URLs to clickable links and images to thumbnails
|
||||
* @param {string} text - HTML-escaped text
|
||||
|
||||
Reference in New Issue
Block a user