fix: race condition on custom styles loading + misc cleanup
All checks were successful
Deploy / Build and Deploy to Production (push) Successful in 22s

Guard watcher-triggered renders in usePreviewRenderer until first
explicit render completes, preventing premature renders with default
styles. Also: disable Contenu tab, update content/blueprints, add
global disabled button styles, minor formatting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
isUnknown 2026-02-24 13:53:55 +01:00
parent 59dfa18ec7
commit f760e1942a
14 changed files with 46 additions and 24 deletions

View file

@ -0,0 +1,8 @@
button[disabled] {
cursor: not-allowed !important;
opacity: 0.6;
}
button[disabled]:hover {
background-color: inherit !important;
}

View file

@ -234,8 +234,8 @@ img {
--space-m: 2rem; --space-m: 2rem;
--space-big: 3em; --space-big: 3em;
--curve: cubic-bezier(0.86, 0, 0.07, 1); --curve: cubic-bezier(0.86, 0, 0.07, 1);
--sans-serif: "DM Sans", sans-serif; --sans-serif: 'DM Sans', sans-serif;
--mono: "Inconsolata", monospace; --mono: 'Inconsolata', monospace;
--input-h: 26px; --input-h: 26px;
--input-w: 160px; --input-w: 160px;
--input-w-small: 45px; --input-w-small: 45px;
@ -688,4 +688,13 @@ input[type=number] {
line-height: 1.5; line-height: 1.5;
resize: none; resize: none;
outline: none; outline: none;
}
button[disabled] {
cursor: not-allowed !important;
opacity: 0.6;
}
button[disabled]:hover {
background-color: inherit !important;
}/*# sourceMappingURL=style.css.map */ }/*# sourceMappingURL=style.css.map */

File diff suppressed because one or more lines are too long

View file

@ -8,3 +8,4 @@
@use "src/_forms-section.scss" as *; @use "src/_forms-section.scss" as *;
@use "src/_buttons.scss" as *; @use "src/_buttons.scss" as *;
@use "src/_settings-popup.scss" as *; @use "src/_settings-popup.scss" as *;
@use "src/_global.scss" as *;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 MiB

After

Width:  |  Height:  |  Size: 2.4 MiB

Before After
Before After

View file

@ -15,9 +15,9 @@ Mapdata:
background: background:
type: osm type: osm
center: center:
lat: 43.82684265866453 lat: 43.484330002696964
lon: 4.3375882121084715 lon: 4.029111008525206
zoom: 11.37799302158894 zoom: 6.503825883663738
---- ----

View file

