@underverse-ui/underverse 2.0.35 → 2.0.37
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/DatePicker-FDOTQMNL.js +15 -0
- package/dist/{EmojiPicker-6H52Q4YE.js → EmojiPicker-Z7QPW4DA.js} +5 -4
- package/dist/EmojiPicker-Z7QPW4DA.js.map +1 -0
- package/dist/chunk-5GMQ23IU.js +719 -0
- package/dist/chunk-5GMQ23IU.js.map +1 -0
- package/dist/{chunk-L73HBI6E.js → chunk-5VCM2Z7M.js} +6 -4
- package/dist/{chunk-L73HBI6E.js.map → chunk-5VCM2Z7M.js.map} +1 -1
- package/dist/{chunk-H4AVZA4K.js → chunk-6K6CKZUL.js} +469 -360
- package/dist/chunk-6K6CKZUL.js.map +1 -0
- package/dist/{chunk-6FAHXNDQ.js → chunk-6XQTRIP6.js} +10 -349
- package/dist/chunk-6XQTRIP6.js.map +1 -0
- package/dist/chunk-EN33T3LJ.js +358 -0
- package/dist/chunk-EN33T3LJ.js.map +1 -0
- package/dist/{chunk-F2P3DJSC.js → chunk-GZ7EDNGF.js} +333 -1022
- package/dist/chunk-GZ7EDNGF.js.map +1 -0
- package/dist/{chunk-WFQV7XFC.js → chunk-JABD2ONI.js} +3 -3
- package/dist/chunk-JG3U26V6.js +1692 -0
- package/dist/chunk-JG3U26V6.js.map +1 -0
- package/dist/{chunk-W3QTP2DM.js → chunk-TSBKJELM.js} +2 -2
- package/dist/index.cjs +13513 -13323
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +1942 -3569
- package/dist/index.js.map +1 -1
- package/dist/{menu-bar-MUISXLMR.js → menu-bar-VXAMTP3E.js} +6 -4
- package/dist/{menu-bar-MUISXLMR.js.map → menu-bar-VXAMTP3E.js.map} +1 -1
- package/dist/ueditor.cjs +2803 -1098
- package/dist/ueditor.cjs.map +1 -1
- package/dist/ueditor.js +6 -4
- package/package.json +1 -1
- package/dist/chunk-6FAHXNDQ.js.map +0 -1
- package/dist/chunk-F2P3DJSC.js.map +0 -1
- package/dist/chunk-H4AVZA4K.js.map +0 -1
- /package/dist/{EmojiPicker-6H52Q4YE.js.map → DatePicker-FDOTQMNL.js.map} +0 -0
- /package/dist/{chunk-WFQV7XFC.js.map → chunk-JABD2ONI.js.map} +0 -0
- /package/dist/{chunk-W3QTP2DM.js.map → chunk-TSBKJELM.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EmojiGridButton,
|
|
3
3
|
formatEmojiCountLabel
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-TSBKJELM.js";
|
|
5
5
|
import {
|
|
6
6
|
COLUMN_RESIZE_LINE_THICKNESS,
|
|
7
7
|
CellBgColorIcon,
|
|
@@ -17,9 +17,11 @@ import {
|
|
|
17
17
|
HighlightColorIcon,
|
|
18
18
|
LinkInput,
|
|
19
19
|
MIN_TABLE_ROW_HEIGHT,
|
|
20
|
-
Popover,
|
|
21
20
|
ROW_RESIZE_LINE_THICKNESS,
|
|
22
21
|
TABLE_WIDTH_BASIS_POINTS,
|
|
22
|
+
TableVerticalAlignBottomIcon,
|
|
23
|
+
TableVerticalAlignMiddleIcon,
|
|
24
|
+
TableVerticalAlignTopIcon,
|
|
23
25
|
TextColorIcon,
|
|
24
26
|
ToolbarButton,
|
|
25
27
|
UEDITOR_PROSEMIRROR_CLASS_NAME,
|
|
@@ -94,9 +96,14 @@ import {
|
|
|
94
96
|
sanitizeUEditorUrl,
|
|
95
97
|
useEditorColors,
|
|
96
98
|
useSharedEditorUiRenderState
|
|
97
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-GZ7EDNGF.js";
|
|
100
|
+
import {
|
|
101
|
+
Tooltip
|
|
102
|
+
} from "./chunk-EN33T3LJ.js";
|
|
103
|
+
import {
|
|
104
|
+
Popover
|
|
105
|
+
} from "./chunk-5GMQ23IU.js";
|
|
98
106
|
import {
|
|
99
|
-
Tooltip,
|
|
100
107
|
UEditorPortalProvider,
|
|
101
108
|
cn,
|
|
102
109
|
formControlGroupOutlineClass,
|
|
@@ -104,7 +111,7 @@ import {
|
|
|
104
111
|
resolveUEditorPortalContainer,
|
|
105
112
|
useSmartTranslations,
|
|
106
113
|
useUEditorPortalContainerGetter
|
|
107
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-6XQTRIP6.js";
|
|
108
115
|
|
|
109
116
|
// src/components/UEditor/prepare-content-for-save.ts
|
|
110
117
|
var MIME_EXTENSION_MAP = {
|
|
@@ -522,11 +529,11 @@ async function prepareUEditorContentForSave({
|
|
|
522
529
|
}
|
|
523
530
|
|
|
524
531
|
// src/components/UEditor/UEditor.tsx
|
|
525
|
-
import
|
|
532
|
+
import React17, { useEffect as useEffect10, useImperativeHandle as useImperativeHandle4, useMemo as useMemo2, useRef as useRef10 } from "react";
|
|
526
533
|
import { useEditor, EditorContent } from "@tiptap/react";
|
|
527
534
|
|
|
528
535
|
// src/components/UEditor/extensions.ts
|
|
529
|
-
import { mergeAttributes as
|
|
536
|
+
import { mergeAttributes as mergeAttributes9 } from "@tiptap/core";
|
|
530
537
|
import { Document } from "@tiptap/extension-document";
|
|
531
538
|
import { Paragraph } from "@tiptap/extension-paragraph";
|
|
532
539
|
import { Text } from "@tiptap/extension-text";
|
|
@@ -544,7 +551,7 @@ import { TaskItem } from "@tiptap/extension-task-item";
|
|
|
544
551
|
import { Blockquote } from "@tiptap/extension-blockquote";
|
|
545
552
|
import { Code } from "@tiptap/extension-code";
|
|
546
553
|
import { wrappingInputRule } from "@tiptap/core";
|
|
547
|
-
import { ReactNodeViewRenderer as
|
|
554
|
+
import { ReactNodeViewRenderer as ReactNodeViewRenderer8 } from "@tiptap/react";
|
|
548
555
|
|
|
549
556
|
// src/components/UEditor/callout.ts
|
|
550
557
|
import { Node, mergeAttributes } from "@tiptap/core";
|
|
@@ -557,7 +564,7 @@ import { NodeViewWrapper, NodeViewContent } from "@tiptap/react";
|
|
|
557
564
|
import React from "react";
|
|
558
565
|
import { jsx } from "react/jsx-runtime";
|
|
559
566
|
var LazyBaseEmojiPicker = React.lazy(async () => {
|
|
560
|
-
const { EmojiPicker: EmojiPicker2 } = await import("./EmojiPicker-
|
|
567
|
+
const { EmojiPicker: EmojiPicker2 } = await import("./EmojiPicker-Z7QPW4DA.js");
|
|
561
568
|
return { default: EmojiPicker2 };
|
|
562
569
|
});
|
|
563
570
|
var EmojiPicker = ({ onSelect }) => {
|
|
@@ -1647,6 +1654,96 @@ var FormRadio = Node5.create({
|
|
|
1647
1654
|
}
|
|
1648
1655
|
});
|
|
1649
1656
|
|
|
1657
|
+
// src/components/UEditor/date-picker-node.ts
|
|
1658
|
+
import { Node as Node6, mergeAttributes as mergeAttributes6 } from "@tiptap/core";
|
|
1659
|
+
import { ReactNodeViewRenderer as ReactNodeViewRenderer6 } from "@tiptap/react";
|
|
1660
|
+
|
|
1661
|
+
// src/components/UEditor/DatePickerNodeView.tsx
|
|
1662
|
+
import React5 from "react";
|
|
1663
|
+
import { Calendar } from "lucide-react";
|
|
1664
|
+
import { NodeViewWrapper as NodeViewWrapper6 } from "@tiptap/react";
|
|
1665
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1666
|
+
var LazyDatePicker = React5.lazy(async () => {
|
|
1667
|
+
const { DatePicker } = await import("./DatePicker-FDOTQMNL.js");
|
|
1668
|
+
return { default: DatePicker };
|
|
1669
|
+
});
|
|
1670
|
+
function isDateValue(value) {
|
|
1671
|
+
return typeof value === "string" && /^\d{4}-\d{2}-\d{2}$/.test(value);
|
|
1672
|
+
}
|
|
1673
|
+
function parseDateValue(value) {
|
|
1674
|
+
if (!isDateValue(value)) return void 0;
|
|
1675
|
+
const [year, month, day] = value.split("-").map(Number);
|
|
1676
|
+
return new Date(year, month - 1, day);
|
|
1677
|
+
}
|
|
1678
|
+
function formatDateValue(value) {
|
|
1679
|
+
const year = value.getFullYear();
|
|
1680
|
+
const month = String(value.getMonth() + 1).padStart(2, "0");
|
|
1681
|
+
const day = String(value.getDate()).padStart(2, "0");
|
|
1682
|
+
return `${year}-${month}-${day}`;
|
|
1683
|
+
}
|
|
1684
|
+
var DatePickerNodeView = ({ node, updateAttributes, editor, selected }) => {
|
|
1685
|
+
const date = isDateValue(node.attrs.date) ? node.attrs.date : "";
|
|
1686
|
+
const isEditable = editor.isEditable;
|
|
1687
|
+
return /* @__PURE__ */ jsx7(
|
|
1688
|
+
NodeViewWrapper6,
|
|
1689
|
+
{
|
|
1690
|
+
as: "span",
|
|
1691
|
+
"data-type": "date-picker",
|
|
1692
|
+
"data-date": date || void 0,
|
|
1693
|
+
"data-ueditor-date-picker": "true",
|
|
1694
|
+
className: selected ? "inline-flex items-center align-middle mx-1 rounded ring-2 ring-primary/30" : "inline-flex items-center align-middle mx-1",
|
|
1695
|
+
children: /* @__PURE__ */ jsx7("span", { contentEditable: false, children: /* @__PURE__ */ jsx7(React5.Suspense, { fallback: /* @__PURE__ */ jsx7(Calendar, { className: "h-4 w-4", "aria-hidden": "true" }), children: /* @__PURE__ */ jsx7(
|
|
1696
|
+
LazyDatePicker,
|
|
1697
|
+
{
|
|
1698
|
+
iconOnly: true,
|
|
1699
|
+
iconOnlyDateFormat: "year-month-day",
|
|
1700
|
+
value: parseDateValue(date),
|
|
1701
|
+
disabled: !isEditable,
|
|
1702
|
+
getPortalContainer: () => editor.view.dom.ownerDocument.body,
|
|
1703
|
+
onChange: (value) => updateAttributes({ date: value ? formatDateValue(value) : "" })
|
|
1704
|
+
}
|
|
1705
|
+
) }) })
|
|
1706
|
+
}
|
|
1707
|
+
);
|
|
1708
|
+
};
|
|
1709
|
+
|
|
1710
|
+
// src/components/UEditor/date-picker-node.ts
|
|
1711
|
+
var DatePickerNode = Node6.create({
|
|
1712
|
+
name: "datePicker",
|
|
1713
|
+
group: "inline",
|
|
1714
|
+
inline: true,
|
|
1715
|
+
atom: true,
|
|
1716
|
+
addOptions() {
|
|
1717
|
+
return { HTMLAttributes: {} };
|
|
1718
|
+
},
|
|
1719
|
+
addAttributes() {
|
|
1720
|
+
return {
|
|
1721
|
+
date: {
|
|
1722
|
+
default: "",
|
|
1723
|
+
parseHTML: (element) => element.getAttribute("data-date") || "",
|
|
1724
|
+
renderHTML: (attributes) => attributes.date ? { "data-date": attributes.date } : {}
|
|
1725
|
+
}
|
|
1726
|
+
};
|
|
1727
|
+
},
|
|
1728
|
+
parseHTML() {
|
|
1729
|
+
return [{ tag: 'span[data-type="date-picker"]' }];
|
|
1730
|
+
},
|
|
1731
|
+
renderHTML({ HTMLAttributes }) {
|
|
1732
|
+
return [
|
|
1733
|
+
"span",
|
|
1734
|
+
mergeAttributes6(this.options.HTMLAttributes, HTMLAttributes, { "data-type": "date-picker" })
|
|
1735
|
+
];
|
|
1736
|
+
},
|
|
1737
|
+
addNodeView() {
|
|
1738
|
+
return ReactNodeViewRenderer6(DatePickerNodeView);
|
|
1739
|
+
},
|
|
1740
|
+
addCommands() {
|
|
1741
|
+
return {
|
|
1742
|
+
setDatePicker: (attributes) => ({ commands }) => commands.insertContent({ type: this.name, attrs: attributes })
|
|
1743
|
+
};
|
|
1744
|
+
}
|
|
1745
|
+
});
|
|
1746
|
+
|
|
1650
1747
|
// src/components/UEditor/extensions.ts
|
|
1651
1748
|
import { CodeBlockLowlight } from "@tiptap/extension-code-block-lowlight";
|
|
1652
1749
|
import { History } from "@tiptap/extension-history";
|
|
@@ -1668,7 +1765,7 @@ import { Gapcursor } from "@tiptap/extension-gapcursor";
|
|
|
1668
1765
|
import { Extension } from "@tiptap/core";
|
|
1669
1766
|
import { Suggestion } from "@tiptap/suggestion";
|
|
1670
1767
|
import { ReactRenderer } from "@tiptap/react";
|
|
1671
|
-
import
|
|
1768
|
+
import React6, { forwardRef, useEffect as useEffect3, useImperativeHandle, useRef as useRef2 } from "react";
|
|
1672
1769
|
import {
|
|
1673
1770
|
FileCode,
|
|
1674
1771
|
Heading1,
|
|
@@ -1686,7 +1783,8 @@ import {
|
|
|
1686
1783
|
Paperclip,
|
|
1687
1784
|
CheckSquare,
|
|
1688
1785
|
CircleCheckBig,
|
|
1689
|
-
CircleDot
|
|
1786
|
+
CircleDot,
|
|
1787
|
+
CalendarDays
|
|
1690
1788
|
} from "lucide-react";
|
|
1691
1789
|
|
|
1692
1790
|
// src/components/UEditor/tippy-interop.ts
|
|
@@ -1713,7 +1811,7 @@ function setTippyReferenceClientRect(instance, clientRect) {
|
|
|
1713
1811
|
}
|
|
1714
1812
|
|
|
1715
1813
|
// src/components/UEditor/slash-command.tsx
|
|
1716
|
-
import { jsx as
|
|
1814
|
+
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1717
1815
|
var DEFAULT_MESSAGES = {
|
|
1718
1816
|
noResults: "No results",
|
|
1719
1817
|
basicBlocks: "Basic Blocks",
|
|
@@ -1737,6 +1835,8 @@ var DEFAULT_MESSAGES = {
|
|
|
1737
1835
|
codeBlockDesc: "Display code with syntax highlighting",
|
|
1738
1836
|
divider: "Divider",
|
|
1739
1837
|
dividerDesc: "Visually divide blocks",
|
|
1838
|
+
date: "Date",
|
|
1839
|
+
dateDesc: "Insert a date from the calendar",
|
|
1740
1840
|
table: "Table",
|
|
1741
1841
|
tableDesc: "Insert a table",
|
|
1742
1842
|
callout: "Callout",
|
|
@@ -1753,9 +1853,9 @@ var DEFAULT_MESSAGES = {
|
|
|
1753
1853
|
formRadioDesc: "Insert an interactive radio button field"
|
|
1754
1854
|
};
|
|
1755
1855
|
function useResettingIndex(resetToken) {
|
|
1756
|
-
const [state, setState] =
|
|
1856
|
+
const [state, setState] = React6.useState({ resetToken, index: 0 });
|
|
1757
1857
|
const selectedIndex = Object.is(state.resetToken, resetToken) ? state.index : 0;
|
|
1758
|
-
const setSelectedIndex =
|
|
1858
|
+
const setSelectedIndex = React6.useCallback((nextIndex) => {
|
|
1759
1859
|
setState((prev) => {
|
|
1760
1860
|
const prevIndex = Object.is(prev.resetToken, resetToken) ? prev.index : 0;
|
|
1761
1861
|
return {
|
|
@@ -1794,6 +1894,8 @@ function buildSlashCommandMessages(translate) {
|
|
|
1794
1894
|
codeBlockDesc: translate("slashCommand.codeBlockDesc"),
|
|
1795
1895
|
divider: translate("slashCommand.divider") || "Divider",
|
|
1796
1896
|
dividerDesc: translate("slashCommand.dividerDesc") || "Visually divide blocks",
|
|
1897
|
+
date: translate("slashCommand.date") || "Date",
|
|
1898
|
+
dateDesc: translate("slashCommand.dateDesc") || "Insert a date from the calendar",
|
|
1797
1899
|
table: translate("slashCommand.table") || "Table",
|
|
1798
1900
|
tableDesc: translate("slashCommand.tableDesc") || "Insert a table",
|
|
1799
1901
|
callout: translate("slashCommand.callout") || "Callout",
|
|
@@ -1896,6 +1998,15 @@ function buildSlashCommandItems({
|
|
|
1896
1998
|
getCommandChain(editor, range).setHorizontalRule().run();
|
|
1897
1999
|
})
|
|
1898
2000
|
},
|
|
2001
|
+
{
|
|
2002
|
+
icon: CalendarDays,
|
|
2003
|
+
title: messages.date,
|
|
2004
|
+
description: messages.dateDesc,
|
|
2005
|
+
searchTerms: ["calendar", "date"],
|
|
2006
|
+
command: run(({ editor, range }) => {
|
|
2007
|
+
getCommandChain(editor, range).setDatePicker().run();
|
|
2008
|
+
})
|
|
2009
|
+
},
|
|
1899
2010
|
{
|
|
1900
2011
|
icon: Table,
|
|
1901
2012
|
title: messages.table,
|
|
@@ -1983,7 +2094,7 @@ function buildSlashCommandItems({
|
|
|
1983
2094
|
var SlashCommandList = forwardRef((props, ref) => {
|
|
1984
2095
|
const [selectedIndex, setSelectedIndex] = useResettingIndex(props.items);
|
|
1985
2096
|
const listRef = useRef2(null);
|
|
1986
|
-
const listId =
|
|
2097
|
+
const listId = React6.useId();
|
|
1987
2098
|
useEffect3(() => {
|
|
1988
2099
|
const selectedElement = listRef.current?.querySelector(`[data-index="${selectedIndex}"]`);
|
|
1989
2100
|
selectedElement?.scrollIntoView({ block: "nearest" });
|
|
@@ -2014,7 +2125,7 @@ var SlashCommandList = forwardRef((props, ref) => {
|
|
|
2014
2125
|
}
|
|
2015
2126
|
}));
|
|
2016
2127
|
if (props.items.length === 0) {
|
|
2017
|
-
return /* @__PURE__ */
|
|
2128
|
+
return /* @__PURE__ */ jsx8("div", { role: "status", className: "w-72 p-4 text-center text-sm text-muted-foreground", children: props.messages.noResults });
|
|
2018
2129
|
}
|
|
2019
2130
|
return /* @__PURE__ */ jsxs5(
|
|
2020
2131
|
"div",
|
|
@@ -2026,8 +2137,8 @@ var SlashCommandList = forwardRef((props, ref) => {
|
|
|
2026
2137
|
"aria-activedescendant": `${listId}-option-${selectedIndex}`,
|
|
2027
2138
|
className: "w-72 max-h-80 overflow-y-auto bg-card border border-border/50 rounded-2xl shadow-lg",
|
|
2028
2139
|
children: [
|
|
2029
|
-
/* @__PURE__ */
|
|
2030
|
-
/* @__PURE__ */
|
|
2140
|
+
/* @__PURE__ */ jsx8("div", { className: "px-3 py-2 border-b", children: /* @__PURE__ */ jsx8("span", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: props.messages.basicBlocks }) }),
|
|
2141
|
+
/* @__PURE__ */ jsx8("div", { className: "p-1", children: props.items.map((item, index) => /* @__PURE__ */ jsxs5(
|
|
2031
2142
|
"button",
|
|
2032
2143
|
{
|
|
2033
2144
|
type: "button",
|
|
@@ -2043,19 +2154,19 @@ var SlashCommandList = forwardRef((props, ref) => {
|
|
|
2043
2154
|
selectedIndex === index ? "bg-accent" : "hover:bg-accent/50"
|
|
2044
2155
|
),
|
|
2045
2156
|
children: [
|
|
2046
|
-
/* @__PURE__ */
|
|
2157
|
+
/* @__PURE__ */ jsx8(
|
|
2047
2158
|
"div",
|
|
2048
2159
|
{
|
|
2049
2160
|
className: cn(
|
|
2050
2161
|
"flex items-center justify-center w-10 h-10 rounded-lg mr-3 transition-colors",
|
|
2051
2162
|
selectedIndex === index ? "bg-primary/10" : "bg-muted/50 group-hover:bg-muted"
|
|
2052
2163
|
),
|
|
2053
|
-
children: /* @__PURE__ */
|
|
2164
|
+
children: /* @__PURE__ */ jsx8(item.icon, { "aria-hidden": "true", className: cn("w-5 h-5", selectedIndex === index ? "text-primary" : "text-muted-foreground") })
|
|
2054
2165
|
}
|
|
2055
2166
|
),
|
|
2056
2167
|
/* @__PURE__ */ jsxs5("div", { className: "text-left", children: [
|
|
2057
|
-
/* @__PURE__ */
|
|
2058
|
-
/* @__PURE__ */
|
|
2168
|
+
/* @__PURE__ */ jsx8("div", { className: cn("text-sm font-medium", selectedIndex === index && "text-primary"), children: item.title }),
|
|
2169
|
+
/* @__PURE__ */ jsx8("div", { className: "text-xs text-muted-foreground", children: item.description })
|
|
2059
2170
|
] })
|
|
2060
2171
|
]
|
|
2061
2172
|
},
|
|
@@ -2147,13 +2258,13 @@ import { Extension as Extension2 } from "@tiptap/core";
|
|
|
2147
2258
|
import { Suggestion as Suggestion2 } from "@tiptap/suggestion";
|
|
2148
2259
|
import { ReactRenderer as ReactRenderer2 } from "@tiptap/react";
|
|
2149
2260
|
import { PluginKey as PluginKey2 } from "@tiptap/pm/state";
|
|
2150
|
-
import
|
|
2261
|
+
import React7, { forwardRef as forwardRef2, useImperativeHandle as useImperativeHandle2 } from "react";
|
|
2151
2262
|
import { Smile } from "lucide-react";
|
|
2152
|
-
import { jsx as
|
|
2263
|
+
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2153
2264
|
function useResettingIndex2(resetToken) {
|
|
2154
|
-
const [state, setState] =
|
|
2265
|
+
const [state, setState] = React7.useState({ resetToken, index: 0 });
|
|
2155
2266
|
const selectedIndex = Object.is(state.resetToken, resetToken) ? state.index : 0;
|
|
2156
|
-
const setSelectedIndex =
|
|
2267
|
+
const setSelectedIndex = React7.useCallback((nextIndex) => {
|
|
2157
2268
|
setState((prev) => {
|
|
2158
2269
|
const prevIndex = Object.is(prev.resetToken, resetToken) ? prev.index : 0;
|
|
2159
2270
|
return {
|
|
@@ -2167,7 +2278,7 @@ function useResettingIndex2(resetToken) {
|
|
|
2167
2278
|
var EmojiList = forwardRef2((props, ref) => {
|
|
2168
2279
|
const t = useSmartTranslations("UEditor");
|
|
2169
2280
|
const [selectedIndex, setSelectedIndex] = useResettingIndex2(props.items);
|
|
2170
|
-
const listId =
|
|
2281
|
+
const listId = React7.useId();
|
|
2171
2282
|
const showingCountLabel = formatEmojiCountLabel(t("emojiSuggestion.showingCount"), 64, props.items.length);
|
|
2172
2283
|
useImperativeHandle2(ref, () => ({
|
|
2173
2284
|
onKeyDown: (keyProps) => {
|
|
@@ -2200,7 +2311,7 @@ var EmojiList = forwardRef2((props, ref) => {
|
|
|
2200
2311
|
}
|
|
2201
2312
|
}));
|
|
2202
2313
|
if (props.items.length === 0) {
|
|
2203
|
-
return /* @__PURE__ */
|
|
2314
|
+
return /* @__PURE__ */ jsx9("div", { role: "status", className: "w-80 p-4 text-center text-sm text-muted-foreground bg-card border border-border/50 rounded-2xl shadow-lg", children: t("emojiSuggestion.noResults") });
|
|
2204
2315
|
}
|
|
2205
2316
|
return /* @__PURE__ */ jsxs6(
|
|
2206
2317
|
"div",
|
|
@@ -2211,12 +2322,12 @@ var EmojiList = forwardRef2((props, ref) => {
|
|
|
2211
2322
|
"aria-activedescendant": `${listId}-option-${selectedIndex}`,
|
|
2212
2323
|
className: "w-80 max-h-80 overflow-y-auto bg-card border border-border/50 rounded-2xl shadow-lg",
|
|
2213
2324
|
children: [
|
|
2214
|
-
/* @__PURE__ */
|
|
2215
|
-
/* @__PURE__ */
|
|
2216
|
-
/* @__PURE__ */
|
|
2325
|
+
/* @__PURE__ */ jsx9("div", { className: "px-3 py-2 border-b bg-muted/30", children: /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
|
|
2326
|
+
/* @__PURE__ */ jsx9(Smile, { className: "w-4 h-4 text-primary" }),
|
|
2327
|
+
/* @__PURE__ */ jsx9("span", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: t("emojiSuggestion.title") })
|
|
2217
2328
|
] }) }),
|
|
2218
2329
|
/* @__PURE__ */ jsxs6("div", { className: "p-3", children: [
|
|
2219
|
-
/* @__PURE__ */
|
|
2330
|
+
/* @__PURE__ */ jsx9("div", { className: "grid grid-cols-8 gap-1", children: props.items.slice(0, 64).map((item, index) => /* @__PURE__ */ jsx9(
|
|
2220
2331
|
EmojiGridButton,
|
|
2221
2332
|
{
|
|
2222
2333
|
id: `${listId}-option-${index}`,
|
|
@@ -2231,7 +2342,7 @@ var EmojiList = forwardRef2((props, ref) => {
|
|
|
2231
2342
|
},
|
|
2232
2343
|
item.name
|
|
2233
2344
|
)) }),
|
|
2234
|
-
props.items.length > 64 && /* @__PURE__ */
|
|
2345
|
+
props.items.length > 64 && /* @__PURE__ */ jsx9("div", { className: "mt-2 text-xs text-center text-muted-foreground", children: showingCountLabel })
|
|
2235
2346
|
] })
|
|
2236
2347
|
]
|
|
2237
2348
|
}
|
|
@@ -2325,9 +2436,9 @@ import { Extension as Extension3 } from "@tiptap/core";
|
|
|
2325
2436
|
import { Suggestion as Suggestion3 } from "@tiptap/suggestion";
|
|
2326
2437
|
import { ReactRenderer as ReactRenderer3 } from "@tiptap/react";
|
|
2327
2438
|
import { PluginKey as PluginKey3 } from "@tiptap/pm/state";
|
|
2328
|
-
import
|
|
2439
|
+
import React8, { forwardRef as forwardRef3, useImperativeHandle as useImperativeHandle3 } from "react";
|
|
2329
2440
|
import { Sigma } from "lucide-react";
|
|
2330
|
-
import { jsx as
|
|
2441
|
+
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2331
2442
|
var FORMULA_FUNCTIONS = [
|
|
2332
2443
|
{
|
|
2333
2444
|
name: "SUM",
|
|
@@ -2380,9 +2491,9 @@ function isFormulaFunctionSuggestionQuery(query) {
|
|
|
2380
2491
|
}
|
|
2381
2492
|
var FormulaSuggestionList = forwardRef3((props, ref) => {
|
|
2382
2493
|
const t = useSmartTranslations("UEditor");
|
|
2383
|
-
const [selectedIndex, setSelectedIndex] =
|
|
2384
|
-
const listId =
|
|
2385
|
-
|
|
2494
|
+
const [selectedIndex, setSelectedIndex] = React8.useState(0);
|
|
2495
|
+
const listId = React8.useId();
|
|
2496
|
+
React8.useEffect(() => {
|
|
2386
2497
|
setSelectedIndex(0);
|
|
2387
2498
|
}, [props.items]);
|
|
2388
2499
|
useImperativeHandle3(ref, () => ({
|
|
@@ -2407,7 +2518,7 @@ var FormulaSuggestionList = forwardRef3((props, ref) => {
|
|
|
2407
2518
|
}
|
|
2408
2519
|
}));
|
|
2409
2520
|
if (props.items.length === 0) {
|
|
2410
|
-
return /* @__PURE__ */
|
|
2521
|
+
return /* @__PURE__ */ jsx10("div", { role: "status", className: "w-72 p-3 text-sm text-muted-foreground bg-card border border-border/50 rounded-lg shadow-lg", children: t("formulaSuggestion.noResults") });
|
|
2411
2522
|
}
|
|
2412
2523
|
return /* @__PURE__ */ jsxs7(
|
|
2413
2524
|
"div",
|
|
@@ -2418,11 +2529,11 @@ var FormulaSuggestionList = forwardRef3((props, ref) => {
|
|
|
2418
2529
|
"aria-activedescendant": `${listId}-option-${selectedIndex}`,
|
|
2419
2530
|
className: "w-72 max-h-80 overflow-y-auto bg-card border border-border/50 rounded-lg shadow-lg",
|
|
2420
2531
|
children: [
|
|
2421
|
-
/* @__PURE__ */
|
|
2422
|
-
/* @__PURE__ */
|
|
2423
|
-
/* @__PURE__ */
|
|
2532
|
+
/* @__PURE__ */ jsx10("div", { className: "px-3 py-2 border-b bg-muted/30", children: /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-2", children: [
|
|
2533
|
+
/* @__PURE__ */ jsx10(Sigma, { className: "w-4 h-4 text-primary" }),
|
|
2534
|
+
/* @__PURE__ */ jsx10("span", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: t("formulaSuggestion.title") })
|
|
2424
2535
|
] }) }),
|
|
2425
|
-
/* @__PURE__ */
|
|
2536
|
+
/* @__PURE__ */ jsx10("div", { className: "p-1.5", children: props.items.map((item, index) => /* @__PURE__ */ jsxs7(
|
|
2426
2537
|
"button",
|
|
2427
2538
|
{
|
|
2428
2539
|
type: "button",
|
|
@@ -2436,10 +2547,10 @@ var FormulaSuggestionList = forwardRef3((props, ref) => {
|
|
|
2436
2547
|
onClick: () => props.command(item),
|
|
2437
2548
|
children: [
|
|
2438
2549
|
/* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between gap-3", children: [
|
|
2439
|
-
/* @__PURE__ */
|
|
2440
|
-
/* @__PURE__ */
|
|
2550
|
+
/* @__PURE__ */ jsx10("span", { className: "font-mono text-sm font-semibold", children: item.name }),
|
|
2551
|
+
/* @__PURE__ */ jsx10("span", { className: "font-mono text-xs text-muted-foreground", children: item.signature })
|
|
2441
2552
|
] }),
|
|
2442
|
-
/* @__PURE__ */
|
|
2553
|
+
/* @__PURE__ */ jsx10("div", { className: "mt-0.5 text-xs text-muted-foreground", children: t(item.descriptionKey) })
|
|
2443
2554
|
]
|
|
2444
2555
|
},
|
|
2445
2556
|
item.name
|
|
@@ -2649,9 +2760,9 @@ var UEditorPlaceholder = Extension4.create({
|
|
|
2649
2760
|
// src/components/UEditor/resizable-image.tsx
|
|
2650
2761
|
import { useEffect as useEffect4, useRef as useRef3, useState as useState3 } from "react";
|
|
2651
2762
|
import { Image as Image2 } from "@tiptap/extension-image";
|
|
2652
|
-
import { mergeAttributes as
|
|
2653
|
-
import { NodeViewWrapper as
|
|
2654
|
-
import { jsx as
|
|
2763
|
+
import { mergeAttributes as mergeAttributes7 } from "@tiptap/core";
|
|
2764
|
+
import { NodeViewWrapper as NodeViewWrapper7, ReactNodeViewRenderer as ReactNodeViewRenderer7 } from "@tiptap/react";
|
|
2765
|
+
import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2655
2766
|
var MIN_IMAGE_SIZE_PX = 40;
|
|
2656
2767
|
var IMAGE_LAYOUTS = /* @__PURE__ */ new Set(["block", "left", "right"]);
|
|
2657
2768
|
var IMAGE_WIDTH_PRESETS = /* @__PURE__ */ new Set(["sm", "md", "lg"]);
|
|
@@ -2894,7 +3005,7 @@ function ResizableImageNodeView(props) {
|
|
|
2894
3005
|
const wrapperAlignClass = imageLayout === "block" ? textAlign === "center" ? "mx-auto" : textAlign === "right" ? "ml-auto" : textAlign === "justify" ? "mx-auto" : "" : "";
|
|
2895
3006
|
const wrapperLayoutClass = imageLayout === "left" ? "float-left mr-4 mb-3 mt-1 clear-none max-w-[min(45%,20rem)]" : imageLayout === "right" ? "float-right ml-4 mb-3 mt-1 clear-none max-w-[min(45%,20rem)]" : "w-fit";
|
|
2896
3007
|
return /* @__PURE__ */ jsxs8(
|
|
2897
|
-
|
|
3008
|
+
NodeViewWrapper7,
|
|
2898
3009
|
{
|
|
2899
3010
|
as: "div",
|
|
2900
3011
|
ref: wrapperRef,
|
|
@@ -2908,7 +3019,7 @@ function ResizableImageNodeView(props) {
|
|
|
2908
3019
|
},
|
|
2909
3020
|
contentEditable: false,
|
|
2910
3021
|
children: [
|
|
2911
|
-
/* @__PURE__ */
|
|
3022
|
+
/* @__PURE__ */ jsx11(
|
|
2912
3023
|
"img",
|
|
2913
3024
|
{
|
|
2914
3025
|
ref: imgRef,
|
|
@@ -2924,7 +3035,7 @@ function ResizableImageNodeView(props) {
|
|
|
2924
3035
|
style: getImageDisplayStyle(widthAttr, heightAttr)
|
|
2925
3036
|
}
|
|
2926
3037
|
),
|
|
2927
|
-
/* @__PURE__ */
|
|
3038
|
+
/* @__PURE__ */ jsx11(
|
|
2928
3039
|
"div",
|
|
2929
3040
|
{
|
|
2930
3041
|
ref: resizePreviewRef,
|
|
@@ -2948,7 +3059,7 @@ function ResizableImageNodeView(props) {
|
|
|
2948
3059
|
}
|
|
2949
3060
|
}
|
|
2950
3061
|
),
|
|
2951
|
-
showHandle && /* @__PURE__ */
|
|
3062
|
+
showHandle && /* @__PURE__ */ jsx11(
|
|
2952
3063
|
"div",
|
|
2953
3064
|
{
|
|
2954
3065
|
"aria-hidden": "true",
|
|
@@ -3014,10 +3125,10 @@ var ResizableImage = Image2.extend({
|
|
|
3014
3125
|
};
|
|
3015
3126
|
},
|
|
3016
3127
|
renderHTML({ HTMLAttributes }) {
|
|
3017
|
-
return ["img",
|
|
3128
|
+
return ["img", mergeAttributes7(this.options.HTMLAttributes, HTMLAttributes)];
|
|
3018
3129
|
},
|
|
3019
3130
|
addNodeView() {
|
|
3020
|
-
return
|
|
3131
|
+
return ReactNodeViewRenderer7(ResizableImageNodeView);
|
|
3021
3132
|
}
|
|
3022
3133
|
}).configure({
|
|
3023
3134
|
allowBase64: true,
|
|
@@ -3444,7 +3555,7 @@ var Indent = Extension9.create({
|
|
|
3444
3555
|
var indent_default = Indent;
|
|
3445
3556
|
|
|
3446
3557
|
// src/components/UEditor/table-align.ts
|
|
3447
|
-
import { mergeAttributes as
|
|
3558
|
+
import { mergeAttributes as mergeAttributes8 } from "@tiptap/core";
|
|
3448
3559
|
import { Table as Table2 } from "@tiptap/extension-table";
|
|
3449
3560
|
import { Plugin as Plugin4, PluginKey as PluginKey5, TextSelection } from "@tiptap/pm/state";
|
|
3450
3561
|
import {
|
|
@@ -4325,7 +4436,7 @@ var UEditorTable = Table2.extend({
|
|
|
4325
4436
|
].join("; ") + ";" : tableWidth ? `width: ${tableWidth}; ${renderFixedTableAlignStyle(tableAlign)}` : `table-layout: fixed; ${renderFixedTableAlignStyle(tableAlign)}`;
|
|
4326
4437
|
const table = [
|
|
4327
4438
|
"table",
|
|
4328
|
-
|
|
4439
|
+
mergeAttributes8(this.options.HTMLAttributes, HTMLAttributes, {
|
|
4329
4440
|
...widthMode === "responsive" ? {
|
|
4330
4441
|
"data-table-width-mode": "responsive",
|
|
4331
4442
|
"data-table-width": formatBasisPointsAsPercentage(widthBp),
|
|
@@ -4432,10 +4543,10 @@ var UEditorTable = Table2.extend({
|
|
|
4432
4543
|
var table_align_default = UEditorTable;
|
|
4433
4544
|
|
|
4434
4545
|
// src/components/UEditor/CodeBlockView.tsx
|
|
4435
|
-
import
|
|
4436
|
-
import { NodeViewWrapper as
|
|
4546
|
+
import React10, { useState as useState4 } from "react";
|
|
4547
|
+
import { NodeViewWrapper as NodeViewWrapper8, NodeViewContent as NodeViewContent2 } from "@tiptap/react";
|
|
4437
4548
|
import { Check as Check2, Copy, ChevronDown } from "lucide-react";
|
|
4438
|
-
import { Fragment, jsx as
|
|
4549
|
+
import { Fragment, jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
4439
4550
|
var LANGUAGES = [
|
|
4440
4551
|
{ label: "Plain Text", value: "text" },
|
|
4441
4552
|
{ label: "JavaScript", value: "javascript" },
|
|
@@ -4459,11 +4570,11 @@ var CodeBlockView = ({
|
|
|
4459
4570
|
}) => {
|
|
4460
4571
|
const [copied, setCopied] = useState4(false);
|
|
4461
4572
|
const [isDropdownOpen, setIsDropdownOpen] = useState4(false);
|
|
4462
|
-
const timeoutRef =
|
|
4573
|
+
const timeoutRef = React10.useRef(null);
|
|
4463
4574
|
const t = useSmartTranslations("UEditor");
|
|
4464
4575
|
const currentLangValue = node.attrs.language || "text";
|
|
4465
4576
|
const currentLangLabel = LANGUAGES.find((lang) => lang.value === currentLangValue)?.label || "Plain Text";
|
|
4466
|
-
|
|
4577
|
+
React10.useEffect(() => {
|
|
4467
4578
|
return () => {
|
|
4468
4579
|
if (timeoutRef.current) {
|
|
4469
4580
|
clearTimeout(timeoutRef.current);
|
|
@@ -4484,7 +4595,7 @@ var CodeBlockView = ({
|
|
|
4484
4595
|
console.error("Failed to copy code text: ", err);
|
|
4485
4596
|
}
|
|
4486
4597
|
};
|
|
4487
|
-
return /* @__PURE__ */ jsxs9(
|
|
4598
|
+
return /* @__PURE__ */ jsxs9(NodeViewWrapper8, { className: "group/code relative my-4 rounded-xl border border-border/60 bg-muted/40 p-4 font-mono text-sm shadow-sm overflow-visible", children: [
|
|
4488
4599
|
/* @__PURE__ */ jsxs9(
|
|
4489
4600
|
"div",
|
|
4490
4601
|
{
|
|
@@ -4502,19 +4613,19 @@ var CodeBlockView = ({
|
|
|
4502
4613
|
className: "flex items-center gap-1.5 rounded-lg border border-border bg-background px-2.5 py-1 text-xs text-muted-foreground hover:text-foreground hover:bg-muted active:scale-95 transition-[color,background-color,transform] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
4503
4614
|
children: [
|
|
4504
4615
|
currentLangLabel,
|
|
4505
|
-
/* @__PURE__ */
|
|
4616
|
+
/* @__PURE__ */ jsx12(ChevronDown, { "aria-hidden": "true", className: "h-3 w-3" })
|
|
4506
4617
|
]
|
|
4507
4618
|
}
|
|
4508
4619
|
),
|
|
4509
4620
|
isDropdownOpen && /* @__PURE__ */ jsxs9(Fragment, { children: [
|
|
4510
|
-
/* @__PURE__ */
|
|
4621
|
+
/* @__PURE__ */ jsx12(
|
|
4511
4622
|
"div",
|
|
4512
4623
|
{
|
|
4513
4624
|
className: "fixed inset-0 z-20",
|
|
4514
4625
|
onClick: () => setIsDropdownOpen(false)
|
|
4515
4626
|
}
|
|
4516
4627
|
),
|
|
4517
|
-
/* @__PURE__ */
|
|
4628
|
+
/* @__PURE__ */ jsx12("div", { role: "listbox", "aria-label": currentLangLabel, className: "absolute right-0 mt-1 max-h-56 w-36 overflow-y-auto rounded-lg border border-border/50 bg-popover p-1 shadow-lg z-30 [scrollbar-width:thin] animate-in fade-in-0 zoom-in-95 motion-reduce:animate-none", children: LANGUAGES.map((lang) => /* @__PURE__ */ jsx12(
|
|
4518
4629
|
"button",
|
|
4519
4630
|
{
|
|
4520
4631
|
type: "button",
|
|
@@ -4534,7 +4645,7 @@ var CodeBlockView = ({
|
|
|
4534
4645
|
)) })
|
|
4535
4646
|
] })
|
|
4536
4647
|
] }),
|
|
4537
|
-
/* @__PURE__ */
|
|
4648
|
+
/* @__PURE__ */ jsx12(
|
|
4538
4649
|
"button",
|
|
4539
4650
|
{
|
|
4540
4651
|
type: "button",
|
|
@@ -4542,13 +4653,13 @@ var CodeBlockView = ({
|
|
|
4542
4653
|
"aria-label": t("menubar.copy"),
|
|
4543
4654
|
className: "flex h-7 w-7 items-center justify-center rounded-lg border border-border bg-background text-muted-foreground hover:text-foreground hover:bg-muted active:scale-95 transition-[color,background-color,transform] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
4544
4655
|
title: t("menubar.copy"),
|
|
4545
|
-
children: copied ? /* @__PURE__ */
|
|
4656
|
+
children: copied ? /* @__PURE__ */ jsx12(Check2, { "aria-hidden": "true", className: "h-3.5 w-3.5 text-success animate-in fade-in-0 zoom-in-75 motion-reduce:animate-none" }) : /* @__PURE__ */ jsx12(Copy, { "aria-hidden": "true", className: "h-3.5 w-3.5" })
|
|
4546
4657
|
}
|
|
4547
4658
|
)
|
|
4548
4659
|
]
|
|
4549
4660
|
}
|
|
4550
4661
|
),
|
|
4551
|
-
/* @__PURE__ */
|
|
4662
|
+
/* @__PURE__ */ jsx12("pre", { className: "m-0 overflow-x-auto [scrollbar-width:thin] pt-4 sm:pt-0", children: /* @__PURE__ */ jsx12("code", { className: "bg-transparent! text-foreground!", children: /* @__PURE__ */ jsx12(NodeViewContent2, {}) }) })
|
|
4552
4663
|
] });
|
|
4553
4664
|
};
|
|
4554
4665
|
|
|
@@ -5417,7 +5528,7 @@ var CustomTableCell = TableCell.extend({
|
|
|
5417
5528
|
mergedStyle = mergedStyle.replace(/^;/, "").trim();
|
|
5418
5529
|
return [
|
|
5419
5530
|
"td",
|
|
5420
|
-
|
|
5531
|
+
mergeAttributes9(this.options.HTMLAttributes, HTMLAttributes, getFormulaStateAttributes(HTMLAttributes), mergedStyle ? { style: mergedStyle } : {}),
|
|
5421
5532
|
0
|
|
5422
5533
|
];
|
|
5423
5534
|
}
|
|
@@ -5550,7 +5661,7 @@ var CustomTableHeader = TableHeader.extend({
|
|
|
5550
5661
|
mergedStyle = mergedStyle.replace(/^;/, "").trim();
|
|
5551
5662
|
return [
|
|
5552
5663
|
"th",
|
|
5553
|
-
|
|
5664
|
+
mergeAttributes9(this.options.HTMLAttributes, HTMLAttributes, getFormulaStateAttributes(HTMLAttributes), mergedStyle ? { style: mergedStyle } : {}),
|
|
5554
5665
|
0
|
|
5555
5666
|
];
|
|
5556
5667
|
}
|
|
@@ -5597,7 +5708,7 @@ function ensureCommonLowlightLanguages() {
|
|
|
5597
5708
|
}
|
|
5598
5709
|
var CustomCodeBlockLowlight = CodeBlockLowlight.extend({
|
|
5599
5710
|
addNodeView() {
|
|
5600
|
-
return
|
|
5711
|
+
return ReactNodeViewRenderer8(CodeBlockView);
|
|
5601
5712
|
},
|
|
5602
5713
|
addProseMirrorPlugins() {
|
|
5603
5714
|
const parentPlugins = this.parent?.() ?? [];
|
|
@@ -5768,7 +5879,8 @@ function buildUEditorExtensions({
|
|
|
5768
5879
|
upload: uploadFile
|
|
5769
5880
|
}),
|
|
5770
5881
|
FormCheckbox,
|
|
5771
|
-
FormRadio
|
|
5882
|
+
FormRadio,
|
|
5883
|
+
DatePickerNode
|
|
5772
5884
|
];
|
|
5773
5885
|
}
|
|
5774
5886
|
|
|
@@ -5799,9 +5911,6 @@ import {
|
|
|
5799
5911
|
Unlink,
|
|
5800
5912
|
ExternalLink as ExternalLink2,
|
|
5801
5913
|
Sigma as Sigma2,
|
|
5802
|
-
AlignStartVertical,
|
|
5803
|
-
AlignCenterVertical,
|
|
5804
|
-
AlignEndVertical,
|
|
5805
5914
|
ArrowDown,
|
|
5806
5915
|
ArrowRight,
|
|
5807
5916
|
WrapText
|
|
@@ -5974,7 +6083,7 @@ function subscribeSharedGlobalEvent(target, type, listener, options) {
|
|
|
5974
6083
|
}
|
|
5975
6084
|
|
|
5976
6085
|
// src/components/UEditor/menus.tsx
|
|
5977
|
-
import { jsx as
|
|
6086
|
+
import { jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
5978
6087
|
var FloatingSlashCommandMenu = ({ editor, onClose }) => {
|
|
5979
6088
|
const t = useSmartTranslations("UEditor");
|
|
5980
6089
|
const messages = useMemo(() => buildSlashCommandMessages(t), [t]);
|
|
@@ -5997,7 +6106,7 @@ var FloatingSlashCommandMenu = ({ editor, onClose }) => {
|
|
|
5997
6106
|
if (!portalDocument) return;
|
|
5998
6107
|
return subscribeSharedGlobalEvent(portalDocument, "keydown", handleKeyDown2);
|
|
5999
6108
|
}, [onClose, portalDocument]);
|
|
6000
|
-
return /* @__PURE__ */
|
|
6109
|
+
return /* @__PURE__ */ jsx13(
|
|
6001
6110
|
SlashCommandList,
|
|
6002
6111
|
{
|
|
6003
6112
|
ref: listRef,
|
|
@@ -6014,7 +6123,7 @@ var FloatingMenuContent = ({ editor }) => {
|
|
|
6014
6123
|
const t = useSmartTranslations("UEditor");
|
|
6015
6124
|
const [showCommands, setShowCommands] = useState5(false);
|
|
6016
6125
|
if (showCommands) {
|
|
6017
|
-
return /* @__PURE__ */
|
|
6126
|
+
return /* @__PURE__ */ jsx13(FloatingSlashCommandMenu, { editor, onClose: () => setShowCommands(false) });
|
|
6018
6127
|
}
|
|
6019
6128
|
return /* @__PURE__ */ jsxs10(
|
|
6020
6129
|
"button",
|
|
@@ -6023,8 +6132,8 @@ var FloatingMenuContent = ({ editor }) => {
|
|
|
6023
6132
|
onClick: () => setShowCommands(true),
|
|
6024
6133
|
className: "group flex items-center gap-1 rounded-lg px-2 py-1.5 transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",
|
|
6025
6134
|
children: [
|
|
6026
|
-
/* @__PURE__ */
|
|
6027
|
-
/* @__PURE__ */
|
|
6135
|
+
/* @__PURE__ */ jsx13(Plus, { className: "w-4 h-4 text-muted-foreground group-hover:text-foreground" }),
|
|
6136
|
+
/* @__PURE__ */ jsx13("span", { className: "text-sm text-muted-foreground group-hover:text-foreground", children: t("floatingMenu.addBlock") })
|
|
6028
6137
|
]
|
|
6029
6138
|
}
|
|
6030
6139
|
);
|
|
@@ -6056,7 +6165,7 @@ function applyTableCellAttribute(editor, name, value, options = {}) {
|
|
|
6056
6165
|
}
|
|
6057
6166
|
function BorderStylePreviewIcon({ style }) {
|
|
6058
6167
|
const isNone = style === "none";
|
|
6059
|
-
return /* @__PURE__ */
|
|
6168
|
+
return /* @__PURE__ */ jsx13(
|
|
6060
6169
|
"span",
|
|
6061
6170
|
{
|
|
6062
6171
|
"aria-hidden": "true",
|
|
@@ -6068,7 +6177,7 @@ function BorderStylePreviewIcon({ style }) {
|
|
|
6068
6177
|
borderStyle: style,
|
|
6069
6178
|
borderWidth: style === "double" ? 3 : 2
|
|
6070
6179
|
},
|
|
6071
|
-
children: isNone && /* @__PURE__ */
|
|
6180
|
+
children: isNone && /* @__PURE__ */ jsx13("span", { className: "absolute left-1/2 top-0 h-full w-px -translate-x-1/2 rotate-45 bg-muted-foreground/70" })
|
|
6072
6181
|
}
|
|
6073
6182
|
);
|
|
6074
6183
|
}
|
|
@@ -6080,7 +6189,7 @@ function BorderPositionPreviewIcon({ position }) {
|
|
|
6080
6189
|
const showHorizontal = position === "all" || position === "inner" || position === "horizontal";
|
|
6081
6190
|
const showVertical = position === "all" || position === "inner" || position === "vertical";
|
|
6082
6191
|
return /* @__PURE__ */ jsxs10("svg", { "aria-hidden": "true", viewBox: "0 0 20 20", className: "h-5 w-5 fill-none stroke-current", children: [
|
|
6083
|
-
/* @__PURE__ */
|
|
6192
|
+
/* @__PURE__ */ jsx13(
|
|
6084
6193
|
"path",
|
|
6085
6194
|
{
|
|
6086
6195
|
d: "M2 2H18V18H2Z M2 10H18 M10 2V18",
|
|
@@ -6090,12 +6199,12 @@ function BorderPositionPreviewIcon({ position }) {
|
|
|
6090
6199
|
strokeWidth: "1.25"
|
|
6091
6200
|
}
|
|
6092
6201
|
),
|
|
6093
|
-
showTop && /* @__PURE__ */
|
|
6094
|
-
showRight && /* @__PURE__ */
|
|
6095
|
-
showBottom && /* @__PURE__ */
|
|
6096
|
-
showLeft && /* @__PURE__ */
|
|
6097
|
-
showHorizontal && /* @__PURE__ */
|
|
6098
|
-
showVertical && /* @__PURE__ */
|
|
6202
|
+
showTop && /* @__PURE__ */ jsx13("path", { d: "M2 2H18", strokeWidth: "2" }),
|
|
6203
|
+
showRight && /* @__PURE__ */ jsx13("path", { d: "M18 2V18", strokeWidth: "2" }),
|
|
6204
|
+
showBottom && /* @__PURE__ */ jsx13("path", { d: "M2 18H18", strokeWidth: "2" }),
|
|
6205
|
+
showLeft && /* @__PURE__ */ jsx13("path", { d: "M2 2V18", strokeWidth: "2" }),
|
|
6206
|
+
showHorizontal && /* @__PURE__ */ jsx13("path", { d: "M2 10H18", strokeWidth: "2" }),
|
|
6207
|
+
showVertical && /* @__PURE__ */ jsx13("path", { d: "M10 2V18", strokeWidth: "2" })
|
|
6099
6208
|
] });
|
|
6100
6209
|
}
|
|
6101
6210
|
function getBubbleMenuPosition({
|
|
@@ -6327,7 +6436,7 @@ var BubbleMenuContent = ({
|
|
|
6327
6436
|
};
|
|
6328
6437
|
}, [editor, showLinkInput]);
|
|
6329
6438
|
if (showLinkInput) {
|
|
6330
|
-
return /* @__PURE__ */
|
|
6439
|
+
return /* @__PURE__ */ jsx13(
|
|
6331
6440
|
LinkInput,
|
|
6332
6441
|
{
|
|
6333
6442
|
initialUrl: editor.getAttributes("link").href || "",
|
|
@@ -6348,10 +6457,10 @@ var BubbleMenuContent = ({
|
|
|
6348
6457
|
const isHighlightPalette = activeColorPalette === "highlight";
|
|
6349
6458
|
if (activeColorPalette === "cell-border") {
|
|
6350
6459
|
return /* @__PURE__ */ jsxs10("div", { className: "flex w-72 flex-col gap-2 p-2 text-sm", "data-ueditor-keep-open": true, children: [
|
|
6351
|
-
/* @__PURE__ */
|
|
6460
|
+
/* @__PURE__ */ jsx13("div", { className: "font-semibold text-xs text-muted-foreground uppercase tracking-wider mb-1", children: t("tableMenu.cellBorder") || "Cell Borders" }),
|
|
6352
6461
|
/* @__PURE__ */ jsxs10("div", { className: "flex gap-2", children: [
|
|
6353
6462
|
/* @__PURE__ */ jsxs10("div", { className: "min-w-0 flex-1", children: [
|
|
6354
|
-
/* @__PURE__ */
|
|
6463
|
+
/* @__PURE__ */ jsx13("label", { className: "mb-1 block text-xs text-muted-foreground", children: t("tableMenu.borderPosition") || "Border placement" }),
|
|
6355
6464
|
/* @__PURE__ */ jsxs10("div", { className: "grid grid-cols-5 gap-1", role: "group", "aria-label": t("tableMenu.borderPosition") || "Border placement", children: [
|
|
6356
6465
|
[
|
|
6357
6466
|
["all", "borderAll"],
|
|
@@ -6365,7 +6474,7 @@ var BubbleMenuContent = ({
|
|
|
6365
6474
|
["left", "borderLeft"]
|
|
6366
6475
|
].map(([position, labelKey]) => {
|
|
6367
6476
|
const label = t(`tableMenu.${labelKey}`) || position;
|
|
6368
|
-
return /* @__PURE__ */
|
|
6477
|
+
return /* @__PURE__ */ jsx13(
|
|
6369
6478
|
"button",
|
|
6370
6479
|
{
|
|
6371
6480
|
type: "button",
|
|
@@ -6377,12 +6486,12 @@ var BubbleMenuContent = ({
|
|
|
6377
6486
|
"inline-flex h-8 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted hover:text-primary",
|
|
6378
6487
|
activeBorderPosition === position ? "bg-primary/10 text-primary" : "bg-muted/40"
|
|
6379
6488
|
),
|
|
6380
|
-
children: /* @__PURE__ */
|
|
6489
|
+
children: /* @__PURE__ */ jsx13(BorderPositionPreviewIcon, { position })
|
|
6381
6490
|
},
|
|
6382
6491
|
position
|
|
6383
6492
|
);
|
|
6384
6493
|
}),
|
|
6385
|
-
/* @__PURE__ */
|
|
6494
|
+
/* @__PURE__ */ jsx13(
|
|
6386
6495
|
"button",
|
|
6387
6496
|
{
|
|
6388
6497
|
type: "button",
|
|
@@ -6391,13 +6500,13 @@ var BubbleMenuContent = ({
|
|
|
6391
6500
|
onMouseDown: (event) => event.preventDefault(),
|
|
6392
6501
|
onClick: clearTableCellBorders,
|
|
6393
6502
|
className: "inline-flex h-8 items-center justify-center rounded-md bg-muted/40 text-destructive transition-colors hover:bg-destructive/10",
|
|
6394
|
-
children: /* @__PURE__ */
|
|
6503
|
+
children: /* @__PURE__ */ jsx13(BorderStylePreviewIcon, { style: "none" })
|
|
6395
6504
|
}
|
|
6396
6505
|
)
|
|
6397
6506
|
] })
|
|
6398
6507
|
] }),
|
|
6399
6508
|
/* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-1 border-l border-border pl-2 pt-5", role: "group", "aria-label": t("tableMenu.borderMode") || "Border mode", children: [
|
|
6400
|
-
/* @__PURE__ */
|
|
6509
|
+
/* @__PURE__ */ jsx13(
|
|
6401
6510
|
"button",
|
|
6402
6511
|
{
|
|
6403
6512
|
type: "button",
|
|
@@ -6409,10 +6518,10 @@ var BubbleMenuContent = ({
|
|
|
6409
6518
|
"inline-flex h-8 w-8 items-center justify-center rounded-md transition-colors hover:bg-muted",
|
|
6410
6519
|
borderEditMode === "draw" ? "bg-primary/10 text-primary" : "text-muted-foreground"
|
|
6411
6520
|
),
|
|
6412
|
-
children: /* @__PURE__ */
|
|
6521
|
+
children: /* @__PURE__ */ jsx13(Edit2, { className: "h-4 w-4" })
|
|
6413
6522
|
}
|
|
6414
6523
|
),
|
|
6415
|
-
/* @__PURE__ */
|
|
6524
|
+
/* @__PURE__ */ jsx13(
|
|
6416
6525
|
"button",
|
|
6417
6526
|
{
|
|
6418
6527
|
type: "button",
|
|
@@ -6424,14 +6533,14 @@ var BubbleMenuContent = ({
|
|
|
6424
6533
|
"inline-flex h-8 w-8 items-center justify-center rounded-md transition-colors hover:bg-muted",
|
|
6425
6534
|
borderEditMode === "erase" ? "bg-destructive/10 text-destructive" : "text-muted-foreground"
|
|
6426
6535
|
),
|
|
6427
|
-
children: /* @__PURE__ */
|
|
6536
|
+
children: /* @__PURE__ */ jsx13(Eraser, { className: "h-4 w-4" })
|
|
6428
6537
|
}
|
|
6429
6538
|
)
|
|
6430
6539
|
] })
|
|
6431
6540
|
] }),
|
|
6432
6541
|
/* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-1", children: [
|
|
6433
|
-
/* @__PURE__ */
|
|
6434
|
-
/* @__PURE__ */
|
|
6542
|
+
/* @__PURE__ */ jsx13("label", { className: "text-xs text-muted-foreground", children: t("tableMenu.borderStyle") || "Border Style" }),
|
|
6543
|
+
/* @__PURE__ */ jsx13("div", { className: "grid grid-cols-4 gap-1.5", role: "group", "aria-label": t("tableMenu.borderStyle") || "Border Style", children: [
|
|
6435
6544
|
["solid", "Solid"],
|
|
6436
6545
|
["dashed", "Dashed"],
|
|
6437
6546
|
["dotted", "Dotted"],
|
|
@@ -6447,16 +6556,16 @@ var BubbleMenuContent = ({
|
|
|
6447
6556
|
borderStyleDraft === style ? "bg-primary/10 text-primary" : "bg-muted/40 text-foreground"
|
|
6448
6557
|
),
|
|
6449
6558
|
children: [
|
|
6450
|
-
/* @__PURE__ */
|
|
6451
|
-
/* @__PURE__ */
|
|
6559
|
+
/* @__PURE__ */ jsx13(BorderStylePreviewIcon, { style }),
|
|
6560
|
+
/* @__PURE__ */ jsx13("span", { children: label })
|
|
6452
6561
|
]
|
|
6453
6562
|
},
|
|
6454
6563
|
style
|
|
6455
6564
|
)) })
|
|
6456
6565
|
] }),
|
|
6457
6566
|
/* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-1", children: [
|
|
6458
|
-
/* @__PURE__ */
|
|
6459
|
-
/* @__PURE__ */
|
|
6567
|
+
/* @__PURE__ */ jsx13("label", { className: "text-xs text-muted-foreground", children: t("tableMenu.borderWidth") || "Border Width" }),
|
|
6568
|
+
/* @__PURE__ */ jsx13("div", { className: "grid grid-cols-4 gap-1", role: "group", "aria-label": t("tableMenu.borderWidth") || "Border Width", children: ["1px", "2px", "3px", "4px"].map((width) => /* @__PURE__ */ jsx13(
|
|
6460
6569
|
"button",
|
|
6461
6570
|
{
|
|
6462
6571
|
type: "button",
|
|
@@ -6478,8 +6587,8 @@ var BubbleMenuContent = ({
|
|
|
6478
6587
|
onClick: () => setActiveColorPalette("cell-border-color"),
|
|
6479
6588
|
className: "flex items-center justify-between w-full h-8 px-2 rounded-md border border-input hover:bg-accent text-xs",
|
|
6480
6589
|
children: [
|
|
6481
|
-
/* @__PURE__ */
|
|
6482
|
-
/* @__PURE__ */
|
|
6590
|
+
/* @__PURE__ */ jsx13("span", { children: t("tableMenu.borderColor") || "Border Color" }),
|
|
6591
|
+
/* @__PURE__ */ jsx13(
|
|
6483
6592
|
"span",
|
|
6484
6593
|
{
|
|
6485
6594
|
className: "w-4 h-4 rounded-full border border-border",
|
|
@@ -6494,7 +6603,7 @@ var BubbleMenuContent = ({
|
|
|
6494
6603
|
] });
|
|
6495
6604
|
}
|
|
6496
6605
|
if (activeColorPalette === "cell-border-color") {
|
|
6497
|
-
return /* @__PURE__ */
|
|
6606
|
+
return /* @__PURE__ */ jsx13("div", { className: "w-56", "data-ueditor-keep-open": true, children: /* @__PURE__ */ jsx13(
|
|
6498
6607
|
EditorColorPalette,
|
|
6499
6608
|
{
|
|
6500
6609
|
colors: borderColors,
|
|
@@ -6504,7 +6613,7 @@ var BubbleMenuContent = ({
|
|
|
6504
6613
|
}
|
|
6505
6614
|
) });
|
|
6506
6615
|
}
|
|
6507
|
-
return /* @__PURE__ */
|
|
6616
|
+
return /* @__PURE__ */ jsx13("div", { className: "w-56", "data-ueditor-keep-open": true, children: /* @__PURE__ */ jsx13(
|
|
6508
6617
|
EditorColorPalette,
|
|
6509
6618
|
{
|
|
6510
6619
|
colors: isTextPalette ? textColors : highlightColors,
|
|
@@ -6517,22 +6626,22 @@ var BubbleMenuContent = ({
|
|
|
6517
6626
|
}
|
|
6518
6627
|
if (isImageSelected) {
|
|
6519
6628
|
return /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-0.5 p-1", children: [
|
|
6520
|
-
/* @__PURE__ */
|
|
6521
|
-
/* @__PURE__ */
|
|
6522
|
-
/* @__PURE__ */
|
|
6523
|
-
/* @__PURE__ */
|
|
6524
|
-
/* @__PURE__ */
|
|
6525
|
-
/* @__PURE__ */
|
|
6526
|
-
/* @__PURE__ */
|
|
6527
|
-
/* @__PURE__ */
|
|
6528
|
-
/* @__PURE__ */
|
|
6529
|
-
/* @__PURE__ */
|
|
6629
|
+
/* @__PURE__ */ jsx13(ToolbarButton, { onClick: () => applyImageLayout(editor, "block"), active: imageLayout === "block", title: t("toolbar.imageLayoutBlock"), children: /* @__PURE__ */ jsx13(AlignCenter, { className: "w-4 h-4" }) }),
|
|
6630
|
+
/* @__PURE__ */ jsx13(ToolbarButton, { onClick: () => applyImageLayout(editor, "left"), active: imageLayout === "left", title: t("toolbar.imageLayoutLeft"), children: /* @__PURE__ */ jsx13(AlignLeft, { className: "w-4 h-4" }) }),
|
|
6631
|
+
/* @__PURE__ */ jsx13(ToolbarButton, { onClick: () => applyImageLayout(editor, "right"), active: imageLayout === "right", title: t("toolbar.imageLayoutRight"), children: /* @__PURE__ */ jsx13(AlignRight, { className: "w-4 h-4" }) }),
|
|
6632
|
+
/* @__PURE__ */ jsx13("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
6633
|
+
/* @__PURE__ */ jsx13(ToolbarButton, { onClick: () => applyImageWidthPreset(editor, "sm"), active: imageWidthPreset === "sm", title: t("toolbar.imageWidthSm"), children: /* @__PURE__ */ jsx13("span", { className: "text-[10px] font-semibold", children: "S" }) }),
|
|
6634
|
+
/* @__PURE__ */ jsx13(ToolbarButton, { onClick: () => applyImageWidthPreset(editor, "md"), active: imageWidthPreset === "md", title: t("toolbar.imageWidthMd"), children: /* @__PURE__ */ jsx13("span", { className: "text-[10px] font-semibold", children: "M" }) }),
|
|
6635
|
+
/* @__PURE__ */ jsx13(ToolbarButton, { onClick: () => applyImageWidthPreset(editor, "lg"), active: imageWidthPreset === "lg", title: t("toolbar.imageWidthLg"), children: /* @__PURE__ */ jsx13("span", { className: "text-[10px] font-semibold", children: "L" }) }),
|
|
6636
|
+
/* @__PURE__ */ jsx13("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
6637
|
+
/* @__PURE__ */ jsx13(ToolbarButton, { onClick: () => resetImageSize(editor), title: t("toolbar.imageResetSize"), children: /* @__PURE__ */ jsx13(RotateCcw, { className: "w-4 h-4" }) }),
|
|
6638
|
+
/* @__PURE__ */ jsx13(
|
|
6530
6639
|
ToolbarButton,
|
|
6531
6640
|
{
|
|
6532
6641
|
onClick: () => deleteSelectedImage(editor),
|
|
6533
6642
|
title: t("toolbar.imageDelete"),
|
|
6534
6643
|
className: "text-destructive hover:text-destructive",
|
|
6535
|
-
children: /* @__PURE__ */
|
|
6644
|
+
children: /* @__PURE__ */ jsx13(Trash2, { className: "w-4 h-4" })
|
|
6536
6645
|
}
|
|
6537
6646
|
)
|
|
6538
6647
|
] });
|
|
@@ -6540,8 +6649,8 @@ var BubbleMenuContent = ({
|
|
|
6540
6649
|
if (showFormulaPanel && isInTable3) {
|
|
6541
6650
|
return /* @__PURE__ */ jsxs10("div", { className: "w-72 p-2", children: [
|
|
6542
6651
|
/* @__PURE__ */ jsxs10("div", { className: "mb-2 flex items-center justify-between gap-2", children: [
|
|
6543
|
-
/* @__PURE__ */
|
|
6544
|
-
/* @__PURE__ */
|
|
6652
|
+
/* @__PURE__ */ jsx13("span", { className: "px-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: t("tableMenu.formula") || "Formula" }),
|
|
6653
|
+
/* @__PURE__ */ jsx13(
|
|
6545
6654
|
"button",
|
|
6546
6655
|
{
|
|
6547
6656
|
type: "button",
|
|
@@ -6554,7 +6663,7 @@ var BubbleMenuContent = ({
|
|
|
6554
6663
|
}
|
|
6555
6664
|
)
|
|
6556
6665
|
] }),
|
|
6557
|
-
/* @__PURE__ */
|
|
6666
|
+
/* @__PURE__ */ jsx13("div", { className: cn("flex h-9 items-center overflow-hidden rounded-md bg-muted/40", formControlGroupOutlineClass), children: /* @__PURE__ */ jsx13(
|
|
6558
6667
|
"input",
|
|
6559
6668
|
{
|
|
6560
6669
|
value: formulaDraft,
|
|
@@ -6576,14 +6685,14 @@ var BubbleMenuContent = ({
|
|
|
6576
6685
|
}
|
|
6577
6686
|
) }),
|
|
6578
6687
|
/* @__PURE__ */ jsxs10("div", { className: "mt-2", children: [
|
|
6579
|
-
/* @__PURE__ */
|
|
6580
|
-
/* @__PURE__ */
|
|
6688
|
+
/* @__PURE__ */ jsx13("div", { className: "mb-1 px-1 text-[11px] font-medium text-muted-foreground", children: t("tableMenu.numberFormat") || "Number format" }),
|
|
6689
|
+
/* @__PURE__ */ jsx13("div", { className: "grid grid-cols-5 gap-1", children: [
|
|
6581
6690
|
["text", "Text"],
|
|
6582
6691
|
["number", "123"],
|
|
6583
6692
|
["currency", "$"],
|
|
6584
6693
|
["percent", "%"],
|
|
6585
6694
|
["date", "Date"]
|
|
6586
|
-
].map(([format, label]) => /* @__PURE__ */
|
|
6695
|
+
].map(([format, label]) => /* @__PURE__ */ jsx13(
|
|
6587
6696
|
"button",
|
|
6588
6697
|
{
|
|
6589
6698
|
type: "button",
|
|
@@ -6598,7 +6707,7 @@ var BubbleMenuContent = ({
|
|
|
6598
6707
|
)) })
|
|
6599
6708
|
] }),
|
|
6600
6709
|
/* @__PURE__ */ jsxs10("div", { className: "mt-2 grid grid-cols-3 gap-1", children: [
|
|
6601
|
-
/* @__PURE__ */
|
|
6710
|
+
/* @__PURE__ */ jsx13(
|
|
6602
6711
|
"button",
|
|
6603
6712
|
{
|
|
6604
6713
|
type: "button",
|
|
@@ -6611,7 +6720,7 @@ var BubbleMenuContent = ({
|
|
|
6611
6720
|
children: t("tableMenu.apply") || "Apply"
|
|
6612
6721
|
}
|
|
6613
6722
|
),
|
|
6614
|
-
/* @__PURE__ */
|
|
6723
|
+
/* @__PURE__ */ jsx13(
|
|
6615
6724
|
"button",
|
|
6616
6725
|
{
|
|
6617
6726
|
type: "button",
|
|
@@ -6623,7 +6732,7 @@ var BubbleMenuContent = ({
|
|
|
6623
6732
|
children: t("tableMenu.clear") || "Clear"
|
|
6624
6733
|
}
|
|
6625
6734
|
),
|
|
6626
|
-
/* @__PURE__ */
|
|
6735
|
+
/* @__PURE__ */ jsx13(
|
|
6627
6736
|
"button",
|
|
6628
6737
|
{
|
|
6629
6738
|
type: "button",
|
|
@@ -6638,8 +6747,8 @@ var BubbleMenuContent = ({
|
|
|
6638
6747
|
if (showTypographyPanel) {
|
|
6639
6748
|
return /* @__PURE__ */ jsxs10("div", { className: "w-72 p-2", children: [
|
|
6640
6749
|
/* @__PURE__ */ jsxs10("div", { className: "mb-2 flex items-center justify-between gap-2", children: [
|
|
6641
|
-
/* @__PURE__ */
|
|
6642
|
-
/* @__PURE__ */
|
|
6750
|
+
/* @__PURE__ */ jsx13("span", { className: "px-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: t("toolbar.textStyle") }),
|
|
6751
|
+
/* @__PURE__ */ jsx13(
|
|
6643
6752
|
"button",
|
|
6644
6753
|
{
|
|
6645
6754
|
type: "button",
|
|
@@ -6651,9 +6760,9 @@ var BubbleMenuContent = ({
|
|
|
6651
6760
|
] }),
|
|
6652
6761
|
/* @__PURE__ */ jsxs10("div", { className: "space-y-2", children: [
|
|
6653
6762
|
/* @__PURE__ */ jsxs10("div", { children: [
|
|
6654
|
-
/* @__PURE__ */
|
|
6763
|
+
/* @__PURE__ */ jsx13("div", { className: "mb-1 px-1 text-[11px] font-medium text-muted-foreground", children: t("toolbar.fontSize") }),
|
|
6655
6764
|
/* @__PURE__ */ jsxs10("div", { className: cn("flex h-9 items-center overflow-hidden rounded-md bg-muted/40", formControlGroupOutlineClass), children: [
|
|
6656
|
-
/* @__PURE__ */
|
|
6765
|
+
/* @__PURE__ */ jsx13(
|
|
6657
6766
|
"input",
|
|
6658
6767
|
{
|
|
6659
6768
|
type: "number",
|
|
@@ -6677,8 +6786,8 @@ var BubbleMenuContent = ({
|
|
|
6677
6786
|
className: "h-full min-w-0 flex-1 bg-transparent px-2 text-center text-sm font-semibold text-foreground outline-none [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"
|
|
6678
6787
|
}
|
|
6679
6788
|
),
|
|
6680
|
-
/* @__PURE__ */
|
|
6681
|
-
/* @__PURE__ */
|
|
6789
|
+
/* @__PURE__ */ jsx13("span", { className: "border-l border-border/50 px-2 text-[11px] text-muted-foreground", children: "px" }),
|
|
6790
|
+
/* @__PURE__ */ jsx13(
|
|
6682
6791
|
"button",
|
|
6683
6792
|
{
|
|
6684
6793
|
type: "button",
|
|
@@ -6688,12 +6797,12 @@ var BubbleMenuContent = ({
|
|
|
6688
6797
|
"flex h-full w-9 items-center justify-center border-l border-border/50 transition-colors hover:bg-muted",
|
|
6689
6798
|
showFontSizeOptions && "bg-primary/10 text-primary"
|
|
6690
6799
|
),
|
|
6691
|
-
children: /* @__PURE__ */
|
|
6800
|
+
children: /* @__PURE__ */ jsx13(ChevronDown2, { className: "h-4 w-4" })
|
|
6692
6801
|
}
|
|
6693
6802
|
)
|
|
6694
6803
|
] }),
|
|
6695
6804
|
showFontSizeOptions && /* @__PURE__ */ jsxs10("div", { className: "mt-1 grid grid-cols-4 gap-1", children: [
|
|
6696
|
-
/* @__PURE__ */
|
|
6805
|
+
/* @__PURE__ */ jsx13(
|
|
6697
6806
|
"button",
|
|
6698
6807
|
{
|
|
6699
6808
|
type: "button",
|
|
@@ -6708,7 +6817,7 @@ var BubbleMenuContent = ({
|
|
|
6708
6817
|
children: "A"
|
|
6709
6818
|
}
|
|
6710
6819
|
),
|
|
6711
|
-
quickFontSizes.map((option) => /* @__PURE__ */
|
|
6820
|
+
quickFontSizes.map((option) => /* @__PURE__ */ jsx13(
|
|
6712
6821
|
"button",
|
|
6713
6822
|
{
|
|
6714
6823
|
type: "button",
|
|
@@ -6727,9 +6836,9 @@ var BubbleMenuContent = ({
|
|
|
6727
6836
|
] })
|
|
6728
6837
|
] }),
|
|
6729
6838
|
/* @__PURE__ */ jsxs10("div", { children: [
|
|
6730
|
-
/* @__PURE__ */
|
|
6839
|
+
/* @__PURE__ */ jsx13("div", { className: "mb-1 px-1 text-[11px] font-medium text-muted-foreground", children: t("toolbar.lineHeight") }),
|
|
6731
6840
|
/* @__PURE__ */ jsxs10("div", { className: "grid grid-cols-4 gap-1", children: [
|
|
6732
|
-
/* @__PURE__ */
|
|
6841
|
+
/* @__PURE__ */ jsx13(
|
|
6733
6842
|
"button",
|
|
6734
6843
|
{
|
|
6735
6844
|
type: "button",
|
|
@@ -6741,7 +6850,7 @@ var BubbleMenuContent = ({
|
|
|
6741
6850
|
children: "LH"
|
|
6742
6851
|
}
|
|
6743
6852
|
),
|
|
6744
|
-
quickLineHeights.map((option) => /* @__PURE__ */
|
|
6853
|
+
quickLineHeights.map((option) => /* @__PURE__ */ jsx13(
|
|
6745
6854
|
"button",
|
|
6746
6855
|
{
|
|
6747
6856
|
type: "button",
|
|
@@ -6767,7 +6876,7 @@ var BubbleMenuContent = ({
|
|
|
6767
6876
|
editor.isActive("subscript") ? "bg-primary/10 text-primary" : "bg-muted/40 text-foreground"
|
|
6768
6877
|
),
|
|
6769
6878
|
children: [
|
|
6770
|
-
/* @__PURE__ */
|
|
6879
|
+
/* @__PURE__ */ jsx13(SubscriptIcon, { className: "h-4 w-4" }),
|
|
6771
6880
|
t("toolbar.subscript")
|
|
6772
6881
|
]
|
|
6773
6882
|
}
|
|
@@ -6782,7 +6891,7 @@ var BubbleMenuContent = ({
|
|
|
6782
6891
|
editor.isActive("superscript") ? "bg-primary/10 text-primary" : "bg-muted/40 text-foreground"
|
|
6783
6892
|
),
|
|
6784
6893
|
children: [
|
|
6785
|
-
/* @__PURE__ */
|
|
6894
|
+
/* @__PURE__ */ jsx13(SuperscriptIcon, { className: "h-4 w-4" }),
|
|
6786
6895
|
t("toolbar.superscript")
|
|
6787
6896
|
]
|
|
6788
6897
|
}
|
|
@@ -6791,20 +6900,20 @@ var BubbleMenuContent = ({
|
|
|
6791
6900
|
] })
|
|
6792
6901
|
] });
|
|
6793
6902
|
}
|
|
6794
|
-
const VerticalAlignActiveIcon = currentCellVerticalAlign === "middle" ?
|
|
6903
|
+
const VerticalAlignActiveIcon = currentCellVerticalAlign === "middle" ? TableVerticalAlignMiddleIcon : currentCellVerticalAlign === "bottom" ? TableVerticalAlignBottomIcon : TableVerticalAlignTopIcon;
|
|
6795
6904
|
if (isTableCellSelection) {
|
|
6796
6905
|
return /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-0.5 p-1", "data-ueditor-cell-inspector": "", children: [
|
|
6797
|
-
/* @__PURE__ */
|
|
6906
|
+
/* @__PURE__ */ jsx13(
|
|
6798
6907
|
ToolbarButton,
|
|
6799
6908
|
{
|
|
6800
6909
|
onMouseDown: () => onKeepOpenChange?.(true),
|
|
6801
6910
|
onClick: () => setActiveColorPalette("cell-bg"),
|
|
6802
6911
|
active: Boolean(currentCellBgColor),
|
|
6803
6912
|
title: t("tableMenu.cellBackground") || "Cell background",
|
|
6804
|
-
children: /* @__PURE__ */
|
|
6913
|
+
children: /* @__PURE__ */ jsx13(CellBgColorIcon, { color: currentCellBgColor })
|
|
6805
6914
|
}
|
|
6806
6915
|
),
|
|
6807
|
-
/* @__PURE__ */
|
|
6916
|
+
/* @__PURE__ */ jsx13(
|
|
6808
6917
|
ToolbarButton,
|
|
6809
6918
|
{
|
|
6810
6919
|
onMouseDown: () => onKeepOpenChange?.(true),
|
|
@@ -6813,7 +6922,7 @@ var BubbleMenuContent = ({
|
|
|
6813
6922
|
editor.getAttributes("tableCell").borderColor || editor.getAttributes("tableHeader").borderColor || editor.getAttributes("tableCell").borderStyle || editor.getAttributes("tableHeader").borderStyle || editor.getAttributes("tableCell").borderWidth || editor.getAttributes("tableHeader").borderWidth
|
|
6814
6923
|
),
|
|
6815
6924
|
title: t("tableMenu.cellBorder") || "Cell border",
|
|
6816
|
-
children: /* @__PURE__ */
|
|
6925
|
+
children: /* @__PURE__ */ jsx13(
|
|
6817
6926
|
CellBorderIcon,
|
|
6818
6927
|
{
|
|
6819
6928
|
color: editor.getAttributes("tableCell").borderColor || editor.getAttributes("tableHeader").borderColor
|
|
@@ -6821,7 +6930,7 @@ var BubbleMenuContent = ({
|
|
|
6821
6930
|
)
|
|
6822
6931
|
}
|
|
6823
6932
|
),
|
|
6824
|
-
/* @__PURE__ */
|
|
6933
|
+
/* @__PURE__ */ jsx13(
|
|
6825
6934
|
ToolbarButton,
|
|
6826
6935
|
{
|
|
6827
6936
|
onMouseDown: () => onKeepOpenChange?.(true),
|
|
@@ -6831,10 +6940,10 @@ var BubbleMenuContent = ({
|
|
|
6831
6940
|
},
|
|
6832
6941
|
active: Boolean(currentCellFormula),
|
|
6833
6942
|
title: t("tableMenu.formula") || "Formula",
|
|
6834
|
-
children: /* @__PURE__ */
|
|
6943
|
+
children: /* @__PURE__ */ jsx13(Sigma2, { className: "w-4 h-4" })
|
|
6835
6944
|
}
|
|
6836
6945
|
),
|
|
6837
|
-
/* @__PURE__ */
|
|
6946
|
+
/* @__PURE__ */ jsx13(
|
|
6838
6947
|
ToolbarButton,
|
|
6839
6948
|
{
|
|
6840
6949
|
onClick: () => {
|
|
@@ -6847,10 +6956,10 @@ var BubbleMenuContent = ({
|
|
|
6847
6956
|
active: canSplitCell,
|
|
6848
6957
|
disabled: !canMergeCells && !canSplitCell,
|
|
6849
6958
|
title: canSplitCell ? t("tableMenu.splitCell") || "Split cell" : t("tableMenu.mergeCells") || "Merge cells",
|
|
6850
|
-
children: /* @__PURE__ */
|
|
6959
|
+
children: /* @__PURE__ */ jsx13(TableCellsMerge, { className: "w-4 h-4" })
|
|
6851
6960
|
}
|
|
6852
6961
|
),
|
|
6853
|
-
/* @__PURE__ */
|
|
6962
|
+
/* @__PURE__ */ jsx13(
|
|
6854
6963
|
ToolbarButton,
|
|
6855
6964
|
{
|
|
6856
6965
|
onClick: () => applyTableCellAttribute(
|
|
@@ -6861,7 +6970,7 @@ var BubbleMenuContent = ({
|
|
|
6861
6970
|
),
|
|
6862
6971
|
active: currentCellTextWrap !== "nowrap",
|
|
6863
6972
|
title: currentCellTextWrap === "nowrap" ? t("tableMenu.wrapText") : t("tableMenu.noWrapText"),
|
|
6864
|
-
children: /* @__PURE__ */
|
|
6973
|
+
children: /* @__PURE__ */ jsx13(WrapText, { className: "h-4 w-4" })
|
|
6865
6974
|
}
|
|
6866
6975
|
),
|
|
6867
6976
|
/* @__PURE__ */ jsxs10(
|
|
@@ -6876,34 +6985,34 @@ var BubbleMenuContent = ({
|
|
|
6876
6985
|
},
|
|
6877
6986
|
title: t("tableMenu.alignVertical") || "Vertical alignment",
|
|
6878
6987
|
children: [
|
|
6879
|
-
/* @__PURE__ */
|
|
6880
|
-
/* @__PURE__ */
|
|
6988
|
+
/* @__PURE__ */ jsx13(VerticalAlignActiveIcon, { className: "w-4 h-4" }),
|
|
6989
|
+
/* @__PURE__ */ jsx13(ChevronDown2, { className: "w-3 h-3" })
|
|
6881
6990
|
]
|
|
6882
6991
|
}
|
|
6883
6992
|
),
|
|
6884
6993
|
children: [
|
|
6885
|
-
/* @__PURE__ */
|
|
6994
|
+
/* @__PURE__ */ jsx13(
|
|
6886
6995
|
DropdownMenuItem,
|
|
6887
6996
|
{
|
|
6888
|
-
icon:
|
|
6997
|
+
icon: TableVerticalAlignTopIcon,
|
|
6889
6998
|
label: t("tableMenu.alignVerticalTop") || "Align top",
|
|
6890
6999
|
onClick: () => applyTableCellAttribute(editor, "verticalAlign", "top", { focus: false }),
|
|
6891
7000
|
active: currentCellVerticalAlign === "top"
|
|
6892
7001
|
}
|
|
6893
7002
|
),
|
|
6894
|
-
/* @__PURE__ */
|
|
7003
|
+
/* @__PURE__ */ jsx13(
|
|
6895
7004
|
DropdownMenuItem,
|
|
6896
7005
|
{
|
|
6897
|
-
icon:
|
|
7006
|
+
icon: TableVerticalAlignMiddleIcon,
|
|
6898
7007
|
label: t("tableMenu.alignVerticalMiddle") || "Align middle",
|
|
6899
7008
|
onClick: () => applyTableCellAttribute(editor, "verticalAlign", "middle", { focus: false }),
|
|
6900
7009
|
active: currentCellVerticalAlign === "middle"
|
|
6901
7010
|
}
|
|
6902
7011
|
),
|
|
6903
|
-
/* @__PURE__ */
|
|
7012
|
+
/* @__PURE__ */ jsx13(
|
|
6904
7013
|
DropdownMenuItem,
|
|
6905
7014
|
{
|
|
6906
|
-
icon:
|
|
7015
|
+
icon: TableVerticalAlignBottomIcon,
|
|
6907
7016
|
label: t("tableMenu.alignVerticalBottom") || "Align bottom",
|
|
6908
7017
|
onClick: () => applyTableCellAttribute(editor, "verticalAlign", "bottom", { focus: false }),
|
|
6909
7018
|
active: currentCellVerticalAlign === "bottom"
|
|
@@ -6924,13 +7033,13 @@ var BubbleMenuContent = ({
|
|
|
6924
7033
|
},
|
|
6925
7034
|
title: t("tableMenu.textDirection"),
|
|
6926
7035
|
children: [
|
|
6927
|
-
currentCellTextDirection === "vertical" ? /* @__PURE__ */
|
|
6928
|
-
/* @__PURE__ */
|
|
7036
|
+
currentCellTextDirection === "vertical" ? /* @__PURE__ */ jsx13(ArrowDown, { className: "w-4 h-4" }) : /* @__PURE__ */ jsx13(ArrowRight, { className: "w-4 h-4" }),
|
|
7037
|
+
/* @__PURE__ */ jsx13(ChevronDown2, { className: "w-3 h-3" })
|
|
6929
7038
|
]
|
|
6930
7039
|
}
|
|
6931
7040
|
),
|
|
6932
7041
|
children: [
|
|
6933
|
-
/* @__PURE__ */
|
|
7042
|
+
/* @__PURE__ */ jsx13(
|
|
6934
7043
|
DropdownMenuItem,
|
|
6935
7044
|
{
|
|
6936
7045
|
icon: ArrowRight,
|
|
@@ -6939,7 +7048,7 @@ var BubbleMenuContent = ({
|
|
|
6939
7048
|
active: currentCellTextDirection === "horizontal"
|
|
6940
7049
|
}
|
|
6941
7050
|
),
|
|
6942
|
-
/* @__PURE__ */
|
|
7051
|
+
/* @__PURE__ */ jsx13(
|
|
6943
7052
|
DropdownMenuItem,
|
|
6944
7053
|
{
|
|
6945
7054
|
icon: ArrowDown,
|
|
@@ -6954,21 +7063,21 @@ var BubbleMenuContent = ({
|
|
|
6954
7063
|
] });
|
|
6955
7064
|
}
|
|
6956
7065
|
return /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-0.5 p-1", children: [
|
|
6957
|
-
/* @__PURE__ */
|
|
6958
|
-
/* @__PURE__ */
|
|
6959
|
-
/* @__PURE__ */
|
|
7066
|
+
/* @__PURE__ */ jsx13(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ jsx13(BoldIcon, { className: "w-4 h-4" }) }),
|
|
7067
|
+
/* @__PURE__ */ jsx13(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ jsx13(ItalicIcon, { className: "w-4 h-4" }) }),
|
|
7068
|
+
/* @__PURE__ */ jsx13(
|
|
6960
7069
|
ToolbarButton,
|
|
6961
7070
|
{
|
|
6962
7071
|
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
6963
7072
|
active: editor.isActive("underline"),
|
|
6964
7073
|
title: t("toolbar.underline"),
|
|
6965
|
-
children: /* @__PURE__ */
|
|
7074
|
+
children: /* @__PURE__ */ jsx13(UnderlineIcon, { className: "w-4 h-4" })
|
|
6966
7075
|
}
|
|
6967
7076
|
),
|
|
6968
|
-
/* @__PURE__ */
|
|
6969
|
-
/* @__PURE__ */
|
|
6970
|
-
/* @__PURE__ */
|
|
6971
|
-
/* @__PURE__ */
|
|
7077
|
+
/* @__PURE__ */ jsx13(ToolbarButton, { onClick: () => editor.chain().focus().toggleStrike().run(), active: editor.isActive("strike"), title: t("toolbar.strike"), children: /* @__PURE__ */ jsx13(StrikethroughIcon, { className: "w-4 h-4" }) }),
|
|
7078
|
+
/* @__PURE__ */ jsx13(ToolbarButton, { onClick: () => editor.chain().focus().toggleCode().run(), active: editor.isActive("code"), title: t("toolbar.code"), children: /* @__PURE__ */ jsx13(CodeIcon, { className: "w-4 h-4" }) }),
|
|
7079
|
+
/* @__PURE__ */ jsx13("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
7080
|
+
/* @__PURE__ */ jsx13(
|
|
6972
7081
|
ToolbarButton,
|
|
6973
7082
|
{
|
|
6974
7083
|
onMouseDown: () => {
|
|
@@ -6979,18 +7088,18 @@ var BubbleMenuContent = ({
|
|
|
6979
7088
|
},
|
|
6980
7089
|
active: editor.isActive("link"),
|
|
6981
7090
|
title: t("toolbar.link"),
|
|
6982
|
-
children: /* @__PURE__ */
|
|
7091
|
+
children: /* @__PURE__ */ jsx13(LinkIcon, { className: "w-4 h-4" })
|
|
6983
7092
|
}
|
|
6984
7093
|
),
|
|
6985
|
-
/* @__PURE__ */
|
|
6986
|
-
/* @__PURE__ */
|
|
6987
|
-
/* @__PURE__ */
|
|
7094
|
+
/* @__PURE__ */ jsx13(ToolbarButton, { onClick: () => setActiveColorPalette("text"), title: t("colors.textColor"), children: /* @__PURE__ */ jsx13(TextColorIcon, { color: currentTextColor }) }),
|
|
7095
|
+
/* @__PURE__ */ jsx13(ToolbarButton, { onClick: () => setActiveColorPalette("highlight"), active: editor.isActive("highlight"), title: t("colors.highlight"), children: /* @__PURE__ */ jsx13(HighlightColorIcon, { color: currentHighlightColor }) }),
|
|
7096
|
+
/* @__PURE__ */ jsx13(
|
|
6988
7097
|
ToolbarButton,
|
|
6989
7098
|
{
|
|
6990
7099
|
onClick: () => setShowTypographyPanel(true),
|
|
6991
7100
|
active: Boolean(currentFontSize || currentLineHeight || editor.isActive("subscript") || editor.isActive("superscript")),
|
|
6992
7101
|
title: t("toolbar.textStyle"),
|
|
6993
|
-
children: /* @__PURE__ */
|
|
7102
|
+
children: /* @__PURE__ */ jsx13(Type2, { className: "w-4 h-4" })
|
|
6994
7103
|
}
|
|
6995
7104
|
)
|
|
6996
7105
|
] });
|
|
@@ -7006,11 +7115,11 @@ var LinkPreviewContent = ({ editor, onEdit }) => {
|
|
|
7006
7115
|
editor.chain().focus().unsetLink().run();
|
|
7007
7116
|
};
|
|
7008
7117
|
return /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1 p-1 max-w-sm", children: [
|
|
7009
|
-
/* @__PURE__ */
|
|
7010
|
-
/* @__PURE__ */
|
|
7011
|
-
/* @__PURE__ */
|
|
7012
|
-
/* @__PURE__ */
|
|
7013
|
-
/* @__PURE__ */
|
|
7118
|
+
/* @__PURE__ */ jsx13("span", { className: "text-xs text-muted-foreground font-mono px-2 truncate max-w-45", children: url }),
|
|
7119
|
+
/* @__PURE__ */ jsx13("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
7120
|
+
/* @__PURE__ */ jsx13(ToolbarButton, { onClick: handleOpen, title: t("linkPreview.open") || "Open link", children: /* @__PURE__ */ jsx13(ExternalLink2, { className: "w-4 h-4" }) }),
|
|
7121
|
+
/* @__PURE__ */ jsx13(ToolbarButton, { onClick: onEdit, title: t("linkPreview.edit") || "Edit link", children: /* @__PURE__ */ jsx13(Edit2, { className: "w-4 h-4" }) }),
|
|
7122
|
+
/* @__PURE__ */ jsx13(ToolbarButton, { onClick: handleUnlink, title: t("linkPreview.unlink") || "Remove link", className: "text-destructive hover:text-destructive", children: /* @__PURE__ */ jsx13(Unlink, { className: "w-4 h-4" }) })
|
|
7014
7123
|
] });
|
|
7015
7124
|
};
|
|
7016
7125
|
var CustomBubbleMenu = ({
|
|
@@ -7205,7 +7314,7 @@ var CustomBubbleMenu = ({
|
|
|
7205
7314
|
const context = getBubbleMenuContext(editor);
|
|
7206
7315
|
if (context === "none") return null;
|
|
7207
7316
|
return createPortal(
|
|
7208
|
-
/* @__PURE__ */
|
|
7317
|
+
/* @__PURE__ */ jsx13(
|
|
7209
7318
|
"div",
|
|
7210
7319
|
{
|
|
7211
7320
|
ref: menuRef,
|
|
@@ -7229,7 +7338,7 @@ var CustomBubbleMenu = ({
|
|
|
7229
7338
|
}
|
|
7230
7339
|
e.preventDefault();
|
|
7231
7340
|
},
|
|
7232
|
-
children: context === "link" && !keepOpen && !linkInputOpen ? /* @__PURE__ */
|
|
7341
|
+
children: context === "link" && !keepOpen && !linkInputOpen ? /* @__PURE__ */ jsx13(
|
|
7233
7342
|
LinkPreviewContent,
|
|
7234
7343
|
{
|
|
7235
7344
|
editor,
|
|
@@ -7238,7 +7347,7 @@ var CustomBubbleMenu = ({
|
|
|
7238
7347
|
setKeepOpen(true);
|
|
7239
7348
|
}
|
|
7240
7349
|
}
|
|
7241
|
-
) : /* @__PURE__ */
|
|
7350
|
+
) : /* @__PURE__ */ jsx13(
|
|
7242
7351
|
BubbleMenuContent,
|
|
7243
7352
|
{
|
|
7244
7353
|
editor,
|
|
@@ -7303,7 +7412,7 @@ var CustomFloatingMenu = ({ editor }) => {
|
|
|
7303
7412
|
}, [editor, editorWindow]);
|
|
7304
7413
|
if (!isVisible || !portalContainer) return null;
|
|
7305
7414
|
return createPortal(
|
|
7306
|
-
/* @__PURE__ */
|
|
7415
|
+
/* @__PURE__ */ jsx13(
|
|
7307
7416
|
"div",
|
|
7308
7417
|
{
|
|
7309
7418
|
"data-popover": true,
|
|
@@ -7314,7 +7423,7 @@ var CustomFloatingMenu = ({ editor }) => {
|
|
|
7314
7423
|
transform: "translate(-50%, -100%)"
|
|
7315
7424
|
},
|
|
7316
7425
|
onMouseDown: (e) => e.preventDefault(),
|
|
7317
|
-
children: /* @__PURE__ */
|
|
7426
|
+
children: /* @__PURE__ */ jsx13(FloatingMenuContent, { editor })
|
|
7318
7427
|
}
|
|
7319
7428
|
),
|
|
7320
7429
|
portalContainer
|
|
@@ -7357,7 +7466,7 @@ var CharacterCountDisplay = ({ editor, maxCharacters }) => {
|
|
|
7357
7466
|
};
|
|
7358
7467
|
|
|
7359
7468
|
// src/components/UEditor/table-controls.tsx
|
|
7360
|
-
import
|
|
7469
|
+
import React12 from "react";
|
|
7361
7470
|
|
|
7362
7471
|
// node_modules/prosemirror-model/dist/index.js
|
|
7363
7472
|
function findDiffStart(a, b, pos) {
|
|
@@ -8406,7 +8515,7 @@ var NodeRange = class {
|
|
|
8406
8515
|
}
|
|
8407
8516
|
};
|
|
8408
8517
|
var emptyAttrs = /* @__PURE__ */ Object.create(null);
|
|
8409
|
-
var
|
|
8518
|
+
var Node7 = class _Node {
|
|
8410
8519
|
/**
|
|
8411
8520
|
@internal
|
|
8412
8521
|
*/
|
|
@@ -8808,7 +8917,7 @@ var Node6 = class _Node {
|
|
|
8808
8917
|
return node;
|
|
8809
8918
|
}
|
|
8810
8919
|
};
|
|
8811
|
-
|
|
8920
|
+
Node7.prototype.text = void 0;
|
|
8812
8921
|
function wrapMarks(marks, str) {
|
|
8813
8922
|
for (let i = marks.length - 1; i >= 0; i--)
|
|
8814
8923
|
str = marks[i].type.name + "(" + str + ")";
|
|
@@ -11910,7 +12019,7 @@ function buildTableHoverState({
|
|
|
11910
12019
|
}
|
|
11911
12020
|
|
|
11912
12021
|
// src/components/UEditor/table-drag-preview.tsx
|
|
11913
|
-
import { Fragment as Fragment3, jsx as
|
|
12022
|
+
import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
11914
12023
|
function TableDragPreview({
|
|
11915
12024
|
columnDragLabel,
|
|
11916
12025
|
dragPreview,
|
|
@@ -11923,7 +12032,7 @@ function TableDragPreview({
|
|
|
11923
12032
|
const dragStatusText = dragPreview.kind === "row" ? `${rowDragLabel} ${dragPreview.originIndex + 1} -> ${dragPreview.targetIndex + 1}` : dragPreview.kind === "column" ? `${columnDragLabel} ${dragPreview.originIndex + 1} -> ${dragPreview.targetIndex + 1}` : dragPreview.kind === "add-row" ? `+${dragPreview.previewRows}R` : `+${dragPreview.previewCols}C`;
|
|
11924
12033
|
return /* @__PURE__ */ jsxs12(Fragment3, { children: [
|
|
11925
12034
|
dragPreview.kind === "row" && /* @__PURE__ */ jsxs12(Fragment3, { children: [
|
|
11926
|
-
/* @__PURE__ */
|
|
12035
|
+
/* @__PURE__ */ jsx14(
|
|
11927
12036
|
"div",
|
|
11928
12037
|
{
|
|
11929
12038
|
"aria-hidden": "true",
|
|
@@ -11936,7 +12045,7 @@ function TableDragPreview({
|
|
|
11936
12045
|
}
|
|
11937
12046
|
}
|
|
11938
12047
|
),
|
|
11939
|
-
/* @__PURE__ */
|
|
12048
|
+
/* @__PURE__ */ jsx14(
|
|
11940
12049
|
"div",
|
|
11941
12050
|
{
|
|
11942
12051
|
"aria-hidden": "true",
|
|
@@ -11951,7 +12060,7 @@ function TableDragPreview({
|
|
|
11951
12060
|
)
|
|
11952
12061
|
] }),
|
|
11953
12062
|
dragPreview.kind === "column" && /* @__PURE__ */ jsxs12(Fragment3, { children: [
|
|
11954
|
-
/* @__PURE__ */
|
|
12063
|
+
/* @__PURE__ */ jsx14(
|
|
11955
12064
|
"div",
|
|
11956
12065
|
{
|
|
11957
12066
|
"aria-hidden": "true",
|
|
@@ -11964,7 +12073,7 @@ function TableDragPreview({
|
|
|
11964
12073
|
}
|
|
11965
12074
|
}
|
|
11966
12075
|
),
|
|
11967
|
-
/* @__PURE__ */
|
|
12076
|
+
/* @__PURE__ */ jsx14(
|
|
11968
12077
|
"div",
|
|
11969
12078
|
{
|
|
11970
12079
|
"aria-hidden": "true",
|
|
@@ -11978,7 +12087,7 @@ function TableDragPreview({
|
|
|
11978
12087
|
}
|
|
11979
12088
|
)
|
|
11980
12089
|
] }),
|
|
11981
|
-
(dragPreview.kind === "add-row" || dragPreview.kind === "add-column") && /* @__PURE__ */
|
|
12090
|
+
(dragPreview.kind === "add-row" || dragPreview.kind === "add-column") && /* @__PURE__ */ jsx14(
|
|
11982
12091
|
"div",
|
|
11983
12092
|
{
|
|
11984
12093
|
"aria-hidden": "true",
|
|
@@ -11991,7 +12100,7 @@ function TableDragPreview({
|
|
|
11991
12100
|
}
|
|
11992
12101
|
}
|
|
11993
12102
|
),
|
|
11994
|
-
/* @__PURE__ */
|
|
12103
|
+
/* @__PURE__ */ jsx14(
|
|
11995
12104
|
"div",
|
|
11996
12105
|
{
|
|
11997
12106
|
role: "status",
|
|
@@ -12007,7 +12116,7 @@ function TableDragPreview({
|
|
|
12007
12116
|
}
|
|
12008
12117
|
|
|
12009
12118
|
// src/components/UEditor/table-add-rails.tsx
|
|
12010
|
-
import { Fragment as Fragment4, jsx as
|
|
12119
|
+
import { Fragment as Fragment4, jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
12011
12120
|
var ADD_COLUMN_RAIL_GAP = 4;
|
|
12012
12121
|
var ADD_ROW_RAIL_GAP = 4;
|
|
12013
12122
|
var BUTTON_LONG_SIZE = 36;
|
|
@@ -12033,12 +12142,12 @@ function TableAddRails({
|
|
|
12033
12142
|
const showColumnRail = controlsVisible || addColumnVisible;
|
|
12034
12143
|
const showRowRail = controlsVisible || addRowVisible;
|
|
12035
12144
|
return /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
12036
|
-
/* @__PURE__ */
|
|
12145
|
+
/* @__PURE__ */ jsx15(
|
|
12037
12146
|
Tooltip,
|
|
12038
12147
|
{
|
|
12039
12148
|
placement: "right",
|
|
12040
|
-
content: /* @__PURE__ */
|
|
12041
|
-
children: /* @__PURE__ */
|
|
12149
|
+
content: /* @__PURE__ */ jsx15("span", { className: "text-xs font-medium", children: quickAddColumnLabel }),
|
|
12150
|
+
children: /* @__PURE__ */ jsx15(
|
|
12042
12151
|
"button",
|
|
12043
12152
|
{
|
|
12044
12153
|
type: "button",
|
|
@@ -12066,17 +12175,17 @@ function TableAddRails({
|
|
|
12066
12175
|
transform: showColumnRail ? "scale(1)" : "scale(0.85)",
|
|
12067
12176
|
pointerEvents: showColumnRail ? "auto" : "none"
|
|
12068
12177
|
},
|
|
12069
|
-
children: /* @__PURE__ */
|
|
12178
|
+
children: /* @__PURE__ */ jsx15("span", { className: "text-sm font-medium leading-none", children: "+" })
|
|
12070
12179
|
}
|
|
12071
12180
|
)
|
|
12072
12181
|
}
|
|
12073
12182
|
),
|
|
12074
|
-
/* @__PURE__ */
|
|
12183
|
+
/* @__PURE__ */ jsx15(
|
|
12075
12184
|
Tooltip,
|
|
12076
12185
|
{
|
|
12077
12186
|
placement: "bottom",
|
|
12078
|
-
content: /* @__PURE__ */
|
|
12079
|
-
children: /* @__PURE__ */
|
|
12187
|
+
content: /* @__PURE__ */ jsx15("span", { className: "text-xs font-medium", children: quickAddRowLabel }),
|
|
12188
|
+
children: /* @__PURE__ */ jsx15(
|
|
12080
12189
|
"button",
|
|
12081
12190
|
{
|
|
12082
12191
|
type: "button",
|
|
@@ -12102,7 +12211,7 @@ function TableAddRails({
|
|
|
12102
12211
|
transform: showRowRail ? "scale(1)" : "scale(0.85)",
|
|
12103
12212
|
pointerEvents: showRowRail ? "auto" : "none"
|
|
12104
12213
|
},
|
|
12105
|
-
children: /* @__PURE__ */
|
|
12214
|
+
children: /* @__PURE__ */ jsx15("span", { className: "text-sm font-medium leading-none", children: "+" })
|
|
12106
12215
|
}
|
|
12107
12216
|
)
|
|
12108
12217
|
}
|
|
@@ -12112,7 +12221,7 @@ function TableAddRails({
|
|
|
12112
12221
|
|
|
12113
12222
|
// src/components/UEditor/table-control-menu.tsx
|
|
12114
12223
|
import { MoreHorizontal } from "lucide-react";
|
|
12115
|
-
import { jsx as
|
|
12224
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
12116
12225
|
function TableControlMenu({
|
|
12117
12226
|
controlsVisible,
|
|
12118
12227
|
isOpen,
|
|
@@ -12124,7 +12233,7 @@ function TableControlMenu({
|
|
|
12124
12233
|
top
|
|
12125
12234
|
}) {
|
|
12126
12235
|
const shown = controlsVisible || menuVisible || isOpen;
|
|
12127
|
-
return /* @__PURE__ */
|
|
12236
|
+
return /* @__PURE__ */ jsx16(
|
|
12128
12237
|
"div",
|
|
12129
12238
|
{
|
|
12130
12239
|
className: "absolute z-30",
|
|
@@ -12133,13 +12242,13 @@ function TableControlMenu({
|
|
|
12133
12242
|
top,
|
|
12134
12243
|
left
|
|
12135
12244
|
},
|
|
12136
|
-
children: /* @__PURE__ */
|
|
12245
|
+
children: /* @__PURE__ */ jsx16(
|
|
12137
12246
|
Tooltip,
|
|
12138
12247
|
{
|
|
12139
12248
|
placement: "top",
|
|
12140
12249
|
disabled: isOpen,
|
|
12141
|
-
content: /* @__PURE__ */
|
|
12142
|
-
children: /* @__PURE__ */
|
|
12250
|
+
content: /* @__PURE__ */ jsx16("span", { className: "text-xs font-medium", children: label }),
|
|
12251
|
+
children: /* @__PURE__ */ jsx16("span", { className: "inline-flex", children: /* @__PURE__ */ jsx16(
|
|
12143
12252
|
DropdownMenu,
|
|
12144
12253
|
{
|
|
12145
12254
|
placement: "bottom-start",
|
|
@@ -12147,7 +12256,7 @@ function TableControlMenu({
|
|
|
12147
12256
|
onOpenChange,
|
|
12148
12257
|
contentClassName: "p-2",
|
|
12149
12258
|
items,
|
|
12150
|
-
trigger: /* @__PURE__ */
|
|
12259
|
+
trigger: /* @__PURE__ */ jsx16(
|
|
12151
12260
|
"button",
|
|
12152
12261
|
{
|
|
12153
12262
|
type: "button",
|
|
@@ -12163,7 +12272,7 @@ function TableControlMenu({
|
|
|
12163
12272
|
transform: shown ? "scale(1)" : "scale(0.82)",
|
|
12164
12273
|
pointerEvents: shown ? "auto" : "none"
|
|
12165
12274
|
},
|
|
12166
|
-
children: /* @__PURE__ */
|
|
12275
|
+
children: /* @__PURE__ */ jsx16(MoreHorizontal, { "aria-hidden": "true", className: "h-4 w-4" })
|
|
12167
12276
|
}
|
|
12168
12277
|
)
|
|
12169
12278
|
}
|
|
@@ -12176,7 +12285,7 @@ function TableControlMenu({
|
|
|
12176
12285
|
|
|
12177
12286
|
// src/components/UEditor/table-axis-handles.tsx
|
|
12178
12287
|
import { GripHorizontal, GripVertical } from "lucide-react";
|
|
12179
|
-
import { Fragment as Fragment5, jsx as
|
|
12288
|
+
import { Fragment as Fragment5, jsx as jsx17 } from "react/jsx-runtime";
|
|
12180
12289
|
var IDLE_HANDLE_SCALE = "0.78";
|
|
12181
12290
|
function TableRowHandles({
|
|
12182
12291
|
activeRowIndex,
|
|
@@ -12191,12 +12300,12 @@ function TableRowHandles({
|
|
|
12191
12300
|
rowHandleLeft,
|
|
12192
12301
|
rowHandles
|
|
12193
12302
|
}) {
|
|
12194
|
-
return /* @__PURE__ */
|
|
12303
|
+
return /* @__PURE__ */ jsx17(Fragment5, { children: rowHandles.map((rowHandle) => {
|
|
12195
12304
|
const menuKey = `row:${rowHandle.index}`;
|
|
12196
12305
|
const isActive = rowHandle.index === activeRowIndex;
|
|
12197
12306
|
const visible = controlsVisible || hoverRowHandleIndex === rowHandle.index || openMenuKey === menuKey;
|
|
12198
12307
|
const isShown = visible || isActive;
|
|
12199
|
-
return /* @__PURE__ */
|
|
12308
|
+
return /* @__PURE__ */ jsx17(
|
|
12200
12309
|
"div",
|
|
12201
12310
|
{
|
|
12202
12311
|
className: "absolute z-30",
|
|
@@ -12206,13 +12315,13 @@ function TableRowHandles({
|
|
|
12206
12315
|
left: rowHandleLeft,
|
|
12207
12316
|
pointerEvents: visible ? "auto" : "none"
|
|
12208
12317
|
},
|
|
12209
|
-
children: /* @__PURE__ */
|
|
12318
|
+
children: /* @__PURE__ */ jsx17(
|
|
12210
12319
|
Tooltip,
|
|
12211
12320
|
{
|
|
12212
12321
|
placement: "right",
|
|
12213
12322
|
disabled: openMenuKey === menuKey || !visible && isActive,
|
|
12214
|
-
content: /* @__PURE__ */
|
|
12215
|
-
children: /* @__PURE__ */
|
|
12323
|
+
content: /* @__PURE__ */ jsx17("span", { className: "text-xs font-medium", children: `${rowDragLabel} ${rowHandle.index + 1}` }),
|
|
12324
|
+
children: /* @__PURE__ */ jsx17("span", { className: "inline-flex", children: /* @__PURE__ */ jsx17(
|
|
12216
12325
|
DropdownMenu,
|
|
12217
12326
|
{
|
|
12218
12327
|
placement: "right",
|
|
@@ -12220,7 +12329,7 @@ function TableRowHandles({
|
|
|
12220
12329
|
onOpenChange: (open) => onOpenMenuChange(menuKey, open),
|
|
12221
12330
|
contentClassName: "p-2",
|
|
12222
12331
|
items: getMenuItems(rowHandle),
|
|
12223
|
-
trigger: /* @__PURE__ */
|
|
12332
|
+
trigger: /* @__PURE__ */ jsx17(
|
|
12224
12333
|
"button",
|
|
12225
12334
|
{
|
|
12226
12335
|
type: "button",
|
|
@@ -12245,7 +12354,7 @@ function TableRowHandles({
|
|
|
12245
12354
|
// selection near the first character of a table cell.
|
|
12246
12355
|
pointerEvents: visible ? "auto" : "none"
|
|
12247
12356
|
},
|
|
12248
|
-
children: visible ? /* @__PURE__ */
|
|
12357
|
+
children: visible ? /* @__PURE__ */ jsx17(GripVertical, { "aria-hidden": "true", className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx17("div", { className: "h-3 w-1 rounded-full bg-muted-foreground/50 hover:bg-muted-foreground" })
|
|
12249
12358
|
}
|
|
12250
12359
|
)
|
|
12251
12360
|
}
|
|
@@ -12270,12 +12379,12 @@ function TableColumnHandles({
|
|
|
12270
12379
|
onStartDrag,
|
|
12271
12380
|
openMenuKey
|
|
12272
12381
|
}) {
|
|
12273
|
-
return /* @__PURE__ */
|
|
12382
|
+
return /* @__PURE__ */ jsx17(Fragment5, { children: columnHandles.map((columnHandle) => {
|
|
12274
12383
|
const menuKey = `column:${columnHandle.index}`;
|
|
12275
12384
|
const isActive = columnHandle.index === activeColumnIndex;
|
|
12276
12385
|
const visible = controlsVisible || hoverColumnHandleIndex === columnHandle.index || openMenuKey === menuKey;
|
|
12277
12386
|
const isShown = visible || isActive;
|
|
12278
|
-
return /* @__PURE__ */
|
|
12387
|
+
return /* @__PURE__ */ jsx17(
|
|
12279
12388
|
"div",
|
|
12280
12389
|
{
|
|
12281
12390
|
className: "absolute z-30",
|
|
@@ -12285,13 +12394,13 @@ function TableColumnHandles({
|
|
|
12285
12394
|
left: Math.max(8, columnHandle.center - 12),
|
|
12286
12395
|
pointerEvents: visible ? "auto" : "none"
|
|
12287
12396
|
},
|
|
12288
|
-
children: /* @__PURE__ */
|
|
12397
|
+
children: /* @__PURE__ */ jsx17(
|
|
12289
12398
|
Tooltip,
|
|
12290
12399
|
{
|
|
12291
12400
|
placement: "top",
|
|
12292
12401
|
disabled: openMenuKey === menuKey || !visible && isActive,
|
|
12293
|
-
content: /* @__PURE__ */
|
|
12294
|
-
children: /* @__PURE__ */
|
|
12402
|
+
content: /* @__PURE__ */ jsx17("span", { className: "text-xs font-medium", children: `${columnDragLabel} ${columnHandle.index + 1}` }),
|
|
12403
|
+
children: /* @__PURE__ */ jsx17("span", { className: "inline-flex", children: /* @__PURE__ */ jsx17(
|
|
12295
12404
|
DropdownMenu,
|
|
12296
12405
|
{
|
|
12297
12406
|
placement: "bottom-start",
|
|
@@ -12299,7 +12408,7 @@ function TableColumnHandles({
|
|
|
12299
12408
|
onOpenChange: (open) => onOpenMenuChange(menuKey, open),
|
|
12300
12409
|
contentClassName: "p-2",
|
|
12301
12410
|
items: getMenuItems(columnHandle),
|
|
12302
|
-
trigger: /* @__PURE__ */
|
|
12411
|
+
trigger: /* @__PURE__ */ jsx17(
|
|
12303
12412
|
"button",
|
|
12304
12413
|
{
|
|
12305
12414
|
type: "button",
|
|
@@ -12321,7 +12430,7 @@ function TableColumnHandles({
|
|
|
12321
12430
|
transform: isShown ? "scale(1)" : `scale(${IDLE_HANDLE_SCALE})`,
|
|
12322
12431
|
pointerEvents: visible ? "auto" : "none"
|
|
12323
12432
|
},
|
|
12324
|
-
children: visible ? /* @__PURE__ */
|
|
12433
|
+
children: visible ? /* @__PURE__ */ jsx17(GripHorizontal, { "aria-hidden": "true", className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx17("div", { className: "h-1 w-3 rounded-full bg-muted-foreground/50 hover:bg-muted-foreground" })
|
|
12325
12434
|
}
|
|
12326
12435
|
)
|
|
12327
12436
|
}
|
|
@@ -12336,7 +12445,7 @@ function TableColumnHandles({
|
|
|
12336
12445
|
|
|
12337
12446
|
// src/components/UEditor/table-resize-handles.tsx
|
|
12338
12447
|
import { MoveDiagonal2 } from "lucide-react";
|
|
12339
|
-
import { Fragment as Fragment6, jsx as
|
|
12448
|
+
import { Fragment as Fragment6, jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
12340
12449
|
var EDGE_HANDLE_CLASS = cn(
|
|
12341
12450
|
"pointer-events-auto absolute top-0 z-10 h-full w-2 touch-none cursor-col-resize bg-transparent p-0",
|
|
12342
12451
|
"border-transparent transition-colors duration-150 hover:border-primary",
|
|
@@ -12387,7 +12496,7 @@ function TableResizeHandles({
|
|
|
12387
12496
|
},
|
|
12388
12497
|
children: [
|
|
12389
12498
|
layout.widthMode === "responsive" ? /* @__PURE__ */ jsxs14(Fragment6, { children: [
|
|
12390
|
-
/* @__PURE__ */
|
|
12499
|
+
/* @__PURE__ */ jsx18(
|
|
12391
12500
|
"button",
|
|
12392
12501
|
{
|
|
12393
12502
|
type: "button",
|
|
@@ -12402,7 +12511,7 @@ function TableResizeHandles({
|
|
|
12402
12511
|
onKeyDown: (event) => onKeyboardResize(event, "left")
|
|
12403
12512
|
}
|
|
12404
12513
|
),
|
|
12405
|
-
/* @__PURE__ */
|
|
12514
|
+
/* @__PURE__ */ jsx18(
|
|
12406
12515
|
"button",
|
|
12407
12516
|
{
|
|
12408
12517
|
type: "button",
|
|
@@ -12418,7 +12527,7 @@ function TableResizeHandles({
|
|
|
12418
12527
|
}
|
|
12419
12528
|
)
|
|
12420
12529
|
] }) : null,
|
|
12421
|
-
/* @__PURE__ */
|
|
12530
|
+
/* @__PURE__ */ jsx18(
|
|
12422
12531
|
"button",
|
|
12423
12532
|
{
|
|
12424
12533
|
type: "button",
|
|
@@ -12436,10 +12545,10 @@ function TableResizeHandles({
|
|
|
12436
12545
|
},
|
|
12437
12546
|
onPointerDown: (event) => onStartResize(event, "both"),
|
|
12438
12547
|
onKeyDown: (event) => onKeyboardResize(event, "both"),
|
|
12439
|
-
children: /* @__PURE__ */
|
|
12548
|
+
children: /* @__PURE__ */ jsx18(MoveDiagonal2, { "aria-hidden": "true", className: "h-3.5 w-3.5", strokeWidth: 2.25 })
|
|
12440
12549
|
}
|
|
12441
12550
|
),
|
|
12442
|
-
active ? /* @__PURE__ */
|
|
12551
|
+
active ? /* @__PURE__ */ jsx18(
|
|
12443
12552
|
"span",
|
|
12444
12553
|
{
|
|
12445
12554
|
role: "status",
|
|
@@ -12689,7 +12798,7 @@ function applyTableSize(editor, snapshot, dimensions, options = {}) {
|
|
|
12689
12798
|
}
|
|
12690
12799
|
|
|
12691
12800
|
// src/components/UEditor/table-controls.tsx
|
|
12692
|
-
import { Fragment as Fragment7, jsx as
|
|
12801
|
+
import { Fragment as Fragment7, jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
12693
12802
|
var TABLE_MENU_TOP_OFFSET = 10;
|
|
12694
12803
|
var AXIS_HANDLE_RADIUS = 12;
|
|
12695
12804
|
function clamp2(value, min, max) {
|
|
@@ -12725,21 +12834,21 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
12725
12834
|
const t = useSmartTranslations("UEditor");
|
|
12726
12835
|
const editorDocument = editor.view.dom.ownerDocument;
|
|
12727
12836
|
const editorWindow = editorDocument.defaultView;
|
|
12728
|
-
const [layout, setLayout] =
|
|
12729
|
-
const [dragPreview, setDragPreview] =
|
|
12730
|
-
const [tableResizeActive, setTableResizeActive] =
|
|
12731
|
-
const [hoverState, setHoverState] =
|
|
12732
|
-
const [openMenuKey, setOpenMenuKey] =
|
|
12733
|
-
const layoutRef =
|
|
12734
|
-
const dragStateRef =
|
|
12735
|
-
const syncFrameRef =
|
|
12736
|
-
const layoutRefreshFrameRef =
|
|
12737
|
-
const tableResizeFrameRef =
|
|
12738
|
-
const tableResizePreviewFrameRef =
|
|
12739
|
-
|
|
12837
|
+
const [layout, setLayout] = React12.useState(null);
|
|
12838
|
+
const [dragPreview, setDragPreview] = React12.useState(null);
|
|
12839
|
+
const [tableResizeActive, setTableResizeActive] = React12.useState(false);
|
|
12840
|
+
const [hoverState, setHoverState] = React12.useState(DEFAULT_TABLE_HOVER_STATE);
|
|
12841
|
+
const [openMenuKey, setOpenMenuKey] = React12.useState(null);
|
|
12842
|
+
const layoutRef = React12.useRef(null);
|
|
12843
|
+
const dragStateRef = React12.useRef(null);
|
|
12844
|
+
const syncFrameRef = React12.useRef(null);
|
|
12845
|
+
const layoutRefreshFrameRef = React12.useRef(null);
|
|
12846
|
+
const tableResizeFrameRef = React12.useRef(null);
|
|
12847
|
+
const tableResizePreviewFrameRef = React12.useRef(null);
|
|
12848
|
+
React12.useEffect(() => {
|
|
12740
12849
|
layoutRef.current = layout;
|
|
12741
12850
|
}, [layout]);
|
|
12742
|
-
const syncFromCell =
|
|
12851
|
+
const syncFromCell = React12.useCallback((cell) => {
|
|
12743
12852
|
const surface = containerRef.current;
|
|
12744
12853
|
if (!surface || !cell) {
|
|
12745
12854
|
layoutRef.current = null;
|
|
@@ -12750,10 +12859,10 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
12750
12859
|
layoutRef.current = nextLayout;
|
|
12751
12860
|
setLayout(nextLayout);
|
|
12752
12861
|
}, [containerRef, editor]);
|
|
12753
|
-
const syncFromSelection =
|
|
12862
|
+
const syncFromSelection = React12.useCallback(() => {
|
|
12754
12863
|
syncFromCell(getSelectedCell(editor));
|
|
12755
12864
|
}, [editor, syncFromCell]);
|
|
12756
|
-
const scheduleSyncFromSelection =
|
|
12865
|
+
const scheduleSyncFromSelection = React12.useCallback(() => {
|
|
12757
12866
|
if (syncFrameRef.current !== null) return;
|
|
12758
12867
|
if (!editorWindow) return;
|
|
12759
12868
|
syncFrameRef.current = editorWindow.requestAnimationFrame(() => {
|
|
@@ -12761,13 +12870,13 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
12761
12870
|
syncFromSelection();
|
|
12762
12871
|
});
|
|
12763
12872
|
}, [editorWindow, syncFromSelection]);
|
|
12764
|
-
|
|
12873
|
+
React12.useEffect(() => () => {
|
|
12765
12874
|
if (syncFrameRef.current !== null) {
|
|
12766
12875
|
editorWindow?.cancelAnimationFrame(syncFrameRef.current);
|
|
12767
12876
|
syncFrameRef.current = null;
|
|
12768
12877
|
}
|
|
12769
12878
|
}, [editorWindow]);
|
|
12770
|
-
const refreshCurrentLayout =
|
|
12879
|
+
const refreshCurrentLayout = React12.useCallback(() => {
|
|
12771
12880
|
const currentLayout = layoutRef.current;
|
|
12772
12881
|
if (!currentLayout) return;
|
|
12773
12882
|
const surface = containerRef.current;
|
|
@@ -12782,7 +12891,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
12782
12891
|
layoutRef.current = nextLayout;
|
|
12783
12892
|
setLayout(nextLayout);
|
|
12784
12893
|
}, [containerRef, editor]);
|
|
12785
|
-
const scheduleCurrentLayoutRefresh =
|
|
12894
|
+
const scheduleCurrentLayoutRefresh = React12.useCallback(() => {
|
|
12786
12895
|
if (!layoutRef.current || layoutRefreshFrameRef.current !== null) return;
|
|
12787
12896
|
if (!editorWindow) return;
|
|
12788
12897
|
layoutRefreshFrameRef.current = editorWindow.requestAnimationFrame(() => {
|
|
@@ -12790,13 +12899,13 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
12790
12899
|
refreshCurrentLayout();
|
|
12791
12900
|
});
|
|
12792
12901
|
}, [editorWindow, refreshCurrentLayout]);
|
|
12793
|
-
|
|
12902
|
+
React12.useEffect(() => () => {
|
|
12794
12903
|
if (layoutRefreshFrameRef.current !== null) {
|
|
12795
12904
|
editorWindow?.cancelAnimationFrame(layoutRefreshFrameRef.current);
|
|
12796
12905
|
layoutRefreshFrameRef.current = null;
|
|
12797
12906
|
}
|
|
12798
12907
|
}, [editorWindow]);
|
|
12799
|
-
const updateTableResizePreview =
|
|
12908
|
+
const updateTableResizePreview = React12.useCallback((dimensions) => {
|
|
12800
12909
|
const frame = tableResizeFrameRef.current;
|
|
12801
12910
|
if (!frame) return;
|
|
12802
12911
|
frame.style.width = `${dimensions.width}px`;
|
|
@@ -12816,7 +12925,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
12816
12925
|
});
|
|
12817
12926
|
}
|
|
12818
12927
|
}, []);
|
|
12819
|
-
const resetTableResizePreview =
|
|
12928
|
+
const resetTableResizePreview = React12.useCallback(() => {
|
|
12820
12929
|
const activeLayout = layoutRef.current;
|
|
12821
12930
|
if (!activeLayout) return;
|
|
12822
12931
|
updateTableResizePreview({
|
|
@@ -12825,7 +12934,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
12825
12934
|
leftDelta: 0
|
|
12826
12935
|
});
|
|
12827
12936
|
}, [updateTableResizePreview]);
|
|
12828
|
-
const clearDrag =
|
|
12937
|
+
const clearDrag = React12.useCallback(() => {
|
|
12829
12938
|
const dragState = dragStateRef.current;
|
|
12830
12939
|
if (dragState?.kind === "resize-table") {
|
|
12831
12940
|
try {
|
|
@@ -12845,7 +12954,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
12845
12954
|
resetTableResizePreview();
|
|
12846
12955
|
setDocumentCursor(editorDocument, "");
|
|
12847
12956
|
}, [editorDocument, editorWindow, resetTableResizePreview]);
|
|
12848
|
-
const updateHoverState =
|
|
12957
|
+
const updateHoverState = React12.useCallback((event) => {
|
|
12849
12958
|
const activeLayout = layoutRef.current;
|
|
12850
12959
|
const surface = containerRef.current;
|
|
12851
12960
|
if (!activeLayout || !surface || dragStateRef.current || event.buttons !== 0) {
|
|
@@ -12861,7 +12970,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
12861
12970
|
return areTableHoverStatesEqual(prev, nextState) ? prev : nextState;
|
|
12862
12971
|
});
|
|
12863
12972
|
}, [containerRef]);
|
|
12864
|
-
|
|
12973
|
+
React12.useEffect(() => {
|
|
12865
12974
|
const proseMirror = editor.view.dom;
|
|
12866
12975
|
const surface = containerRef.current;
|
|
12867
12976
|
if (!surface) return void 0;
|
|
@@ -12948,37 +13057,37 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
12948
13057
|
editor.off("update", scheduleCurrentLayoutRefresh);
|
|
12949
13058
|
};
|
|
12950
13059
|
}, [clearDrag, containerRef, editor, editorWindow, scheduleCurrentLayoutRefresh, scheduleSyncFromSelection, syncFromCell, syncFromSelection, updateHoverState]);
|
|
12951
|
-
const runAtCellPos =
|
|
13060
|
+
const runAtCellPos = React12.useCallback((cellPos, command, options) => {
|
|
12952
13061
|
const result = runTableCommandAtCellPos(editor, cellPos, command);
|
|
12953
13062
|
if (options?.sync !== false) {
|
|
12954
13063
|
scheduleSyncFromSelection();
|
|
12955
13064
|
}
|
|
12956
13065
|
return result;
|
|
12957
13066
|
}, [editor, scheduleSyncFromSelection]);
|
|
12958
|
-
const runAtActiveCell =
|
|
13067
|
+
const runAtActiveCell = React12.useCallback((command, options) => {
|
|
12959
13068
|
return runAtCellPos(layoutRef.current?.cellPos ?? null, command, options);
|
|
12960
13069
|
}, [runAtCellPos]);
|
|
12961
|
-
const duplicateRowAt =
|
|
13070
|
+
const duplicateRowAt = React12.useCallback((rowIndex, cellPos) => {
|
|
12962
13071
|
const result = duplicateTableRowAt(editor, rowIndex, cellPos);
|
|
12963
13072
|
scheduleSyncFromSelection();
|
|
12964
13073
|
return result;
|
|
12965
13074
|
}, [editor, scheduleSyncFromSelection]);
|
|
12966
|
-
const clearRowAt =
|
|
13075
|
+
const clearRowAt = React12.useCallback((rowIndex, cellPos) => {
|
|
12967
13076
|
const result = clearTableRowAt(editor, rowIndex, cellPos);
|
|
12968
13077
|
scheduleSyncFromSelection();
|
|
12969
13078
|
return result;
|
|
12970
13079
|
}, [editor, scheduleSyncFromSelection]);
|
|
12971
|
-
const duplicateColumnAt =
|
|
13080
|
+
const duplicateColumnAt = React12.useCallback((columnIndex, cellPos) => {
|
|
12972
13081
|
const result = duplicateTableColumnAt(editor, columnIndex, cellPos);
|
|
12973
13082
|
scheduleSyncFromSelection();
|
|
12974
13083
|
return result;
|
|
12975
13084
|
}, [editor, scheduleSyncFromSelection]);
|
|
12976
|
-
const clearColumnAt =
|
|
13085
|
+
const clearColumnAt = React12.useCallback((columnIndex, cellPos) => {
|
|
12977
13086
|
const result = clearTableColumnAt(editor, columnIndex, cellPos);
|
|
12978
13087
|
scheduleSyncFromSelection();
|
|
12979
13088
|
return result;
|
|
12980
13089
|
}, [editor, scheduleSyncFromSelection]);
|
|
12981
|
-
const expandTableBy =
|
|
13090
|
+
const expandTableBy = React12.useCallback((rows, cols) => {
|
|
12982
13091
|
const activeCellPos = layoutRef.current?.cellPos ?? editor.state.selection.from;
|
|
12983
13092
|
const result = expandTableFromCell(editor, activeCellPos, rows, cols);
|
|
12984
13093
|
scheduleSyncFromSelection();
|
|
@@ -12987,7 +13096,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
12987
13096
|
const canExpandTable = Boolean(layout);
|
|
12988
13097
|
const controlsVisible = false;
|
|
12989
13098
|
const tableMenuOpen = openMenuKey === "table";
|
|
12990
|
-
const startTableResize =
|
|
13099
|
+
const startTableResize = React12.useCallback((event, edge) => {
|
|
12991
13100
|
if (event.button !== 0 || dragStateRef.current) return;
|
|
12992
13101
|
const activeLayout = layoutRef.current;
|
|
12993
13102
|
if (!activeLayout) return;
|
|
@@ -13025,7 +13134,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
13025
13134
|
updateTableResizePreview(pendingDimensions);
|
|
13026
13135
|
setDocumentCursor(editorDocument, edge === "both" ? "nwse-resize" : "ew-resize");
|
|
13027
13136
|
}, [editor, editorDocument, updateTableResizePreview]);
|
|
13028
|
-
const fitTableToEditorWidth =
|
|
13137
|
+
const fitTableToEditorWidth = React12.useCallback(() => {
|
|
13029
13138
|
if (dragStateRef.current) return;
|
|
13030
13139
|
const activeLayout = layoutRef.current;
|
|
13031
13140
|
if (!activeLayout) return;
|
|
@@ -13048,7 +13157,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
13048
13157
|
scheduleSyncFromSelection();
|
|
13049
13158
|
}
|
|
13050
13159
|
}, [editor, scheduleSyncFromSelection]);
|
|
13051
|
-
const resizeTableWithKeyboard =
|
|
13160
|
+
const resizeTableWithKeyboard = React12.useCallback((event, edge) => {
|
|
13052
13161
|
const horizontal = event.key === "ArrowLeft" || event.key === "ArrowRight";
|
|
13053
13162
|
const vertical = event.key === "ArrowUp" || event.key === "ArrowDown";
|
|
13054
13163
|
if (!horizontal && !vertical || edge !== "both" && !horizontal) return;
|
|
@@ -13077,7 +13186,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
13077
13186
|
scheduleSyncFromSelection();
|
|
13078
13187
|
}
|
|
13079
13188
|
}, [editor, scheduleSyncFromSelection]);
|
|
13080
|
-
const startAddColumnDrag =
|
|
13189
|
+
const startAddColumnDrag = React12.useCallback((event) => {
|
|
13081
13190
|
if (event.button !== 0 || dragStateRef.current) return;
|
|
13082
13191
|
event.preventDefault();
|
|
13083
13192
|
event.stopPropagation();
|
|
@@ -13086,7 +13195,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
13086
13195
|
setDragPreview({ kind: "add-column", previewCols: 1 });
|
|
13087
13196
|
setDocumentCursor(editorDocument, "ew-resize");
|
|
13088
13197
|
}, [editorDocument]);
|
|
13089
|
-
const startAddRowDrag =
|
|
13198
|
+
const startAddRowDrag = React12.useCallback((event) => {
|
|
13090
13199
|
if (event.button !== 0 || dragStateRef.current) return;
|
|
13091
13200
|
event.preventDefault();
|
|
13092
13201
|
event.stopPropagation();
|
|
@@ -13095,7 +13204,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
13095
13204
|
setDragPreview({ kind: "add-row", previewRows: 1 });
|
|
13096
13205
|
setDocumentCursor(editorDocument, "ns-resize");
|
|
13097
13206
|
}, [editorDocument]);
|
|
13098
|
-
const startRowDrag =
|
|
13207
|
+
const startRowDrag = React12.useCallback((event, rowHandle) => {
|
|
13099
13208
|
if (event.button !== 0 || dragStateRef.current) return;
|
|
13100
13209
|
event.preventDefault();
|
|
13101
13210
|
event.stopPropagation();
|
|
@@ -13115,7 +13224,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
13115
13224
|
});
|
|
13116
13225
|
setDocumentCursor(editorDocument, "grabbing");
|
|
13117
13226
|
}, [editorDocument]);
|
|
13118
|
-
const startColumnDrag =
|
|
13227
|
+
const startColumnDrag = React12.useCallback((event, columnHandle) => {
|
|
13119
13228
|
if (event.button !== 0 || dragStateRef.current) return;
|
|
13120
13229
|
event.preventDefault();
|
|
13121
13230
|
event.stopPropagation();
|
|
@@ -13135,7 +13244,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
13135
13244
|
});
|
|
13136
13245
|
setDocumentCursor(editorDocument, "grabbing");
|
|
13137
13246
|
}, [editorDocument]);
|
|
13138
|
-
const moveRowWithKeyboard =
|
|
13247
|
+
const moveRowWithKeyboard = React12.useCallback((rowHandle, direction) => {
|
|
13139
13248
|
const targetIndex = clamp2(rowHandle.index + direction, 0, (layoutRef.current?.rowHandles.length ?? 1) - 1);
|
|
13140
13249
|
if (targetIndex === rowHandle.index) return;
|
|
13141
13250
|
const tableInfo = findTableInfo(editor, rowHandle.cellPos);
|
|
@@ -13156,7 +13265,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
13156
13265
|
});
|
|
13157
13266
|
scheduleSyncFromSelection();
|
|
13158
13267
|
}, [editor, scheduleSyncFromSelection]);
|
|
13159
|
-
const moveColumnWithKeyboard =
|
|
13268
|
+
const moveColumnWithKeyboard = React12.useCallback((columnHandle, direction) => {
|
|
13160
13269
|
const targetIndex = clamp2(columnHandle.index + direction, 0, (layoutRef.current?.columnHandles.length ?? 1) - 1);
|
|
13161
13270
|
if (targetIndex === columnHandle.index) return;
|
|
13162
13271
|
const tableInfo = findTableInfo(editor, columnHandle.cellPos);
|
|
@@ -13188,7 +13297,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
13188
13297
|
});
|
|
13189
13298
|
scheduleSyncFromSelection();
|
|
13190
13299
|
}, [editor, scheduleSyncFromSelection]);
|
|
13191
|
-
|
|
13300
|
+
React12.useEffect(() => {
|
|
13192
13301
|
if (!editorWindow) return;
|
|
13193
13302
|
const handlePointerMove = (event) => {
|
|
13194
13303
|
const dragState = dragStateRef.current;
|
|
@@ -13333,7 +13442,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
13333
13442
|
unsubscribeBlur();
|
|
13334
13443
|
};
|
|
13335
13444
|
}, [clearDrag, containerRef, editor, editorDocument, editorWindow, expandTableBy, scheduleSyncFromSelection]);
|
|
13336
|
-
|
|
13445
|
+
React12.useEffect(() => {
|
|
13337
13446
|
if (!editorWindow) return;
|
|
13338
13447
|
const handlePointerMove = (event) => {
|
|
13339
13448
|
const dragState = dragStateRef.current;
|
|
@@ -13404,7 +13513,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
13404
13513
|
}
|
|
13405
13514
|
};
|
|
13406
13515
|
}, [clearDrag, editor, editorDocument, editorWindow, scheduleSyncFromSelection, updateTableResizePreview]);
|
|
13407
|
-
const openCellInspector =
|
|
13516
|
+
const openCellInspector = React12.useCallback(() => {
|
|
13408
13517
|
const cellPos = layoutRef.current?.cellPos;
|
|
13409
13518
|
if (!showCellInspector || cellPos == null) return;
|
|
13410
13519
|
const didSelect = editor.commands.setCellSelection({
|
|
@@ -13416,7 +13525,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
13416
13525
|
if (!editor.isDestroyed) editor.view.focus();
|
|
13417
13526
|
});
|
|
13418
13527
|
}, [editor, editorWindow, showCellInspector]);
|
|
13419
|
-
const menuItems =
|
|
13528
|
+
const menuItems = React12.useMemo(() => {
|
|
13420
13529
|
if (!layout) return [];
|
|
13421
13530
|
return [
|
|
13422
13531
|
...showCellInspector ? [{
|
|
@@ -13494,7 +13603,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
13494
13603
|
}
|
|
13495
13604
|
];
|
|
13496
13605
|
}, [editor, fitTableToEditorWidth, layout, openCellInspector, runAtActiveCell, showCellInspector, t]);
|
|
13497
|
-
const getRowHandleMenuItems =
|
|
13606
|
+
const getRowHandleMenuItems = React12.useCallback((rowHandle) => [
|
|
13498
13607
|
{
|
|
13499
13608
|
label: t("tableMenu.addRowBefore"),
|
|
13500
13609
|
icon: ArrowUp,
|
|
@@ -13522,7 +13631,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
13522
13631
|
destructive: true
|
|
13523
13632
|
}
|
|
13524
13633
|
], [clearRowAt, duplicateRowAt, runAtCellPos, t]);
|
|
13525
|
-
const getColumnHandleMenuItems =
|
|
13634
|
+
const getColumnHandleMenuItems = React12.useCallback((columnHandle) => [
|
|
13526
13635
|
{
|
|
13527
13636
|
label: t("tableMenu.addColumnBefore"),
|
|
13528
13637
|
icon: ArrowLeft,
|
|
@@ -13558,7 +13667,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
13558
13667
|
const rowHandleLeft = layout.tableLeft - AXIS_HANDLE_RADIUS;
|
|
13559
13668
|
const columnHandleTop = layout.tableTop - AXIS_HANDLE_RADIUS;
|
|
13560
13669
|
return /* @__PURE__ */ jsxs15(Fragment7, { children: [
|
|
13561
|
-
/* @__PURE__ */
|
|
13670
|
+
/* @__PURE__ */ jsx19(
|
|
13562
13671
|
TableRowHandles,
|
|
13563
13672
|
{
|
|
13564
13673
|
activeRowIndex: layout.activeRowIndex,
|
|
@@ -13576,7 +13685,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
13576
13685
|
rowHandles: layout.rowHandles
|
|
13577
13686
|
}
|
|
13578
13687
|
),
|
|
13579
|
-
/* @__PURE__ */
|
|
13688
|
+
/* @__PURE__ */ jsx19(
|
|
13580
13689
|
TableColumnHandles,
|
|
13581
13690
|
{
|
|
13582
13691
|
activeColumnIndex: layout.activeColumnIndex,
|
|
@@ -13594,7 +13703,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
13594
13703
|
openMenuKey
|
|
13595
13704
|
}
|
|
13596
13705
|
),
|
|
13597
|
-
/* @__PURE__ */
|
|
13706
|
+
/* @__PURE__ */ jsx19(
|
|
13598
13707
|
TableControlMenu,
|
|
13599
13708
|
{
|
|
13600
13709
|
controlsVisible,
|
|
@@ -13609,7 +13718,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
13609
13718
|
top: menuTop
|
|
13610
13719
|
}
|
|
13611
13720
|
),
|
|
13612
|
-
dragPreview === null && /* @__PURE__ */
|
|
13721
|
+
dragPreview === null && /* @__PURE__ */ jsx19(
|
|
13613
13722
|
TableResizeHandles,
|
|
13614
13723
|
{
|
|
13615
13724
|
active: tableResizeActive,
|
|
@@ -13622,7 +13731,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
13622
13731
|
resizeBothLabel: t("tableMenu.resizeBoth")
|
|
13623
13732
|
}
|
|
13624
13733
|
),
|
|
13625
|
-
/* @__PURE__ */
|
|
13734
|
+
/* @__PURE__ */ jsx19(
|
|
13626
13735
|
TableAddRails,
|
|
13627
13736
|
{
|
|
13628
13737
|
addColumnVisible: hoverState.addColumnVisible,
|
|
@@ -13638,7 +13747,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
13638
13747
|
quickAddRowLabel: t("tableMenu.quickAddRowAfter")
|
|
13639
13748
|
}
|
|
13640
13749
|
),
|
|
13641
|
-
/* @__PURE__ */
|
|
13750
|
+
/* @__PURE__ */ jsx19(
|
|
13642
13751
|
TableDragPreview,
|
|
13643
13752
|
{
|
|
13644
13753
|
columnDragLabel: t("tableMenu.dragColumn"),
|
|
@@ -13651,10 +13760,10 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
13651
13760
|
}
|
|
13652
13761
|
|
|
13653
13762
|
// src/components/UEditor/use-table-interactions.ts
|
|
13654
|
-
import
|
|
13763
|
+
import React14, { useEffect as useEffect6, useRef as useRef6 } from "react";
|
|
13655
13764
|
|
|
13656
13765
|
// src/components/UEditor/use-table-row-resize.ts
|
|
13657
|
-
import
|
|
13766
|
+
import React13, { useRef as useRef5 } from "react";
|
|
13658
13767
|
function setRowResizeBodyState(ownerDocument, active) {
|
|
13659
13768
|
ownerDocument.body.style.userSelect = active ? "none" : "";
|
|
13660
13769
|
ownerDocument.body.style.cursor = active ? "row-resize" : "";
|
|
@@ -13668,15 +13777,15 @@ function useTableRowResize({
|
|
|
13668
13777
|
scheduleTableLayoutSync
|
|
13669
13778
|
}) {
|
|
13670
13779
|
const stateRef = useRef5(null);
|
|
13671
|
-
const syncActiveGuide =
|
|
13780
|
+
const syncActiveGuide = React13.useCallback(() => {
|
|
13672
13781
|
const state = stateRef.current;
|
|
13673
13782
|
if (!state) return false;
|
|
13674
13783
|
setHoveredTableCell(state.cellElement);
|
|
13675
13784
|
showRowGuide(state.tableElement, state.rowElement, state.cellElement, state.pendingHeight);
|
|
13676
13785
|
return true;
|
|
13677
13786
|
}, [setHoveredTableCell, showRowGuide]);
|
|
13678
|
-
const isResizing =
|
|
13679
|
-
const beginResize =
|
|
13787
|
+
const isResizing = React13.useCallback(() => stateRef.current !== null, []);
|
|
13788
|
+
const beginResize = React13.useCallback((event, table, row, cell) => {
|
|
13680
13789
|
if (!editor || !isRowResizeHotspot(cell, event.clientX, event.clientY)) {
|
|
13681
13790
|
return false;
|
|
13682
13791
|
}
|
|
@@ -13705,7 +13814,7 @@ function useTableRowResize({
|
|
|
13705
13814
|
event.stopPropagation();
|
|
13706
13815
|
return true;
|
|
13707
13816
|
}, [editor, setHoveredTableCell, showRowGuide]);
|
|
13708
|
-
const handlePointerMove =
|
|
13817
|
+
const handlePointerMove = React13.useCallback((event) => {
|
|
13709
13818
|
const state = stateRef.current;
|
|
13710
13819
|
if (!state) return;
|
|
13711
13820
|
const nextHeight = Math.max(
|
|
@@ -13722,7 +13831,7 @@ function useTableRowResize({
|
|
|
13722
13831
|
setRowResizeBodyState(state.rowElement.ownerDocument, true);
|
|
13723
13832
|
showRowGuide(state.tableElement, state.rowElement, state.cellElement, nextHeight);
|
|
13724
13833
|
}, [showRowGuide]);
|
|
13725
|
-
const handlePointerUp =
|
|
13834
|
+
const handlePointerUp = React13.useCallback((event) => {
|
|
13726
13835
|
if (!editor) return;
|
|
13727
13836
|
const state = stateRef.current;
|
|
13728
13837
|
if (!state) return;
|
|
@@ -13747,7 +13856,7 @@ function useTableRowResize({
|
|
|
13747
13856
|
clearAllTableResizeHover();
|
|
13748
13857
|
scheduleTableLayoutSync();
|
|
13749
13858
|
}, [clearAllTableResizeHover, clearHoveredTableCell, editor, scheduleTableLayoutSync]);
|
|
13750
|
-
const cancelResize =
|
|
13859
|
+
const cancelResize = React13.useCallback(() => {
|
|
13751
13860
|
const state = stateRef.current;
|
|
13752
13861
|
if (!state) return;
|
|
13753
13862
|
stateRef.current = null;
|
|
@@ -13757,7 +13866,7 @@ function useTableRowResize({
|
|
|
13757
13866
|
clearAllTableResizeHover();
|
|
13758
13867
|
scheduleTableLayoutSync();
|
|
13759
13868
|
}, [clearAllTableResizeHover, clearHoveredTableCell, scheduleTableLayoutSync]);
|
|
13760
|
-
const cleanup =
|
|
13869
|
+
const cleanup = React13.useCallback(() => {
|
|
13761
13870
|
const editorDocument = stateRef.current?.rowElement.ownerDocument ?? editor?.view.dom.ownerDocument;
|
|
13762
13871
|
stateRef.current = null;
|
|
13763
13872
|
isRowResizingGlobal.active = false;
|
|
@@ -13786,16 +13895,16 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
13786
13895
|
const activeTableCellRef = useRef6(null);
|
|
13787
13896
|
const suppressActiveCellHighlightRef = useRef6(false);
|
|
13788
13897
|
const tableLayoutSyncFrameRef = useRef6(null);
|
|
13789
|
-
const getProseMirrorElement =
|
|
13898
|
+
const getProseMirrorElement = React14.useCallback(() => {
|
|
13790
13899
|
return editorContentRef.current?.querySelector(".ProseMirror");
|
|
13791
13900
|
}, []);
|
|
13792
|
-
const setEditorResizeCursor =
|
|
13901
|
+
const setEditorResizeCursor = React14.useCallback((cursor) => {
|
|
13793
13902
|
const proseMirror = getProseMirrorElement();
|
|
13794
13903
|
if (proseMirror) {
|
|
13795
13904
|
proseMirror.style.cursor = cursor;
|
|
13796
13905
|
}
|
|
13797
13906
|
}, [getProseMirrorElement]);
|
|
13798
|
-
const hideColumnGuide =
|
|
13907
|
+
const hideColumnGuide = React14.useCallback(() => {
|
|
13799
13908
|
editorContentRef.current?.classList.remove("resize-cursor");
|
|
13800
13909
|
getProseMirrorElement()?.classList.remove("resize-cursor");
|
|
13801
13910
|
const guide = tableColumnGuideRef.current;
|
|
@@ -13803,7 +13912,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
13803
13912
|
guide.style.opacity = "0";
|
|
13804
13913
|
}
|
|
13805
13914
|
}, [getProseMirrorElement]);
|
|
13806
|
-
const hideRowGuide =
|
|
13915
|
+
const hideRowGuide = React14.useCallback(() => {
|
|
13807
13916
|
editorContentRef.current?.classList.remove("resize-row-cursor");
|
|
13808
13917
|
getProseMirrorElement()?.classList.remove("resize-row-cursor");
|
|
13809
13918
|
const guide = tableRowGuideRef.current;
|
|
@@ -13813,21 +13922,21 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
13813
13922
|
}, [getProseMirrorElement]);
|
|
13814
13923
|
const hotspotTimerRef = useRef6(null);
|
|
13815
13924
|
const activeHotspotKeyRef = useRef6(null);
|
|
13816
|
-
const clearHotspotTimer =
|
|
13925
|
+
const clearHotspotTimer = React14.useCallback(() => {
|
|
13817
13926
|
if (hotspotTimerRef.current !== null) {
|
|
13818
13927
|
const realm = editorContentRef.current?.ownerDocument.defaultView;
|
|
13819
13928
|
realm?.clearTimeout(hotspotTimerRef.current);
|
|
13820
13929
|
hotspotTimerRef.current = null;
|
|
13821
13930
|
}
|
|
13822
13931
|
}, []);
|
|
13823
|
-
const clearAllTableResizeHover =
|
|
13932
|
+
const clearAllTableResizeHover = React14.useCallback(() => {
|
|
13824
13933
|
clearHotspotTimer();
|
|
13825
13934
|
activeHotspotKeyRef.current = null;
|
|
13826
13935
|
setEditorResizeCursor("");
|
|
13827
13936
|
hideColumnGuide();
|
|
13828
13937
|
hideRowGuide();
|
|
13829
13938
|
}, [clearHotspotTimer, hideColumnGuide, hideRowGuide, setEditorResizeCursor]);
|
|
13830
|
-
const updateActiveCellHighlight =
|
|
13939
|
+
const updateActiveCellHighlight = React14.useCallback((cell) => {
|
|
13831
13940
|
const surface = editorContentRef.current;
|
|
13832
13941
|
const highlight = activeTableCellHighlightRef.current;
|
|
13833
13942
|
if (!highlight) return;
|
|
@@ -13842,7 +13951,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
13842
13951
|
highlight.style.width = `${metrics.width}px`;
|
|
13843
13952
|
highlight.style.height = `${metrics.height}px`;
|
|
13844
13953
|
}, []);
|
|
13845
|
-
const scheduleTableLayoutSync =
|
|
13954
|
+
const scheduleTableLayoutSync = React14.useCallback(() => {
|
|
13846
13955
|
if (!activeTableCellRef.current || tableLayoutSyncFrameRef.current !== null) return;
|
|
13847
13956
|
const realm = editorContentRef.current?.ownerDocument.defaultView;
|
|
13848
13957
|
if (!realm) return;
|
|
@@ -13854,7 +13963,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
13854
13963
|
editorContentRef.current?.dispatchEvent(new realm.CustomEvent(UEDITOR_TABLE_LAYOUT_CHANGE_EVENT));
|
|
13855
13964
|
});
|
|
13856
13965
|
}, [updateActiveCellHighlight]);
|
|
13857
|
-
const setActiveTableCell =
|
|
13966
|
+
const setActiveTableCell = React14.useCallback((cell) => {
|
|
13858
13967
|
if (activeTableCellRef.current === cell) {
|
|
13859
13968
|
updateActiveCellHighlight(cell);
|
|
13860
13969
|
return;
|
|
@@ -13862,17 +13971,17 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
13862
13971
|
activeTableCellRef.current = cell;
|
|
13863
13972
|
updateActiveCellHighlight(activeTableCellRef.current);
|
|
13864
13973
|
}, [updateActiveCellHighlight]);
|
|
13865
|
-
const clearActiveTableCell =
|
|
13974
|
+
const clearActiveTableCell = React14.useCallback(() => {
|
|
13866
13975
|
activeTableCellRef.current = null;
|
|
13867
13976
|
updateActiveCellHighlight(null);
|
|
13868
13977
|
}, [updateActiveCellHighlight]);
|
|
13869
|
-
const setHoveredTableCell =
|
|
13978
|
+
const setHoveredTableCell = React14.useCallback((cell) => {
|
|
13870
13979
|
hoveredTableCellRef.current = cell;
|
|
13871
13980
|
}, []);
|
|
13872
|
-
const clearHoveredTableCell =
|
|
13981
|
+
const clearHoveredTableCell = React14.useCallback(() => {
|
|
13873
13982
|
hoveredTableCellRef.current = null;
|
|
13874
13983
|
}, []);
|
|
13875
|
-
const showColumnGuide =
|
|
13984
|
+
const showColumnGuide = React14.useCallback((table, row, cell) => {
|
|
13876
13985
|
const surface = editorContentRef.current;
|
|
13877
13986
|
const guide = tableColumnGuideRef.current;
|
|
13878
13987
|
if (!surface || !guide) return;
|
|
@@ -13886,7 +13995,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
13886
13995
|
getProseMirrorElement()?.classList.add("resize-cursor");
|
|
13887
13996
|
setEditorResizeCursor("col-resize");
|
|
13888
13997
|
}, [getProseMirrorElement, setEditorResizeCursor]);
|
|
13889
|
-
const showRowGuide =
|
|
13998
|
+
const showRowGuide = React14.useCallback((table, row, cell, previewHeight) => {
|
|
13890
13999
|
const surface = editorContentRef.current;
|
|
13891
14000
|
const guide = tableRowGuideRef.current;
|
|
13892
14001
|
if (!surface || !guide) return;
|
|
@@ -13918,7 +14027,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
13918
14027
|
clearAllTableResizeHover,
|
|
13919
14028
|
scheduleTableLayoutSync
|
|
13920
14029
|
});
|
|
13921
|
-
const syncActiveTableCellFromSelection =
|
|
14030
|
+
const syncActiveTableCellFromSelection = React14.useCallback(() => {
|
|
13922
14031
|
if (!editor) return;
|
|
13923
14032
|
if (!editor.isFocused) {
|
|
13924
14033
|
clearActiveTableCell();
|
|
@@ -14655,7 +14764,7 @@ function useFormulaCoordinateOverlay(editor, containerRef, labels) {
|
|
|
14655
14764
|
import { useEffect as useEffect8, useRef as useRef8, useState as useState6 } from "react";
|
|
14656
14765
|
import { useEditorState as useEditorState2 } from "@tiptap/react";
|
|
14657
14766
|
import { AlertCircle as AlertCircle2, Check as Check3, Hash, Sigma as Sigma3, Trash2 as Trash23 } from "lucide-react";
|
|
14658
|
-
import { jsx as
|
|
14767
|
+
import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
14659
14768
|
function TableFormulaBar({ editor }) {
|
|
14660
14769
|
const t = useSmartTranslations("UEditor");
|
|
14661
14770
|
const inputRef = useRef8(null);
|
|
@@ -14726,7 +14835,7 @@ function TableFormulaBar({ editor }) {
|
|
|
14726
14835
|
"aria-label": t("tableMenu.formulaBar"),
|
|
14727
14836
|
className: "flex min-h-10 items-center gap-2 border-b border-border/60 bg-muted/25 px-2 py-1.5",
|
|
14728
14837
|
children: [
|
|
14729
|
-
/* @__PURE__ */
|
|
14838
|
+
/* @__PURE__ */ jsx20(
|
|
14730
14839
|
"span",
|
|
14731
14840
|
{
|
|
14732
14841
|
"data-ueditor-formula-cell-label": "",
|
|
@@ -14734,8 +14843,8 @@ function TableFormulaBar({ editor }) {
|
|
|
14734
14843
|
children: selectedCell.label
|
|
14735
14844
|
}
|
|
14736
14845
|
),
|
|
14737
|
-
/* @__PURE__ */
|
|
14738
|
-
/* @__PURE__ */
|
|
14846
|
+
/* @__PURE__ */ jsx20(Sigma3, { "aria-hidden": "true", className: "h-4 w-4 shrink-0 text-primary" }),
|
|
14847
|
+
/* @__PURE__ */ jsx20(
|
|
14739
14848
|
"input",
|
|
14740
14849
|
{
|
|
14741
14850
|
ref: inputRef,
|
|
@@ -14762,12 +14871,12 @@ function TableFormulaBar({ editor }) {
|
|
|
14762
14871
|
role: "status",
|
|
14763
14872
|
className: "hidden shrink-0 items-center gap-1 text-xs font-medium text-destructive sm:inline-flex",
|
|
14764
14873
|
children: [
|
|
14765
|
-
/* @__PURE__ */
|
|
14874
|
+
/* @__PURE__ */ jsx20(AlertCircle2, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
|
|
14766
14875
|
t("tableMenu.formulaError")
|
|
14767
14876
|
]
|
|
14768
14877
|
}
|
|
14769
14878
|
),
|
|
14770
|
-
/* @__PURE__ */
|
|
14879
|
+
/* @__PURE__ */ jsx20(
|
|
14771
14880
|
"button",
|
|
14772
14881
|
{
|
|
14773
14882
|
type: "button",
|
|
@@ -14775,10 +14884,10 @@ function TableFormulaBar({ editor }) {
|
|
|
14775
14884
|
"aria-label": t("tableMenu.apply"),
|
|
14776
14885
|
title: t("tableMenu.apply"),
|
|
14777
14886
|
className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-primary text-primary-foreground transition-colors hover:bg-primary/90",
|
|
14778
|
-
children: /* @__PURE__ */
|
|
14887
|
+
children: /* @__PURE__ */ jsx20(Check3, { "aria-hidden": "true", className: "h-4 w-4" })
|
|
14779
14888
|
}
|
|
14780
14889
|
),
|
|
14781
|
-
/* @__PURE__ */
|
|
14890
|
+
/* @__PURE__ */ jsx20(
|
|
14782
14891
|
"button",
|
|
14783
14892
|
{
|
|
14784
14893
|
type: "button",
|
|
@@ -14789,10 +14898,10 @@ function TableFormulaBar({ editor }) {
|
|
|
14789
14898
|
"aria-label": t("tableMenu.convertToValue"),
|
|
14790
14899
|
title: t("tableMenu.convertToValue"),
|
|
14791
14900
|
className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-border/60 bg-background text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",
|
|
14792
|
-
children: /* @__PURE__ */
|
|
14901
|
+
children: /* @__PURE__ */ jsx20(Hash, { "aria-hidden": "true", className: "h-4 w-4" })
|
|
14793
14902
|
}
|
|
14794
14903
|
),
|
|
14795
|
-
/* @__PURE__ */
|
|
14904
|
+
/* @__PURE__ */ jsx20(
|
|
14796
14905
|
"button",
|
|
14797
14906
|
{
|
|
14798
14907
|
type: "button",
|
|
@@ -14803,7 +14912,7 @@ function TableFormulaBar({ editor }) {
|
|
|
14803
14912
|
"aria-label": t("tableMenu.clearCell"),
|
|
14804
14913
|
title: t("tableMenu.clearCell"),
|
|
14805
14914
|
className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-destructive/30 bg-background text-destructive transition-colors hover:bg-destructive/10",
|
|
14806
|
-
children: /* @__PURE__ */
|
|
14915
|
+
children: /* @__PURE__ */ jsx20(Trash23, { "aria-hidden": "true", className: "h-4 w-4" })
|
|
14807
14916
|
}
|
|
14808
14917
|
)
|
|
14809
14918
|
]
|
|
@@ -14812,7 +14921,7 @@ function TableFormulaBar({ editor }) {
|
|
|
14812
14921
|
}
|
|
14813
14922
|
|
|
14814
14923
|
// src/components/UEditor/use-editor-output.ts
|
|
14815
|
-
import * as
|
|
14924
|
+
import * as React16 from "react";
|
|
14816
14925
|
function normalizeDebounceMs(value) {
|
|
14817
14926
|
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : 0;
|
|
14818
14927
|
}
|
|
@@ -14822,18 +14931,18 @@ function useUEditorOutput({
|
|
|
14822
14931
|
onJsonChange,
|
|
14823
14932
|
outputDebounceMs
|
|
14824
14933
|
}) {
|
|
14825
|
-
const callbacksRef =
|
|
14934
|
+
const callbacksRef = React16.useRef({
|
|
14826
14935
|
onChange,
|
|
14827
14936
|
onHtmlChange,
|
|
14828
14937
|
onJsonChange
|
|
14829
14938
|
});
|
|
14830
|
-
const pendingEditorRef =
|
|
14831
|
-
const timeoutRef =
|
|
14939
|
+
const pendingEditorRef = React16.useRef(null);
|
|
14940
|
+
const timeoutRef = React16.useRef(null);
|
|
14832
14941
|
const debounceMs = normalizeDebounceMs(outputDebounceMs);
|
|
14833
|
-
|
|
14942
|
+
React16.useLayoutEffect(() => {
|
|
14834
14943
|
callbacksRef.current = { onChange, onHtmlChange, onJsonChange };
|
|
14835
14944
|
}, [onChange, onHtmlChange, onJsonChange]);
|
|
14836
|
-
const flushOutputUpdates =
|
|
14945
|
+
const flushOutputUpdates = React16.useCallback(() => {
|
|
14837
14946
|
if (timeoutRef.current !== null) {
|
|
14838
14947
|
clearTimeout(timeoutRef.current);
|
|
14839
14948
|
timeoutRef.current = null;
|
|
@@ -14851,7 +14960,7 @@ function useUEditorOutput({
|
|
|
14851
14960
|
callbacks.onJsonChange(editor.getJSON());
|
|
14852
14961
|
}
|
|
14853
14962
|
}, []);
|
|
14854
|
-
const scheduleOutputUpdate =
|
|
14963
|
+
const scheduleOutputUpdate = React16.useCallback((editor) => {
|
|
14855
14964
|
const callbacks = callbacksRef.current;
|
|
14856
14965
|
if (!callbacks.onChange && !callbacks.onHtmlChange && !callbacks.onJsonChange) return;
|
|
14857
14966
|
pendingEditorRef.current = editor;
|
|
@@ -14865,13 +14974,13 @@ function useUEditorOutput({
|
|
|
14865
14974
|
}
|
|
14866
14975
|
timeoutRef.current = setTimeout(flushOutputUpdates, debounceMs);
|
|
14867
14976
|
}, [debounceMs, flushOutputUpdates]);
|
|
14868
|
-
|
|
14977
|
+
React16.useEffect(() => {
|
|
14869
14978
|
if (!pendingEditorRef.current || timeoutRef.current === null) return;
|
|
14870
14979
|
clearTimeout(timeoutRef.current);
|
|
14871
14980
|
timeoutRef.current = debounceMs === 0 ? null : setTimeout(flushOutputUpdates, debounceMs);
|
|
14872
14981
|
if (debounceMs === 0) flushOutputUpdates();
|
|
14873
14982
|
}, [debounceMs, flushOutputUpdates]);
|
|
14874
|
-
|
|
14983
|
+
React16.useEffect(() => () => {
|
|
14875
14984
|
flushOutputUpdates();
|
|
14876
14985
|
if (timeoutRef.current !== null) {
|
|
14877
14986
|
clearTimeout(timeoutRef.current);
|
|
@@ -14886,12 +14995,12 @@ function useUEditorOutput({
|
|
|
14886
14995
|
}
|
|
14887
14996
|
|
|
14888
14997
|
// src/components/UEditor/UEditor.tsx
|
|
14889
|
-
import { jsx as
|
|
14890
|
-
var LazyMenuBar =
|
|
14891
|
-
const { MenuBar } = await import("./menu-bar-
|
|
14998
|
+
import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
14999
|
+
var LazyMenuBar = React17.lazy(async () => {
|
|
15000
|
+
const { MenuBar } = await import("./menu-bar-VXAMTP3E.js");
|
|
14892
15001
|
return { default: MenuBar };
|
|
14893
15002
|
});
|
|
14894
|
-
var UEditor =
|
|
15003
|
+
var UEditor = React17.forwardRef(({
|
|
14895
15004
|
getPortalContainer,
|
|
14896
15005
|
content = "",
|
|
14897
15006
|
onChange,
|
|
@@ -14952,8 +15061,8 @@ var UEditor = React16.forwardRef(({
|
|
|
14952
15061
|
const editorInstanceRef = useRef10(null);
|
|
14953
15062
|
const formulaRangePickRef = useRef10(null);
|
|
14954
15063
|
const formulaRangeSurfaceRef = useRef10(null);
|
|
14955
|
-
const [formulaRangeHighlight, setFormulaRangeHighlight] =
|
|
14956
|
-
const [isMenuBarVisible, setIsMenuBarVisible] =
|
|
15064
|
+
const [formulaRangeHighlight, setFormulaRangeHighlight] = React17.useState(null);
|
|
15065
|
+
const [isMenuBarVisible, setIsMenuBarVisible] = React17.useState(showMenuBar);
|
|
14957
15066
|
useEffect10(() => {
|
|
14958
15067
|
setIsMenuBarVisible(showMenuBar);
|
|
14959
15068
|
}, [showMenuBar]);
|
|
@@ -14963,7 +15072,7 @@ var UEditor = React16.forwardRef(({
|
|
|
14963
15072
|
onJsonChange,
|
|
14964
15073
|
outputDebounceMs
|
|
14965
15074
|
});
|
|
14966
|
-
const scheduleFormulaRecalculate =
|
|
15075
|
+
const scheduleFormulaRecalculate = React17.useCallback((editor2, options) => {
|
|
14967
15076
|
if (editor2.isDestroyed || scheduledFormulaRecalculateRef.current) return;
|
|
14968
15077
|
if (!options?.force && isEditingTableFormulaText(editor2)) return;
|
|
14969
15078
|
scheduledFormulaRecalculateRef.current = true;
|
|
@@ -15005,7 +15114,7 @@ var UEditor = React16.forwardRef(({
|
|
|
15005
15114
|
],
|
|
15006
15115
|
[getPortalContainer, effectivePlaceholder, t, maxCharacters, uploadImage, resolvedUploadFile, imageInsertMode, maxImageFileSize, allowedImageMimeTypes, fallbackToDataUrl, onImageUploadError, editable, fetchMetadata, extraExtensions]
|
|
15007
15116
|
);
|
|
15008
|
-
const syncFormulaRangeHighlight =
|
|
15117
|
+
const syncFormulaRangeHighlight = React17.useCallback((pickState) => {
|
|
15009
15118
|
const container = formulaRangeSurfaceRef.current;
|
|
15010
15119
|
setFormulaRangeHighlight(container && pickState ? getFormulaRangePickHighlight(container, pickState) : null);
|
|
15011
15120
|
}, []);
|
|
@@ -15202,7 +15311,7 @@ var UEditor = React16.forwardRef(({
|
|
|
15202
15311
|
}
|
|
15203
15312
|
}, [content, editor]);
|
|
15204
15313
|
if (!editor) {
|
|
15205
|
-
return /* @__PURE__ */
|
|
15314
|
+
return /* @__PURE__ */ jsx21(UEditorPortalProvider, { getPortalContainer, children: /* @__PURE__ */ jsx21(
|
|
15206
15315
|
"div",
|
|
15207
15316
|
{
|
|
15208
15317
|
role: "status",
|
|
@@ -15213,7 +15322,7 @@ var UEditor = React16.forwardRef(({
|
|
|
15213
15322
|
}
|
|
15214
15323
|
) });
|
|
15215
15324
|
}
|
|
15216
|
-
return /* @__PURE__ */
|
|
15325
|
+
return /* @__PURE__ */ jsx21(UEditorPortalProvider, { getPortalContainer, children: /* @__PURE__ */ jsx21("div", { "data-ueditor-width-boundary": "", className: "w-full", children: /* @__PURE__ */ jsxs17(
|
|
15217
15326
|
"div",
|
|
15218
15327
|
{
|
|
15219
15328
|
className: cn(
|
|
@@ -15230,7 +15339,7 @@ var UEditor = React16.forwardRef(({
|
|
|
15230
15339
|
),
|
|
15231
15340
|
children: [
|
|
15232
15341
|
editable && (showMenuBar || showToolbar || showBubbleMenu) ? /* @__PURE__ */ jsxs17(EditorUiRenderStateProvider, { editor, children: [
|
|
15233
|
-
isMenuBarVisible && /* @__PURE__ */
|
|
15342
|
+
isMenuBarVisible && /* @__PURE__ */ jsx21(React17.Suspense, { fallback: null, children: /* @__PURE__ */ jsx21(
|
|
15234
15343
|
LazyMenuBar,
|
|
15235
15344
|
{
|
|
15236
15345
|
editor,
|
|
@@ -15248,7 +15357,7 @@ var UEditor = React16.forwardRef(({
|
|
|
15248
15357
|
showPreviewButton
|
|
15249
15358
|
}
|
|
15250
15359
|
) }),
|
|
15251
|
-
showToolbar && /* @__PURE__ */
|
|
15360
|
+
showToolbar && /* @__PURE__ */ jsx21(
|
|
15252
15361
|
EditorToolbar,
|
|
15253
15362
|
{
|
|
15254
15363
|
editor,
|
|
@@ -15268,8 +15377,8 @@ var UEditor = React16.forwardRef(({
|
|
|
15268
15377
|
letterSpacings
|
|
15269
15378
|
}
|
|
15270
15379
|
),
|
|
15271
|
-
/* @__PURE__ */
|
|
15272
|
-
showBubbleMenu && /* @__PURE__ */
|
|
15380
|
+
/* @__PURE__ */ jsx21(TableFormulaBar, { editor }),
|
|
15381
|
+
showBubbleMenu && /* @__PURE__ */ jsx21(
|
|
15273
15382
|
CustomBubbleMenu,
|
|
15274
15383
|
{
|
|
15275
15384
|
editor,
|
|
@@ -15278,8 +15387,8 @@ var UEditor = React16.forwardRef(({
|
|
|
15278
15387
|
lineHeights
|
|
15279
15388
|
}
|
|
15280
15389
|
)
|
|
15281
|
-
] }) : editable ? /* @__PURE__ */
|
|
15282
|
-
editable && showFloatingMenu && /* @__PURE__ */
|
|
15390
|
+
] }) : editable ? /* @__PURE__ */ jsx21(TableFormulaBar, { editor }) : null,
|
|
15391
|
+
editable && showFloatingMenu && /* @__PURE__ */ jsx21(CustomFloatingMenu, { editor }),
|
|
15283
15392
|
/* @__PURE__ */ jsxs17(
|
|
15284
15393
|
"div",
|
|
15285
15394
|
{
|
|
@@ -15298,7 +15407,7 @@ var UEditor = React16.forwardRef(({
|
|
|
15298
15407
|
"--ueditor-table-cell-padding-x": `${resolvedTableCellHorizontalPadding}px`
|
|
15299
15408
|
},
|
|
15300
15409
|
children: [
|
|
15301
|
-
/* @__PURE__ */
|
|
15410
|
+
/* @__PURE__ */ jsx21(
|
|
15302
15411
|
"span",
|
|
15303
15412
|
{
|
|
15304
15413
|
ref: tableColumnGuideRef,
|
|
@@ -15306,7 +15415,7 @@ var UEditor = React16.forwardRef(({
|
|
|
15306
15415
|
className: "pointer-events-none absolute z-20 bg-primary/50 opacity-0 transition-opacity duration-200 delay-100 ease-out"
|
|
15307
15416
|
}
|
|
15308
15417
|
),
|
|
15309
|
-
/* @__PURE__ */
|
|
15418
|
+
/* @__PURE__ */ jsx21(
|
|
15310
15419
|
"span",
|
|
15311
15420
|
{
|
|
15312
15421
|
ref: tableRowGuideRef,
|
|
@@ -15314,7 +15423,7 @@ var UEditor = React16.forwardRef(({
|
|
|
15314
15423
|
className: "pointer-events-none absolute z-20 bg-primary/50 opacity-0 transition-opacity duration-200 delay-100 ease-out"
|
|
15315
15424
|
}
|
|
15316
15425
|
),
|
|
15317
|
-
/* @__PURE__ */
|
|
15426
|
+
/* @__PURE__ */ jsx21(
|
|
15318
15427
|
"span",
|
|
15319
15428
|
{
|
|
15320
15429
|
ref: activeTableCellHighlightRef,
|
|
@@ -15323,7 +15432,7 @@ var UEditor = React16.forwardRef(({
|
|
|
15323
15432
|
className: "pointer-events-none hidden absolute z-20 rounded-[2px] border border-primary/50 bg-primary/5"
|
|
15324
15433
|
}
|
|
15325
15434
|
),
|
|
15326
|
-
/* @__PURE__ */
|
|
15435
|
+
/* @__PURE__ */ jsx21(
|
|
15327
15436
|
"div",
|
|
15328
15437
|
{
|
|
15329
15438
|
ref: formulaCoordinateOverlayRef,
|
|
@@ -15331,7 +15440,7 @@ var UEditor = React16.forwardRef(({
|
|
|
15331
15440
|
className: "pointer-events-none absolute inset-0 z-[35] hidden overflow-visible"
|
|
15332
15441
|
}
|
|
15333
15442
|
),
|
|
15334
|
-
formulaRangeHighlight && /* @__PURE__ */
|
|
15443
|
+
formulaRangeHighlight && /* @__PURE__ */ jsx21(
|
|
15335
15444
|
"span",
|
|
15336
15445
|
{
|
|
15337
15446
|
"aria-hidden": "true",
|
|
@@ -15349,7 +15458,7 @@ var UEditor = React16.forwardRef(({
|
|
|
15349
15458
|
}
|
|
15350
15459
|
}
|
|
15351
15460
|
),
|
|
15352
|
-
editable && /* @__PURE__ */
|
|
15461
|
+
editable && /* @__PURE__ */ jsx21(
|
|
15353
15462
|
TableControls,
|
|
15354
15463
|
{
|
|
15355
15464
|
editor,
|
|
@@ -15357,7 +15466,7 @@ var UEditor = React16.forwardRef(({
|
|
|
15357
15466
|
showCellInspector: showBubbleMenu
|
|
15358
15467
|
}
|
|
15359
15468
|
),
|
|
15360
|
-
/* @__PURE__ */
|
|
15469
|
+
/* @__PURE__ */ jsx21(
|
|
15361
15470
|
EditorContent,
|
|
15362
15471
|
{
|
|
15363
15472
|
editor,
|
|
@@ -15367,7 +15476,7 @@ var UEditor = React16.forwardRef(({
|
|
|
15367
15476
|
]
|
|
15368
15477
|
}
|
|
15369
15478
|
),
|
|
15370
|
-
showFooter && showCharacterCount && /* @__PURE__ */
|
|
15479
|
+
showFooter && showCharacterCount && /* @__PURE__ */ jsx21(CharacterCountDisplay, { editor, maxCharacters })
|
|
15371
15480
|
]
|
|
15372
15481
|
}
|
|
15373
15482
|
) }) });
|
|
@@ -15382,4 +15491,4 @@ export {
|
|
|
15382
15491
|
prepareUEditorContentForSave,
|
|
15383
15492
|
UEditor_default
|
|
15384
15493
|
};
|
|
15385
|
-
//# sourceMappingURL=chunk-
|
|
15494
|
+
//# sourceMappingURL=chunk-6K6CKZUL.js.map
|