@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.js
CHANGED
|
@@ -2140,6 +2140,8 @@ function EditorInner({
|
|
|
2140
2140
|
} = useFooter();
|
|
2141
2141
|
(0, import_react21.useEffect)(() => {
|
|
2142
2142
|
let instance = null;
|
|
2143
|
+
let cancelled = false;
|
|
2144
|
+
let closeDropdowns = null;
|
|
2143
2145
|
const initEditor = async () => {
|
|
2144
2146
|
if (!containerRef.current) return;
|
|
2145
2147
|
const {
|
|
@@ -2151,6 +2153,7 @@ function EditorInner({
|
|
|
2151
2153
|
Dialog,
|
|
2152
2154
|
Signature
|
|
2153
2155
|
} = await import("@windoc/core");
|
|
2156
|
+
if (cancelled) return;
|
|
2154
2157
|
const data = defaultValue ?? { main: [] };
|
|
2155
2158
|
instance = new EditorClass(
|
|
2156
2159
|
containerRef.current,
|
|
@@ -2250,12 +2253,7 @@ function EditorInner({
|
|
|
2250
2253
|
}
|
|
2251
2254
|
}
|
|
2252
2255
|
]);
|
|
2253
|
-
|
|
2254
|
-
instance.override.drop = (evt) => {
|
|
2255
|
-
evt.preventDefault();
|
|
2256
|
-
};
|
|
2257
|
-
}
|
|
2258
|
-
const closeDropdowns = (evt) => {
|
|
2256
|
+
closeDropdowns = (evt) => {
|
|
2259
2257
|
const visibleDom = document.querySelector(".visible");
|
|
2260
2258
|
if (!visibleDom) return;
|
|
2261
2259
|
const parent = visibleDom.parentElement;
|
|
@@ -2269,7 +2267,13 @@ function EditorInner({
|
|
|
2269
2267
|
};
|
|
2270
2268
|
initEditor();
|
|
2271
2269
|
return () => {
|
|
2270
|
+
cancelled = true;
|
|
2272
2271
|
instance?.destroy();
|
|
2272
|
+
editorRef.current = null;
|
|
2273
|
+
if (closeDropdowns) {
|
|
2274
|
+
window.removeEventListener("click", closeDropdowns, { capture: true });
|
|
2275
|
+
closeDropdowns = null;
|
|
2276
|
+
}
|
|
2273
2277
|
};
|
|
2274
2278
|
}, []);
|
|
2275
2279
|
const handleDrop = (e) => {
|