From 7e30a3217ae64aa02ec627e0a6c9cae400214c0f Mon Sep 17 00:00:00 2001 From: mhoennig Date: Thu, 23 Jul 2026 06:09:20 +0200 Subject: [PATCH] frontend: Editor-Panel Copy & Agenda Buttons nur sichtbar wenn Panel offen genug ist MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- frontend/src/app.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/frontend/src/app.js b/frontend/src/app.js index dc2ba7e..3e2d26d 100644 --- a/frontend/src/app.js +++ b/frontend/src/app.js @@ -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 */ +}