@contentful/experiences-visual-editor-react 1.0.1 → 1.0.2-beta.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 CHANGED
@@ -2176,13 +2176,24 @@ const sendSelectedComponentCoordinates = (instanceId) => {
2176
2176
  parent = parent?.parentElement;
2177
2177
  }
2178
2178
  if (selectedElement) {
2179
- sendMessage(OUTGOING_EVENTS.UpdateSelectedComponentCoordinates, {
2180
- selectedNodeCoordinates: getElementCoordinates(selectedElement),
2181
- selectedAssemblyChildCoordinates: selectedAssemblyChild
2182
- ? getElementCoordinates(selectedAssemblyChild)
2183
- : null,
2184
- parentCoordinates: parent ? getElementCoordinates(parent) : null,
2185
- });
2179
+ const sendUpdateSelectedComponentCoordinates = () => {
2180
+ sendMessage(OUTGOING_EVENTS.UpdateSelectedComponentCoordinates, {
2181
+ selectedNodeCoordinates: getElementCoordinates(selectedElement),
2182
+ selectedAssemblyChildCoordinates: selectedAssemblyChild
2183
+ ? getElementCoordinates(selectedAssemblyChild)
2184
+ : null,
2185
+ parentCoordinates: parent ? getElementCoordinates(parent) : null,
2186
+ });
2187
+ };
2188
+ const childImage = selectedElement.querySelector('img');
2189
+ if (childImage) {
2190
+ const handleImageLoad = () => {
2191
+ sendUpdateSelectedComponentCoordinates();
2192
+ childImage.removeEventListener('load', handleImageLoad);
2193
+ };
2194
+ childImage.addEventListener('load', handleImageLoad);
2195
+ }
2196
+ sendUpdateSelectedComponentCoordinates();
2186
2197
  }
2187
2198
  };
2188
2199
 
@@ -2384,7 +2395,7 @@ const useComponentProps = ({ node, areEntitiesFetched, resolveDesignValue, rende
2384
2395
  [variableName]: value,
2385
2396
  };
2386
2397
  }
2387
- else {
2398
+ else if (variableMapping.type === 'UnboundValue') {
2388
2399
  const value = getUnboundValues({
2389
2400
  key: variableMapping.key,
2390
2401
  fallback: variableDefinition.defaultValue,
@@ -2395,6 +2406,9 @@ const useComponentProps = ({ node, areEntitiesFetched, resolveDesignValue, rende
2395
2406
  [variableName]: value,
2396
2407
  };
2397
2408
  }
2409
+ else {
2410
+ return { ...acc };
2411
+ }
2398
2412
  }, {});
2399
2413
  }, [
2400
2414
  definition,
@@ -2488,7 +2502,7 @@ var PostMessageMethods;
2488
2502
  var css_248z$6 = ".cf-heading {\n white-space: pre-line;\n}\n";
2489
2503
  styleInject(css_248z$6);
2490
2504
 
2491
- var css_248z$5 = ".cf-richtext {\n white-space: pre-line;\n}\n";
2505
+ var css_248z$5 = ".cf-richtext {\n white-space: pre-line;\n}\n\n.cf-richtext > *:first-child {\n margin-top: 0;\n}\n\n.cf-richtext > *:last-child {\n margin-bottom: 0;\n}\n";
2492
2506
  styleInject(css_248z$5);
2493
2507
 
2494
2508
  var css_248z$4 = ".cf-text {\n white-space: pre-line;\n}\n";