@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/renderApp.js CHANGED
@@ -50313,6 +50313,31 @@ const useComponentProps = ({ node, entityStore, areEntitiesFetched, resolveDesig
50313
50313
  styles: componentStyles,
50314
50314
  nodeId: node.data.id,
50315
50315
  });
50316
+ // Allows custom components to render differently in the editor. This needs to be activated
50317
+ // through registry options as the component has to be aware of this prop to not cause any React warnings.
50318
+ const editorProps = reactExports.useMemo(() => {
50319
+ const editorProps = {};
50320
+ if (options?.enableEditorProperties?.isEditorMode) {
50321
+ editorProps.isEditorMode = true;
50322
+ }
50323
+ if (options?.enableEditorProperties?.isEmpty) {
50324
+ editorProps.isEmpty = node.children.length === 0;
50325
+ }
50326
+ if (options?.enableEditorProperties?.nodeBlockId) {
50327
+ editorProps.nodeBlockId = node.data.blockId;
50328
+ }
50329
+ if (options?.enableCustomEditorView) {
50330
+ editorProps.isInExpEditorMode = true;
50331
+ }
50332
+ return editorProps;
50333
+ }, [
50334
+ node.children.length,
50335
+ node.data.blockId,
50336
+ options?.enableEditorProperties?.isEditorMode,
50337
+ options?.enableEditorProperties?.isEmpty,
50338
+ options?.enableEditorProperties?.nodeBlockId,
50339
+ options?.enableCustomEditorView,
50340
+ ]);
50316
50341
  const componentProps = reactExports.useMemo(() => {
50317
50342
  const sharedProps = {
50318
50343
  'data-cf-node-id': node.data.id,
@@ -50322,21 +50347,10 @@ const useComponentProps = ({ node, entityStore, areEntitiesFetched, resolveDesig
50322
50347
  };
50323
50348
  return {
50324
50349
  ...sharedProps,
50325
- // Allows custom components to render differently in the editor. This needs to be activated
50326
- // through options as the component has to be aware of this prop to not cause any React warnings.
50327
- ...(options?.enableCustomEditorView ? { isInExpEditorMode: true } : {}),
50328
- ...(options?.editorProperties?.isEditorMode ? { isEditorMode: true } : {}),
50329
- ...(options?.editorProperties?.node ? { node } : {}),
50350
+ ...editorProps,
50330
50351
  ...sanitizeNodeProps(props),
50331
50352
  };
50332
- }, [
50333
- cfCsrClassName,
50334
- node,
50335
- options?.editorProperties?.isEditorMode,
50336
- options?.editorProperties?.node,
50337
- options?.enableCustomEditorView,
50338
- props,
50339
- ]);
50353
+ }, [cfCsrClassName, editorProps, node, props]);
50340
50354
  return { componentProps };
50341
50355
  };
50342
50356