refactor(glossaire): disable reading-only controls in glossary #221
@@ -19,6 +19,9 @@ const {
|
||||
|
||||
const lvl = level ?? 1;
|
||||
|
||||
const isGlossaryEdition = String(editionKey ?? "") === "glossaire";
|
||||
const showLevelToggle = !isGlossaryEdition;
|
||||
|
||||
const canonical = Astro.site
|
||||
? new URL(Astro.url.pathname, Astro.site).href
|
||||
: Astro.url.href;
|
||||
@@ -197,6 +200,7 @@ const WHOAMI_FORCE_LOCALHOST = (import.meta.env.PUBLIC_WHOAMI_FORCE_LOCALHOST ??
|
||||
data-doc-title={title}
|
||||
data-doc-version={version}
|
||||
data-reading-level={String(lvl)}
|
||||
data-edition-key={String(editionKey ?? "")}
|
||||
>
|
||||
<header>
|
||||
<SiteNav />
|
||||
@@ -221,7 +225,7 @@ const WHOAMI_FORCE_LOCALHOST = (import.meta.env.PUBLIC_WHOAMI_FORCE_LOCALHOST ??
|
||||
<button class="jump-btn" id="jump-go" type="submit">Aller</button>
|
||||
</form>
|
||||
|
||||
<LevelToggle initialLevel={lvl} />
|
||||
{showLevelToggle && <LevelToggle initialLevel={lvl} />}
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@@ -421,6 +425,11 @@ const WHOAMI_FORCE_LOCALHOST = (import.meta.env.PUBLIC_WHOAMI_FORCE_LOCALHOST ??
|
||||
position: relative;
|
||||
padding-right: 132px;
|
||||
}
|
||||
|
||||
/* Glossaire : pas de rail para-tools */
|
||||
:global(body[data-edition-key="glossaire"] .reading p[id^="p-"]){
|
||||
padding-right: 0;
|
||||
}
|
||||
:global(.para-tools){
|
||||
position: absolute;
|
||||
right: 0;
|
||||
@@ -454,6 +463,10 @@ const WHOAMI_FORCE_LOCALHOST = (import.meta.env.PUBLIC_WHOAMI_FORCE_LOCALHOST ??
|
||||
background: rgba(140,140,255,0.07);
|
||||
border-radius: 12px;
|
||||
}
|
||||
:global(body[data-edition-key="glossaire"] .reading p.is-panel-current){
|
||||
background: transparent;
|
||||
border-radius: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script is:inline>
|
||||
@@ -478,6 +491,8 @@ const WHOAMI_FORCE_LOCALHOST = (import.meta.env.PUBLIC_WHOAMI_FORCE_LOCALHOST ??
|
||||
|
||||
const docTitle = document.body?.dataset?.docTitle || document.title || "Archicratie";
|
||||
const docVersion = document.body?.dataset?.docVersion || "";
|
||||
const docEditionKey = document.body?.dataset?.editionKey || "";
|
||||
const isGlossaryEdition = docEditionKey === "glossaire";
|
||||
|
||||
function px(n){ return `${Math.max(0, Math.round(n))}px`; }
|
||||
function setRootVar(name, value) { document.documentElement.style.setProperty(name, value); }
|
||||
@@ -919,6 +934,8 @@ const WHOAMI_FORCE_LOCALHOST = (import.meta.env.PUBLIC_WHOAMI_FORCE_LOCALHOST ??
|
||||
}
|
||||
|
||||
safe("para-tools", () => {
|
||||
if (isGlossaryEdition) return;
|
||||
|
||||
for (const p of parasAll) {
|
||||
if (p.querySelector(".para-tools")) continue;
|
||||
|
||||
@@ -1033,6 +1050,7 @@ const WHOAMI_FORCE_LOCALHOST = (import.meta.env.PUBLIC_WHOAMI_FORCE_LOCALHOST ??
|
||||
});
|
||||
|
||||
safe("propose-gate", () => {
|
||||
if (isGlossaryEdition) return;
|
||||
if (!giteaReady) return;
|
||||
|
||||
const p = window.__archiIsEditorP || Promise.resolve(false);
|
||||
@@ -1156,11 +1174,13 @@ const WHOAMI_FORCE_LOCALHOST = (import.meta.env.PUBLIC_WHOAMI_FORCE_LOCALHOST ??
|
||||
}
|
||||
|
||||
safe("active-para", () => {
|
||||
if (isGlossaryEdition) return;
|
||||
scheduleActive();
|
||||
window.addEventListener("scroll", scheduleActive, { passive: true });
|
||||
});
|
||||
|
||||
safe("hover-para", () => {
|
||||
if (isGlossaryEdition) return;
|
||||
if (!reading) return;
|
||||
|
||||
let t = 0;
|
||||
@@ -1183,6 +1203,7 @@ const WHOAMI_FORCE_LOCALHOST = (import.meta.env.PUBLIC_WHOAMI_FORCE_LOCALHOST ??
|
||||
|
||||
/* ✅ NOUVEAU : clic paragraphe => snap sous reading-follow + SidePanel aligné */
|
||||
safe("click-para-align", () => {
|
||||
if (isGlossaryEdition) return;
|
||||
if (!reading) return;
|
||||
|
||||
reading.addEventListener("click", (ev) => {
|
||||
|
||||
Reference in New Issue
Block a user