frontend: Editor-Panel Copy & Agenda Buttons nur sichtbar wenn Panel offen genug ist
- ResizeObserver überwacht .editor-body Höhe - Copy und Agenda Buttons werden versteckt wenn Body-Höhe < Head-Höhe - Schwellwert: Buttons nur sichtbar wenn mindestens Titelzeilenhöhe Inhalt vorhanden ist Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Haiku 4.5
parent
a4ea1f760a
commit
7e30a3217a
@@ -1168,3 +1168,25 @@ function mountBuildBadge(){
|
||||
h1.appendChild(el);
|
||||
}
|
||||
mountBuildBadge();
|
||||
|
||||
/* ---------- Editor-Panel: Copy & Agenda Buttons nur sichtbar wenn Panel offen genug ---------- */
|
||||
const editorPanel = document.querySelector('.panel.editor');
|
||||
const editorHead = editorPanel?.querySelector('.panel-head');
|
||||
const editorBody = editorPanel?.querySelector('.editor-body');
|
||||
const copyBtn = document.getElementById('copy');
|
||||
const legendBtn = document.getElementById('legendBtn');
|
||||
|
||||
if(editorBody && editorHead && copyBtn && legendBtn){
|
||||
const updateButtonVisibility = () => {
|
||||
const headHeight = editorHead.offsetHeight;
|
||||
const bodyHeight = editorBody.offsetHeight;
|
||||
/* Buttons nur sichtbar wenn mindestens Titelzeilenhöhe sichtbar ist */
|
||||
const shouldShow = bodyHeight >= headHeight;
|
||||
copyBtn.style.display = shouldShow ? 'block' : 'none';
|
||||
legendBtn.style.display = shouldShow ? 'block' : 'none';
|
||||
};
|
||||
|
||||
const resizeObserver = new ResizeObserver(updateButtonVisibility);
|
||||
resizeObserver.observe(editorBody);
|
||||
updateButtonVisibility(); /* Initial call */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user