@zero-library/common 2.3.12 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
- import Icon, { MinusCircleOutlined, PlusCircleOutlined, RedoOutlined, FileUnknownOutlined, FileZipOutlined, FileMarkdownOutlined, FileGifOutlined, FileImageOutlined, FileJpgOutlined, NotificationOutlined, VideoCameraOutlined, FilePptOutlined, FileExcelOutlined, FileWordOutlined, FilePdfOutlined, FileTextOutlined, ColumnWidthOutlined, MessageOutlined, BookOutlined, AudioMutedOutlined, AudioOutlined, EditOutlined, DeleteOutlined, CloseOutlined } from '@ant-design/icons';
2
+ import { MinusCircleOutlined, PlusCircleOutlined, RedoOutlined, FileUnknownOutlined, FileZipOutlined, FileMarkdownOutlined, FileGifOutlined, FileImageOutlined, FileJpgOutlined, NotificationOutlined, VideoCameraOutlined, FilePptOutlined, FileExcelOutlined, FileWordOutlined, FilePdfOutlined, FileTextOutlined, ColumnWidthOutlined, MessageOutlined, BookOutlined, EditOutlined, DeleteOutlined, CloseOutlined } from '@ant-design/icons';
3
3
  import { Spin, Input, Typography, Tooltip as Tooltip$1, Button, message, Flex, Alert, Skeleton, Result, Splitter, Empty, Image, Drawer, Avatar, notification, Modal, Form, Card, List, Space, Popconfirm } from 'antd';
4
4
  import classNames2 from 'classnames';
5
5
  import { renderAsync } from 'docx-preview';
@@ -44,7 +44,7 @@ import { Selection as Selection$1 } from '@tiptap/extensions';
44
44
  import { StarterKit } from '@tiptap/starter-kit';
45
45
  import { TableHeader, TableRow, TableCell, Table } from '@tiptap/extension-table';
46
46
  import TiptapHorizontalRule from '@tiptap/extension-horizontal-rule';
47
- import { Node, mergeAttributes as mergeAttributes$1, Extension, Mark } from '@tiptap/core';
47
+ import { Node as Node$1, mergeAttributes as mergeAttributes$1, Extension, Mark } from '@tiptap/core';
48
48
  import { PluginKey, Plugin, TextSelection, Selection, NodeSelection, AllSelection } from '@tiptap/pm/state';
49
49
  import { shift, flip, offset, useMergeRefs, FloatingPortal, useFloating, autoUpdate, useTransitionStyles, useDismiss, useInteractions, FloatingDelayGroup, useHover, useFocus, useRole } from '@floating-ui/react';
50
50
  import { CellSelection } from '@tiptap/pm/tables';
@@ -1277,7 +1277,7 @@ var DocxPreview_default = ({ fileUrl, scale = 1 }) => {
1277
1277
  };
