@contentful/experiences-visual-editor-react 3.4.1-dev-20250901T1444-62c96a8.0 → 3.5.0-dev-20250902T1514-0e19e78.0
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/index.js +29 -13
- package/dist/index.js.map +1 -1
- package/dist/renderApp.js +29 -13
- package/dist/renderApp.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -763,6 +763,7 @@ const BreakpointSchema$1 = z
|
|
|
763
763
|
const BaseComponentTreeNodeSchema$1 = z.object({
|
|
764
764
|
id: ComponentTreeNodeIdSchema$1.optional(),
|
|
765
765
|
definitionId: DefinitionPropertyKeySchema$1,
|
|
766
|
+
prebindingId: z.string().optional(),
|
|
766
767
|
displayName: z.string().optional(),
|
|
767
768
|
slotId: z.string().optional(),
|
|
768
769
|
variables: z.record(propertyKeySchema$1, ComponentPropertyValueSchema$1),
|
|
@@ -3577,6 +3578,7 @@ const BreakpointSchema = z
|
|
|
3577
3578
|
const BaseComponentTreeNodeSchema = z.object({
|
|
3578
3579
|
id: ComponentTreeNodeIdSchema.optional(),
|
|
3579
3580
|
definitionId: DefinitionPropertyKeySchema,
|
|
3581
|
+
prebindingId: z.string().optional(),
|
|
3580
3582
|
displayName: z.string().optional(),
|
|
3581
3583
|
slotId: z.string().optional(),
|
|
3582
3584
|
variables: z.record(propertyKeySchema, ComponentPropertyValueSchema),
|
|
@@ -4915,6 +4917,31 @@ const useComponentProps = ({ node, entityStore, areEntitiesFetched, resolveDesig
|
|
|
4915
4917
|
styles: componentStyles,
|
|
4916
4918
|
nodeId: node.data.id,
|
|
4917
4919
|
});
|
|
4920
|
+
// Allows custom components to render differently in the editor. This needs to be activated
|
|
4921
|
+
// through registry options as the component has to be aware of this prop to not cause any React warnings.
|
|
4922
|
+
const editorProps = useMemo(() => {
|
|
4923
|
+
const editorProps = {};
|
|
4924
|
+
if (options?.enableEditorProperties?.isEditorMode) {
|
|
4925
|
+
editorProps.isEditorMode = true;
|
|
4926
|
+
}
|
|
4927
|
+
if (options?.enableEditorProperties?.isEmpty) {
|
|
4928
|
+
editorProps.isEmpty = node.children.length === 0;
|
|
4929
|
+
}
|
|
4930
|
+
if (options?.enableEditorProperties?.nodeBlockId) {
|
|
4931
|
+
editorProps.nodeBlockId = node.data.blockId;
|
|
4932
|
+
}
|
|
4933
|
+
if (options?.enableCustomEditorView) {
|
|
4934
|
+
editorProps.isInExpEditorMode = true;
|
|
4935
|
+
}
|
|
4936
|
+
return editorProps;
|
|
4937
|
+
}, [
|
|
4938
|
+
node.children.length,
|
|
4939
|
+
node.data.blockId,
|
|
4940
|
+
options?.enableEditorProperties?.isEditorMode,
|
|
4941
|
+
options?.enableEditorProperties?.isEmpty,
|
|
4942
|
+
options?.enableEditorProperties?.nodeBlockId,
|
|
4943
|
+
options?.enableCustomEditorView,
|
|
4944
|
+
]);
|
|
4918
4945
|
const componentProps = useMemo(() => {
|
|
4919
4946
|
const sharedProps = {
|
|
4920
4947
|
'data-cf-node-id': node.data.id,
|
|
@@ -4924,21 +4951,10 @@ const useComponentProps = ({ node, entityStore, areEntitiesFetched, resolveDesig
|
|
|
4924
4951
|
};
|
|
4925
4952
|
return {
|
|
4926
4953
|
...sharedProps,
|
|
4927
|
-
|
|
4928
|
-
// through options as the component has to be aware of this prop to not cause any React warnings.
|
|
4929
|
-
...(options?.enableCustomEditorView ? { isInExpEditorMode: true } : {}),
|
|
4930
|
-
...(options?.editorProperties?.isEditorMode ? { isEditorMode: true } : {}),
|
|
4931
|
-
...(options?.editorProperties?.node ? { node } : {}),
|
|
4954
|
+
...editorProps,
|
|
4932
4955
|
...sanitizeNodeProps(props),
|
|
4933
4956
|
};
|
|
4934
|
-
}, [
|
|
4935
|
-
cfCsrClassName,
|
|
4936
|
-
node,
|
|
4937
|
-
options?.editorProperties?.isEditorMode,
|
|
4938
|
-
options?.editorProperties?.node,
|
|
4939
|
-
options?.enableCustomEditorView,
|
|
4940
|
-
props,
|
|
4941
|
-
]);
|
|
4957
|
+
}, [cfCsrClassName, editorProps, node, props]);
|
|
4942
4958
|
return { componentProps };
|
|
4943
4959
|
};
|
|
4944
4960
|
|