@underverse-ui/underverse 2.0.13 → 2.0.15
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/api-reference.json +1 -1
- package/dist/{EmojiPicker-FFNIUMI3.js → EmojiPicker-3X2S7XPP.js} +4 -4
- package/dist/{chunk-R7ZKNCWR.js → chunk-D22TNGE5.js} +3 -3
- package/dist/{chunk-PYC5EY5W.js → chunk-EPBYGZHZ.js} +106 -62
- package/dist/chunk-EPBYGZHZ.js.map +1 -0
- package/dist/{chunk-HEYNAGQD.js → chunk-HTGAV4IG.js} +3 -3
- package/dist/{chunk-WDY3QWOW.js → chunk-NWVDNVLR.js} +231 -158
- package/dist/chunk-NWVDNVLR.js.map +1 -0
- package/dist/{chunk-VNSCI3OK.js → chunk-SKCO2GFM.js} +2 -2
- package/dist/{chunk-MMMCBJ2L.js → chunk-WEGE3MZ5.js} +109 -67
- package/dist/chunk-WEGE3MZ5.js.map +1 -0
- package/dist/index.cjs +3173 -3009
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +6 -6
- package/dist/{menu-bar-SVX36W4S.js → menu-bar-YMEOEYJS.js} +4 -4
- package/dist/ueditor.cjs +1142 -978
- package/dist/ueditor.cjs.map +1 -1
- package/dist/ueditor.d.cts +2 -0
- package/dist/ueditor.d.ts +2 -0
- package/dist/ueditor.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-MMMCBJ2L.js.map +0 -1
- package/dist/chunk-PYC5EY5W.js.map +0 -1
- package/dist/chunk-WDY3QWOW.js.map +0 -1
- /package/dist/{EmojiPicker-FFNIUMI3.js.map → EmojiPicker-3X2S7XPP.js.map} +0 -0
- /package/dist/{chunk-R7ZKNCWR.js.map → chunk-D22TNGE5.js.map} +0 -0
- /package/dist/{chunk-HEYNAGQD.js.map → chunk-HTGAV4IG.js.map} +0 -0
- /package/dist/{chunk-VNSCI3OK.js.map → chunk-SKCO2GFM.js.map} +0 -0
- /package/dist/{menu-bar-SVX36W4S.js.map → menu-bar-YMEOEYJS.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
cn
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EPBYGZHZ.js";
|
|
4
4
|
|
|
5
5
|
// src/components/emoji-ui.tsx
|
|
6
6
|
import React from "react";
|
|
@@ -71,4 +71,4 @@ export {
|
|
|
71
71
|
getEmojiImageUrl,
|
|
72
72
|
EmojiGridButton
|
|
73
73
|
};
|
|
74
|
-
//# sourceMappingURL=chunk-
|
|
74
|
+
//# sourceMappingURL=chunk-SKCO2GFM.js.map
|
|
@@ -7,9 +7,11 @@ import {
|
|
|
7
7
|
formControlSizeStyles,
|
|
8
8
|
formControlValueClass,
|
|
9
9
|
mergeRefs,
|
|
10
|
+
resolveUEditorPortalContainer,
|
|
10
11
|
setRefValue,
|
|
11
|
-
useSmartTranslations
|
|
12
|
-
|
|
12
|
+
useSmartTranslations,
|
|
13
|
+
useUEditorPortalContainerGetter
|
|
14
|
+
} from "./chunk-EPBYGZHZ.js";
|
|
13
15
|
|
|
14
16
|
// src/contexts/UnderverseConfigContext.tsx
|
|
15
17
|
import * as React from "react";
|
|
@@ -349,6 +351,10 @@ var Popover = ({
|
|
|
349
351
|
const globalConfig = useUnderverseUIConfig();
|
|
350
352
|
const resolvedBorderMode = borderMode ?? globalConfig.popover?.borderMode ?? globalConfig.borderMode;
|
|
351
353
|
const isOpen = isControlled ? open : internalOpen;
|
|
354
|
+
const getPortalContainer = useUEditorPortalContainerGetter();
|
|
355
|
+
const portalContainer = isOpen ? resolveUEditorPortalContainer(getPortalContainer) : null;
|
|
356
|
+
const portalDocument = portalContainer?.ownerDocument ?? null;
|
|
357
|
+
const portalWindow = portalDocument?.defaultView ?? null;
|
|
352
358
|
const setIsOpen = React2.useCallback(
|
|
353
359
|
(next) => {
|
|
354
360
|
if (!isControlled) setInternalOpen(next);
|
|
@@ -392,7 +398,10 @@ var Popover = ({
|
|
|
392
398
|
placement,
|
|
393
399
|
offset,
|
|
394
400
|
padding,
|
|
395
|
-
viewport: {
|
|
401
|
+
viewport: {
|
|
402
|
+
width: portalWindow?.innerWidth ?? window.innerWidth,
|
|
403
|
+
height: portalWindow?.innerHeight ?? window.innerHeight
|
|
404
|
+
}
|
|
396
405
|
});
|
|
397
406
|
const top = Math.round(next.top);
|
|
398
407
|
const left = Math.round(next.left);
|
|
@@ -403,57 +412,58 @@ var Popover = ({
|
|
|
403
412
|
panelEl.style.transformOrigin = getTransformOrigin(next.side, next.align);
|
|
404
413
|
if (positionerEl.style.visibility !== "visible") positionerEl.style.visibility = "visible";
|
|
405
414
|
if (positionerEl.style.pointerEvents !== "auto") positionerEl.style.pointerEvents = "auto";
|
|
406
|
-
}, [placement, matchTriggerWidth, contentWidth]);
|
|
415
|
+
}, [placement, matchTriggerWidth, contentWidth, portalWindow]);
|
|
407
416
|
React2.useLayoutEffect(() => {
|
|
408
|
-
if (!isOpen) return;
|
|
417
|
+
if (!isOpen || !portalWindow) return;
|
|
409
418
|
updatePosition();
|
|
410
419
|
let raf1 = 0;
|
|
411
420
|
let raf2 = 0;
|
|
412
|
-
raf1 =
|
|
421
|
+
raf1 = portalWindow.requestAnimationFrame(() => {
|
|
413
422
|
updatePosition();
|
|
414
|
-
raf2 =
|
|
423
|
+
raf2 = portalWindow.requestAnimationFrame(() => updatePosition());
|
|
415
424
|
});
|
|
416
425
|
return () => {
|
|
417
|
-
cancelAnimationFrame(raf1);
|
|
418
|
-
cancelAnimationFrame(raf2);
|
|
426
|
+
portalWindow.cancelAnimationFrame(raf1);
|
|
427
|
+
portalWindow.cancelAnimationFrame(raf2);
|
|
419
428
|
};
|
|
420
|
-
}, [isOpen, updatePosition]);
|
|
429
|
+
}, [isOpen, portalWindow, updatePosition]);
|
|
421
430
|
React2.useEffect(() => {
|
|
422
|
-
if (!isOpen) return;
|
|
431
|
+
if (!isOpen || !portalWindow) return;
|
|
423
432
|
let raf = 0;
|
|
424
433
|
const tick = () => {
|
|
425
434
|
updatePosition();
|
|
426
|
-
raf =
|
|
435
|
+
raf = portalWindow.requestAnimationFrame(tick);
|
|
427
436
|
};
|
|
428
|
-
raf =
|
|
429
|
-
return () =>
|
|
430
|
-
}, [isOpen, updatePosition]);
|
|
437
|
+
raf = portalWindow.requestAnimationFrame(tick);
|
|
438
|
+
return () => portalWindow.cancelAnimationFrame(raf);
|
|
439
|
+
}, [isOpen, portalWindow, updatePosition]);
|
|
431
440
|
React2.useEffect(() => {
|
|
432
|
-
if (!isOpen) return;
|
|
441
|
+
if (!isOpen || !portalDocument || !portalWindow) return;
|
|
433
442
|
let raf = 0;
|
|
434
443
|
const handler = () => {
|
|
435
|
-
cancelAnimationFrame(raf);
|
|
436
|
-
raf =
|
|
444
|
+
portalWindow.cancelAnimationFrame(raf);
|
|
445
|
+
raf = portalWindow.requestAnimationFrame(() => updatePosition());
|
|
437
446
|
};
|
|
438
447
|
handler();
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
448
|
+
portalWindow.addEventListener("resize", handler);
|
|
449
|
+
portalWindow.addEventListener("scroll", handler, true);
|
|
450
|
+
portalDocument.addEventListener("scroll", handler, true);
|
|
442
451
|
return () => {
|
|
443
|
-
cancelAnimationFrame(raf);
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
452
|
+
portalWindow.cancelAnimationFrame(raf);
|
|
453
|
+
portalWindow.removeEventListener("resize", handler);
|
|
454
|
+
portalWindow.removeEventListener("scroll", handler, true);
|
|
455
|
+
portalDocument.removeEventListener("scroll", handler, true);
|
|
447
456
|
};
|
|
448
|
-
}, [isOpen, updatePosition]);
|
|
457
|
+
}, [isOpen, portalDocument, portalWindow, updatePosition]);
|
|
449
458
|
React2.useEffect(() => {
|
|
450
|
-
if (!isOpen) return;
|
|
451
|
-
|
|
452
|
-
|
|
459
|
+
if (!isOpen || !portalWindow) return;
|
|
460
|
+
const ResizeObserverCtor = portalWindow.ResizeObserver;
|
|
461
|
+
if (!ResizeObserverCtor) return;
|
|
462
|
+
const ro = new ResizeObserverCtor(() => updatePosition());
|
|
453
463
|
if (positionerRef.current) ro.observe(positionerRef.current);
|
|
454
464
|
if (triggerRef.current) ro.observe(triggerRef.current);
|
|
455
465
|
return () => ro.disconnect();
|
|
456
|
-
}, [isOpen, updatePosition]);
|
|
466
|
+
}, [isOpen, portalWindow, updatePosition]);
|
|
457
467
|
React2.useLayoutEffect(() => {
|
|
458
468
|
if (!isOpen) {
|
|
459
469
|
lastAppliedRef.current = null;
|
|
@@ -461,7 +471,7 @@ var Popover = ({
|
|
|
461
471
|
}
|
|
462
472
|
}, [isOpen]);
|
|
463
473
|
React2.useEffect(() => {
|
|
464
|
-
if (!isOpen) return;
|
|
474
|
+
if (!isOpen || !portalDocument || !portalWindow) return;
|
|
465
475
|
const handleClickOutside = (event) => {
|
|
466
476
|
const target = event.target;
|
|
467
477
|
const triggerEl = triggerRef.current;
|
|
@@ -469,7 +479,7 @@ var Popover = ({
|
|
|
469
479
|
if (!triggerEl || !popoverEl) return;
|
|
470
480
|
if (triggerEl.contains(target)) return;
|
|
471
481
|
if (popoverEl.contains(target)) return;
|
|
472
|
-
if (target instanceof Element && target.closest("[data-popover]")) return;
|
|
482
|
+
if (target instanceof portalWindow.Element && target.closest("[data-popover]")) return;
|
|
473
483
|
setIsOpen(false);
|
|
474
484
|
};
|
|
475
485
|
const handleEscape = (event) => {
|
|
@@ -477,21 +487,19 @@ var Popover = ({
|
|
|
477
487
|
setIsOpen(false);
|
|
478
488
|
}
|
|
479
489
|
};
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
}
|
|
488
|
-
}, [isOpen, setIsOpen]);
|
|
490
|
+
portalDocument.addEventListener("mousedown", handleClickOutside);
|
|
491
|
+
portalDocument.addEventListener("keydown", handleEscape);
|
|
492
|
+
return () => {
|
|
493
|
+
portalDocument.removeEventListener("mousedown", handleClickOutside);
|
|
494
|
+
portalDocument.removeEventListener("keydown", handleEscape);
|
|
495
|
+
};
|
|
496
|
+
}, [isOpen, portalDocument, portalWindow, setIsOpen]);
|
|
489
497
|
const handleTriggerClick = () => {
|
|
490
498
|
if (!disabled) {
|
|
491
499
|
setIsOpen(!isOpen);
|
|
492
500
|
}
|
|
493
501
|
};
|
|
494
|
-
const popoverContent = isOpen &&
|
|
502
|
+
const popoverContent = isOpen && portalContainer ? createPortal(
|
|
495
503
|
/* @__PURE__ */ jsx2(
|
|
496
504
|
"div",
|
|
497
505
|
{
|
|
@@ -542,7 +550,7 @@ var Popover = ({
|
|
|
542
550
|
)
|
|
543
551
|
}
|
|
544
552
|
),
|
|
545
|
-
|
|
553
|
+
portalContainer
|
|
546
554
|
) : null;
|
|
547
555
|
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
548
556
|
(() => {
|
|
@@ -632,6 +640,7 @@ var DropdownMenu = ({
|
|
|
632
640
|
const [activeIndex, setActiveIndex] = useResettingIndex(open);
|
|
633
641
|
const parentMenu = React3.useContext(DropdownMenuContext);
|
|
634
642
|
const hoverCloseTimeoutRef = React3.useRef(null);
|
|
643
|
+
const getPortalContainer = useUEditorPortalContainerGetter();
|
|
635
644
|
const cancelHoverClose = React3.useCallback(() => {
|
|
636
645
|
if (hoverCloseTimeoutRef.current === null) return;
|
|
637
646
|
clearTimeout(hoverCloseTimeoutRef.current);
|
|
@@ -670,9 +679,9 @@ var DropdownMenu = ({
|
|
|
670
679
|
React3.useEffect(() => {
|
|
671
680
|
if (!open) return;
|
|
672
681
|
const handleKeyNav = (e) => {
|
|
673
|
-
const active = document.activeElement;
|
|
674
682
|
const triggerEl = triggerRef.current;
|
|
675
683
|
const menuEl = menuRef.current;
|
|
684
|
+
const active = menuEl?.ownerDocument.activeElement;
|
|
676
685
|
if (!active || !triggerEl || !menuEl) return;
|
|
677
686
|
const isInMenu = menuEl.contains(active);
|
|
678
687
|
const isOnTrigger = triggerEl.contains(active);
|
|
@@ -699,9 +708,11 @@ var DropdownMenu = ({
|
|
|
699
708
|
closeMenu();
|
|
700
709
|
}
|
|
701
710
|
};
|
|
702
|
-
|
|
711
|
+
const menuDocument = menuRef.current?.ownerDocument;
|
|
712
|
+
if (!menuDocument) return;
|
|
713
|
+
menuDocument.addEventListener("keydown", handleKeyNav, true);
|
|
703
714
|
return () => {
|
|
704
|
-
|
|
715
|
+
menuDocument.removeEventListener("keydown", handleKeyNav, true);
|
|
705
716
|
};
|
|
706
717
|
}, [open, activeIndex, closeMenu, focusMenuItem, getEnabledMenuItems]);
|
|
707
718
|
const menuContext = React3.useMemo(
|
|
@@ -783,15 +794,17 @@ var DropdownMenu = ({
|
|
|
783
794
|
triggerRef.current = node;
|
|
784
795
|
}, [childRef]);
|
|
785
796
|
const handleTriggerKeyDown = React3.useCallback((event) => {
|
|
797
|
+
const portalWindow = resolveUEditorPortalContainer(getPortalContainer)?.ownerDocument.defaultView;
|
|
798
|
+
const scheduleFrame = portalWindow?.requestAnimationFrame.bind(portalWindow) ?? requestAnimationFrame;
|
|
786
799
|
if (!disabled) {
|
|
787
800
|
if (event.key === "ArrowDown") {
|
|
788
801
|
event.preventDefault();
|
|
789
802
|
setOpen(true);
|
|
790
|
-
|
|
803
|
+
scheduleFrame(() => focusMenuItem(0));
|
|
791
804
|
} else if (event.key === "ArrowUp") {
|
|
792
805
|
event.preventDefault();
|
|
793
806
|
setOpen(true);
|
|
794
|
-
|
|
807
|
+
scheduleFrame(() => {
|
|
795
808
|
const enabled = getEnabledMenuItems();
|
|
796
809
|
focusMenuItem(enabled.length - 1);
|
|
797
810
|
});
|
|
@@ -801,7 +814,7 @@ var DropdownMenu = ({
|
|
|
801
814
|
}
|
|
802
815
|
}
|
|
803
816
|
triggerOnKeyDown?.(event);
|
|
804
|
-
}, [disabled, focusMenuItem, getEnabledMenuItems, setOpen, triggerOnKeyDown]);
|
|
817
|
+
}, [disabled, focusMenuItem, getEnabledMenuItems, getPortalContainer, setOpen, triggerOnKeyDown]);
|
|
805
818
|
const handleTriggerClick = React3.useCallback((event) => {
|
|
806
819
|
if (openOnHover && !disabled) {
|
|
807
820
|
cancelHoverClose();
|
|
@@ -2033,6 +2046,8 @@ import {
|
|
|
2033
2046
|
List as ListIcon,
|
|
2034
2047
|
ListOrdered as ListOrderedIcon,
|
|
2035
2048
|
ListTodo,
|
|
2049
|
+
PanelTopClose,
|
|
2050
|
+
PanelTopOpen,
|
|
2036
2051
|
Quote as QuoteIcon,
|
|
2037
2052
|
RotateCcw,
|
|
2038
2053
|
SquareCheckBig,
|
|
@@ -2635,8 +2650,10 @@ function findTableRowNodeInfo(view, rowElement) {
|
|
|
2635
2650
|
return null;
|
|
2636
2651
|
}
|
|
2637
2652
|
function resolveEventElement(target) {
|
|
2638
|
-
|
|
2639
|
-
|
|
2653
|
+
const ownerDocument = target?.ownerDocument;
|
|
2654
|
+
const realm = ownerDocument?.defaultView;
|
|
2655
|
+
if (realm && target instanceof realm.Element) return target;
|
|
2656
|
+
if (realm && target instanceof realm.Node) return target.parentElement;
|
|
2640
2657
|
return null;
|
|
2641
2658
|
}
|
|
2642
2659
|
function isPointOverRenderedText(root, clientX, clientY) {
|
|
@@ -2659,22 +2676,24 @@ function isPointOverRenderedText(root, clientX, clientY) {
|
|
|
2659
2676
|
return false;
|
|
2660
2677
|
}
|
|
2661
2678
|
function getSelectionTableCell(view) {
|
|
2662
|
-
const
|
|
2679
|
+
const realm = view.dom.ownerDocument.defaultView;
|
|
2680
|
+
const browserSelection = realm?.getSelection();
|
|
2663
2681
|
const anchorElement = resolveEventElement(browserSelection?.anchorNode ?? null);
|
|
2664
2682
|
const anchorCell = anchorElement?.closest?.("th,td");
|
|
2665
|
-
if (anchorCell instanceof HTMLElement) {
|
|
2683
|
+
if (realm && anchorCell instanceof realm.HTMLElement) {
|
|
2666
2684
|
return anchorCell;
|
|
2667
2685
|
}
|
|
2668
2686
|
const { from } = view.state.selection;
|
|
2669
2687
|
const domAtPos = view.domAtPos(from);
|
|
2670
2688
|
const element = resolveEventElement(domAtPos.node);
|
|
2671
2689
|
const cell = element?.closest?.("th,td");
|
|
2672
|
-
return cell instanceof HTMLElement ? cell : null;
|
|
2690
|
+
return realm && cell instanceof realm.HTMLElement ? cell : null;
|
|
2673
2691
|
}
|
|
2674
2692
|
function resolveRowResizeTarget(cell, clientX, clientY) {
|
|
2675
2693
|
const rect = cell.getBoundingClientRect();
|
|
2676
2694
|
const row = cell.closest("tr");
|
|
2677
|
-
|
|
2695
|
+
const realm = cell.ownerDocument.defaultView;
|
|
2696
|
+
if (!realm || !(row instanceof realm.HTMLTableRowElement) || !(cell instanceof realm.HTMLTableCellElement)) {
|
|
2678
2697
|
return null;
|
|
2679
2698
|
}
|
|
2680
2699
|
const distToBottom = Math.abs(clientY - rect.bottom);
|
|
@@ -2689,10 +2708,10 @@ function resolveRowResizeTarget(cell, clientX, clientY) {
|
|
|
2689
2708
|
}
|
|
2690
2709
|
if (distToTop <= TABLE_RESIZE_HIT_ZONE) {
|
|
2691
2710
|
const prevRow = row.previousElementSibling;
|
|
2692
|
-
if (prevRow instanceof HTMLTableRowElement) {
|
|
2711
|
+
if (prevRow instanceof realm.HTMLTableRowElement) {
|
|
2693
2712
|
const cellIndex = cell.cellIndex;
|
|
2694
2713
|
const prevCell = prevRow.children[cellIndex] ?? prevRow.firstElementChild;
|
|
2695
|
-
if (prevCell instanceof HTMLTableCellElement) {
|
|
2714
|
+
if (prevCell instanceof realm.HTMLTableCellElement) {
|
|
2696
2715
|
return { row: prevRow, cell: prevCell };
|
|
2697
2716
|
}
|
|
2698
2717
|
}
|
|
@@ -2702,7 +2721,8 @@ function resolveRowResizeTarget(cell, clientX, clientY) {
|
|
|
2702
2721
|
function resolveColumnResizeTarget(cell, clientX, clientY) {
|
|
2703
2722
|
const rect = cell.getBoundingClientRect();
|
|
2704
2723
|
const row = cell.closest("tr");
|
|
2705
|
-
|
|
2724
|
+
const realm = cell.ownerDocument.defaultView;
|
|
2725
|
+
if (!realm || !(row instanceof realm.HTMLTableRowElement) || !(cell instanceof realm.HTMLTableCellElement)) {
|
|
2706
2726
|
return null;
|
|
2707
2727
|
}
|
|
2708
2728
|
const distToRight = Math.abs(clientX - rect.right);
|
|
@@ -2717,7 +2737,7 @@ function resolveColumnResizeTarget(cell, clientX, clientY) {
|
|
|
2717
2737
|
}
|
|
2718
2738
|
if (distToLeft <= TABLE_RESIZE_HIT_ZONE) {
|
|
2719
2739
|
const prevCell = cell.previousElementSibling;
|
|
2720
|
-
if (prevCell instanceof HTMLTableCellElement) {
|
|
2740
|
+
if (prevCell instanceof realm.HTMLTableCellElement) {
|
|
2721
2741
|
return { row, cell: prevCell };
|
|
2722
2742
|
}
|
|
2723
2743
|
}
|
|
@@ -3199,20 +3219,22 @@ import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-run
|
|
|
3199
3219
|
function getTableAnchorPos(editor) {
|
|
3200
3220
|
const tableInfo = findTableNodeInfoFromState(editor.state);
|
|
3201
3221
|
if (tableInfo) return editor.state.selection.from;
|
|
3202
|
-
const
|
|
3222
|
+
const editorDocument = editor.view.dom.ownerDocument;
|
|
3223
|
+
const editorWindow = editorDocument.defaultView;
|
|
3224
|
+
const selectionAnchor = resolveEventElement(editorWindow?.getSelection()?.anchorNode ?? null);
|
|
3203
3225
|
const selectionCell = selectionAnchor?.closest?.("th,td");
|
|
3204
|
-
if (selectionCell instanceof HTMLTableCellElement && editor.view.dom.contains(selectionCell)) {
|
|
3226
|
+
if (editorWindow && selectionCell instanceof editorWindow.HTMLTableCellElement && editor.view.dom.contains(selectionCell)) {
|
|
3205
3227
|
return editor.view.posAtDOM(selectionCell, 0) + 1;
|
|
3206
3228
|
}
|
|
3207
|
-
const activeElement =
|
|
3229
|
+
const activeElement = editorWindow && editorDocument.activeElement instanceof editorWindow.Element ? editorDocument.activeElement : null;
|
|
3208
3230
|
const activeCell = activeElement?.closest?.("th,td");
|
|
3209
|
-
if (activeCell instanceof HTMLTableCellElement && editor.view.dom.contains(activeCell)) {
|
|
3231
|
+
if (editorWindow && activeCell instanceof editorWindow.HTMLTableCellElement && editor.view.dom.contains(activeCell)) {
|
|
3210
3232
|
return editor.view.posAtDOM(activeCell, 0) + 1;
|
|
3211
3233
|
}
|
|
3212
3234
|
const tables = editor.view.dom.querySelectorAll("table");
|
|
3213
3235
|
if (tables.length !== 1) return null;
|
|
3214
3236
|
const firstCell = tables[0]?.querySelector("th,td");
|
|
3215
|
-
return firstCell instanceof HTMLTableCellElement ? editor.view.posAtDOM(firstCell, 0) + 1 : null;
|
|
3237
|
+
return editorWindow && firstCell instanceof editorWindow.HTMLTableCellElement ? editor.view.posAtDOM(firstCell, 0) + 1 : null;
|
|
3216
3238
|
}
|
|
3217
3239
|
var EDITOR_UI_ACTIVE_MARKS = [
|
|
3218
3240
|
"blockquote",
|
|
@@ -3404,6 +3426,8 @@ function applyTableCellAttribute(editor, name, value) {
|
|
|
3404
3426
|
var EditorToolbar = ({
|
|
3405
3427
|
editor,
|
|
3406
3428
|
variant,
|
|
3429
|
+
isMenuBarVisible,
|
|
3430
|
+
onToggleMenuBar,
|
|
3407
3431
|
uploadImage,
|
|
3408
3432
|
imageInsertMode = "base64",
|
|
3409
3433
|
maxImageFileSize = DEFAULT_UEDITOR_IMAGE_MAX_FILE_SIZE,
|
|
@@ -3578,6 +3602,15 @@ var EditorToolbar = ({
|
|
|
3578
3602
|
)
|
|
3579
3603
|
] })
|
|
3580
3604
|
}
|
|
3605
|
+
),
|
|
3606
|
+
onToggleMenuBar && /* @__PURE__ */ jsx7(
|
|
3607
|
+
ToolbarButton,
|
|
3608
|
+
{
|
|
3609
|
+
onClick: onToggleMenuBar,
|
|
3610
|
+
active: isMenuBarVisible,
|
|
3611
|
+
title: t(isMenuBarVisible ? "toolbar.hideMenuBar" : "toolbar.showMenuBar"),
|
|
3612
|
+
children: isMenuBarVisible ? /* @__PURE__ */ jsx7(PanelTopClose, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx7(PanelTopOpen, { className: "h-4 w-4" })
|
|
3613
|
+
}
|
|
3581
3614
|
)
|
|
3582
3615
|
] });
|
|
3583
3616
|
}
|
|
@@ -3586,7 +3619,7 @@ var EditorToolbar = ({
|
|
|
3586
3619
|
"div",
|
|
3587
3620
|
{
|
|
3588
3621
|
role: "toolbar",
|
|
3589
|
-
className: "flex min-h-9 flex-
|
|
3622
|
+
className: "flex min-h-9 flex-wrap items-center gap-0.5 border-b border-[rgba(196,197,213,0.6)] bg-[#F4F4F4] px-1.5 py-1 dark:bg-muted/60",
|
|
3590
3623
|
children: [
|
|
3591
3624
|
isFull && /* @__PURE__ */ jsx7(
|
|
3592
3625
|
DropdownMenu,
|
|
@@ -4301,7 +4334,16 @@ var EditorToolbar = ({
|
|
|
4301
4334
|
children: /* @__PURE__ */ jsx7(TableCellsMerge, { className: "w-4 h-4" })
|
|
4302
4335
|
}
|
|
4303
4336
|
)
|
|
4304
|
-
] })
|
|
4337
|
+
] }),
|
|
4338
|
+
onToggleMenuBar && /* @__PURE__ */ jsx7(
|
|
4339
|
+
ToolbarButton,
|
|
4340
|
+
{
|
|
4341
|
+
onClick: onToggleMenuBar,
|
|
4342
|
+
active: isMenuBarVisible,
|
|
4343
|
+
title: t(isMenuBarVisible ? "toolbar.hideMenuBar" : "toolbar.showMenuBar"),
|
|
4344
|
+
children: isMenuBarVisible ? /* @__PURE__ */ jsx7(PanelTopClose, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx7(PanelTopOpen, { className: "h-4 w-4" })
|
|
4345
|
+
}
|
|
4346
|
+
)
|
|
4305
4347
|
]
|
|
4306
4348
|
}
|
|
4307
4349
|
);
|
|
@@ -4586,4 +4628,4 @@ export {
|
|
|
4586
4628
|
EditorToolbar,
|
|
4587
4629
|
UEDITOR_PROSEMIRROR_CLASS_NAME
|
|
4588
4630
|
};
|
|
4589
|
-
//# sourceMappingURL=chunk-
|
|
4631
|
+
//# sourceMappingURL=chunk-WEGE3MZ5.js.map
|