@delmaredigital/payload-puck 0.6.21 → 0.6.22
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/admin/PuckEditorView.js +16 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useState } from 'react';
|
|
4
4
|
import { useParams, useSearchParams } from 'next/navigation';
|
|
5
|
+
import { mapPayloadFieldsToRootProps } from '../api/utils/mapRootProps.js';
|
|
5
6
|
/**
|
|
6
7
|
* Ready-to-use Puck editor page component
|
|
7
8
|
*
|
|
@@ -190,7 +191,7 @@ import { useParams, useSearchParams } from 'next/navigation';
|
|
|
190
191
|
});
|
|
191
192
|
}
|
|
192
193
|
// Default puck data if none exists
|
|
193
|
-
const
|
|
194
|
+
const basePuckData = page.puckData || {
|
|
194
195
|
root: {
|
|
195
196
|
props: {
|
|
196
197
|
title: page.title || 'New Page'
|
|
@@ -199,6 +200,20 @@ import { useParams, useSearchParams } from 'next/navigation';
|
|
|
199
200
|
content: [],
|
|
200
201
|
zones: {}
|
|
201
202
|
};
|
|
203
|
+
// Hydrate root.props from Payload fields — ensures saved values like pageLayout,
|
|
204
|
+
// isHomepage, conversion settings etc. are reflected in the editor UI even if
|
|
205
|
+
// they weren't stored in puckData (Puck may strip props that match defaults)
|
|
206
|
+
const payloadRootProps = mapPayloadFieldsToRootProps(page);
|
|
207
|
+
const initialData = {
|
|
208
|
+
...basePuckData,
|
|
209
|
+
root: {
|
|
210
|
+
...basePuckData.root,
|
|
211
|
+
props: {
|
|
212
|
+
...basePuckData.root?.props,
|
|
213
|
+
...payloadRootProps
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
};
|
|
202
217
|
return /*#__PURE__*/ _jsx(PuckEditor, {
|
|
203
218
|
pageId: page.id,
|
|
204
219
|
initialData: initialData,
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.6.
|
|
1
|
+
export declare const VERSION = "0.6.22";
|
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.22';
|