@windoc/react 0.3.5 → 0.3.7
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 +10 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -2062,6 +2062,8 @@ function EditorInner({
|
|
|
2062
2062
|
} = useFooter();
|
|
2063
2063
|
useEffect4(() => {
|
|
2064
2064
|
let instance = null;
|
|
2065
|
+
let cancelled = false;
|
|
2066
|
+
let closeDropdowns = null;
|
|
2065
2067
|
const initEditor = async () => {
|
|
2066
2068
|
if (!containerRef.current) return;
|
|
2067
2069
|
const {
|
|
@@ -2073,6 +2075,7 @@ function EditorInner({
|
|
|
2073
2075
|
Dialog,
|
|
2074
2076
|
Signature
|
|
2075
2077
|
} = await import("@windoc/core");
|
|
2078
|
+
if (cancelled) return;
|
|
2076
2079
|
const data = defaultValue ?? { main: [] };
|
|
2077
2080
|
instance = new EditorClass(
|
|
2078
2081
|
containerRef.current,
|
|
@@ -2172,12 +2175,7 @@ function EditorInner({
|
|
|
2172
2175
|
}
|
|
2173
2176
|
}
|
|
2174
2177
|
]);
|
|
2175
|
-
|
|
2176
|
-
instance.override.drop = (evt) => {
|
|
2177
|
-
evt.preventDefault();
|
|
2178
|
-
};
|
|
2179
|
-
}
|
|
2180
|
-
const closeDropdowns = (evt) => {
|
|
2178
|
+
closeDropdowns = (evt) => {
|
|
2181
2179
|
const visibleDom = document.querySelector(".visible");
|
|
2182
2180
|
if (!visibleDom) return;
|
|
2183
2181
|
const parent = visibleDom.parentElement;
|
|
@@ -2191,7 +2189,13 @@ function EditorInner({
|
|
|
2191
2189
|
};
|
|
2192
2190
|
initEditor();
|
|
2193
2191
|
return () => {
|
|
2192
|
+
cancelled = true;
|
|
2194
2193
|
instance?.destroy();
|
|
2194
|
+
editorRef.current = null;
|
|
2195
|
+
if (closeDropdowns) {
|
|
2196
|
+
window.removeEventListener("click", closeDropdowns, { capture: true });
|
|
2197
|
+
closeDropdowns = null;
|
|
2198
|
+
}
|
|
2195
2199
|
};
|
|
2196
2200
|
}, []);
|
|
2197
2201
|
const handleDrop = (e) => {
|