refactor(frontend): Duplikate in JS eliminieren – Runde 2
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
This commit is contained in:
1 parent
b56b83ad1e
commit
1a2c407538
11 files changed
+177
-387
No files matched your search
@@ -68,6 +68,27 @@ function removeToast(toast) {
|
||||
toast.addEventListener('transitionend', function() { toast.remove(); });
|
||||
}
|
||||
|
||||
// ── EasyMDE Helper ──
|
||||
|
||||
function createMDE(element, options) {
|
||||
options = options || {};
|
||||
const mde = new EasyMDE({
|
||||
element: element,
|
||||
initialValue: options.initialValue || '',
|
||||
toolbar: options.toolbar || ['bold', 'italic', 'heading', '|', 'unordered-list', 'ordered-list', '|', 'link', 'code', '|', 'preview'],
|
||||
status: false,
|
||||
spellChecker: false,
|
||||
autoDownloadFontAwesome: false,
|
||||
autofocus: options.autofocus || false,
|
||||
minHeight: options.minHeight || '120px',
|
||||
placeholder: options.placeholder || '',
|
||||
previewClass: ['editor-preview', 'markdown']
|
||||
});
|
||||
mde.codemirror.setOption('theme', 'default');
|
||||
mde.codemirror.getWrapperElement().closest('.EasyMDEContainer').classList.add('fe-mde-wrap');
|
||||
return mde;
|
||||
}
|
||||
|
||||
// ── Meta Bar ──
|
||||
|
||||
function setMeta(text) {
|
||||
|
||||
Reference in new issue
Block a user