@reacteditor/core 0.0.8 → 0.0.9

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.
@@ -3698,23 +3698,25 @@ var DragDropContextClient = ({
3698
3698
  },
3699
3699
  scrollToComponent: (id) => {
3700
3700
  const virtualizers = Array.from(rootVirtualizers.values());
3701
- if (virtualizers.length > 0) {
3702
- for (const handle of virtualizers) {
3703
- const index = handle.resolveIndex(id);
3704
- if (index < 0) {
3705
- continue;
3701
+ const scroll = () => {
3702
+ if (virtualizers.length > 0) {
3703
+ for (const handle of virtualizers) {
3704
+ const index = handle.resolveIndex(id);
3705
+ if (index < 0) continue;
3706
+ handle.virtualizer.scrollToIndex(index, {
3707
+ behavior: "smooth",
3708
+ align: "center"
3709
+ });
3706
3710
  }
3707
- handle.virtualizer.scrollToIndex(index, {
3708
- behavior: "auto",
3709
- // We avoid smooth scroll as this triggers virtualizer renders
3710
- align: "auto"
3711
- });
3711
+ return;
3712
3712
  }
3713
- } else {
3714
3713
  const frame = getFrame();
3715
- const el = frame == null ? void 0 : frame.querySelector(`[data-editor-component="${id}"]`);
3716
- el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
3717
- }
3714
+ const el = frame == null ? void 0 : frame.querySelector(
3715
+ `[data-editor-component="${id}"]`
3716
+ );
3717
+ el == null ? void 0 : el.scrollIntoView({ behavior: "smooth", block: "center" });
3718
+ };
3719
+ requestAnimationFrame(() => requestAnimationFrame(scroll));
3718
3720
  }
3719
3721
  }));
3720
3722
  });
package/dist/index.js CHANGED
@@ -10794,23 +10794,25 @@ var DragDropContextClient = ({
10794
10794
  },
10795
10795
  scrollToComponent: (id) => {
10796
10796
  const virtualizers = Array.from(rootVirtualizers.values());
10797
- if (virtualizers.length > 0) {
10798
- for (const handle of virtualizers) {
10799
- const index = handle.resolveIndex(id);
10800
- if (index < 0) {
10801
- continue;
10797
+ const scroll = () => {
10798
+ if (virtualizers.length > 0) {
10799
+ for (const handle of virtualizers) {
10800
+ const index = handle.resolveIndex(id);
10801
+ if (index < 0) continue;
10802
+ handle.virtualizer.scrollToIndex(index, {
10803
+ behavior: "smooth",
10804
+ align: "center"
10805
+ });
10802
10806
  }
10803
- handle.virtualizer.scrollToIndex(index, {
10804
- behavior: "auto",
10805
- // We avoid smooth scroll as this triggers virtualizer renders
10806
- align: "auto"
10807
- });
10807
+ return;
10808
10808
  }
10809
- } else {
10810
10809
  const frame = getFrame();
10811
- const el = frame == null ? void 0 : frame.querySelector(`[data-editor-component="${id}"]`);
10812
- el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
10813
- }
10810
+ const el = frame == null ? void 0 : frame.querySelector(
10811
+ `[data-editor-component="${id}"]`
10812
+ );
10813
+ el == null ? void 0 : el.scrollIntoView({ behavior: "smooth", block: "center" });
10814
+ };
10815
+ requestAnimationFrame(() => requestAnimationFrame(scroll));
10814
10816
  }
10815
10817
  }));
10816
10818
  });
package/dist/index.mjs CHANGED
@@ -19,7 +19,7 @@ import {
19
19
  useEditor,
20
20
  useGetEditor,
21
21
  usePropsContext
22
- } from "./chunk-R5DQGUQS.mjs";
22
+ } from "./chunk-DU757QEH.mjs";
23
23
  import "./chunk-AJWRDM22.mjs";
24
24
  import {
25
25
  migrate,
@@ -10794,23 +10794,25 @@ var DragDropContextClient = ({
10794
10794
  },
10795
10795
  scrollToComponent: (id) => {
10796
10796
  const virtualizers = Array.from(rootVirtualizers.values());
10797
- if (virtualizers.length > 0) {
10798
- for (const handle of virtualizers) {
10799
- const index = handle.resolveIndex(id);
10800
- if (index < 0) {
10801
- continue;
10797
+ const scroll = () => {
10798
+ if (virtualizers.length > 0) {
10799
+ for (const handle of virtualizers) {
10800
+ const index = handle.resolveIndex(id);
10801
+ if (index < 0) continue;
10802
+ handle.virtualizer.scrollToIndex(index, {
10803
+ behavior: "smooth",
10804
+ align: "center"
10805
+ });
10802
10806
  }
10803
- handle.virtualizer.scrollToIndex(index, {
10804
- behavior: "auto",
10805
- // We avoid smooth scroll as this triggers virtualizer renders
10806
- align: "auto"
10807
- });
10807
+ return;
10808
10808
  }
10809
- } else {
10810
10809
  const frame = getFrame();
10811
- const el = frame == null ? void 0 : frame.querySelector(`[data-editor-component="${id}"]`);
10812
- el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
10813
- }
10810
+ const el = frame == null ? void 0 : frame.querySelector(
10811
+ `[data-editor-component="${id}"]`
10812
+ );
10813
+ el == null ? void 0 : el.scrollIntoView({ behavior: "smooth", block: "center" });
10814
+ };
10815
+ requestAnimationFrame(() => requestAnimationFrame(scroll));
10814
10816
  }
10815
10817
  }));
10816
10818
  });
@@ -19,7 +19,7 @@ import {
19
19
  useEditor,
20
20
  useGetEditor,
21
21
  usePropsContext
22
- } from "./chunk-R5DQGUQS.mjs";
22
+ } from "./chunk-DU757QEH.mjs";
23
23
  import "./chunk-AJWRDM22.mjs";
24
24
  import {
25
25
  migrate,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reacteditor/core",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "description": "The open-source visual editor for React",
5
5
  "author": "Rami Bitar <rami@frontend.co>",
6
6
  "repository": "frontend-inc/react-editor",