@cmssy/react 12.2.0 → 12.3.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/client.cjs CHANGED
@@ -94,6 +94,8 @@ function useEditBridge(page, config) {
94
94
  const selectedIdRef = react.useRef(null);
95
95
  const postSafeRef = react.useRef(() => {
96
96
  });
97
+ const emitBoundsRef = react.useRef(() => {
98
+ });
97
99
  const { id: pageId, blocks } = page;
98
100
  const blocksKey = blocks.map((b) => `${b.id}:${b.type}`).join("|");
99
101
  react.useEffect(() => {
@@ -256,6 +258,7 @@ function useEditBridge(page, config) {
256
258
  });
257
259
  });
258
260
  };
261
+ emitBoundsRef.current = emitSelectedBounds;
259
262
  window.addEventListener("message", handler);
260
263
  document.addEventListener("click", onClick, { capture: true });
261
264
  window.addEventListener("scroll", emitSelectedBounds, {
@@ -274,6 +277,9 @@ function useEditBridge(page, config) {
274
277
  window.removeEventListener("resize", emitSelectedBounds);
275
278
  };
276
279
  }, [config.editorOrigin, pageId, blocksKey]);
280
+ react.useEffect(() => {
281
+ emitBoundsRef.current();
282
+ });
277
283
  react.useEffect(() => {
278
284
  if (typeof window === "undefined" || window.parent === window) return;
279
285
  const notifySelectionGone = () => {
package/dist/client.js CHANGED
@@ -92,6 +92,8 @@ function useEditBridge(page, config) {
92
92
  const selectedIdRef = useRef(null);
93
93
  const postSafeRef = useRef(() => {
94
94
  });
95
+ const emitBoundsRef = useRef(() => {
96
+ });
95
97
  const { id: pageId, blocks } = page;
96
98
  const blocksKey = blocks.map((b) => `${b.id}:${b.type}`).join("|");
97
99
  useEffect(() => {
@@ -254,6 +256,7 @@ function useEditBridge(page, config) {
254
256
  });
255
257
  });
256
258
  };
259
+ emitBoundsRef.current = emitSelectedBounds;
257
260
  window.addEventListener("message", handler);
258
261
  document.addEventListener("click", onClick, { capture: true });
259
262
  window.addEventListener("scroll", emitSelectedBounds, {
@@ -272,6 +275,9 @@ function useEditBridge(page, config) {
272
275
  window.removeEventListener("resize", emitSelectedBounds);
273
276
  };
274
277
  }, [config.editorOrigin, pageId, blocksKey]);
278
+ useEffect(() => {
279
+ emitBoundsRef.current();
280
+ });
275
281
  useEffect(() => {
276
282
  if (typeof window === "undefined" || window.parent === window) return;
277
283
  const notifySelectionGone = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmssy/react",
3
- "version": "12.2.0",
3
+ "version": "12.3.0",
4
4
  "description": "React blocks, renderers, data client and editor bridge for cmssy headless sites",
5
5
  "keywords": [
6
6
  "cmssy",
@@ -97,7 +97,7 @@
97
97
  },
98
98
  "dependencies": {
99
99
  "@cmssy/types": "0.35.0",
100
- "@cmssy/core": "12.2.0"
100
+ "@cmssy/core": "12.3.0"
101
101
  },
102
102
  "scripts": {
103
103
  "build": "tsup",