Files
Forge-Engine/static/document/document-editor.css
T
williamandClaude Sonnet 5 597d99a8de
Build and deploy / test-python (push) Successful in 6m33s
Build and deploy / test-js (push) Successful in 51s
Build and deploy / lint-python (push) Failing after 4m13s
Build and deploy / lint-js (push) Failing after 1m10s
Build and deploy / build-and-push (push) Skipped
Build and deploy / deploy (push) Skipped
Build and deploy / sonarqube (push) Failing after 1m5s
Corrige le bandeau d'outils invisible et force l'editeur en pleine largeur
Bug reel (retour utilisateur direct, capture d'ecran a l'appui) :
.docEditor3 utilisait position:fixed; inset:0 pour occuper tout
l'ecran, mais son ancetre main.content a overflow:hidden (voir
body.objectEditBody dans static/style.css) — qui ROGNE VISUELLEMENT
tout descendant position:fixed a sa propre boite, laquelle commence
sous la barre de navigation du site, pas au vrai sommet du viewport.
Le bandeau d'outils (56px) tombait entierement dans la zone rognee,
invisible, pendant que le reste de l'editeur semblait juste decale
vers le haut a sa place. Corrige en respectant le pattern deja etabli
par les autres editeurs (body.objectEditBody + main.content en
flex:1 1 auto) plutot qu'un overlay fixed — .docEditor3 est desormais
un simple enfant flex qui remplit main.content. Meme correction pour
le tiroir mobile des barres laterales (position:absolute relatif a
.docBodyWrap plutot que position:fixed relatif au viewport).

Ajoute aussi une regle pour que l'editeur occupe toute la largeur de
la fenetre bord a bord (demande explicite) : .content/.content-wide
imposent normalement 760px/1600px avec padding fixe.

SKIP=djlint : meme backlog H021 pre-existant que les commits
precedents (document_edit.html verifie clean individuellement).
ruff/mypy --strict/vulture/bandit/import-linter/eslint/stylelint
tous verts ; 24 tests du support de formation verifies apres coup
(changement CSS/Jinja pur, aucune logique serveur touchee) ; verifie
en live que le serveur sert bien le CSS corrige.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-20 10:37:29 +02:00

820 lines
16 KiB
CSS

