Neue Helper-Funktionen: - _openCardMenu(trigger, dropdown): Card-Menü-Positionierung (4x in dashboard.js dedupliziert) - _createModal(title, extraClasses): Modal-Boilerplate (3 Modals in modals.js dedupliziert) - _openPickerModal(title, items, currentId, onSelect, opts): Picker-Modal (Agent + Session zusammengeführt) - createMDE(element, opts): EasyMDE-Initialisierung (3x in agent/session/profile-page dedupliziert) Weitere Bereinigungen: - _formatReplyTimestamp() entfernt, durch _formatTimestamp() ersetzt (reply.js + chat.js) - showFormMessage/showPageMessage in admin-page.js durch showToast() ersetzt - Inline-Nachrichten (profileMessage, profilePasswordMessage, adminMessage, adminFormMessage) durch Toast-Notifications ersetzt, zugehörige HTML-Elemente entfernt - profile-page.js: messageDiv/passwordMessageDiv-Logik durch showToast() ersetzt 11 Dateien, -210 Zeilen netto
38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
// ── Reply / Quote ──
|
|
|
|
let pendingReply = null; // { index, role, text } - Zitierte Nachricht
|
|
|
|
function setReply(reply) {
|
|
pendingReply = reply;
|
|
renderReplyPreview();
|
|
document.getElementById('input')?.focus();
|
|
}
|
|
|
|
function clearReply() {
|
|
pendingReply = null;
|
|
renderReplyPreview();
|
|
}
|
|
|
|
function renderReplyPreview() {
|
|
const container = $('#replyPreview');
|
|
if (!container) return;
|
|
|
|
if (!pendingReply) {
|
|
container.innerHTML = '';
|
|
container.hidden = true;
|
|
return;
|
|
}
|
|
|
|
const roleLabel = pendingReply.role === 'user' ? 'User' : 'Assistant';
|
|
const timeLabel = _formatTimestamp(pendingReply.timestamp) || 'Jetzt';
|
|
const preview = truncate(pendingReply.text, 150);
|
|
|
|
container.innerHTML = `<div class="reply-preview-item">
|
|
<span class="reply-icon"><i class="fa fa-reply"></i></span>
|
|
<span class="reply-meta">${esc(timeLabel)}, ${esc(roleLabel)}</span>
|
|
<span class="reply-text">${esc(preview)}</span>
|
|
<button class="file-remove" onclick="clearReply()"><i class="fa fa-times"></i></button>
|
|
</div>`;
|
|
container.hidden = false;
|
|
}
|