@delmaredigital/payload-puck 0.6.20 → 0.6.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/editor/PuckEditorImpl.client.js +11 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -74,7 +74,17 @@ import { useAiPrompts } from '../ai/hooks/useAiPrompts.js';
|
|
|
74
74
|
// Preview modal state
|
|
75
75
|
const [isPreviewOpen, setIsPreviewOpen] = useState(false);
|
|
76
76
|
// Preview dark mode state (for toggling dark/light in preview iframe)
|
|
77
|
-
|
|
77
|
+
// If not explicitly set, derive from the active layout's editorDarkMode setting
|
|
78
|
+
const initialDarkMode = useMemo(()=>{
|
|
79
|
+
if (initialPreviewDarkMode) return true;
|
|
80
|
+
if (!layouts || layouts.length === 0) return false;
|
|
81
|
+
// Check the initial data's pageLayout to find the active layout
|
|
82
|
+
const pageLayout = initialData?.root?.props?.[layoutKey];
|
|
83
|
+
const activeLayout = layouts.find((l)=>l.value === pageLayout) ?? layouts[0];
|
|
84
|
+
return activeLayout?.editorDarkMode ?? false;
|
|
85
|
+
}, []) // eslint-disable-line react-hooks/exhaustive-deps -- only compute once on mount
|
|
86
|
+
;
|
|
87
|
+
const [previewDarkMode, setPreviewDarkMode] = useState(initialDarkMode);
|
|
78
88
|
// Inject slug into initial data if not present
|
|
79
89
|
const dataWithSlug = useMemo(()=>{
|
|
80
90
|
const data = initialData;
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.6.
|
|
1
|
+
export declare const VERSION = "0.6.21";
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Auto-generated by scripts/generate-version.js - do not edit manually
|
|
2
|
-
export const VERSION = '0.6.
|
|
2
|
+
export const VERSION = '0.6.21';
|