fix: Leerer Bericht-Editor zeigt DIN A4 Hochformat-Platzhalter
All checks were successful
Deploy bericht / deploy (push) Successful in 2s
All checks were successful
Deploy bericht / deploy (push) Successful in 2s
Wenn noch keine Seite geladen ist, wirkte der Editor mit dem winzigen 1x1-Canvas sehr abgebastelt. Jetzt zeigt der Canvas-Wrap im leeren Zustand eine echte A4-Hochformat-Fläche (max 900px, aspect-ratio 1:1.414) mit Hinweistext 'Seite wählen oder Fotos hinzufügen'. - .bericht-canvas-wrap.empty setzt aspect-ratio auf A4 - ::after Pseudo-Element als Hinweistext - init() markiert den Wrap als 'empty' - loadPage() entfernt die Klasse sobald ein Bild geladen wird - min-height 400px damit auch ohne Content Platz da ist Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> [deploy]
This commit is contained in:
parent
d043dfaf46
commit
4dad496788
2 changed files with 41 additions and 3 deletions
|
|
@ -172,12 +172,42 @@
|
||||||
.bericht-canvas-wrap {
|
.bericht-canvas-wrap {
|
||||||
position: relative;
|
position: relative;
|
||||||
background: var(--colorbackvmenu1, #444);
|
background: var(--colorbackvmenu1, #444);
|
||||||
padding: 10px; border-radius: 4px;
|
padding: 20px; border-radius: 4px;
|
||||||
display: flex; align-items: flex-start; justify-content: center;
|
display: flex; align-items: flex-start; justify-content: center;
|
||||||
|
min-height: 400px;
|
||||||
|
}
|
||||||
|
.bericht-canvas-wrap.empty {
|
||||||
|
align-items: center;
|
||||||
|
padding: 40px 20px;
|
||||||
}
|
}
|
||||||
/* WICHTIG: kein max-width auf #pdf-canvas, sonst weicht display- von buffer-size ab
|
/* WICHTIG: kein max-width auf #pdf-canvas, sonst weicht display- von buffer-size ab
|
||||||
und das Fabric-Overlay rutscht weg. Stattdessen rendert JS auf passende Größe. */
|
und das Fabric-Overlay rutscht weg. Stattdessen rendert JS auf passende Größe. */
|
||||||
#pdf-canvas { background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,0.4); display: block; }
|
#pdf-canvas {
|
||||||
|
background: #fff;
|
||||||
|
box-shadow: 0 2px 12px rgba(0,0,0,0.4);
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
/* Leerer Zustand: A4 Hochformat anzeigen, damit der Canvas nicht winzig wirkt */
|
||||||
|
.bericht-canvas-wrap.empty #pdf-canvas {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 900px;
|
||||||
|
aspect-ratio: 1 / 1.414; /* DIN A4 */
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
.bericht-canvas-wrap.empty::after {
|
||||||
|
content: "Seite wählen oder Fotos hinzufügen";
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
color: #aaa;
|
||||||
|
font-size: 16px;
|
||||||
|
pointer-events: none;
|
||||||
|
text-align: center;
|
||||||
|
background: rgba(255,255,255,0.85);
|
||||||
|
padding: 8px 16px;
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
#fabric-canvas.fabric-overlay { position: absolute !important; pointer-events: auto; }
|
#fabric-canvas.fabric-overlay { position: absolute !important; pointer-events: auto; }
|
||||||
|
|
||||||
.bericht-page-note { margin-top: 8px; }
|
.bericht-page-note { margin-top: 8px; }
|
||||||
|
|
|
||||||
10
js/editor.js
10
js/editor.js
|
|
@ -63,6 +63,10 @@
|
||||||
|
|
||||||
/* ---------- Init ---------- */
|
/* ---------- Init ---------- */
|
||||||
function init() {
|
function init() {
|
||||||
|
// Leer-Zustand: Canvas-Wrap als A4-Hochformat-Platzhalter markieren
|
||||||
|
const wrapEmpty = document.querySelector('.bericht-canvas-wrap');
|
||||||
|
if (wrapEmpty) wrapEmpty.classList.add('empty');
|
||||||
|
|
||||||
// Gespeicherte Einstellungen anwenden — VOR Fabric-Init
|
// Gespeicherte Einstellungen anwenden — VOR Fabric-Init
|
||||||
const s = loadSettings();
|
const s = loadSettings();
|
||||||
const colorEl = document.getElementById('tool-color');
|
const colorEl = document.getElementById('tool-color');
|
||||||
|
|
@ -145,7 +149,11 @@
|
||||||
|
|
||||||
currentPageBuffer = buf;
|
currentPageBuffer = buf;
|
||||||
currentPageMime = ct;
|
currentPageMime = ct;
|
||||||
currentPageRotation = 0; // wird gleich aus loadPageMeta überschrieben falls gespeichert
|
currentPageRotation = 0;
|
||||||
|
|
||||||
|
// Empty-Status beenden — Canvas bekommt jetzt echten Inhalt
|
||||||
|
const wrapL = document.querySelector('.bericht-canvas-wrap');
|
||||||
|
if (wrapL) wrapL.classList.remove('empty'); // wird gleich aus loadPageMeta überschrieben falls gespeichert
|
||||||
|
|
||||||
fabricCanvas.clear();
|
fabricCanvas.clear();
|
||||||
document.getElementById('page-note').value = '';
|
document.getElementById('page-note').value = '';
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue