react-better-html 1.1.255 → 1.1.256
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 +8 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2476,6 +2476,10 @@ var ModalComponent = (0, import_react11.forwardRef)(function Modal({
|
|
|
2476
2476
|
const { app } = useBetterHtmlContextInternal();
|
|
2477
2477
|
const { colorTheme } = (0, import_react_better_core10.useBetterCoreContext)();
|
|
2478
2478
|
const dialogRef = (0, import_react11.useRef)(null);
|
|
2479
|
+
const onOpenRef = (0, import_react11.useRef)(onOpen);
|
|
2480
|
+
onOpenRef.current = onOpen;
|
|
2481
|
+
const onCloseRef = (0, import_react11.useRef)(onClose);
|
|
2482
|
+
onCloseRef.current = onClose;
|
|
2479
2483
|
const [isOpened, setIsOpened] = (0, import_react_better_core10.useBooleanState)(false);
|
|
2480
2484
|
const [isOpenedLate, setIsOpenedLate] = (0, import_react_better_core10.useBooleanState)(false);
|
|
2481
2485
|
const onClickOpen = (0, import_react11.useCallback)(() => {
|
|
@@ -2490,20 +2494,20 @@ var ModalComponent = (0, import_react11.forwardRef)(function Modal({
|
|
|
2490
2494
|
false
|
|
2491
2495
|
);
|
|
2492
2496
|
}
|
|
2493
|
-
|
|
2494
|
-
}, [
|
|
2497
|
+
onOpenRef.current?.();
|
|
2498
|
+
}, [urlQuery, name]);
|
|
2495
2499
|
const onClickClose = (0, import_react11.useCallback)(
|
|
2496
2500
|
(event) => {
|
|
2497
2501
|
event?.stopPropagation();
|
|
2498
2502
|
setIsOpened.setFalse();
|
|
2499
|
-
|
|
2503
|
+
onCloseRef.current?.();
|
|
2500
2504
|
if (urlQuery && name) urlQuery.removeQuery(`${name}-modal`, false);
|
|
2501
2505
|
setTimeout(() => {
|
|
2502
2506
|
dialogRef.current?.close();
|
|
2503
2507
|
setIsOpenedLate.setFalse();
|
|
2504
2508
|
}, 0.2 * 1e3);
|
|
2505
2509
|
},
|
|
2506
|
-
[
|
|
2510
|
+
[urlQuery, name]
|
|
2507
2511
|
);
|
|
2508
2512
|
const onKeyDown = (0, import_react11.useCallback)(
|
|
2509
2513
|
(event) => {
|