@halo-dev/richtext-editor 0.0.0-alpha.24 → 0.0.0-alpha.25

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.
@@ -38,6 +38,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
38
38
  width: import("vue").WritableComputedRef<any>;
39
39
  height: import("vue").WritableComputedRef<any>;
40
40
  resizeRef: import("vue").Ref<HTMLElement>;
41
+ mounted: boolean;
41
42
  reuseResizeObserver: () => {
42
43
  isSupported: import("vue").Ref<boolean>;
43
44
  stop: () => void;
@@ -46,6 +47,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
46
47
  isSupported: import("vue").Ref<boolean>;
47
48
  stop: () => void;
48
49
  };
50
+ resetResizeObserver: () => void;
49
51
  handleSetSize: (width: string, height: string) => void;
50
52
  handleSetFocus: () => void;
51
53
  handleOpenLink: () => void;
@@ -51594,19 +51594,36 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
51594
51594
  }
51595
51595
  });
51596
51596
  const resizeRef = ref();
51597
+ let mounted = false;
51597
51598
  const reuseResizeObserver = () => {
51598
51599
  let init2 = true;
51599
- return useResizeObserver(resizeRef, (entries) => {
51600
- if (init2) {
51601
- init2 = false;
51602
- return;
51603
- }
51604
- const entry = entries[0];
51605
- const { width: width2, height: height2 } = entry.contentRect;
51606
- props.updateAttributes({ width: width2 + "px", height: height2 + "px" });
51607
- });
51600
+ return useResizeObserver(
51601
+ resizeRef,
51602
+ (entries) => {
51603
+ if (!mounted) {
51604
+ mounted = true;
51605
+ return;
51606
+ }
51607
+ if (init2) {
51608
+ init2 = false;
51609
+ return;
51610
+ }
51611
+ const entry = entries[0];
51612
+ const { width: width2, height: height2 } = entry.contentRect;
51613
+ props.updateAttributes({ width: width2 + "px", height: height2 + "px" });
51614
+ },
51615
+ { box: "border-box" }
51616
+ );
51608
51617
  };
51609
51618
  let resizeObserver = reuseResizeObserver();
51619
+ window.addEventListener("resize", resetResizeObserver);
51620
+ onUnmounted(() => {
51621
+ window.removeEventListener("resize", resetResizeObserver);
51622
+ });
51623
+ function resetResizeObserver() {
51624
+ resizeObserver.stop();
51625
+ resizeObserver = reuseResizeObserver();
51626
+ }
51610
51627
  function handleSetSize(width2, height2) {
51611
51628
  resizeObserver.stop();
51612
51629
  props.updateAttributes({ width: width2, height: height2 });
@@ -51774,7 +51791,6 @@ const Image = Image$1.extend({
51774
51791
  width: {
51775
51792
  default: "100%",
51776
51793
  parseHTML: (element) => {
51777
- console.log(element);
51778
51794
  const width = element.getAttribute("width") || element.style.width || null;
51779
51795
  return width;
51780
51796
  },