@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.
|
@@ -51595,19 +51595,36 @@ ${codeFrame}` : message);
|
|
|
51595
51595
|
}
|
|
51596
51596
|
});
|
|
51597
51597
|
const resizeRef = vue.ref();
|
|
51598
|
+
let mounted = false;
|
|
51598
51599
|
const reuseResizeObserver = () => {
|
|
51599
51600
|
let init2 = true;
|
|
51600
|
-
return useResizeObserver(
|
|
51601
|
-
|
|
51602
|
-
|
|
51603
|
-
|
|
51604
|
-
|
|
51605
|
-
|
|
51606
|
-
|
|
51607
|
-
|
|
51608
|
-
|
|
51601
|
+
return useResizeObserver(
|
|
51602
|
+
resizeRef,
|
|
51603
|
+
(entries) => {
|
|
51604
|
+
if (!mounted) {
|
|
51605
|
+
mounted = true;
|
|
51606
|
+
return;
|
|
51607
|
+
}
|
|
51608
|
+
if (init2) {
|
|
51609
|
+
init2 = false;
|
|
51610
|
+
return;
|
|
51611
|
+
}
|
|
51612
|
+
const entry = entries[0];
|
|
51613
|
+
const { width: width2, height: height2 } = entry.contentRect;
|
|
51614
|
+
props.updateAttributes({ width: width2 + "px", height: height2 + "px" });
|
|
51615
|
+
},
|
|
51616
|
+
{ box: "border-box" }
|
|
51617
|
+
);
|
|
51609
51618
|
};
|
|
51610
51619
|
let resizeObserver = reuseResizeObserver();
|
|
51620
|
+
window.addEventListener("resize", resetResizeObserver);
|
|
51621
|
+
vue.onUnmounted(() => {
|
|
51622
|
+
window.removeEventListener("resize", resetResizeObserver);
|
|
51623
|
+
});
|
|
51624
|
+
function resetResizeObserver() {
|
|
51625
|
+
resizeObserver.stop();
|
|
51626
|
+
resizeObserver = reuseResizeObserver();
|
|
51627
|
+
}
|
|
51611
51628
|
function handleSetSize(width2, height2) {
|
|
51612
51629
|
resizeObserver.stop();
|
|
51613
51630
|
props.updateAttributes({ width: width2, height: height2 });
|
|
@@ -51775,7 +51792,6 @@ ${codeFrame}` : message);
|
|
|
51775
51792
|
width: {
|
|
51776
51793
|
default: "100%",
|
|
51777
51794
|
parseHTML: (element) => {
|
|
51778
|
-
console.log(element);
|
|
51779
51795
|
const width = element.getAttribute("width") || element.style.width || null;
|
|
51780
51796
|
return width;
|
|
51781
51797
|
},
|