1278
1278
  var FileIcon_default = ({ suffix, fontSize = 22 }) => {
1279
1279
  const styles = { fontSize, color: "var(--ant-color-primary)" };
1280
- const Icon2 = useMemo(() => {
1280
+ const Icon = useMemo(() => {
1281
1281
  switch (suffix?.toUpperCase()) {
1282
1282
  case "TXT":
1283
1283
  return /* @__PURE__ */ jsx(FileTextOutlined, {});
@@ -1324,7 +1324,7 @@ var FileIcon_default = ({ suffix, fontSize = 22 }) => {
1324
1324
  return /* @__PURE__ */ jsx(FileUnknownOutlined, {});
1325
1325
  }
1326
1326
  }, [suffix]);
1327
- return /* @__PURE__ */ jsx("span", { style: styles, children: Icon2 });
1327
+ return /* @__PURE__ */ jsx("span", { style: styles, children: Icon });
1328
1328
  };
1329
1329
  var VideoPlayer_default = ({ fileUrl }) => {
1330
1330
  return /* @__PURE__ */ jsxs("video", { controls: true, className: styles_module_default.nsPreviewVideo, children: [
@@ -1561,6 +1561,55 @@ var useIframeRelayBridge_default = (allowedOrigins = ["*"]) => {
1561
1561
  }
1562
1562
  return { on, off };
1563
1563
  };
1564
+ var useRefState_default = (init) => {
1565
+ const [state, setState] = useState(init);
1566
+ const stateRef = useRef(init);
1567
+ const setProxy = (newVal) => {
1568
+ stateRef.current = newVal;
1569
+ setState(newVal);
1570
+ };
1571
+ const getState = () => stateRef.current;
1572
+ return [state, setProxy, getState];
1573
+ };
1574
+
1575
+ // src/hooks/useAsyncQueue.ts
1576
+ var useAsyncQueue_default = () => {
1577
+ const [queue, setQueue] = useState([]);
1578
+ const [enabled, setEnabled] = useState(true);
1579
+ const [running, setRunning, getRunning] = useRefState_default(false);
1580
+ const addToQueue = useCallback((func, ...args) => {
1581
+ setQueue((prevQueue) => [...prevQueue, { func, args }]);
1582
+ }, []);
1583
+ const executeQueue = useCallback((nextEnabled) => {
1584
+ setEnabled(nextEnabled);
1585
+ }, []);
1586
+ const clearQueue = useCallback(() => {
1587
+ setQueue([]);
1588
+ }, []);
1589
+ useEffect(() => {
1590
+ if (!enabled) return;
1591
+ if (getRunning()) return;
1592
+ if (queue.length === 0) return;
1593
+ const task = queue[0];
1594
+ setRunning(true);
1595
+ (async () => {
1596
+ try {
1597
+ await task.func(...task.args);
1598
+ } finally {
1599
+ setQueue((prevQueue) => prevQueue.slice(1));
1600
+ setRunning(false);
1601
+ }
1602
+ })();
1603
+ }, [queue, enabled]);
1604
+ return {
1605
+ addToQueue,
1606
+ executeQueue,
1607
+ clearQueue,
1608
+ queueSize: queue.length,
1609
+ enabled,
1610
+ running
1611
+ };
1612
+ };
1564
1613
  var useAutoRefresh_default = (listenValue, shouldRefresh, callback, delay = 1e4) => {
1565
1614
  const timerRef = useRef(null);
1566
1615
  const shouldRefreshRef = useRef(shouldRefresh);
@@ -1678,100 +1727,6 @@ var useDeepEffect_default = (effect, deps) => {
1678
1727
  }
1679
1728
  }, [depsChanged, effect, ...deps]);
1680
1729
  };
1681
- var useRefState_default = (init) => {
1682
- const [state, setState] = useState(init);
1683
- const stateRef = useRef(init);
1684
- const setProxy = (newVal) => {
1685
- stateRef.current = newVal;
1686
- setState(newVal);
1687
- };
1688
- const getState = () => stateRef.current;
1689
- return [state, setProxy, getState];
1690
- };
1691
- var useSpeech_default = ({ onResult, lang = "zh-CN" }) => {
1692
- const [permission, setPermission] = useState("prompt");
1693
- const [isRecording, setIsRecording] = useState(false);
1694
- const recognitionRef = useRef(null);
1695
- useEffect(() => {
1696
- const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
1697
- if (!SpeechRecognition) {
1698
- setPermission("unsupported");
1699
- return;
1700
- }
1701
- const recognition = new SpeechRecognition();
1702
- recognition.continuous = true;
1703
- recognition.interimResults = false;
1704
- recognition.lang = lang;
1705
- recognition.onresult = (event) => {
1706
- let transcript = "";
1707
- for (let i = event.resultIndex; i < event.results.length; i++) {
1708
- transcript += event.results[i][0].transcript;
1709
- }
1710
- onResult?.(transcript.trim());
1711
- };
1712
- recognition.onend = () => {
1713
- setIsRecording(false);
1714
- };
1715
- recognition.onerror = (error) => {
1716
- setIsRecording(false);
1717
- console.error("Speech recognition error:", error);
1718
- };
1719
- recognitionRef.current = recognition;
1720
- return () => {
1721
- recognition.stop?.();
1722
- recognition.onresult = null;
1723
- recognition.onend = null;
1724
- recognition.onerror = null;
1725
- };
1726
- }, [lang, onResult]);
1727
- useEffect(() => {
1728
- if (!navigator.permissions) return;
1729
- navigator.permissions.query({ name: "microphone" }).then((status) => {
1730
- setPermission(status.state);
1731
- status.onchange = () => setPermission(status.state);
1732
- });
1733
- }, []);
1734
- const requestPermission = useCallback(async () => {
1735
- try {
1736
- await navigator.mediaDevices.getUserMedia({ audio: true });
1737
- setPermission("granted");
1738
- } catch {
1739
- setPermission("denied");
1740
- }
1741
- }, []);
1742
- const start = useCallback(() => {
1743
- if (permission === "prompt") {
1744
- requestPermission();
1745
- return;
1746
- }
1747
- if (permission !== "granted") return;
1748
- if (!isRecording) {
1749
- recognitionRef.current?.start();
1750
- setIsRecording(true);
1751
- }
1752
- }, [permission, isRecording, requestPermission]);
1753
- const stop = useCallback(() => {
1754
- try {
1755
- recognitionRef.current?.stop();
1756
- } finally {
1757
- setIsRecording(false);
1758
- }
1759
- }, []);
1760
- return {
1761
- /**
1762
- * 权限状态
1763
- */
1764
- permission,
1765
- /**
1766
- * 录音状态
1767
- */
1768
- isRecording,
1769
- /** 开始语音识别 */
1770
- start,
1771
- /** 停止语音识别 */
1772
- stop
1773
- };
1774
- };
1775
1730
  var useSyncInput_default = (storeValue, setStoreValue) => {
1776
1731
  const [inputValue, setInputValue] = useState(storeValue);
1777
1732
  useEffect(() => {
@@ -2467,7 +2422,7 @@ var PAGE_NO_TAG = "page-no";
2467
2422
  var PAGE_NO_KEY = "PageNo";
2468
2423
 
2469
2424
  // src/components/MarkdownEditor/pageNo/pageNoMark.ts
2470
- var pageNoMark_default = Node.create({
2425
+ var pageNoMark_default = Node$1.create({
2471
2426
  name: PAGE_NO_KEY,
2472
2427
  // 节点名称
2473
2428
  group: "inline",
@@ -3601,6 +3556,90 @@ var COLLECTION_ATTRS = ["collection-id", "user-name", "user-id", "update-time",
3601
3556
 
3602
3557
  // src/components/MarkdownEditor/collection/CollectionMark.ts
3603
3558
  var CollectionMark = createHtmlMark(COLLECTION_KEY, COLLECTION_ATTRS, "editor-collection");
3559
+
3560
+ // src/components/MarkdownEditor/common/utils.ts
3561
+ function selectionHasBlockMath(editor) {
3562
+ if (!editor) return false;
3563
+ const { state } = editor;
3564
+ const { from, to } = state.selection;
3565
+ let hasBlockMath = false;
3566
+ state.doc.nodesBetween(from, to, (node) => {
3567
+ if (node.type.name === "blockMath") {
3568
+ hasBlockMath = true;
3569
+ return false;
3570
+ }
3571
+ });
3572
+ return hasBlockMath;
3573
+ }
3574
+ function hasSelection(editor) {
3575
+ if (!editor) return false;
3576
+ const { from, to } = editor.state.selection;
3577
+ return from < to;
3578
+ }
3579
+ function getSelectedText(editor) {
3580
+ if (!editor) return "";
3581
+ const { from, to } = editor.state.selection;
3582
+ if (from === to) return "";
3583
+ return editor.state.doc.textBetween(from, to, " ");
3584
+ }
3585
+ function getSelectedMarkdown(editor) {
3586
+ if (!editor) return "";
3587
+ if (!editor.markdown) {
3588
+ console.warn("Markdown extension \u672A\u542F\u7528");
3589
+ return "";
3590
+ }
3591
+ const { from, to } = editor.state.selection;
3592
+ const slice = editor.state.doc.cut(from, to);
3593
+ return editor.markdown.serialize({
3594
+ type: "doc",
3595
+ content: slice.content.toJSON()
3596
+ });
3597
+ }
3598
+ function getScrollParent(el) {
3599
+ if (typeof window === "undefined") return null;
3600
+ let current = el?.parentElement ?? null;
3601
+ while (current) {
3602
+ const style = window.getComputedStyle(current);
3603
+ const overflowY = style.overflowY;
3604
+ const overflow = style.overflow;
3605
+ const canScroll = /(auto|scroll|overlay)/.test(overflowY) || /(auto|scroll|overlay)/.test(overflow);
3606
+ if (canScroll) {
3607
+ return current;
3608
+ }
3609
+ current = current.parentElement;
3610
+ }
3611
+ return document.scrollingElement;
3612
+ }
3613
+ function scrollEditorViewToPosInNextFrame(view, pos, options) {
3614
+ const { align = "start", behavior = "auto", offset: offset3 = 0 } = options || {};
3615
+ requestAnimationFrame(() => {
3616
+ try {
3617
+ const result = view.domAtPos(pos);
3618
+ if (!result) return;
3619
+ const el = result.node.nodeType === Node.TEXT_NODE ? result.node.parentElement : result.node;
3620
+ if (!el) return;
3621
+ const scrollParent = getScrollParent(view.dom);
3622
+ const parentRect = scrollParent.getBoundingClientRect();
3623
+ const targetRect = el.getBoundingClientRect();
3624
+ let delta = 0;
3625
+ if (align === "start") {
3626
+ delta = targetRect.top - parentRect.top;
3627
+ } else if (align === "center") {
3628
+ delta = targetRect.top - parentRect.top - parentRect.height / 2 + targetRect.height / 2;
3629
+ } else if (align === "end") {
3630
+ delta = targetRect.bottom - parentRect.bottom;
3631
+ }
3632
+ scrollParent.scrollTo({
3633
+ top: scrollParent.scrollTop + delta - offset3,
3634
+ behavior
3635
+ });
3636
+ } catch (e) {
3637
+ console.warn("scroll error:", e);
3638
+ }
3639
+ });
3640
+ }
3641
+
3642
+ // src/components/MarkdownEditor/collection/CollectionPlugin.ts
3604
3643
  var collectionPluginKey = new PluginKey("collectionPlugin");
3605
3644
  var CollectionPlugin = Extension.create({
3606
3645
  name: "collectionPlugin",
@@ -3623,10 +3662,11 @@ var CollectionPlugin = Extension.create({
3623
3662
  },
3624
3663
  moveCursorToCollection: (id) => ({ state, commands, view }) => {
3625
3664
  const foundFrom = findMarkPosition(state.doc, COLLECTION_KEY, COLLECTION_ATTRS[0], id);
3626
- if (foundFrom) {
3665
+ if (isNumber(foundFrom)) {
3627
3666
  const tr = state.tr.setSelection(TextSelection.create(state.doc, foundFrom));
3628
3667
  view.dispatch(tr);
3629
3668
  commands.focus();
3669
+ scrollEditorViewToPosInNextFrame(view, foundFrom, { align: "start" });
3630
3670
  }
3631
3671
  }
3632
3672
  };
@@ -3798,47 +3838,6 @@ var collectionSidebar_default = ({
3798
3838
  }
3799
3839
  return createPortal(sidebarContent, container);
3800
3840
  };
3801
-
3802
- // src/components/MarkdownEditor/common/utils.ts
3803
- function selectionHasBlockMath(editor) {
3804
- if (!editor) return false;
3805
- const { state } = editor;
3806
- const { from, to } = state.selection;
3807
- let hasBlockMath = false;
3808
- state.doc.nodesBetween(from, to, (node) => {
3809
- if (node.type.name === "blockMath") {
3810
- hasBlockMath = true;
3811
- return false;
3812
- }
3813
- });
3814
- return hasBlockMath;
3815
- }
3816
- function hasSelection(editor) {
3817
- if (!editor) return false;
3818
- const { from, to } = editor.state.selection;
3819
- return from < to;
3820
- }
3821
- function getSelectedText(editor) {
3822
- if (!editor) return "";
3823
- const { from, to } = editor.state.selection;
3824
- if (from === to) return "";
3825
- return editor.state.doc.textBetween(from, to, " ");
3826
- }
3827
- function getSelectedMarkdown(editor) {
3828
- if (!editor) return "";
3829
- if (!editor.markdown) {
3830
- console.warn("Markdown extension \u672A\u542F\u7528");
3831
- return "";
3832
- }
3833
- const { from, to } = editor.state.selection;
3834
- const slice = editor.state.doc.cut(from, to);
3835
- return editor.markdown.serialize({
3836
- type: "doc",
3837
- content: slice.content.toJSON()
3838
- });
3839
- }
3840
-
3841
- // src/components/MarkdownEditor/collection/use-collections.ts
3842
3841
  var useCollections = (collectionConfig) => {
3843
3842
  const [collections, setCollections] = useState([]);
3844
3843
  const [selectedCollectionId, setSelectedCollectionId] = useState(null);
@@ -3877,7 +3876,7 @@ var useCollections = (collectionConfig) => {
3877
3876
  "page-no": pageIndex
3878
3877
  }).run();
3879
3878
  setShowCollection(true);
3880
- handleSelectCollection(remoteId, "sidebar");
3879
+ handleSelectCollection(remoteId);
3881
3880
  };
3882
3881
  const handleDeleteCollection = (id) => {
3883
3882
  if (!editor.current) {
@@ -4414,7 +4413,7 @@ var BlockquoteButton = forwardRef(
4414
4413
  handleToggle,
4415
4414
  label,
4416
4415
  shortcutKeys,
4417
- Icon: Icon2
4416
+ Icon
4418
4417
  } = useBlockquote({
4419
4418
  editor,
4420
4419
  hideWhenUnavailable,
@@ -4448,7 +4447,7 @@ var BlockquoteButton = forwardRef(
4448
4447
  ...buttonProps,
4449
4448
  ref,
4450
4449
  children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
4451
- /* @__PURE__ */ jsx(Icon2, { className: "tiptap-button-icon" }),
4450
+ /* @__PURE__ */ jsx(Icon, { className: "tiptap-button-icon" }),
4452
4451
  text && /* @__PURE__ */ jsx("span", { className: "tiptap-button-text", children: text }),
4453
4452
  showShortcut && /* @__PURE__ */ jsx(BlockquoteShortcutBadge, { shortcutKeys })
4454
4453
  ] })
@@ -4640,7 +4639,7 @@ var CodeBlockButton = forwardRef(
4640
4639
  handleToggle,
4641
4640
  label,
4642
4641
  shortcutKeys,
4643
- Icon: Icon2
4642
+ Icon
4644
4643
  } = useCodeBlock({
4645
4644
  editor,
4646
4645
  hideWhenUnavailable,
@@ -4674,7 +4673,7 @@ var CodeBlockButton = forwardRef(
4674
4673
  ...buttonProps,
4675
4674
  ref,
4676
4675
  children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
4677
- /* @__PURE__ */ jsx(Icon2, { className: "tiptap-button-icon" }),
4676
+ /* @__PURE__ */ jsx(Icon, { className: "tiptap-button-icon" }),
4678
4677
  text && /* @__PURE__ */ jsx("span", { className: "tiptap-button-text", children: text }),
4679
4678
  showShortcut && /* @__PURE__ */ jsx(CodeBlockShortcutBadge, { shortcutKeys })
4680
4679
  ] })
@@ -5360,7 +5359,7 @@ function ColorHighlightPopover({
5360
5359
  }) {
5361
5360
  const { editor } = useTiptapEditor(providedEditor);
5362
5361
  const [isOpen, setIsOpen] = useState(false);
5363
- const { isVisible, canColorHighlight: canColorHighlight2, isActive, label, Icon: Icon2 } = useColorHighlight({
5362
+ const { isVisible, canColorHighlight: canColorHighlight2, isActive, label, Icon } = useColorHighlight({
5364
5363
  editor,
5365
5364
  hideWhenUnavailable,
5366
5365
  onApplied
@@ -5377,7 +5376,7 @@ function ColorHighlightPopover({
5377
5376
  "aria-label": label,
5378
5377
  tooltip: label,
5379
5378
  ...props,
5380
- children: /* @__PURE__ */ jsx(Icon2, { className: "tiptap-button-icon" })
5379
+ children: /* @__PURE__ */ jsx(Icon, { className: "tiptap-button-icon" })
5381
5380
  }
5382
5381
  ) }),
5383
5382
  /* @__PURE__ */ jsx(PopoverContent, { "aria-label": "\u80CC\u666F\u8272", children: /* @__PURE__ */ jsx(ColorHighlightPopoverContent, { editor, colors }) })
@@ -5432,7 +5431,7 @@ var HeadingButton = forwardRef(
5432
5431
  isActive,
5433
5432
  handleToggle,
5434
5433
  label,
5435
- Icon: Icon2,
5434
+ Icon,
5436
5435
  shortcutKeys
5437
5436
  } = useHeading({
5438
5437
  editor,
@@ -5468,7 +5467,7 @@ var HeadingButton = forwardRef(
5468
5467
  ...buttonProps,
5469
5468
  ref,
5470
5469
  children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
5471
- /* @__PURE__ */ jsx(Icon2, { className: "tiptap-button-icon" }),
5470
+ /* @__PURE__ */ jsx(Icon, { className: "tiptap-button-icon" }),
5472
5471
  text && /* @__PURE__ */ jsx("span", { className: "tiptap-button-text", children: text }),
5473
5472
  showShortcut && /* @__PURE__ */ jsx(HeadingShortcutBadge, { level, shortcutKeys })
5474
5473
  ] })
@@ -5863,7 +5862,7 @@ var HeadingDropdownMenu = forwardRef(
5863
5862
  }, ref) => {
5864
5863
  const { editor } = useTiptapEditor(providedEditor);
5865
5864
  const [isOpen, setIsOpen] = useState(false);
5866
- const { isVisible, isActive, canToggle: canToggle3, Icon: Icon2 } = useHeadingDropdownMenu({
5865
+ const { isVisible, isActive, canToggle: canToggle3, Icon } = useHeadingDropdownMenu({
5867
5866
  editor,
5868
5867
  levels,
5869
5868
  hideWhenUnavailable
@@ -5896,7 +5895,7 @@ var HeadingDropdownMenu = forwardRef(
5896
5895
  ...buttonProps,
5897
5896
  ref,
5898
5897
  children: [
5899
- /* @__PURE__ */ jsx(Icon2, { className: "tiptap-button-icon" }),
5898
+ /* @__PURE__ */ jsx(Icon, { className: "tiptap-button-icon" }),
5900
5899
  /* @__PURE__ */ jsx(ChevronDownIcon, { className: "tiptap-button-dropdown-small" })
5901
5900
  ]
5902
5901
  }
@@ -6229,7 +6228,7 @@ var LinkPopover = forwardRef(
6229
6228
  removeLink,
6230
6229
  openLink,
6231
6230
  label,
6232
- Icon: Icon2
6231
+ Icon
6233
6232
  } = useLinkPopover({
6234
6233
  editor,
6235
6234
  hideWhenUnavailable,
@@ -6274,7 +6273,7 @@ var LinkPopover = forwardRef(
6274
6273
  onClick: handleClick,
6275
6274
  ...buttonProps,
6276
6275
  ref,
6277
- children: children ?? /* @__PURE__ */ jsx(Icon2, { className: "tiptap-button-icon" })
6276
+ children: children ?? /* @__PURE__ */ jsx(Icon, { className: "tiptap-button-icon" })
6278
6277
  }
6279
6278
  ) }),
6280
6279
  /* @__PURE__ */ jsx(PopoverContent, { children: /* @__PURE__ */ jsx(
@@ -6446,7 +6445,7 @@ var ListButton = forwardRef(
6446
6445
  handleToggle,
6447
6446
  label,
6448
6447
  shortcutKeys,
6449
- Icon: Icon2
6448
+ Icon
6450
6449
  } = useList({
6451
6450
  editor,
6452
6451
  type,
@@ -6481,7 +6480,7 @@ var ListButton = forwardRef(
6481
6480
  ...buttonProps,
6482
6481
  ref,
6483
6482
  children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
6484
- /* @__PURE__ */ jsx(Icon2, { className: "tiptap-button-icon" }),
6483
+ /* @__PURE__ */ jsx(Icon, { className: "tiptap-button-icon" }),
6485
6484
  text && /* @__PURE__ */ jsx("span", { className: "tiptap-button-text", children: text }),
6486
6485
  showShortcut && /* @__PURE__ */ jsx(ListShortcutBadge, { type, shortcutKeys })
6487
6486
  ] })
@@ -6953,7 +6952,7 @@ function ListDropdownMenu({
6953
6952
  }) {
6954
6953
  const { editor } = useTiptapEditor(providedEditor);
6955
6954
  const [isOpen, setIsOpen] = useState(false);
6956
- const { filteredLists, canToggle: canToggle3, isActive, isVisible, Icon: Icon2 } = useListDropdownMenu({
6955
+ const { filteredLists, canToggle: canToggle3, isActive, isVisible, Icon } = useListDropdownMenu({
6957
6956
  editor,
6958
6957
  types,
6959
6958
  hideWhenUnavailable
@@ -6983,7 +6982,7 @@ function ListDropdownMenu({
6983
6982
  tooltip: "\u5217\u8868",
6984
6983
  ...props,
6985
6984
  children: [
6986
- /* @__PURE__ */ jsx(Icon2, { className: "tiptap-button-icon" }),
6985
+ /* @__PURE__ */ jsx(Icon, { className: "tiptap-button-icon" }),
6987
6986
  /* @__PURE__ */ jsx(ChevronDownIcon, { className: "tiptap-button-dropdown-small" })
6988
6987
  ]
6989
6988
  }
@@ -7024,7 +7023,7 @@ var MarkButton = forwardRef(
7024
7023
  label,
7025
7024
  canToggle: canToggle3,
7026
7025
  isActive,
7027
- Icon: Icon2,
7026
+ Icon,
7028
7027
  shortcutKeys
7029
7028
  } = useMark({
7030
7029
  editor,
@@ -7060,7 +7059,7 @@ var MarkButton = forwardRef(
7060
7059
  ...buttonProps,
7061
7060
  ref,
7062
7061
  children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
7063
- /* @__PURE__ */ jsx(Icon2, { className: "tiptap-button-icon" }),
7062
+ /* @__PURE__ */ jsx(Icon, { className: "tiptap-button-icon" }),
7064
7063
  text && /* @__PURE__ */ jsx("span", { className: "tiptap-button-text", children: text }),
7065
7064
  showShortcut && /* @__PURE__ */ jsx(MarkShortcutBadge, { type, shortcutKeys })
7066
7065
  ] })
@@ -7418,7 +7417,7 @@ var TextAlignButton = forwardRef(
7418
7417
  label,
7419
7418
  canAlign,
7420
7419
  isActive,
7421
- Icon: Icon2,
7420
+ Icon,
7422
7421
  shortcutKeys
7423
7422
  } = useTextAlign({
7424
7423
  editor,
@@ -7437,7 +7436,7 @@ var TextAlignButton = forwardRef(
7437
7436
  if (!isVisible) {
7438
7437
  return null;
7439
7438
  }
7440
- const RenderIcon = CustomIcon ?? Icon2;
7439
+ const RenderIcon = CustomIcon ?? Icon;
7441
7440
  return /* @__PURE__ */ jsx(
7442
7441
  Button6,
7443
7442
  {
@@ -7756,7 +7755,7 @@ var UndoRedoButton = forwardRef(
7756
7755
  ...buttonProps
7757
7756
  }, ref) => {
7758
7757
  const { editor } = useTiptapEditor(providedEditor);
7759
- const { isVisible, handleAction, label, canExecute, Icon: Icon2, shortcutKeys } = useUndoRedo({
7758
+ const { isVisible, handleAction, label, canExecute, Icon, shortcutKeys } = useUndoRedo({
7760
7759
  editor,
7761
7760
  action,
7762
7761
  hideWhenUnavailable,
@@ -7788,7 +7787,7 @@ var UndoRedoButton = forwardRef(
7788
7787
  ...buttonProps,
7789
7788
  ref,
7790
7789
  children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
7791
- /* @__PURE__ */ jsx(Icon2, { className: "tiptap-button-icon" }),
7790
+ /* @__PURE__ */ jsx(Icon, { className: "tiptap-button-icon" }),
7792
7791
  text && /* @__PURE__ */ jsx("span", { className: "tiptap-button-text", children: text }),
7793
7792
  showShortcut && /* @__PURE__ */ jsx(
7794
7793
  HistoryShortcutBadge,
@@ -8835,70 +8834,10 @@ function propsMerge(control, props) {
8835
8834
  }
8836
8835
  return null;
8837
8836
  }
8838
- var SpeechLoading_default = () => /* @__PURE__ */ jsxs("svg", { color: "currentColor", viewBox: "0 0 1000 1000", xmlns: "http://www.w3.org/2000/svg", children: [
8839
- /* @__PURE__ */ jsxs("rect", { fill: "currentColor", rx: "70", ry: "70", height: "250", width: "140", x: "0", y: "375", children: [
8840
- /* @__PURE__ */ jsx("animate", { attributeName: "height", values: "250; 500; 250", keyTimes: "0; 0.5; 1", dur: "0.8s", begin: "0s", repeatCount: "indefinite" }),
8841
- /* @__PURE__ */ jsx("animate", { attributeName: "y", values: "375; 250; 375", keyTimes: "0; 0.5; 1", dur: "0.8s", begin: "0s", repeatCount: "indefinite" })
8842
- ] }),
8843
- /* @__PURE__ */ jsxs("rect", { fill: "currentColor", rx: "70", ry: "70", height: "250", width: "140", x: "286.66666666666663", y: "375", children: [
8844
- /* @__PURE__ */ jsx("animate", { attributeName: "height", values: "250; 500; 250", keyTimes: "0; 0.5; 1", dur: "0.8s", begin: "0.2s", repeatCount: "indefinite" }),
8845
- /* @__PURE__ */ jsx("animate", { attributeName: "y", values: "375; 250; 375", keyTimes: "0; 0.5; 1", dur: "0.8s", begin: "0.2s", repeatCount: "indefinite" })
8846
- ] }),
8847
- /* @__PURE__ */ jsxs("rect", { fill: "currentColor", rx: "70", ry: "70", height: "250", width: "140", x: "573.3333333333333", y: "375", children: [
8848
- /* @__PURE__ */ jsx("animate", { attributeName: "height", values: "250; 500; 250", keyTimes: "0; 0.5; 1", dur: "0.8s", begin: "0.4s", repeatCount: "indefinite" }),
8849
- /* @__PURE__ */ jsx("animate", { attributeName: "y", values: "375; 250; 375", keyTimes: "0; 0.5; 1", dur: "0.8s", begin: "0.4s", repeatCount: "indefinite" })
8850
- ] }),
8851
- /* @__PURE__ */ jsxs("rect", { fill: "currentColor", rx: "70", ry: "70", height: "250", width: "140", x: "859.9999999999999", y: "375", children: [
8852
- /* @__PURE__ */ jsx(
8853
- "animate",
8854
- {
8855
- attributeName: "height",
8856
- values: "250; 500; 250",
8857
- keyTimes: "0; 0.5; 1",
8858
- dur: "0.8s",
8859
- begin: "0.6000000000000001s",
8860
- repeatCount: "indefinite"
8861
- }
8862
- ),
8863
- /* @__PURE__ */ jsx(
8864
- "animate",
8865
- {
8866
- attributeName: "y",
8867
- values: "375; 250; 375",
8868
- keyTimes: "0; 0.5; 1",
8869
- dur: "0.8s",
8870
- begin: "0.6000000000000001s",
8871
- repeatCount: "indefinite"
8872
- }
8873
- )
8874
- ] })
8875
- ] });
8876
- var SpeechButton_default = (props) => {
8877
- const { permission, isRecording, start, stop } = useSpeech_default(props);
8878
- const disabled = permission === "denied" || permission === "unsupported";
8879
- const handleClick = () => {
8880
- if (isRecording) {
8881
- stop();
8882
- } else {
8883
- start();
8884
- }
8885
- };
8886
- return /* @__PURE__ */ jsx(
8887
- Button,
8888
- {
8889
- title: permission === "unsupported" ? "\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u8BED\u97F3\u8BC6\u522B" : permission === "denied" ? "\u9EA6\u514B\u98CE\u6743\u9650\u5DF2\u62D2\u7EDD" : isRecording ? "\u505C\u6B62\u5F55\u97F3" : "\u70B9\u51FB\u5F00\u59CB\u5F55\u97F3",
8890
- disabled,
8891
- color: "primary",
8892
- variant: "text",
8893
- icon: isRecording ? /* @__PURE__ */ jsx(Icon, { style: { width: 16 }, component: SpeechLoading_default }) : disabled ? /* @__PURE__ */ jsx(AudioMutedOutlined, {}) : /* @__PURE__ */ jsx(AudioOutlined, {}),
8894
- onClick: handleClick
8895
- }
8896
- );
8897
- };
8898
8837
  var UserAvatar_default = ({ size, avatarSrc, userName }) => {
8899
8838
  return avatarSrc ? /* @__PURE__ */ jsx(Avatar, { size, src: avatarSrc }) : /* @__PURE__ */ jsx(Avatar, { size, className: "cursor-pointer", style: { backgroundColor: "var(--ant-color-primary)" }, children: userName?.slice(0, 1)?.toLocaleUpperCase() });
8900
8839
  };
8901
8840
 
8902
- export { AudioPlayer_default as AudioPlayer, BusinessCode, DEFAULT_DATE_FORMAT, DEFAULT_DATE_TIME_FORMAT, DEFAULT_YEAR_MONTH_DAY_FORMAT, DEFAULT_YEAR_MONTH_FORMAT, DocxPreview_default as DocxPreview, FileIcon_default as FileIcon, FilePreview_default as FilePreview, FilePreviewDrawer_default as FilePreviewDrawer, HttpStatus, Iframe_default as Iframe, LazyComponent_default as LazyComponent, MarkDrawing_default as MarkDrawing, MarkdownEditor_default as MarkdownEditor, MarkdownPreview_default as MarkdownPreview, MultiEmailValidator, PdfImagePreview_default as PdfImagePreview, PdfPreview_default as PdfPreview, PhoneOrMobileValidator, RegBankCardNo, RegDetailAddress, RegEmail, RegFixedTelePhone, RegIdentityCardNo, RegMobile, RegNumNo, RegPassword, RegSmsCode, RegTaxNo, RegTelePhone, RenderMarkdown_default as RenderMarkdown, RenderWrapper_default as RenderWrapper, SpeechButton_default as SpeechButton, ThanNumLengthValidator, ThanNumValidator, UserAvatar_default as UserAvatar, VideoPlayer_default as VideoPlayer, absVal, addUrlLastSlash, aesDecrypt, aesEncrypt, arrToObj, buildUrlParams, cachedMessage, calculate, compareNum, convertCurrency, convertNewlineToBr, copyText, createRequest, createSecureManager, createTokenManager, decimalPlaces, deepCopy, deepEqual, deepMerge, dividedBy, downloadFile, emit, emitToChild, executeScript, findTreeNodesByIds, formatDate, formatNumberWithCommas, formatSize, genNonDuplicateID, generateRandomNumbers, getAllUrlParams, getDeviceId, getEndOfTimestamp, getFileName, getFileSuffixName, getRowSpanCount, getStartOfTimestamp, getTimestamp, getWebSocketUrl, htmlToMarkdown, htmlToText, importThirdPartyFile, is, isArray, isBlob, isBoolean, isDate, isDef, isElement, isEmpty, isEmptyObj, isExpire, isExternal, isFunction, isInteger, isJson, isLocalhost, isMap, isNegative, isNull, isNullOrUnDef, isNumber, isNumberNoNaN, isObject, isPromise, isReferenceType, isRegExp, isScriptSafe, isSet, isString, isUnDef, isWindow, markdownToText, minus, objToOptions, plus, precision, processItemList, propsMerge, setInterval2 as setInterval, setUrlMainSource, shouldRender, times, toFixed, transform, transforms, useAutoRefresh_default as useAutoRefresh, useCountDown_default as useCountDown, useCreateValtioContext_default as useCreateValtioContext, useDebounce_default as useDebounce, useDeepEffect_default as useDeepEffect, useIframeRelayBridge_default as useIframeRelayBridge, useRefState_default as useRefState, useSpeech_default as useSpeech, useSyncInput_default as useSyncInput, useThrottle_default as useThrottle, useWebSocket_default as useWebSocket };
8841
+ export { AudioPlayer_default as AudioPlayer, BusinessCode, DEFAULT_DATE_FORMAT, DEFAULT_DATE_TIME_FORMAT, DEFAULT_YEAR_MONTH_DAY_FORMAT, DEFAULT_YEAR_MONTH_FORMAT, DocxPreview_default as DocxPreview, FileIcon_default as FileIcon, FilePreview_default as FilePreview, FilePreviewDrawer_default as FilePreviewDrawer, HttpStatus, Iframe_default as Iframe, LazyComponent_default as LazyComponent, MarkDrawing_default as MarkDrawing, MarkdownEditor_default as MarkdownEditor, MarkdownPreview_default as MarkdownPreview, MultiEmailValidator, PdfImagePreview_default as PdfImagePreview, PdfPreview_default as PdfPreview, PhoneOrMobileValidator, RegBankCardNo, RegDetailAddress, RegEmail, RegFixedTelePhone, RegIdentityCardNo, RegMobile, RegNumNo, RegPassword, RegSmsCode, RegTaxNo, RegTelePhone, RenderMarkdown_default as RenderMarkdown, RenderWrapper_default as RenderWrapper, ThanNumLengthValidator, ThanNumValidator, UserAvatar_default as UserAvatar, VideoPlayer_default as VideoPlayer, absVal, addUrlLastSlash, aesDecrypt, aesEncrypt, arrToObj, buildUrlParams, cachedMessage, calculate, compareNum, convertCurrency, convertNewlineToBr, copyText, createRequest, createSecureManager, createTokenManager, decimalPlaces, deepCopy, deepEqual, deepMerge, dividedBy, downloadFile, emit, emitToChild, executeScript, findTreeNodesByIds, formatDate, formatNumberWithCommas, formatSize, genNonDuplicateID, generateRandomNumbers, getAllUrlParams, getDeviceId, getEndOfTimestamp, getFileName, getFileSuffixName, getRowSpanCount, getStartOfTimestamp, getTimestamp, getWebSocketUrl, htmlToMarkdown, htmlToText, importThirdPartyFile, is, isArray, isBlob, isBoolean, isDate, isDef, isElement, isEmpty, isEmptyObj, isExpire, isExternal, isFunction, isInteger, isJson, isLocalhost, isMap, isNegative, isNull, isNullOrUnDef, isNumber, isNumberNoNaN, isObject, isPromise, isReferenceType, isRegExp, isScriptSafe, isSet, isString, isUnDef, isWindow, markdownToText, minus, objToOptions, plus, precision, processItemList, propsMerge, setInterval2 as setInterval, setUrlMainSource, shouldRender, times, toFixed, transform, transforms, useAsyncQueue_default as useAsyncQueue, useAutoRefresh_default as useAutoRefresh, useCountDown_default as useCountDown, useCreateValtioContext_default as useCreateValtioContext, useDebounce_default as useDebounce, useDeepEffect_default as useDeepEffect, useIframeRelayBridge_default as useIframeRelayBridge, useRefState_default as useRefState, useSyncInput_default as useSyncInput, useThrottle_default as useThrottle, useWebSocket_default as useWebSocket };
8903
8842
  //# sourceMappingURL=index.esm.js.map
8904
8843
  //# sourceMappingURL=index.esm.js.map