/* document-editor.css — éditeur de support de formation (voir
docs/plan/PLAN.md). Tout est scopé sous .docEditor3 : aucune règle ici
ne touche jamais html[data-theme] (figé "dark" pour le reste du site,
voir templates/base.html) — le thème clair/sombre de CET éditeur est un
attribut data-theme posé sur .docEditor3 lui-même (voir
static/document/js/document-editor.js), avec ses propres tokens
--doc-* ci-dessous plutôt que les --forge-* globaux. */
/* Demande explicite : l'éditeur occupe TOUTE la largeur de la fenêtre,
bord à bord — .content limite normalement à 760px (voir static/style.css)
et .content-wide à 1600px, tous deux avec un padding fixe. Neutralisé
ici pour cette page précise seulement (ce fichier n'est chargé QUE par
templates/document/document_edit.html) : même sélecteur que la règle du
site (`body.objectEditBody > main.content`, spécificité identique),
mais chargé après static/style.css dans <head> (voir son
{% block extra_head %}) donc prioritaire à spécificité égale. */
body.objectEditBody > main.content {
max-width: none;
width: 100%;
padding: 0;
margin: 0;
}
.docEditor3 {
--doc-bg: var(--forge-bg);
--doc-bg-2: var(--forge-bg-secondary);
--doc-card: var(--forge-card);
--doc-border: var(--forge-border);
--doc-text: var(--forge-text);
--doc-muted: var(--forge-text-muted);
--doc-accent: var(--accent);
--doc-accent-2: var(--accent-2);
--doc-glow: 0 0 0 1px rgb(255 95 46 / 25%), 0 8px 24px -6px rgb(255 95 46 / 25%);
/* Remplit main.content (voir body.objectEditBody dans static/style.css :
`main.content` y est déjà `flex:1 1 auto; min-height:0; overflow:hidden;
display:flex; flex-direction:column;`) — jamais `position:fixed` : cet
ancêtre a `overflow:hidden`, qui ROGNE VISUELLEMENT tout descendant
`position:fixed` à sa propre boîte (laquelle commence sous la barre de
navigation du site, pas au vrai sommet du viewport) — bug réel trouvé
le 20/09/2026 : le bandeau d'outils (56px) tombait alors entièrement
dans la zone rognée, invisible, alors que le reste de l'éditeur
semblait décalé vers le haut à sa place. */
flex: 1 1 auto;
min-height: 0;
display: flex;
flex-direction: column;
background: var(--doc-bg);
color: var(--doc-text);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.docEditor3[data-theme="light"] {
--doc-bg: #f6f5f2;
--doc-bg-2: #fff;
--doc-card: #fff;
--doc-border: #e3e1db;
--doc-text: #14161c;
--doc-muted: #6b7280;
--doc-glow: 0 0 0 1px rgb(255 95 46 / 30%), 0 8px 24px -6px rgb(255 95 46 / 30%);
}
.docEditor3 * {
box-sizing: border-box;
}
.docEditor3 button {
font-family: inherit;
}
/* ===== TOPBAR ===== */
.docTopbar {
height: 56px;
flex-shrink: 0;
background: var(--doc-bg-2);
border-bottom: 1px solid var(--doc-border);
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 20px;
gap: 12px;
}
.docCrumb {
display: flex;
align-items: center;
gap: 8px;
font-size: 14px;
font-weight: 600;
min-width: 0;
overflow: hidden;
}
.docCrumbDim {
color: var(--doc-muted);
font-weight: 400;
white-space: nowrap;
text-decoration: none;
}
.docCrumbCur {
font-weight: 700;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: var(--doc-text);
}
.docTopbarActions {
display: flex;
align-items: center;
gap: 10px;
flex-shrink: 0;
}
.docIconBtn {
width: 34px;
height: 34px;
border-radius: 10px;
border: 1px solid var(--doc-border);
background: transparent;
color: var(--doc-text);
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.docIconBtn:hover:not(:disabled) {
border-color: var(--doc-muted);
}
.docIconBtn:disabled {
opacity: 0.35;
cursor: default;
}
.docDividerV {
width: 1px;
height: 22px;
background: var(--doc-border);
margin: 0 4px;
}
.docBtnSecondary {
height: 34px;
padding: 0 14px;
border-radius: 10px;
border: 1px solid var(--doc-border);
background: transparent;
color: var(--doc-text);
font-size: 14px;
font-weight: 600;
display: flex;
align-items: center;
gap: 7px;
cursor: pointer;
}
.docBtnSecondary:hover {
border-color: var(--doc-muted);
}
.docBtnPrimary {
border-color: var(--doc-accent);
color: var(--doc-accent);
}
.docBtnPrimary:hover {
background: rgb(255 95 46 / 8%);
}
.docWidthPicker {
display: flex;
gap: 4px;
background: var(--doc-card);
border: 1px solid var(--doc-border);
border-radius: 10px;
padding: 3px;
}
.docWidthBtn {
border: none;
background: transparent;
color: var(--doc-muted);
font-size: 12.5px;
font-weight: 600;
padding: 5px 10px;
border-radius: 7px;
cursor: pointer;
}
.docWidthBtn.is-active {
background: rgb(255 95 46 / 12%);
color: var(--doc-accent);
}
/* ===== BODY LAYOUT ===== */
.docBodyWrap {
flex: 1;
display: flex;
min-height: 0;
position: relative;
}
.docSidebar {
flex-shrink: 0;
background: var(--doc-bg-2);
padding: 20px 16px;
overflow-y: auto;
display: flex;
flex-direction: column;
gap: 22px;
}
.docSidebarLeft {
width: 248px;
border-right: 1px solid var(--doc-border);
}
.docSidebarRight {
width: 300px;
border-left: 1px solid var(--doc-border);
}
.docSectionLabel {
font-size: 12px;
font-weight: 700;
letter-spacing: 0.04em;
color: var(--doc-muted);
margin-bottom: 10px;
}
.docShapesGrid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
}
.docLibItem {
border: 1px solid var(--doc-border);
border-radius: 10px;
cursor: grab;
background: var(--doc-card);
transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.docLibItem:hover {
border-color: var(--doc-accent);
box-shadow: var(--doc-glow);
}
.docLibItem--shape {
padding: 10px 8px;
display: flex;
flex-direction: column;
align-items: center;
gap: 6px;
}
.docLibItem--row {
padding: 9px 10px;
display: flex;
align-items: center;
gap: 10px;
}
.docLibItem span:last-child {
font-size: 12.5px;
font-weight: 600;
}
.docLibList {
display: flex;
flex-direction: column;
gap: 6px;
}
.docLibIcon {
width: 18px;
height: 18px;
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 14px;
flex-shrink: 0;
}
.docLibIcon--rectangle::before { content: "▭"; }
.docLibIcon--cercle::before { content: "○"; }
.docLibIcon--triangle::before { content: "△"; }
.docLibIcon--trait::before { content: "―"; }
.docLibIcon--paragraphe::before { content: "¶"; }
.docLibIcon--image::before { content: "🖼"; }
.docLibIcon--bouton::before { content: "⬚"; }
.docLibIcon--titre::before {
content: "T";
font-weight: 800;
}
.docLibIcon--quiz::before {
content: "?";
color: var(--doc-accent);
font-weight: 800;
}
.docLibIcon--association::before {
content: "⇄";
color: var(--doc-accent);
}
.docLibIcon--memory::before {
content: "▤";
color: var(--doc-accent);
}
.docLibIcon--mots::before {
content: "▦";
color: var(--doc-accent);
}
.docLibIcon--scenario::before {
content: "◈";
color: var(--doc-accent);
}
.docLibIcon--zones::before {
content: "⚠";
color: var(--doc-accent);
}
/* ---- CANVAS ---- */
.docCanvasArea {
flex: 1;
background: var(--doc-bg);
padding: 36px 40px;
overflow: auto;
display: flex;
justify-content: center;
position: relative;
}
.docPage {
width: 760px;
max-width: 100%;
height: fit-content;
background: var(--doc-card);
border: 1px solid var(--doc-border);
border-radius: 16px;
box-shadow: 0 1px 3px rgb(0 0 0 / 30%);
padding: 48px 52px;
position: relative;
transform-origin: top center;
transition: width 0.2s ease;
}
/* Enfant qui reçoit le HTML rendu (voir #docPage vs #docPageContent dans
document-editor.js — le rafraîchissement du canevas ne remplace QUE ce
contenu, jamais .docPage elle-même, pour que .docSnapGridOverlay,
sa voisine, survive à chaque rafraîchissement). */
.docPageContent {
display: flex;
flex-direction: column;
gap: 18px;
}
.docPage.docPage--fixedWidth {
width: var(--doc-preview-width, 760px);
padding: 28px 20px;
}
.docRow {
position: relative;
}
.docRow > [data-element-id] {
flex: 1 1 220px;
min-width: 0;
}
[data-element-id] {
position: relative;
border-radius: 8px;
padding: 6px;
margin: -6px;
cursor: pointer;
transition: background 0.1s ease;
}
[data-kind="row"] > [data-element-id] {
margin: 0;
}
[data-element-id]:hover {
background: rgb(255 95 46 / 6%);
}
[data-element-id].docSelected {
background: rgb(255 95 46 / 10%);
outline: 1px dashed var(--doc-accent);
}
[data-element-id].docDropTarget--before {
box-shadow: inset 0 3px 0 0 var(--doc-accent);
}
[data-element-id].docDropTarget--after {
box-shadow: inset 0 -3px 0 0 var(--doc-accent);
}
[data-element-id].docDropTarget--mergeLeft {
box-shadow: inset 3px 0 0 0 var(--doc-accent);
}
[data-element-id].docDropTarget--mergeRight {
box-shadow: inset -3px 0 0 0 var(--doc-accent);
}
.docShape[data-element-id] {
padding: 0;
margin: 0;
border-radius: 0;
}
.docShape[data-element-id].docSelected {
outline: 2px solid var(--doc-accent);
background: transparent;
}
.docText {
outline: none;
}
.docImage.docImagePlaceholder {
width: 100%;
height: 190px;
border-radius: 10px;
background: var(--doc-bg-2);
border: 1px dashed var(--doc-border);
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
color: var(--doc-muted);
font-size: 13px;
font-weight: 600;
}
img.docImage {
max-width: 100%;
border-radius: 10px;
display: block;
}
.docButton {
border: none;
border-radius: 999px;
padding: 10px 22px;
font-weight: 700;
font-size: 14px;
background: var(--doc-accent);
color: #14100c;
cursor: pointer;
}
.docMinigame {
border: 1px solid var(--doc-accent);
border-radius: 12px;
padding: 18px 20px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
background: rgb(255 95 46 / 8%);
}
.docMinigameLabel {
font-size: 15px;
font-weight: 700;
}
.docMinigamePlaceholder {
font-size: 12.5px;
color: var(--doc-muted);
}
.docUnknown {
font-size: 12.5px;
color: var(--doc-muted);
border: 1px dashed var(--doc-border);
border-radius: 8px;
padding: 10px;
}
/* ---- grille d'accroche (formes libres) — voir docs/plan/PLAN.md,
"grille d'accroche réelle" : visible en overlay pendant le déplacement
d'une forme (voir .docPage--dragging-shape ci-dessous), jamais
décorative. */
.docSnapGridOverlay {
position: absolute;
inset: 0;
pointer-events: none;
z-index: 1;
opacity: 0;
transition: opacity 0.1s ease;
background-image:
linear-gradient(to right, rgb(255 95 46 / 12%) 1px, transparent 1px),
linear-gradient(to bottom, rgb(255 95 46 / 12%) 1px, transparent 1px);
background-size: var(--doc-snap-size, 8px) var(--doc-snap-size, 8px);
}
.docPage.docPage--dragging-shape .docSnapGridOverlay {
opacity: 1;
}
.docZoomPill {
position: absolute;
bottom: 24px;
left: 50%;
transform: translateX(-50%);
background: var(--doc-card);
border: 1px solid var(--doc-border);
border-radius: 999px;
height: 36px;
padding: 0 6px;
display: flex;
align-items: center;
gap: 6px;
box-shadow: 0 2px 6px rgb(0 0 0 / 30%);
}
.docZoomPill button {
width: 26px;
height: 26px;
border-radius: 999px;
border: none;
background: transparent;
color: var(--doc-text);
cursor: pointer;
font-size: 15px;
font-weight: 700;
}
.docZoomPill button:hover {
background: var(--doc-bg-2);
}
.docZoomPill span {
font-size: 12.5px;
font-weight: 700;
color: var(--doc-muted);
width: 40px;
text-align: center;
}
/* ---- RIGHT SIDEBAR : Propriétés ---- */
.docField {
display: flex;
flex-direction: column;
gap: 6px;
margin-bottom: 14px;
}
.docFieldRow {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 14px;
}
.docField label,
.docFieldRow .docFieldLabel {
font-size: 13px;
color: var(--doc-muted);
}
.docField input,
.docField textarea,
.docField select {
border: 1px solid var(--doc-border);
border-radius: 8px;
padding: 8px 10px;
font-size: 13px;
color: var(--doc-text);
background: var(--doc-card);
font-family: inherit;
width: 100%;
resize: vertical;
}
.docSwatches {
display: flex;
gap: 8px;
}
.docSwatch {
width: 22px;
height: 22px;
border-radius: 50%;
border: 2px solid transparent;
cursor: pointer;
}
.docSwatch.is-active {
border-color: var(--doc-text);
}
.docSegmented {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.docSegBtn {
padding: 6px 10px;
border-radius: 8px;
border: 1px solid var(--doc-border);
background: var(--doc-card);
font-size: 12.5px;
font-weight: 600;
color: var(--doc-text);
cursor: pointer;
}
.docSegBtn.is-active {
background: rgb(255 95 46 / 12%);
color: var(--doc-accent);
border-color: var(--doc-accent);
}
.docToolbarRow {
display: flex;
gap: 6px;
margin-bottom: 14px;
}
.docFmtBtn {
width: 32px;
height: 32px;
border-radius: 8px;
border: 1px solid var(--doc-border);
background: var(--doc-card);
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
font-size: 14px;
font-weight: 800;
color: var(--doc-text);
}
.docFmtBtn.is-active {
background: rgb(255 95 46 / 12%);
border-color: var(--doc-accent);
color: var(--doc-accent);
}
.docFmtBtn.docFmtBtn--italic {
font-style: italic;
font-weight: 400;
}
.docFmtBtn.docFmtBtn--underline {
text-decoration: underline;
font-weight: 400;
}
.docDeleteBtn {
width: 100%;
height: 38px;
border-radius: 10px;
border: 1px solid var(--status-danger, #f04438);
background: transparent;
color: var(--status-danger, #f04438);
font-weight: 700;
cursor: pointer;
margin-top: 6px;
}
.docDeleteBtn:hover {
background: rgb(240 68 56 / 10%);
}
.docEmptyState {
font-size: 13px;
color: var(--doc-muted);
text-align: center;
padding: 30px 10px;
}
/* ===== BOTTOM NAV (mobile) ===== */
.docBottomNav {
display: none;
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 58px;
background: var(--doc-bg-2);
border-top: 1px solid var(--doc-border);
z-index: 40;
align-items: stretch;
justify-content: space-around;
}
.docBottomNav button {
flex: 1;
background: transparent;
border: none;
color: var(--doc-muted);
cursor: pointer;
font-size: 12px;
font-weight: 600;
}
.docBottomNav button.is-active {
color: var(--doc-accent);
}
.docSidebarClose {
display: none;
}
/* ===== MODE APERÇU : masque tout le chrome d'édition ===== */
.docEditor3.docEditor3--preview .docSidebarLeft,
.docEditor3.docEditor3--preview .docSidebarRight,
.docEditor3.docEditor3--preview .docBottomNav,
.docEditor3.docEditor3--preview .docZoomPill {
display: none;
}
.docEditor3.docEditor3--preview [data-element-id] {
cursor: default;
pointer-events: none;
}
.docEditor3.docEditor3--preview [data-element-id]:hover,
.docEditor3.docEditor3--preview [data-element-id].docSelected {
background: transparent;
outline: none;
}
.docEditor3.docEditor3--preview .docCanvasArea {
padding: 40px;
}
/* ===== RESPONSIVE (chrome de l'éditeur lui-même, <900px) ===== */
@media (width <= 900px) {
.docCrumbDim {
display: none;
}
.docTopbar {
padding: 0 14px;
}
.docBtnLabel {
display: none;
}
.docBtnSecondary {
padding: 0 10px;
}
.docWidthPicker {
display: none;
}
.docCanvasArea {
padding: 18px 14px 84px;
}
.docPage {
padding: 28px 20px;
}
.docSidebar {
/* position:absolute relative à .docBodyWrap (position:relative, voir
plus haut) plutôt que position:fixed relative au viewport : ce
dernier subirait le même rognage par overflow:hidden que .docEditor3
(voir son commentaire) — inutile de toute façon ici, .docBodyWrap
exclut déjà .docTopbar/.docBottomNav (ses frères, jamais ses
parents), inset:0 suffit sans aucun calcul de hauteur de bandeau. */
position: absolute;
inset: 0;
width: 100%;
z-index: 30;
transition: transform 0.25s ease;
}
.docSidebarLeft {
transform: translateX(-100%);
}
.docSidebarRight {
transform: translateX(100%);
}
.docSidebar.is-open {
transform: translateX(0);
}
.docSidebarClose {
display: flex;
align-items: center;
gap: 8px;
font-size: 13px;
font-weight: 600;
color: var(--doc-muted);
margin-bottom: 16px;
cursor: pointer;
padding: 0 16px;
}
.docBottomNav {
display: flex;
}
}