@ -26,7 +26,6 @@ body {
font-family: "DM Sans", sans-serif; font-family: "DM Sans", sans-serif;
text-align: left; text-align: left;
color: rgb(190, 9, 9); color: rgb(190, 9, 9);
background: blue;
} }
p { p {

View file

@ -35,6 +35,7 @@ columns:
template: template:
- map - map
- geoformat - geoformat
info: "{{ page.intendedTemplate }}"
sidebar: sidebar:
width: 1/3 width: 1/3
sections: sections:

View file

@ -7,17 +7,17 @@ columns:
fields: fields:
type: fields type: fields
fields: fields:
subtitle: subtitle:
label: Sous-titre label: Sous-titre
type: text type: text
width: 1/2 width: 1/2
cover: cover:
label: Image de couverture label: Image de couverture
type: files type: files
multiple: false multiple: false
width: 1/2 width: 1/2
pages: pages:
label: Narratives label: Récits
type: pages type: pages
template: narrative template: narrative
sidebar: sidebar:
@ -26,6 +26,3 @@ columns:
files: files:
label: Fichiers label: Fichiers
type: files type: files

View file

@ -61,10 +61,7 @@ const activeFrame = computed(() => {
const { printPreview } = usePrintPreview(activeFrame); const { printPreview } = usePrintPreview(activeFrame);
// Setup keyboard shortcuts (depends on printPreview) // Setup keyboard shortcuts (depends on printPreview)
const { const { handleKeyboardShortcut, isMac } = useKeyboardShortcuts({
handleKeyboardShortcut,
isMac
} = useKeyboardShortcuts({
stylesheetStore, stylesheetStore,
elementPopup, elementPopup,
// pagePopup, // DISABLED: page template styling feature // pagePopup, // DISABLED: page template styling feature
@ -125,7 +122,11 @@ onMounted(async () => {
/> />
--> -->
<button class="print-btn" @click="printPreview" :title="`Imprimer (${isMac ? '⌘' : 'Ctrl'}+P)`"> <button
class="print-btn"
@click="printPreview"
:title="`Imprimer (${isMac ? '⌘' : 'Ctrl'}+P)`"
>
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24" viewBox="0 0 24 24"

View file

@ -24,7 +24,8 @@
class="tab" class="tab"
:class="{ active: activeTab === 'contenu' }" :class="{ active: activeTab === 'contenu' }"
@click="activeTab = 'contenu'" @click="activeTab = 'contenu'"
title="Ouvrir l'onglet Contenu" title="fonctionnalité à venir"
disabled
> >
Contenu Contenu
</button> </button>
@ -131,11 +132,9 @@ nav {
position: relative; position: relative;
left: calc(var(--panel-w) * -1); left: calc(var(--panel-w) * -1);
background-color: var(--color-panel-bg); background-color: var(--color-panel-bg);
box-shadow: -5px 0px 12px; box-shadow: -5px 0px 12px;
transition: left 0.3s var(--curve); transition: left 0.3s var(--curve);
pointer-events: all; pointer-events: all;
} }
@ -145,7 +144,7 @@ nav {
} }
.tab-panel { .tab-panel {
height: calc(100% - var(--panel-nav-h)*2); height: calc(100% - var(--panel-nav-h) * 2);
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
padding: 0 2em; padding: 0 2em;

View file

@ -16,6 +16,7 @@ export function usePreviewRenderer({
let savedScrollPercentage = 0; let savedScrollPercentage = 0;
const currentFrameIndex = ref(1); // 1 or 2, which iframe is currently visible const currentFrameIndex = ref(1); // 1 or 2, which iframe is currently visible
const isTransitioning = ref(false); const isTransitioning = ref(false);
const initialized = ref(false);
let keyboardShortcutHandler = null; let keyboardShortcutHandler = null;
/** /**
@ -117,6 +118,9 @@ export function usePreviewRenderer({
// Swap current frame // Swap current frame
currentFrameIndex.value = currentFrameIndex.value === 1 ? 2 : 1; currentFrameIndex.value = currentFrameIndex.value === 1 ? 2 : 1;
isTransitioning.value = false; isTransitioning.value = false;
if (!initialized.value) {
initialized.value = true;
}
}, 200); // Match CSS transition duration }, 200); // Match CSS transition duration
}, 50); // Small delay to ensure scroll is set }, 50); // Small delay to ensure scroll is set
}, 200); // Wait for PagedJS }, 200); // Wait for PagedJS
@ -127,6 +131,7 @@ export function usePreviewRenderer({
watch( watch(
() => stylesheetStore.content, () => stylesheetStore.content,
() => { () => {
if (!initialized.value) return;
renderPreview(); renderPreview();
} }
); );
@ -135,6 +140,7 @@ export function usePreviewRenderer({
watch( watch(
() => narrativeStore.data, () => narrativeStore.data,
() => { () => {
if (!initialized.value) return;
if (narrativeStore.data) { if (narrativeStore.data) {
renderPreview(); renderPreview();
} }
@ -152,6 +158,7 @@ export function usePreviewRenderer({
renderPreview, renderPreview,
currentFrameIndex, currentFrameIndex,
isTransitioning, isTransitioning,
initialized,
setKeyboardShortcutHandler, setKeyboardShortcutHandler,
}; };
} }

View file

@ -1 +1 @@
@import '../public/assets/css/style.scss'; /* @import '../public/assets/css/style.scss'; */