@zero-library/common 2.3.11 → 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/README.md +43 -0
- package/dist/index.cjs.js +261 -308
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +0 -92
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +61 -56
- package/dist/index.d.ts +61 -56
- package/dist/index.esm.js +233 -278
- package/dist/index.esm.js.map +1 -1
- package/package.json +14 -2
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import
|
|
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
|
|
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:
|
|
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(() => {
|
|
@@ -2089,72 +2044,88 @@ var PdfImagePreview_default = ({ fileUrl, pageNo, scale = 1, isHasThumbnails = t
|
|
|
2089
2044
|
}
|
|
2090
2045
|
}, [zoom, virtualizer]);
|
|
2091
2046
|
return error ? /* @__PURE__ */ jsx(Result, { status: "error", title: error }) : /* @__PURE__ */ jsxs(Splitter, { className: classNames2(styles_module_default.nsPreviewPdfImage), children: [
|
|
2092
|
-
isHasThumbnails && /* @__PURE__ */ jsx(Splitter.Panel, { resizable: false, min: 400, max: 400, collapsible: true, children: /* @__PURE__ */ jsx("div", { ref: thumbsParentRef, className: classNames2(styles_module_default.pdfImageNav, "height-full", "scroll-fade-in"), children:
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
{
|
|
2096
|
-
|
|
2097
|
-
align: "center",
|
|
2098
|
-
className: classNames2(styles_module_default.pdfImageNavItem),
|
|
2099
|
-
style: {
|
|
2100
|
-
top: item.start,
|
|
2101
|
-
height: `${THUMB_IMG_HEIGHT}px`
|
|
2102
|
-
},
|
|
2103
|
-
onClick: () => {
|
|
2104
|
-
virtualizer.scrollToIndex(item.index);
|
|
2105
|
-
},
|
|
2106
|
-
children: [
|
|
2107
|
-
/* @__PURE__ */ jsx(
|
|
2108
|
-
"div",
|
|
2109
|
-
{
|
|
2110
|
-
className: classNames2(styles_module_default.pdfImageNavItemImgWrapper, "flex-1", {
|
|
2111
|
-
[styles_module_default.pdfImageNavItemActive]: item.index === currentIndex
|
|
2112
|
-
}),
|
|
2113
|
-
children: /* @__PURE__ */ jsx("img", { className: styles_module_default.pdfImageNavItemImg, src: images[item.index].thumbnail || images[item.index].imageUrl })
|
|
2114
|
-
}
|
|
2115
|
-
),
|
|
2116
|
-
/* @__PURE__ */ jsx("div", { className: styles_module_default.pdfImageNavItemTip, children: item.index + 1 })
|
|
2117
|
-
]
|
|
2047
|
+
isHasThumbnails && /* @__PURE__ */ jsx(Splitter.Panel, { resizable: false, min: 400, max: 400, collapsible: true, children: /* @__PURE__ */ jsx("div", { ref: thumbsParentRef, className: classNames2(styles_module_default.pdfImageNav, "height-full", "scroll-fade-in"), children: /* @__PURE__ */ jsx(
|
|
2048
|
+
"div",
|
|
2049
|
+
{
|
|
2050
|
+
style: {
|
|
2051
|
+
height: `${thumbsVirtualizer.getTotalSize()}px`
|
|
2118
2052
|
},
|
|
2119
|
-
item
|
|
2120
|
-
|
|
2121
|
-
|
|
2053
|
+
children: thumbsVirtualizer.getVirtualItems().map((item) => {
|
|
2054
|
+
return /* @__PURE__ */ jsxs(
|
|
2055
|
+
Flex,
|
|
2056
|
+
{
|
|
2057
|
+
vertical: true,
|
|
2058
|
+
align: "center",
|
|
2059
|
+
className: classNames2(styles_module_default.pdfImageNavItem),
|
|
2060
|
+
style: {
|
|
2061
|
+
top: item.start,
|
|
2062
|
+
height: `${THUMB_IMG_HEIGHT}px`
|
|
2063
|
+
},
|
|
2064
|
+
onClick: () => {
|
|
2065
|
+
virtualizer.scrollToIndex(item.index);
|
|
2066
|
+
},
|
|
2067
|
+
children: [
|
|
2068
|
+
/* @__PURE__ */ jsx(
|
|
2069
|
+
"div",
|
|
2070
|
+
{
|
|
2071
|
+
className: classNames2(styles_module_default.pdfImageNavItemImgWrapper, "flex-1", {
|
|
2072
|
+
[styles_module_default.pdfImageNavItemActive]: item.index === currentIndex
|
|
2073
|
+
}),
|
|
2074
|
+
children: /* @__PURE__ */ jsx("img", { className: styles_module_default.pdfImageNavItemImg, src: images[item.index].thumbnail || images[item.index].imageUrl })
|
|
2075
|
+
}
|
|
2076
|
+
),
|
|
2077
|
+
/* @__PURE__ */ jsx("div", { className: styles_module_default.pdfImageNavItemTip, children: item.index + 1 })
|
|
2078
|
+
]
|
|
2079
|
+
},
|
|
2080
|
+
item.index
|
|
2081
|
+
);
|
|
2082
|
+
})
|
|
2083
|
+
}
|
|
2084
|
+
) }) }),
|
|
2122
2085
|
/* @__PURE__ */ jsx(Splitter.Panel, { children: /* @__PURE__ */ jsxs("div", { className: classNames2("height-full", styles_module_default.pdfImageBody), children: [
|
|
2123
2086
|
/* @__PURE__ */ jsxs(Flex, { gap: 6, align: "center", className: styles_module_default.pdfImageBodyToolbar, children: [
|
|
2124
2087
|
/* @__PURE__ */ jsx(Button, { onClick: zoomOut, icon: /* @__PURE__ */ jsx(MinusCircleOutlined, {}), title: "\u7F29\u5C0F" }),
|
|
2125
2088
|
/* @__PURE__ */ jsx(Button, { onClick: zoomIn, icon: /* @__PURE__ */ jsx(PlusCircleOutlined, {}), title: "\u653E\u5927" }),
|
|
2126
2089
|
/* @__PURE__ */ jsx(Button, { onClick: zoomFitWidth, icon: /* @__PURE__ */ jsx(ColumnWidthOutlined, {}), title: "\u9002\u5E94\u5BBD\u5EA6" })
|
|
2127
2090
|
] }),
|
|
2128
|
-
/* @__PURE__ */ jsx("div", { ref: containerRef, className: "height-full scroll-fade-in", children:
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
{
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
children: /* @__PURE__ */ jsx(
|
|
2091
|
+
/* @__PURE__ */ jsx("div", { ref: containerRef, className: "height-full scroll-fade-in", children: /* @__PURE__ */ jsx(
|
|
2092
|
+
"div",
|
|
2093
|
+
{
|
|
2094
|
+
style: {
|
|
2095
|
+
height: `${virtualizer.getTotalSize()}px`
|
|
2096
|
+
},
|
|
2097
|
+
children: virtualizer.getVirtualItems().map((item) => {
|
|
2098
|
+
return /* @__PURE__ */ jsx(
|
|
2137
2099
|
"div",
|
|
2138
2100
|
{
|
|
2139
|
-
className:
|
|
2101
|
+
className: styles_module_default.pdfImageBodyItem,
|
|
2140
2102
|
style: {
|
|
2141
|
-
|
|
2142
|
-
height: `${MAIN_IMG_HEIGHT * zoom}px`
|
|
2103
|
+
top: item.start
|
|
2143
2104
|
},
|
|
2144
|
-
children: /* @__PURE__ */ jsx(
|
|
2145
|
-
"
|
|
2105
|
+
children: /* @__PURE__ */ jsx(
|
|
2106
|
+
"div",
|
|
2146
2107
|
{
|
|
2147
|
-
className: classNames2(styles_module_default.
|
|
2148
|
-
|
|
2149
|
-
|
|
2108
|
+
className: classNames2(styles_module_default.pdfImageBodyItemInnerWrapper, "p-8"),
|
|
2109
|
+
style: {
|
|
2110
|
+
width: `${MAIN_IMG_WIDTH * zoom}px`,
|
|
2111
|
+
height: `${MAIN_IMG_HEIGHT * zoom}px`
|
|
2112
|
+
},
|
|
2113
|
+
children: /* @__PURE__ */ jsx("div", { className: classNames2(styles_module_default.pdfImageBodyItemInner, { [styles_module_default.pdfImageBodyItemActive]: item.index === currentIndex }), children: /* @__PURE__ */ jsx(
|
|
2114
|
+
"img",
|
|
2115
|
+
{
|
|
2116
|
+
className: classNames2(styles_module_default.pdfImageBodyItemImg),
|
|
2117
|
+
src: images[item.index].imageUrl,
|
|
2118
|
+
loading: item.index === currentIndex ? "eager" : "lazy"
|
|
2119
|
+
}
|
|
2120
|
+
) })
|
|
2150
2121
|
}
|
|
2151
|
-
)
|
|
2152
|
-
}
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2122
|
+
)
|
|
2123
|
+
},
|
|
2124
|
+
`${item.index}-${images[item.index].pageNum}`
|
|
2125
|
+
);
|
|
2126
|
+
})
|
|
2127
|
+
}
|
|
2128
|
+
) })
|
|
2158
2129
|
] }) })
|
|
2159
2130
|
] });
|
|
2160
2131
|
};
|
|
@@ -2451,7 +2422,7 @@ var PAGE_NO_TAG = "page-no";
|
|
|
2451
2422
|
var PAGE_NO_KEY = "PageNo";
|
|
2452
2423
|
|
|
2453
2424
|
// src/components/MarkdownEditor/pageNo/pageNoMark.ts
|
|
2454
|
-
var pageNoMark_default = Node.create({
|
|
2425
|
+
var pageNoMark_default = Node$1.create({
|
|
2455
2426
|
name: PAGE_NO_KEY,
|
|
2456
2427
|
// 节点名称
|
|
2457
2428
|
group: "inline",
|
|
@@ -3585,6 +3556,90 @@ var COLLECTION_ATTRS = ["collection-id", "user-name", "user-id", "update-time",
|
|
|
3585
3556
|
|
|
3586
3557
|
// src/components/MarkdownEditor/collection/CollectionMark.ts
|
|
3587
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
|
|
3588
3643
|
var collectionPluginKey = new PluginKey("collectionPlugin");
|
|
3589
3644
|
var CollectionPlugin = Extension.create({
|
|
3590
3645
|
name: "collectionPlugin",
|
|
@@ -3607,10 +3662,11 @@ var CollectionPlugin = Extension.create({
|
|
|
3607
3662
|
},
|
|
3608
3663
|
moveCursorToCollection: (id) => ({ state, commands, view }) => {
|
|
3609
3664
|
const foundFrom = findMarkPosition(state.doc, COLLECTION_KEY, COLLECTION_ATTRS[0], id);
|
|
3610
|
-
if (foundFrom) {
|
|
3665
|
+
if (isNumber(foundFrom)) {
|
|
3611
3666
|
const tr = state.tr.setSelection(TextSelection.create(state.doc, foundFrom));
|
|
3612
3667
|
view.dispatch(tr);
|
|
3613
3668
|
commands.focus();
|
|
3669
|
+
scrollEditorViewToPosInNextFrame(view, foundFrom, { align: "start" });
|
|
3614
3670
|
}
|
|
3615
3671
|
}
|
|
3616
3672
|
};
|
|
@@ -3782,47 +3838,6 @@ var collectionSidebar_default = ({
|
|
|
3782
3838
|
}
|
|
3783
3839
|
return createPortal(sidebarContent, container);
|
|
3784
3840
|
};
|
|
3785
|
-
|
|
3786
|
-
// src/components/MarkdownEditor/common/utils.ts
|
|
3787
|
-
function selectionHasBlockMath(editor) {
|
|
3788
|
-
if (!editor) return false;
|
|
3789
|
-
const { state } = editor;
|
|
3790
|
-
const { from, to } = state.selection;
|
|
3791
|
-
let hasBlockMath = false;
|
|
3792
|
-
state.doc.nodesBetween(from, to, (node) => {
|
|
3793
|
-
if (node.type.name === "blockMath") {
|
|
3794
|
-
hasBlockMath = true;
|
|
3795
|
-
return false;
|
|
3796
|
-
}
|
|
3797
|
-
});
|
|
3798
|
-
return hasBlockMath;
|
|
3799
|
-
}
|
|
3800
|
-
function hasSelection(editor) {
|
|
3801
|
-
if (!editor) return false;
|
|
3802
|
-
const { from, to } = editor.state.selection;
|
|
3803
|
-
return from < to;
|
|
3804
|
-
}
|
|
3805
|
-
function getSelectedText(editor) {
|
|
3806
|
-
if (!editor) return "";
|
|
3807
|
-
const { from, to } = editor.state.selection;
|
|
3808
|
-
if (from === to) return "";
|
|
3809
|
-
return editor.state.doc.textBetween(from, to, " ");
|
|
3810
|
-
}
|
|
3811
|
-
function getSelectedMarkdown(editor) {
|
|
3812
|
-
if (!editor) return "";
|
|
3813
|
-
if (!editor.markdown) {
|
|
3814
|
-
console.warn("Markdown extension \u672A\u542F\u7528");
|
|
3815
|
-
return "";
|
|
3816
|
-
}
|
|
3817
|
-
const { from, to } = editor.state.selection;
|
|
3818
|
-
const slice = editor.state.doc.cut(from, to);
|
|
3819
|
-
return editor.markdown.serialize({
|
|
3820
|
-
type: "doc",
|
|
3821
|
-
content: slice.content.toJSON()
|
|
3822
|
-
});
|
|
3823
|
-
}
|
|
3824
|
-
|
|
3825
|
-
// src/components/MarkdownEditor/collection/use-collections.ts
|
|
3826
3841
|
var useCollections = (collectionConfig) => {
|
|
3827
3842
|
const [collections, setCollections] = useState([]);
|
|
3828
3843
|
const [selectedCollectionId, setSelectedCollectionId] = useState(null);
|
|
@@ -3861,7 +3876,7 @@ var useCollections = (collectionConfig) => {
|
|
|
3861
3876
|
"page-no": pageIndex
|
|
3862
3877
|
}).run();
|
|
3863
3878
|
setShowCollection(true);
|
|
3864
|
-
handleSelectCollection(remoteId
|
|
3879
|
+
handleSelectCollection(remoteId);
|
|
3865
3880
|
};
|
|
3866
3881
|
const handleDeleteCollection = (id) => {
|
|
3867
3882
|
if (!editor.current) {
|
|
@@ -4398,7 +4413,7 @@ var BlockquoteButton = forwardRef(
|
|
|
4398
4413
|
handleToggle,
|
|
4399
4414
|
label,
|
|
4400
4415
|
shortcutKeys,
|
|
4401
|
-
Icon
|
|
4416
|
+
Icon
|
|
4402
4417
|
} = useBlockquote({
|
|
4403
4418
|
editor,
|
|
4404
4419
|
hideWhenUnavailable,
|
|
@@ -4432,7 +4447,7 @@ var BlockquoteButton = forwardRef(
|
|
|
4432
4447
|
...buttonProps,
|
|
4433
4448
|
ref,
|
|
4434
4449
|
children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4435
|
-
/* @__PURE__ */ jsx(
|
|
4450
|
+
/* @__PURE__ */ jsx(Icon, { className: "tiptap-button-icon" }),
|
|
4436
4451
|
text && /* @__PURE__ */ jsx("span", { className: "tiptap-button-text", children: text }),
|
|
4437
4452
|
showShortcut && /* @__PURE__ */ jsx(BlockquoteShortcutBadge, { shortcutKeys })
|
|
4438
4453
|
] })
|
|
@@ -4624,7 +4639,7 @@ var CodeBlockButton = forwardRef(
|
|
|
4624
4639
|
handleToggle,
|
|
4625
4640
|
label,
|
|
4626
4641
|
shortcutKeys,
|
|
4627
|
-
Icon
|
|
4642
|
+
Icon
|
|
4628
4643
|
} = useCodeBlock({
|
|
4629
4644
|
editor,
|
|
4630
4645
|
hideWhenUnavailable,
|
|
@@ -4658,7 +4673,7 @@ var CodeBlockButton = forwardRef(
|
|
|
4658
4673
|
...buttonProps,
|
|
4659
4674
|
ref,
|
|
4660
4675
|
children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4661
|
-
/* @__PURE__ */ jsx(
|
|
4676
|
+
/* @__PURE__ */ jsx(Icon, { className: "tiptap-button-icon" }),
|
|
4662
4677
|
text && /* @__PURE__ */ jsx("span", { className: "tiptap-button-text", children: text }),
|
|
4663
4678
|
showShortcut && /* @__PURE__ */ jsx(CodeBlockShortcutBadge, { shortcutKeys })
|
|
4664
4679
|
] })
|
|
@@ -5344,7 +5359,7 @@ function ColorHighlightPopover({
|
|
|
5344
5359
|
}) {
|
|
5345
5360
|
const { editor } = useTiptapEditor(providedEditor);
|
|
5346
5361
|
const [isOpen, setIsOpen] = useState(false);
|
|
5347
|
-
const { isVisible, canColorHighlight: canColorHighlight2, isActive, label, Icon
|
|
5362
|
+
const { isVisible, canColorHighlight: canColorHighlight2, isActive, label, Icon } = useColorHighlight({
|
|
5348
5363
|
editor,
|
|
5349
5364
|
hideWhenUnavailable,
|
|
5350
5365
|
onApplied
|
|
@@ -5361,7 +5376,7 @@ function ColorHighlightPopover({
|
|
|
5361
5376
|
"aria-label": label,
|
|
5362
5377
|
tooltip: label,
|
|
5363
5378
|
...props,
|
|
5364
|
-
children: /* @__PURE__ */ jsx(
|
|
5379
|
+
children: /* @__PURE__ */ jsx(Icon, { className: "tiptap-button-icon" })
|
|
5365
5380
|
}
|
|
5366
5381
|
) }),
|
|
5367
5382
|
/* @__PURE__ */ jsx(PopoverContent, { "aria-label": "\u80CC\u666F\u8272", children: /* @__PURE__ */ jsx(ColorHighlightPopoverContent, { editor, colors }) })
|
|
@@ -5416,7 +5431,7 @@ var HeadingButton = forwardRef(
|
|
|
5416
5431
|
isActive,
|
|
5417
5432
|
handleToggle,
|
|
5418
5433
|
label,
|
|
5419
|
-
Icon
|
|
5434
|
+
Icon,
|
|
5420
5435
|
shortcutKeys
|
|
5421
5436
|
} = useHeading({
|
|
5422
5437
|
editor,
|
|
@@ -5452,7 +5467,7 @@ var HeadingButton = forwardRef(
|
|
|
5452
5467
|
...buttonProps,
|
|
5453
5468
|
ref,
|
|
5454
5469
|
children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5455
|
-
/* @__PURE__ */ jsx(
|
|
5470
|
+
/* @__PURE__ */ jsx(Icon, { className: "tiptap-button-icon" }),
|
|
5456
5471
|
text && /* @__PURE__ */ jsx("span", { className: "tiptap-button-text", children: text }),
|
|
5457
5472
|
showShortcut && /* @__PURE__ */ jsx(HeadingShortcutBadge, { level, shortcutKeys })
|
|
5458
5473
|
] })
|
|
@@ -5847,7 +5862,7 @@ var HeadingDropdownMenu = forwardRef(
|
|
|
5847
5862
|
}, ref) => {
|
|
5848
5863
|
const { editor } = useTiptapEditor(providedEditor);
|
|
5849
5864
|
const [isOpen, setIsOpen] = useState(false);
|
|
5850
|
-
const { isVisible, isActive, canToggle: canToggle3, Icon
|
|
5865
|
+
const { isVisible, isActive, canToggle: canToggle3, Icon } = useHeadingDropdownMenu({
|
|
5851
5866
|
editor,
|
|
5852
5867
|
levels,
|
|
5853
5868
|
hideWhenUnavailable
|
|
@@ -5880,7 +5895,7 @@ var HeadingDropdownMenu = forwardRef(
|
|
|
5880
5895
|
...buttonProps,
|
|
5881
5896
|
ref,
|
|
5882
5897
|
children: [
|
|
5883
|
-
/* @__PURE__ */ jsx(
|
|
5898
|
+
/* @__PURE__ */ jsx(Icon, { className: "tiptap-button-icon" }),
|
|
5884
5899
|
/* @__PURE__ */ jsx(ChevronDownIcon, { className: "tiptap-button-dropdown-small" })
|
|
5885
5900
|
]
|
|
5886
5901
|
}
|
|
@@ -6213,7 +6228,7 @@ var LinkPopover = forwardRef(
|
|
|
6213
6228
|
removeLink,
|
|
6214
6229
|
openLink,
|
|
6215
6230
|
label,
|
|
6216
|
-
Icon
|
|
6231
|
+
Icon
|
|
6217
6232
|
} = useLinkPopover({
|
|
6218
6233
|
editor,
|
|
6219
6234
|
hideWhenUnavailable,
|
|
@@ -6258,7 +6273,7 @@ var LinkPopover = forwardRef(
|
|
|
6258
6273
|
onClick: handleClick,
|
|
6259
6274
|
...buttonProps,
|
|
6260
6275
|
ref,
|
|
6261
|
-
children: children ?? /* @__PURE__ */ jsx(
|
|
6276
|
+
children: children ?? /* @__PURE__ */ jsx(Icon, { className: "tiptap-button-icon" })
|
|
6262
6277
|
}
|
|
6263
6278
|
) }),
|
|
6264
6279
|
/* @__PURE__ */ jsx(PopoverContent, { children: /* @__PURE__ */ jsx(
|
|
@@ -6430,7 +6445,7 @@ var ListButton = forwardRef(
|
|
|
6430
6445
|
handleToggle,
|
|
6431
6446
|
label,
|
|
6432
6447
|
shortcutKeys,
|
|
6433
|
-
Icon
|
|
6448
|
+
Icon
|
|
6434
6449
|
} = useList({
|
|
6435
6450
|
editor,
|
|
6436
6451
|
type,
|
|
@@ -6465,7 +6480,7 @@ var ListButton = forwardRef(
|
|
|
6465
6480
|
...buttonProps,
|
|
6466
6481
|
ref,
|
|
6467
6482
|
children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6468
|
-
/* @__PURE__ */ jsx(
|
|
6483
|
+
/* @__PURE__ */ jsx(Icon, { className: "tiptap-button-icon" }),
|
|
6469
6484
|
text && /* @__PURE__ */ jsx("span", { className: "tiptap-button-text", children: text }),
|
|
6470
6485
|
showShortcut && /* @__PURE__ */ jsx(ListShortcutBadge, { type, shortcutKeys })
|
|
6471
6486
|
] })
|
|
@@ -6937,7 +6952,7 @@ function ListDropdownMenu({
|
|
|
6937
6952
|
}) {
|
|
6938
6953
|
const { editor } = useTiptapEditor(providedEditor);
|
|
6939
6954
|
const [isOpen, setIsOpen] = useState(false);
|
|
6940
|
-
const { filteredLists, canToggle: canToggle3, isActive, isVisible, Icon
|
|
6955
|
+
const { filteredLists, canToggle: canToggle3, isActive, isVisible, Icon } = useListDropdownMenu({
|
|
6941
6956
|
editor,
|
|
6942
6957
|
types,
|
|
6943
6958
|
hideWhenUnavailable
|
|
@@ -6967,7 +6982,7 @@ function ListDropdownMenu({
|
|
|
6967
6982
|
tooltip: "\u5217\u8868",
|
|
6968
6983
|
...props,
|
|
6969
6984
|
children: [
|
|
6970
|
-
/* @__PURE__ */ jsx(
|
|
6985
|
+
/* @__PURE__ */ jsx(Icon, { className: "tiptap-button-icon" }),
|
|
6971
6986
|
/* @__PURE__ */ jsx(ChevronDownIcon, { className: "tiptap-button-dropdown-small" })
|
|
6972
6987
|
]
|
|
6973
6988
|
}
|
|
@@ -7008,7 +7023,7 @@ var MarkButton = forwardRef(
|
|
|
7008
7023
|
label,
|
|
7009
7024
|
canToggle: canToggle3,
|
|
7010
7025
|
isActive,
|
|
7011
|
-
Icon
|
|
7026
|
+
Icon,
|
|
7012
7027
|
shortcutKeys
|
|
7013
7028
|
} = useMark({
|
|
7014
7029
|
editor,
|
|
@@ -7044,7 +7059,7 @@ var MarkButton = forwardRef(
|
|
|
7044
7059
|
...buttonProps,
|
|
7045
7060
|
ref,
|
|
7046
7061
|
children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7047
|
-
/* @__PURE__ */ jsx(
|
|
7062
|
+
/* @__PURE__ */ jsx(Icon, { className: "tiptap-button-icon" }),
|
|
7048
7063
|
text && /* @__PURE__ */ jsx("span", { className: "tiptap-button-text", children: text }),
|
|
7049
7064
|
showShortcut && /* @__PURE__ */ jsx(MarkShortcutBadge, { type, shortcutKeys })
|
|
7050
7065
|
] })
|
|
@@ -7402,7 +7417,7 @@ var TextAlignButton = forwardRef(
|
|
|
7402
7417
|
label,
|
|
7403
7418
|
canAlign,
|
|
7404
7419
|
isActive,
|
|
7405
|
-
Icon
|
|
7420
|
+
Icon,
|
|
7406
7421
|
shortcutKeys
|
|
7407
7422
|
} = useTextAlign({
|
|
7408
7423
|
editor,
|
|
@@ -7421,7 +7436,7 @@ var TextAlignButton = forwardRef(
|
|
|
7421
7436
|
if (!isVisible) {
|
|
7422
7437
|
return null;
|
|
7423
7438
|
}
|
|
7424
|
-
const RenderIcon = CustomIcon ??
|
|
7439
|
+
const RenderIcon = CustomIcon ?? Icon;
|
|
7425
7440
|
return /* @__PURE__ */ jsx(
|
|
7426
7441
|
Button6,
|
|
7427
7442
|
{
|
|
@@ -7740,7 +7755,7 @@ var UndoRedoButton = forwardRef(
|
|
|
7740
7755
|
...buttonProps
|
|
7741
7756
|
}, ref) => {
|
|
7742
7757
|
const { editor } = useTiptapEditor(providedEditor);
|
|
7743
|
-
const { isVisible, handleAction, label, canExecute, Icon
|
|
7758
|
+
const { isVisible, handleAction, label, canExecute, Icon, shortcutKeys } = useUndoRedo({
|
|
7744
7759
|
editor,
|
|
7745
7760
|
action,
|
|
7746
7761
|
hideWhenUnavailable,
|
|
@@ -7772,7 +7787,7 @@ var UndoRedoButton = forwardRef(
|
|
|
7772
7787
|
...buttonProps,
|
|
7773
7788
|
ref,
|
|
7774
7789
|
children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7775
|
-
/* @__PURE__ */ jsx(
|
|
7790
|
+
/* @__PURE__ */ jsx(Icon, { className: "tiptap-button-icon" }),
|
|
7776
7791
|
text && /* @__PURE__ */ jsx("span", { className: "tiptap-button-text", children: text }),
|
|
7777
7792
|
showShortcut && /* @__PURE__ */ jsx(
|
|
7778
7793
|
HistoryShortcutBadge,
|
|
@@ -8819,70 +8834,10 @@ function propsMerge(control, props) {
|
|
|
8819
8834
|
}
|
|
8820
8835
|
return null;
|
|
8821
8836
|
}
|
|
8822
|
-
var SpeechLoading_default = () => /* @__PURE__ */ jsxs("svg", { color: "currentColor", viewBox: "0 0 1000 1000", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
8823
|
-
/* @__PURE__ */ jsxs("rect", { fill: "currentColor", rx: "70", ry: "70", height: "250", width: "140", x: "0", y: "375", children: [
|
|
8824
|
-
/* @__PURE__ */ jsx("animate", { attributeName: "height", values: "250; 500; 250", keyTimes: "0; 0.5; 1", dur: "0.8s", begin: "0s", repeatCount: "indefinite" }),
|
|
8825
|
-
/* @__PURE__ */ jsx("animate", { attributeName: "y", values: "375; 250; 375", keyTimes: "0; 0.5; 1", dur: "0.8s", begin: "0s", repeatCount: "indefinite" })
|
|
8826
|
-
] }),
|
|
8827
|
-
/* @__PURE__ */ jsxs("rect", { fill: "currentColor", rx: "70", ry: "70", height: "250", width: "140", x: "286.66666666666663", y: "375", children: [
|
|
8828
|
-
/* @__PURE__ */ jsx("animate", { attributeName: "height", values: "250; 500; 250", keyTimes: "0; 0.5; 1", dur: "0.8s", begin: "0.2s", repeatCount: "indefinite" }),
|
|
8829
|
-
/* @__PURE__ */ jsx("animate", { attributeName: "y", values: "375; 250; 375", keyTimes: "0; 0.5; 1", dur: "0.8s", begin: "0.2s", repeatCount: "indefinite" })
|
|
8830
|
-
] }),
|
|
8831
|
-
/* @__PURE__ */ jsxs("rect", { fill: "currentColor", rx: "70", ry: "70", height: "250", width: "140", x: "573.3333333333333", y: "375", children: [
|
|
8832
|
-
/* @__PURE__ */ jsx("animate", { attributeName: "height", values: "250; 500; 250", keyTimes: "0; 0.5; 1", dur: "0.8s", begin: "0.4s", repeatCount: "indefinite" }),
|
|
8833
|
-
/* @__PURE__ */ jsx("animate", { attributeName: "y", values: "375; 250; 375", keyTimes: "0; 0.5; 1", dur: "0.8s", begin: "0.4s", repeatCount: "indefinite" })
|
|
8834
|
-
] }),
|
|
8835
|
-
/* @__PURE__ */ jsxs("rect", { fill: "currentColor", rx: "70", ry: "70", height: "250", width: "140", x: "859.9999999999999", y: "375", children: [
|
|
8836
|
-
/* @__PURE__ */ jsx(
|
|
8837
|
-
"animate",
|
|
8838
|
-
{
|
|
8839
|
-
attributeName: "height",
|
|
8840
|
-
values: "250; 500; 250",
|
|
8841
|
-
keyTimes: "0; 0.5; 1",
|
|
8842
|
-
dur: "0.8s",
|
|
8843
|
-
begin: "0.6000000000000001s",
|
|
8844
|
-
repeatCount: "indefinite"
|
|
8845
|
-
}
|
|
8846
|
-
),
|
|
8847
|
-
/* @__PURE__ */ jsx(
|
|
8848
|
-
"animate",
|
|
8849
|
-
{
|
|
8850
|
-
attributeName: "y",
|
|
8851
|
-
values: "375; 250; 375",
|
|
8852
|
-
keyTimes: "0; 0.5; 1",
|
|
8853
|
-
dur: "0.8s",
|
|
8854
|
-
begin: "0.6000000000000001s",
|
|
8855
|
-
repeatCount: "indefinite"
|
|
8856
|
-
}
|
|
8857
|
-
)
|
|
8858
|
-
] })
|
|
8859
|
-
] });
|
|
8860
|
-
var SpeechButton_default = (props) => {
|
|
8861
|
-
const { permission, isRecording, start, stop } = useSpeech_default(props);
|
|
8862
|
-
const disabled = permission === "denied" || permission === "unsupported";
|
|
8863
|
-
const handleClick = () => {
|
|
8864
|
-
if (isRecording) {
|
|
8865
|
-
stop();
|
|
8866
|
-
} else {
|
|
8867
|
-
start();
|
|
8868
|
-
}
|
|
8869
|
-
};
|
|
8870
|
-
return /* @__PURE__ */ jsx(
|
|
8871
|
-
Button,
|
|
8872
|
-
{
|
|
8873
|
-
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",
|
|
8874
|
-
disabled,
|
|
8875
|
-
color: "primary",
|
|
8876
|
-
variant: "text",
|
|
8877
|
-
icon: isRecording ? /* @__PURE__ */ jsx(Icon, { style: { width: 16 }, component: SpeechLoading_default }) : disabled ? /* @__PURE__ */ jsx(AudioMutedOutlined, {}) : /* @__PURE__ */ jsx(AudioOutlined, {}),
|
|
8878
|
-
onClick: handleClick
|
|
8879
|
-
}
|
|
8880
|
-
);
|
|
8881
|
-
};
|
|
8882
8837
|
var UserAvatar_default = ({ size, avatarSrc, userName }) => {
|
|
8883
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() });
|
|
8884
8839
|
};
|
|
8885
8840
|
|
|
8886
|
-
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,
|
|
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 };
|
|
8887
8842
|
//# sourceMappingURL=index.esm.js.map
|
|
8888
8843
|
//# sourceMappingURL=index.esm.js.map
|