@contentful/experiences-visual-editor-react 1.36.0-dev-20250326T1634-bb7d4c2.0 → 1.36.0-dev-20250331T1251-7ba8661.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 +14 -4
- package/dist/index.js.map +1 -1
- package/dist/renderApp.js +14 -4
- package/dist/renderApp.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -4646,6 +4646,9 @@ const useComponentProps = ({ node, areEntitiesFetched, resolveDesignValue, rende
|
|
|
4646
4646
|
if (!definition || node.type === ASSEMBLY_NODE_TYPE) {
|
|
4647
4647
|
return propsBase;
|
|
4648
4648
|
}
|
|
4649
|
+
// Note, that here we iterate over DEFINITION variables, not the actual node variables
|
|
4650
|
+
// this means that node may have "orphan" props, or some "newborn" props will be initialized
|
|
4651
|
+
// with the default values.
|
|
4649
4652
|
const extractedProps = Object.entries(definition.variables).reduce((acc, [variableName, variableDefinition]) => {
|
|
4650
4653
|
const variableMapping = node.data.props[variableName];
|
|
4651
4654
|
if (!variableMapping) {
|
|
@@ -4748,6 +4751,7 @@ const useComponentProps = ({ node, areEntitiesFetched, resolveDesignValue, rende
|
|
|
4748
4751
|
renderDropzone,
|
|
4749
4752
|
]);
|
|
4750
4753
|
const cfStyles = useMemo(() => buildCfStyles(props), [props]);
|
|
4754
|
+
const cfVisibility = props['cfVisibility'];
|
|
4751
4755
|
const isAssemblyBlock = node.type === ASSEMBLY_BLOCK_NODE_TYPE;
|
|
4752
4756
|
const isSingleColumn = node?.data.blockId === CONTENTFUL_COMPONENTS$1.columns.id;
|
|
4753
4757
|
const isStructureComponent = isContentfulStructureComponent(node?.data.blockId);
|
|
@@ -4757,13 +4761,18 @@ const useComponentProps = ({ node, areEntitiesFetched, resolveDesignValue, rende
|
|
|
4757
4761
|
const overrideStyles = {};
|
|
4758
4762
|
const wrapperStyles = { width: options?.wrapContainerWidth };
|
|
4759
4763
|
if (requiresDragWrapper) {
|
|
4760
|
-
|
|
4764
|
+
// when element is marked by user as not-visible, on that element the node `display: none !important`
|
|
4765
|
+
// will be set and it will disappear. However, when such a node has a wrapper div, the wrapper
|
|
4766
|
+
// should not have any css properties (at least not ones which force size), as such div should
|
|
4767
|
+
// simply be a zero height wrapper around element with `display: none !important`.
|
|
4768
|
+
// Hence we guard all wrapperStyles with `cfVisibility` check.
|
|
4769
|
+
if (cfVisibility && cfStyles.width)
|
|
4761
4770
|
wrapperStyles.width = cfStyles.width;
|
|
4762
|
-
if (cfStyles.height)
|
|
4771
|
+
if (cfVisibility && cfStyles.height)
|
|
4763
4772
|
wrapperStyles.height = cfStyles.height;
|
|
4764
|
-
if (cfStyles.maxWidth)
|
|
4773
|
+
if (cfVisibility && cfStyles.maxWidth)
|
|
4765
4774
|
wrapperStyles.maxWidth = cfStyles.maxWidth;
|
|
4766
|
-
if (cfStyles.margin)
|
|
4775
|
+
if (cfVisibility && cfStyles.margin)
|
|
4767
4776
|
wrapperStyles.margin = cfStyles.margin;
|
|
4768
4777
|
}
|
|
4769
4778
|
// Override component styles to fill the wrapper
|
|
@@ -4798,6 +4807,7 @@ const useComponentProps = ({ node, areEntitiesFetched, resolveDesignValue, rende
|
|
|
4798
4807
|
node.data.id,
|
|
4799
4808
|
draggingId,
|
|
4800
4809
|
nodeRect,
|
|
4810
|
+
cfVisibility,
|
|
4801
4811
|
]);
|
|
4802
4812
|
// Styles that will be applied to the component element
|
|
4803
4813
|
// This has to be memoized to avoid recreating the styles in useEditorModeClassName on every render
|