@contentful/experiences-visual-editor-react 3.5.0-dev-20250902T0640-ab0b512.0 → 3.5.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 +27 -13
- package/dist/index.js.map +1 -1
- package/dist/renderApp.js +27 -13
- package/dist/renderApp.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -4917,6 +4917,31 @@ const useComponentProps = ({ node, entityStore, areEntitiesFetched, resolveDesig
|
|
|
4917
4917
|
styles: componentStyles,
|
|
4918
4918
|
nodeId: node.data.id,
|
|
4919
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
|
+
]);
|
|
4920
4945
|
const componentProps = useMemo(() => {
|
|
4921
4946
|
const sharedProps = {
|
|
4922
4947
|
'data-cf-node-id': node.data.id,
|
|
@@ -4926,21 +4951,10 @@ const useComponentProps = ({ node, entityStore, areEntitiesFetched, resolveDesig
|
|
|
4926
4951
|
};
|
|
4927
4952
|
return {
|
|
4928
4953
|
...sharedProps,
|
|
4929
|
-
|
|
4930
|
-
// through options as the component has to be aware of this prop to not cause any React warnings.
|
|
4931
|
-
...(options?.enableCustomEditorView ? { isInExpEditorMode: true } : {}),
|
|
4932
|
-
...(options?.editorProperties?.isEditorMode ? { isEditorMode: true } : {}),
|
|
4933
|
-
...(options?.editorProperties?.node ? { node } : {}),
|
|
4954
|
+
...editorProps,
|
|
4934
4955
|
...sanitizeNodeProps(props),
|
|
4935
4956
|
};
|
|
4936
|
-
}, [
|
|
4937
|
-
cfCsrClassName,
|
|
4938
|
-
node,
|
|
4939
|
-
options?.editorProperties?.isEditorMode,
|
|
4940
|
-
options?.editorProperties?.node,
|
|
4941
|
-
options?.enableCustomEditorView,
|
|
4942
|
-
props,
|
|
4943
|
-
]);
|
|
4957
|
+
}, [cfCsrClassName, editorProps, node, props]);
|
|
4944
4958
|
return { componentProps };
|
|
4945
4959
|
};
|
|
4946
4960
|
|