@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/README.md +43 -0
- package/dist/index.cjs.js +192 -255
- 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 +164 -225
- package/dist/index.esm.js.map +1 -1
- package/package.json +14 -2
package/dist/index.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var
|
|
4
|
+
var icons = require('@ant-design/icons');
|
|
5
5
|
var antd = require('antd');
|
|
6
6
|
var classNames2 = require('classnames');
|
|
7
7
|
var docxPreview = require('docx-preview');
|
|
@@ -78,7 +78,6 @@ function _interopNamespace(e) {
|
|
|
78
78
|
return Object.freeze(n);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
var Icon__default = /*#__PURE__*/_interopDefault(Icon);
|
|
82
81
|
var classNames2__default = /*#__PURE__*/_interopDefault(classNames2);
|
|
83
82
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
84
83
|
var AES__default = /*#__PURE__*/_interopDefault(AES);
|
|
@@ -1302,9 +1301,9 @@ var DocxPreview_default = ({ fileUrl, scale = 1 }) => {
|
|
|
1302
1301
|
};
|
|
1303
1302
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames2__default.default(styles_module_default.nsPreviewDocx, "height-full", "width-full"), children: [
|
|
1304
1303
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 6, align: "center", className: styles_module_default.docxToolbar, children: [
|
|
1305
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Button, { onClick: zoomOut, icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1306
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Button, { onClick: zoomIn, icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1307
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Button, { onClick: resetZoom, icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1304
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Button, { onClick: zoomOut, icon: /* @__PURE__ */ jsxRuntime.jsx(icons.MinusCircleOutlined, {}), title: "\u7F29\u5C0F" }),
|
|
1305
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Button, { onClick: zoomIn, icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PlusCircleOutlined, {}), title: "\u653E\u5927" }),
|
|
1306
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Button, { onClick: resetZoom, icon: /* @__PURE__ */ jsxRuntime.jsx(icons.RedoOutlined, {}), title: "\u8FD8\u539F" })
|
|
1308
1307
|
] }),
|
|
1309
1308
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames2__default.default(styles_module_default.docxContent, "height-full", "scroll-fade-in"), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1310
1309
|
"div",
|
|
@@ -1320,54 +1319,54 @@ var DocxPreview_default = ({ fileUrl, scale = 1 }) => {
|
|
|
1320
1319
|
};
|
|
1321
1320
|
var FileIcon_default = ({ suffix, fontSize = 22 }) => {
|
|
1322
1321
|
const styles = { fontSize, color: "var(--ant-color-primary)" };
|
|
1323
|
-
const
|
|
1322
|
+
const Icon = React.useMemo(() => {
|
|
1324
1323
|
switch (suffix?.toUpperCase()) {
|
|
1325
1324
|
case "TXT":
|
|
1326
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1325
|
+
return /* @__PURE__ */ jsxRuntime.jsx(icons.FileTextOutlined, {});
|
|
1327
1326
|
case "PDF":
|
|
1328
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1327
|
+
return /* @__PURE__ */ jsxRuntime.jsx(icons.FilePdfOutlined, {});
|
|
1329
1328
|
case "DOC":
|
|
1330
1329
|
case "DOCX":
|
|
1331
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1330
|
+
return /* @__PURE__ */ jsxRuntime.jsx(icons.FileWordOutlined, {});
|
|
1332
1331
|
case "XLS":
|
|
1333
1332
|
case "XLSX":
|
|
1334
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1333
|
+
return /* @__PURE__ */ jsxRuntime.jsx(icons.FileExcelOutlined, {});
|
|
1335
1334
|
case "PPT":
|
|
1336
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1335
|
+
return /* @__PURE__ */ jsxRuntime.jsx(icons.FilePptOutlined, {});
|
|
1337
1336
|
case "MP4":
|
|
1338
1337
|
case "MOV":
|
|
1339
1338
|
case "MKV":
|
|
1340
1339
|
case "AVI":
|
|
1341
1340
|
case "FLV":
|
|
1342
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1341
|
+
return /* @__PURE__ */ jsxRuntime.jsx(icons.VideoCameraOutlined, {});
|
|
1343
1342
|
case "MP3":
|
|
1344
1343
|
case "WAV":
|
|
1345
1344
|
case "M4A":
|
|
1346
1345
|
case "ACC":
|
|
1347
1346
|
case "WMA":
|
|
1348
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1347
|
+
return /* @__PURE__ */ jsxRuntime.jsx(icons.NotificationOutlined, {});
|
|
1349
1348
|
case "JPG":
|
|
1350
1349
|
case "JPEG":
|
|
1351
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1350
|
+
return /* @__PURE__ */ jsxRuntime.jsx(icons.FileJpgOutlined, {});
|
|
1352
1351
|
case "PNG":
|
|
1353
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1352
|
+
return /* @__PURE__ */ jsxRuntime.jsx(icons.FileImageOutlined, {});
|
|
1354
1353
|
case "GIF":
|
|
1355
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1354
|
+
return /* @__PURE__ */ jsxRuntime.jsx(icons.FileGifOutlined, {});
|
|
1356
1355
|
case "MD":
|
|
1357
1356
|
case "MARKDOWN":
|
|
1358
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1357
|
+
return /* @__PURE__ */ jsxRuntime.jsx(icons.FileMarkdownOutlined, {});
|
|
1359
1358
|
case "ZIP":
|
|
1360
1359
|
case "RAR":
|
|
1361
1360
|
case "7Z":
|
|
1362
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1361
|
+
return /* @__PURE__ */ jsxRuntime.jsx(icons.FileZipOutlined, {});
|
|
1363
1362
|
case "CATALOG":
|
|
1364
1363
|
return /* @__PURE__ */ jsxRuntime.jsx("i", { style: styles, className: "iconfont icon-wenjianjia" });
|
|
1365
1364
|
// 文件夹图标
|
|
1366
1365
|
default:
|
|
1367
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1366
|
+
return /* @__PURE__ */ jsxRuntime.jsx(icons.FileUnknownOutlined, {});
|
|
1368
1367
|
}
|
|
1369
1368
|
}, [suffix]);
|
|
1370
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { style: styles, children:
|
|
1369
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { style: styles, children: Icon });
|
|
1371
1370
|
};
|
|
1372
1371
|
var VideoPlayer_default = ({ fileUrl }) => {
|
|
1373
1372
|
return /* @__PURE__ */ jsxRuntime.jsxs("video", { controls: true, className: styles_module_default.nsPreviewVideo, children: [
|
|
@@ -1604,6 +1603,55 @@ var useIframeRelayBridge_default = (allowedOrigins = ["*"]) => {
|
|
|
1604
1603
|
}
|
|
1605
1604
|
return { on, off };
|
|
1606
1605
|
};
|
|
1606
|
+
var useRefState_default = (init) => {
|
|
1607
|
+
const [state, setState] = React.useState(init);
|
|
1608
|
+
const stateRef = React.useRef(init);
|
|
1609
|
+
const setProxy = (newVal) => {
|
|
1610
|
+
stateRef.current = newVal;
|
|
1611
|
+
setState(newVal);
|
|
1612
|
+
};
|
|
1613
|
+
const getState = () => stateRef.current;
|
|
1614
|
+
return [state, setProxy, getState];
|
|
1615
|
+
};
|
|
1616
|
+
|
|
1617
|
+
// src/hooks/useAsyncQueue.ts
|
|
1618
|
+
var useAsyncQueue_default = () => {
|
|
1619
|
+
const [queue, setQueue] = React.useState([]);
|
|
1620
|
+
const [enabled, setEnabled] = React.useState(true);
|
|
1621
|
+
const [running, setRunning, getRunning] = useRefState_default(false);
|
|
1622
|
+
const addToQueue = React.useCallback((func, ...args) => {
|
|
1623
|
+
setQueue((prevQueue) => [...prevQueue, { func, args }]);
|
|
1624
|
+
}, []);
|
|
1625
|
+
const executeQueue = React.useCallback((nextEnabled) => {
|
|
1626
|
+
setEnabled(nextEnabled);
|
|
1627
|
+
}, []);
|
|
1628
|
+
const clearQueue = React.useCallback(() => {
|
|
1629
|
+
setQueue([]);
|
|
1630
|
+
}, []);
|
|
1631
|
+
React.useEffect(() => {
|
|
1632
|
+
if (!enabled) return;
|
|
1633
|
+
if (getRunning()) return;
|
|
1634
|
+
if (queue.length === 0) return;
|
|
1635
|
+
const task = queue[0];
|
|
1636
|
+
setRunning(true);
|
|
1637
|
+
(async () => {
|
|
1638
|
+
try {
|
|
1639
|
+
await task.func(...task.args);
|
|
1640
|
+
} finally {
|
|
1641
|
+
setQueue((prevQueue) => prevQueue.slice(1));
|
|
1642
|
+
setRunning(false);
|
|
1643
|
+
}
|
|
1644
|
+
})();
|
|
1645
|
+
}, [queue, enabled]);
|
|
1646
|
+
return {
|
|
1647
|
+
addToQueue,
|
|
1648
|
+
executeQueue,
|
|
1649
|
+
clearQueue,
|
|
1650
|
+
queueSize: queue.length,
|
|
1651
|
+
enabled,
|
|
1652
|
+
running
|
|
1653
|
+
};
|
|
1654
|
+
};
|
|
1607
1655
|
var useAutoRefresh_default = (listenValue, shouldRefresh, callback, delay = 1e4) => {
|
|
1608
1656
|
const timerRef = React.useRef(null);
|
|
1609
1657
|
const shouldRefreshRef = React.useRef(shouldRefresh);
|
|
@@ -1721,100 +1769,6 @@ var useDeepEffect_default = (effect, deps) => {
|
|
|
1721
1769
|
}
|
|
1722
1770
|
}, [depsChanged, effect, ...deps]);
|
|
1723
1771
|
};
|
|
1724
|
-
var useRefState_default = (init) => {
|
|
1725
|
-
const [state, setState] = React.useState(init);
|
|
1726
|
-
const stateRef = React.useRef(init);
|
|
1727
|
-
const setProxy = (newVal) => {
|
|
1728
|
-
stateRef.current = newVal;
|
|
1729
|
-
setState(newVal);
|
|
1730
|
-
};
|
|
1731
|
-
const getState = () => stateRef.current;
|
|
1732
|
-
return [state, setProxy, getState];
|
|
1733
|
-
};
|
|
1734
|
-
var useSpeech_default = ({ onResult, lang = "zh-CN" }) => {
|
|
1735
|
-
const [permission, setPermission] = React.useState("prompt");
|
|
1736
|
-
const [isRecording, setIsRecording] = React.useState(false);
|
|
1737
|
-
const recognitionRef = React.useRef(null);
|
|
1738
|
-
React.useEffect(() => {
|
|
1739
|
-
const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
|
|
1740
|
-
if (!SpeechRecognition) {
|
|
1741
|
-
setPermission("unsupported");
|
|
1742
|
-
return;
|
|
1743
|
-
}
|
|
1744
|
-
const recognition = new SpeechRecognition();
|
|
1745
|
-
recognition.continuous = true;
|
|
1746
|
-
recognition.interimResults = false;
|
|
1747
|
-
recognition.lang = lang;
|
|
1748
|
-
recognition.onresult = (event) => {
|
|
1749
|
-
let transcript = "";
|
|
1750
|
-
for (let i = event.resultIndex; i < event.results.length; i++) {
|
|
1751
|
-
transcript += event.results[i][0].transcript;
|
|
1752
|
-
}
|
|
1753
|
-
onResult?.(transcript.trim());
|
|
1754
|
-
};
|
|
1755
|
-
recognition.onend = () => {
|
|
1756
|
-
setIsRecording(false);
|
|
1757
|
-
};
|
|
1758
|
-
recognition.onerror = (error) => {
|
|
1759
|
-
setIsRecording(false);
|
|
1760
|
-
console.error("Speech recognition error:", error);
|
|
1761
|
-
};
|
|
1762
|
-
recognitionRef.current = recognition;
|
|
1763
|
-
return () => {
|
|
1764
|
-
recognition.stop?.();
|
|
1765
|
-
recognition.onresult = null;
|
|
1766
|
-
recognition.onend = null;
|
|
1767
|
-
recognition.onerror = null;
|
|
1768
|
-
};
|
|
1769
|
-
}, [lang, onResult]);
|
|
1770
|
-
React.useEffect(() => {
|
|
1771
|
-
if (!navigator.permissions) return;
|
|
1772
|
-
navigator.permissions.query({ name: "microphone" }).then((status) => {
|
|
1773
|
-
setPermission(status.state);
|
|
1774
|
-
status.onchange = () => setPermission(status.state);
|
|
1775
|
-
});
|
|
1776
|
-
}, []);
|
|
1777
|
-
const requestPermission = React.useCallback(async () => {
|
|
1778
|
-
try {
|
|
1779
|
-
await navigator.mediaDevices.getUserMedia({ audio: true });
|
|
1780
|
-
setPermission("granted");
|
|
1781
|
-
} catch {
|
|
1782
|
-
setPermission("denied");
|
|
1783
|
-
}
|
|
1784
|
-
}, []);
|
|
1785
|
-
const start = React.useCallback(() => {
|
|
1786
|
-
if (permission === "prompt") {
|
|
1787
|
-
requestPermission();
|
|
1788
|
-
return;
|
|
1789
|
-
}
|
|
1790
|
-
if (permission !== "granted") return;
|
|
1791
|
-
if (!isRecording) {
|
|
1792
|
-
recognitionRef.current?.start();
|
|
1793
|
-
setIsRecording(true);
|
|
1794
|
-
}
|
|
1795
|
-
}, [permission, isRecording, requestPermission]);
|
|
1796
|
-
const stop = React.useCallback(() => {
|
|
1797
|
-
try {
|
|
1798
|
-
recognitionRef.current?.stop();
|
|
1799
|
-
} finally {
|
|
1800
|
-
setIsRecording(false);
|
|
1801
|
-
}
|
|
1802
|
-
}, []);
|
|
1803
|
-
return {
|
|
1804
|
-
/**
|
|
1805
|
-
* 权限状态
|
|
1806
|
-
*/
|
|
1807
|
-
permission,
|
|
1808
|
-
/**
|
|
1809
|
-
* 录音状态
|
|
1810
|
-
*/
|
|
1811
|
-
isRecording,
|
|
1812
|
-
/** 开始语音识别 */
|
|
1813
|
-
start,
|
|
1814
|
-
/** 停止语音识别 */
|
|
1815
|
-
stop
|
|
1816
|
-
};
|
|
1817
|
-
};
|
|
1818
1772
|
var useSyncInput_default = (storeValue, setStoreValue) => {
|
|
1819
1773
|
const [inputValue, setInputValue] = React.useState(storeValue);
|
|
1820
1774
|
React.useEffect(() => {
|
|
@@ -2172,9 +2126,9 @@ var PdfImagePreview_default = ({ fileUrl, pageNo, scale = 1, isHasThumbnails = t
|
|
|
2172
2126
|
) }) }),
|
|
2173
2127
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Splitter.Panel, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames2__default.default("height-full", styles_module_default.pdfImageBody), children: [
|
|
2174
2128
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 6, align: "center", className: styles_module_default.pdfImageBodyToolbar, children: [
|
|
2175
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Button, { onClick: zoomOut, icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2176
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Button, { onClick: zoomIn, icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2177
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Button, { onClick: zoomFitWidth, icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2129
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Button, { onClick: zoomOut, icon: /* @__PURE__ */ jsxRuntime.jsx(icons.MinusCircleOutlined, {}), title: "\u7F29\u5C0F" }),
|
|
2130
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Button, { onClick: zoomIn, icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PlusCircleOutlined, {}), title: "\u653E\u5927" }),
|
|
2131
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Button, { onClick: zoomFitWidth, icon: /* @__PURE__ */ jsxRuntime.jsx(icons.ColumnWidthOutlined, {}), title: "\u9002\u5E94\u5BBD\u5EA6" })
|
|
2178
2132
|
] }),
|
|
2179
2133
|
/* @__PURE__ */ jsxRuntime.jsx("div", { ref: containerRef, className: "height-full scroll-fade-in", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2180
2134
|
"div",
|
|
@@ -3227,13 +3181,13 @@ var AnnotationSidebar_default = ({
|
|
|
3227
3181
|
className: "full-card no-padding-card extra-sidebar",
|
|
3228
3182
|
title: annotationConfig?.showListHeader === false ? false : /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "space-between", align: "center", children: [
|
|
3229
3183
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Space, { children: [
|
|
3230
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3184
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.MessageOutlined, {}),
|
|
3231
3185
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
3232
3186
|
"\u6279\u6CE8",
|
|
3233
3187
|
annotations.length > 0 && `\uFF08${annotations.length}\uFF09`
|
|
3234
3188
|
] })
|
|
3235
3189
|
] }),
|
|
3236
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "text", size: "small", icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3190
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "text", size: "small", icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CloseOutlined, {}), onClick: onClose })
|
|
3237
3191
|
] }),
|
|
3238
3192
|
variant: "borderless",
|
|
3239
3193
|
children: annotations.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3283,7 +3237,7 @@ var AnnotationSidebar_default = ({
|
|
|
3283
3237
|
type: "text",
|
|
3284
3238
|
size: "small",
|
|
3285
3239
|
title: "\u7F16\u8F91\u6279\u6CE8",
|
|
3286
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3240
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.EditOutlined, {}),
|
|
3287
3241
|
onClick: (e) => {
|
|
3288
3242
|
handleEdit(annotation);
|
|
3289
3243
|
}
|
|
@@ -3297,7 +3251,7 @@ var AnnotationSidebar_default = ({
|
|
|
3297
3251
|
cancelText: "\u53D6\u6D88",
|
|
3298
3252
|
description: "\u786E\u8BA4\u5220\u9664\u5F53\u524D\u6279\u6CE8\u5417?",
|
|
3299
3253
|
onConfirm: () => onDeleteAnnotation(annotation[ANNOTATION_ATTRS[0]]),
|
|
3300
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "text", size: "small", title: "\u5220\u9664\u6279\u6CE8", icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3254
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "text", size: "small", title: "\u5220\u9664\u6279\u6CE8", icon: /* @__PURE__ */ jsxRuntime.jsx(icons.DeleteOutlined, {}) })
|
|
3301
3255
|
}
|
|
3302
3256
|
)
|
|
3303
3257
|
] })
|
|
@@ -3644,6 +3598,90 @@ var COLLECTION_ATTRS = ["collection-id", "user-name", "user-id", "update-time",
|
|
|
3644
3598
|
|
|
3645
3599
|
// src/components/MarkdownEditor/collection/CollectionMark.ts
|
|
3646
3600
|
var CollectionMark = createHtmlMark(COLLECTION_KEY, COLLECTION_ATTRS, "editor-collection");
|
|
3601
|
+
|
|
3602
|
+
// src/components/MarkdownEditor/common/utils.ts
|
|
3603
|
+
function selectionHasBlockMath(editor) {
|
|
3604
|
+
if (!editor) return false;
|
|
3605
|
+
const { state } = editor;
|
|
3606
|
+
const { from, to } = state.selection;
|
|
3607
|
+
let hasBlockMath = false;
|
|
3608
|
+
state.doc.nodesBetween(from, to, (node) => {
|
|
3609
|
+
if (node.type.name === "blockMath") {
|
|
3610
|
+
hasBlockMath = true;
|
|
3611
|
+
return false;
|
|
3612
|
+
}
|
|
3613
|
+
});
|
|
3614
|
+
return hasBlockMath;
|
|
3615
|
+
}
|
|
3616
|
+
function hasSelection(editor) {
|
|
3617
|
+
if (!editor) return false;
|
|
3618
|
+
const { from, to } = editor.state.selection;
|
|
3619
|
+
return from < to;
|
|
3620
|
+
}
|
|
3621
|
+
function getSelectedText(editor) {
|
|
3622
|
+
if (!editor) return "";
|
|
3623
|
+
const { from, to } = editor.state.selection;
|
|
3624
|
+
if (from === to) return "";
|
|
3625
|
+
return editor.state.doc.textBetween(from, to, " ");
|
|
3626
|
+
}
|
|
3627
|
+
function getSelectedMarkdown(editor) {
|
|
3628
|
+
if (!editor) return "";
|
|
3629
|
+
if (!editor.markdown) {
|
|
3630
|
+
console.warn("Markdown extension \u672A\u542F\u7528");
|
|
3631
|
+
return "";
|
|
3632
|
+
}
|
|
3633
|
+
const { from, to } = editor.state.selection;
|
|
3634
|
+
const slice = editor.state.doc.cut(from, to);
|
|
3635
|
+
return editor.markdown.serialize({
|
|
3636
|
+
type: "doc",
|
|
3637
|
+
content: slice.content.toJSON()
|
|
3638
|
+
});
|
|
3639
|
+
}
|
|
3640
|
+
function getScrollParent(el) {
|
|
3641
|
+
if (typeof window === "undefined") return null;
|
|
3642
|
+
let current = el?.parentElement ?? null;
|
|
3643
|
+
while (current) {
|
|
3644
|
+
const style = window.getComputedStyle(current);
|
|
3645
|
+
const overflowY = style.overflowY;
|
|
3646
|
+
const overflow = style.overflow;
|
|
3647
|
+
const canScroll = /(auto|scroll|overlay)/.test(overflowY) || /(auto|scroll|overlay)/.test(overflow);
|
|
3648
|
+
if (canScroll) {
|
|
3649
|
+
return current;
|
|
3650
|
+
}
|
|
3651
|
+
current = current.parentElement;
|
|
3652
|
+
}
|
|
3653
|
+
return document.scrollingElement;
|
|
3654
|
+
}
|
|
3655
|
+
function scrollEditorViewToPosInNextFrame(view, pos, options) {
|
|
3656
|
+
const { align = "start", behavior = "auto", offset: offset3 = 0 } = options || {};
|
|
3657
|
+
requestAnimationFrame(() => {
|
|
3658
|
+
try {
|
|
3659
|
+
const result = view.domAtPos(pos);
|
|
3660
|
+
if (!result) return;
|
|
3661
|
+
const el = result.node.nodeType === Node.TEXT_NODE ? result.node.parentElement : result.node;
|
|
3662
|
+
if (!el) return;
|
|
3663
|
+
const scrollParent = getScrollParent(view.dom);
|
|
3664
|
+
const parentRect = scrollParent.getBoundingClientRect();
|
|
3665
|
+
const targetRect = el.getBoundingClientRect();
|
|
3666
|
+
let delta = 0;
|
|
3667
|
+
if (align === "start") {
|
|
3668
|
+
delta = targetRect.top - parentRect.top;
|
|
3669
|
+
} else if (align === "center") {
|
|
3670
|
+
delta = targetRect.top - parentRect.top - parentRect.height / 2 + targetRect.height / 2;
|
|
3671
|
+
} else if (align === "end") {
|
|
3672
|
+
delta = targetRect.bottom - parentRect.bottom;
|
|
3673
|
+
}
|
|
3674
|
+
scrollParent.scrollTo({
|
|
3675
|
+
top: scrollParent.scrollTop + delta - offset3,
|
|
3676
|
+
behavior
|
|
3677
|
+
});
|
|
3678
|
+
} catch (e) {
|
|
3679
|
+
console.warn("scroll error:", e);
|
|
3680
|
+
}
|
|
3681
|
+
});
|
|
3682
|
+
}
|
|
3683
|
+
|
|
3684
|
+
// src/components/MarkdownEditor/collection/CollectionPlugin.ts
|
|
3647
3685
|
var collectionPluginKey = new state.PluginKey("collectionPlugin");
|
|
3648
3686
|
var CollectionPlugin = core.Extension.create({
|
|
3649
3687
|
name: "collectionPlugin",
|
|
@@ -3666,10 +3704,11 @@ var CollectionPlugin = core.Extension.create({
|
|
|
3666
3704
|
},
|
|
3667
3705
|
moveCursorToCollection: (id) => ({ state: state$1, commands, view }) => {
|
|
3668
3706
|
const foundFrom = findMarkPosition(state$1.doc, COLLECTION_KEY, COLLECTION_ATTRS[0], id);
|
|
3669
|
-
if (foundFrom) {
|
|
3707
|
+
if (isNumber(foundFrom)) {
|
|
3670
3708
|
const tr = state$1.tr.setSelection(state.TextSelection.create(state$1.doc, foundFrom));
|
|
3671
3709
|
view.dispatch(tr);
|
|
3672
3710
|
commands.focus();
|
|
3711
|
+
scrollEditorViewToPosInNextFrame(view, foundFrom, { align: "start" });
|
|
3673
3712
|
}
|
|
3674
3713
|
}
|
|
3675
3714
|
};
|
|
@@ -3773,13 +3812,13 @@ var collectionSidebar_default = ({
|
|
|
3773
3812
|
className: "full-card no-padding-card extra-sidebar",
|
|
3774
3813
|
title: collectionConfig?.showListHeader === false ? false : /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "space-between", align: "center", children: [
|
|
3775
3814
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Space, { children: [
|
|
3776
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3815
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.BookOutlined, {}),
|
|
3777
3816
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
3778
3817
|
"\u6458\u5F55",
|
|
3779
3818
|
collections.length > 0 && `\uFF08${collections.length}\uFF09`
|
|
3780
3819
|
] })
|
|
3781
3820
|
] }),
|
|
3782
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "text", size: "small", icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3821
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "text", size: "small", icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CloseOutlined, {}), onClick: onClose })
|
|
3783
3822
|
] }),
|
|
3784
3823
|
variant: "borderless",
|
|
3785
3824
|
children: collections.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3823,7 +3862,7 @@ var collectionSidebar_default = ({
|
|
|
3823
3862
|
cancelText: "\u53D6\u6D88",
|
|
3824
3863
|
description: "\u786E\u8BA4\u5220\u9664\u5F53\u524D\u6458\u5F55\u5417?",
|
|
3825
3864
|
onConfirm: () => onDeleteCollection(collection[COLLECTION_ATTRS[0]]),
|
|
3826
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "text", size: "small", title: "\u5220\u9664\u6458\u5F55", icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3865
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "text", size: "small", title: "\u5220\u9664\u6458\u5F55", icon: /* @__PURE__ */ jsxRuntime.jsx(icons.DeleteOutlined, {}) })
|
|
3827
3866
|
}
|
|
3828
3867
|
) })
|
|
3829
3868
|
] })
|
|
@@ -3841,47 +3880,6 @@ var collectionSidebar_default = ({
|
|
|
3841
3880
|
}
|
|
3842
3881
|
return reactDom.createPortal(sidebarContent, container);
|
|
3843
3882
|
};
|
|
3844
|
-
|
|
3845
|
-
// src/components/MarkdownEditor/common/utils.ts
|
|
3846
|
-
function selectionHasBlockMath(editor) {
|
|
3847
|
-
if (!editor) return false;
|
|
3848
|
-
const { state } = editor;
|
|
3849
|
-
const { from, to } = state.selection;
|
|
3850
|
-
let hasBlockMath = false;
|
|
3851
|
-
state.doc.nodesBetween(from, to, (node) => {
|
|
3852
|
-
if (node.type.name === "blockMath") {
|
|
3853
|
-
hasBlockMath = true;
|
|
3854
|
-
return false;
|
|
3855
|
-
}
|
|
3856
|
-
});
|
|
3857
|
-
return hasBlockMath;
|
|
3858
|
-
}
|
|
3859
|
-
function hasSelection(editor) {
|
|
3860
|
-
if (!editor) return false;
|
|
3861
|
-
const { from, to } = editor.state.selection;
|
|
3862
|
-
return from < to;
|
|
3863
|
-
}
|
|
3864
|
-
function getSelectedText(editor) {
|
|
3865
|
-
if (!editor) return "";
|
|
3866
|
-
const { from, to } = editor.state.selection;
|
|
3867
|
-
if (from === to) return "";
|
|
3868
|
-
return editor.state.doc.textBetween(from, to, " ");
|
|
3869
|
-
}
|
|
3870
|
-
function getSelectedMarkdown(editor) {
|
|
3871
|
-
if (!editor) return "";
|
|
3872
|
-
if (!editor.markdown) {
|
|
3873
|
-
console.warn("Markdown extension \u672A\u542F\u7528");
|
|
3874
|
-
return "";
|
|
3875
|
-
}
|
|
3876
|
-
const { from, to } = editor.state.selection;
|
|
3877
|
-
const slice = editor.state.doc.cut(from, to);
|
|
3878
|
-
return editor.markdown.serialize({
|
|
3879
|
-
type: "doc",
|
|
3880
|
-
content: slice.content.toJSON()
|
|
3881
|
-
});
|
|
3882
|
-
}
|
|
3883
|
-
|
|
3884
|
-
// src/components/MarkdownEditor/collection/use-collections.ts
|
|
3885
3883
|
var useCollections = (collectionConfig) => {
|
|
3886
3884
|
const [collections, setCollections] = React.useState([]);
|
|
3887
3885
|
const [selectedCollectionId, setSelectedCollectionId] = React.useState(null);
|
|
@@ -3920,7 +3918,7 @@ var useCollections = (collectionConfig) => {
|
|
|
3920
3918
|
"page-no": pageIndex
|
|
3921
3919
|
}).run();
|
|
3922
3920
|
setShowCollection(true);
|
|
3923
|
-
handleSelectCollection(remoteId
|
|
3921
|
+
handleSelectCollection(remoteId);
|
|
3924
3922
|
};
|
|
3925
3923
|
const handleDeleteCollection = (id) => {
|
|
3926
3924
|
if (!editor.current) {
|
|
@@ -4457,7 +4455,7 @@ var BlockquoteButton = React.forwardRef(
|
|
|
4457
4455
|
handleToggle,
|
|
4458
4456
|
label,
|
|
4459
4457
|
shortcutKeys,
|
|
4460
|
-
Icon
|
|
4458
|
+
Icon
|
|
4461
4459
|
} = useBlockquote({
|
|
4462
4460
|
editor,
|
|
4463
4461
|
hideWhenUnavailable,
|
|
@@ -4491,7 +4489,7 @@ var BlockquoteButton = React.forwardRef(
|
|
|
4491
4489
|
...buttonProps,
|
|
4492
4490
|
ref,
|
|
4493
4491
|
children: children ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4494
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4492
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "tiptap-button-icon" }),
|
|
4495
4493
|
text && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tiptap-button-text", children: text }),
|
|
4496
4494
|
showShortcut && /* @__PURE__ */ jsxRuntime.jsx(BlockquoteShortcutBadge, { shortcutKeys })
|
|
4497
4495
|
] })
|
|
@@ -4683,7 +4681,7 @@ var CodeBlockButton = React.forwardRef(
|
|
|
4683
4681
|
handleToggle,
|
|
4684
4682
|
label,
|
|
4685
4683
|
shortcutKeys,
|
|
4686
|
-
Icon
|
|
4684
|
+
Icon
|
|
4687
4685
|
} = useCodeBlock({
|
|
4688
4686
|
editor,
|
|
4689
4687
|
hideWhenUnavailable,
|
|
@@ -4717,7 +4715,7 @@ var CodeBlockButton = React.forwardRef(
|
|
|
4717
4715
|
...buttonProps,
|
|
4718
4716
|
ref,
|
|
4719
4717
|
children: children ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4720
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4718
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "tiptap-button-icon" }),
|
|
4721
4719
|
text && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tiptap-button-text", children: text }),
|
|
4722
4720
|
showShortcut && /* @__PURE__ */ jsxRuntime.jsx(CodeBlockShortcutBadge, { shortcutKeys })
|
|
4723
4721
|
] })
|
|
@@ -5403,7 +5401,7 @@ function ColorHighlightPopover({
|
|
|
5403
5401
|
}) {
|
|
5404
5402
|
const { editor } = useTiptapEditor(providedEditor);
|
|
5405
5403
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
5406
|
-
const { isVisible, canColorHighlight: canColorHighlight2, isActive, label, Icon
|
|
5404
|
+
const { isVisible, canColorHighlight: canColorHighlight2, isActive, label, Icon } = useColorHighlight({
|
|
5407
5405
|
editor,
|
|
5408
5406
|
hideWhenUnavailable,
|
|
5409
5407
|
onApplied
|
|
@@ -5420,7 +5418,7 @@ function ColorHighlightPopover({
|
|
|
5420
5418
|
"aria-label": label,
|
|
5421
5419
|
tooltip: label,
|
|
5422
5420
|
...props,
|
|
5423
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5421
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "tiptap-button-icon" })
|
|
5424
5422
|
}
|
|
5425
5423
|
) }),
|
|
5426
5424
|
/* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { "aria-label": "\u80CC\u666F\u8272", children: /* @__PURE__ */ jsxRuntime.jsx(ColorHighlightPopoverContent, { editor, colors }) })
|
|
@@ -5475,7 +5473,7 @@ var HeadingButton = React.forwardRef(
|
|
|
5475
5473
|
isActive,
|
|
5476
5474
|
handleToggle,
|
|
5477
5475
|
label,
|
|
5478
|
-
Icon
|
|
5476
|
+
Icon,
|
|
5479
5477
|
shortcutKeys
|
|
5480
5478
|
} = useHeading({
|
|
5481
5479
|
editor,
|
|
@@ -5511,7 +5509,7 @@ var HeadingButton = React.forwardRef(
|
|
|
5511
5509
|
...buttonProps,
|
|
5512
5510
|
ref,
|
|
5513
5511
|
children: children ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5514
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5512
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "tiptap-button-icon" }),
|
|
5515
5513
|
text && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tiptap-button-text", children: text }),
|
|
5516
5514
|
showShortcut && /* @__PURE__ */ jsxRuntime.jsx(HeadingShortcutBadge, { level, shortcutKeys })
|
|
5517
5515
|
] })
|
|
@@ -5906,7 +5904,7 @@ var HeadingDropdownMenu = React.forwardRef(
|
|
|
5906
5904
|
}, ref) => {
|
|
5907
5905
|
const { editor } = useTiptapEditor(providedEditor);
|
|
5908
5906
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
5909
|
-
const { isVisible, isActive, canToggle: canToggle3, Icon
|
|
5907
|
+
const { isVisible, isActive, canToggle: canToggle3, Icon } = useHeadingDropdownMenu({
|
|
5910
5908
|
editor,
|
|
5911
5909
|
levels,
|
|
5912
5910
|
hideWhenUnavailable
|
|
@@ -5939,7 +5937,7 @@ var HeadingDropdownMenu = React.forwardRef(
|
|
|
5939
5937
|
...buttonProps,
|
|
5940
5938
|
ref,
|
|
5941
5939
|
children: [
|
|
5942
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5940
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "tiptap-button-icon" }),
|
|
5943
5941
|
/* @__PURE__ */ jsxRuntime.jsx(ChevronDownIcon, { className: "tiptap-button-dropdown-small" })
|
|
5944
5942
|
]
|
|
5945
5943
|
}
|
|
@@ -6272,7 +6270,7 @@ var LinkPopover = React.forwardRef(
|
|
|
6272
6270
|
removeLink,
|
|
6273
6271
|
openLink,
|
|
6274
6272
|
label,
|
|
6275
|
-
Icon
|
|
6273
|
+
Icon
|
|
6276
6274
|
} = useLinkPopover({
|
|
6277
6275
|
editor,
|
|
6278
6276
|
hideWhenUnavailable,
|
|
@@ -6317,7 +6315,7 @@ var LinkPopover = React.forwardRef(
|
|
|
6317
6315
|
onClick: handleClick,
|
|
6318
6316
|
...buttonProps,
|
|
6319
6317
|
ref,
|
|
6320
|
-
children: children ?? /* @__PURE__ */ jsxRuntime.jsx(
|
|
6318
|
+
children: children ?? /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "tiptap-button-icon" })
|
|
6321
6319
|
}
|
|
6322
6320
|
) }),
|
|
6323
6321
|
/* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -6489,7 +6487,7 @@ var ListButton = React.forwardRef(
|
|
|
6489
6487
|
handleToggle,
|
|
6490
6488
|
label,
|
|
6491
6489
|
shortcutKeys,
|
|
6492
|
-
Icon
|
|
6490
|
+
Icon
|
|
6493
6491
|
} = useList({
|
|
6494
6492
|
editor,
|
|
6495
6493
|
type,
|
|
@@ -6524,7 +6522,7 @@ var ListButton = React.forwardRef(
|
|
|
6524
6522
|
...buttonProps,
|
|
6525
6523
|
ref,
|
|
6526
6524
|
children: children ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6527
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6525
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "tiptap-button-icon" }),
|
|
6528
6526
|
text && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tiptap-button-text", children: text }),
|
|
6529
6527
|
showShortcut && /* @__PURE__ */ jsxRuntime.jsx(ListShortcutBadge, { type, shortcutKeys })
|
|
6530
6528
|
] })
|
|
@@ -6996,7 +6994,7 @@ function ListDropdownMenu({
|
|
|
6996
6994
|
}) {
|
|
6997
6995
|
const { editor } = useTiptapEditor(providedEditor);
|
|
6998
6996
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
6999
|
-
const { filteredLists, canToggle: canToggle3, isActive, isVisible, Icon
|
|
6997
|
+
const { filteredLists, canToggle: canToggle3, isActive, isVisible, Icon } = useListDropdownMenu({
|
|
7000
6998
|
editor,
|
|
7001
6999
|
types,
|
|
7002
7000
|
hideWhenUnavailable
|
|
@@ -7026,7 +7024,7 @@ function ListDropdownMenu({
|
|
|
7026
7024
|
tooltip: "\u5217\u8868",
|
|
7027
7025
|
...props,
|
|
7028
7026
|
children: [
|
|
7029
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7027
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "tiptap-button-icon" }),
|
|
7030
7028
|
/* @__PURE__ */ jsxRuntime.jsx(ChevronDownIcon, { className: "tiptap-button-dropdown-small" })
|
|
7031
7029
|
]
|
|
7032
7030
|
}
|
|
@@ -7067,7 +7065,7 @@ var MarkButton = React.forwardRef(
|
|
|
7067
7065
|
label,
|
|
7068
7066
|
canToggle: canToggle3,
|
|
7069
7067
|
isActive,
|
|
7070
|
-
Icon
|
|
7068
|
+
Icon,
|
|
7071
7069
|
shortcutKeys
|
|
7072
7070
|
} = useMark({
|
|
7073
7071
|
editor,
|
|
@@ -7103,7 +7101,7 @@ var MarkButton = React.forwardRef(
|
|
|
7103
7101
|
...buttonProps,
|
|
7104
7102
|
ref,
|
|
7105
7103
|
children: children ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7106
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7104
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "tiptap-button-icon" }),
|
|
7107
7105
|
text && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tiptap-button-text", children: text }),
|
|
7108
7106
|
showShortcut && /* @__PURE__ */ jsxRuntime.jsx(MarkShortcutBadge, { type, shortcutKeys })
|
|
7109
7107
|
] })
|
|
@@ -7461,7 +7459,7 @@ var TextAlignButton = React.forwardRef(
|
|
|
7461
7459
|
label,
|
|
7462
7460
|
canAlign,
|
|
7463
7461
|
isActive,
|
|
7464
|
-
Icon
|
|
7462
|
+
Icon,
|
|
7465
7463
|
shortcutKeys
|
|
7466
7464
|
} = useTextAlign({
|
|
7467
7465
|
editor,
|
|
@@ -7480,7 +7478,7 @@ var TextAlignButton = React.forwardRef(
|
|
|
7480
7478
|
if (!isVisible) {
|
|
7481
7479
|
return null;
|
|
7482
7480
|
}
|
|
7483
|
-
const RenderIcon = CustomIcon ??
|
|
7481
|
+
const RenderIcon = CustomIcon ?? Icon;
|
|
7484
7482
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7485
7483
|
Button6,
|
|
7486
7484
|
{
|
|
@@ -7799,7 +7797,7 @@ var UndoRedoButton = React.forwardRef(
|
|
|
7799
7797
|
...buttonProps
|
|
7800
7798
|
}, ref) => {
|
|
7801
7799
|
const { editor } = useTiptapEditor(providedEditor);
|
|
7802
|
-
const { isVisible, handleAction, label, canExecute, Icon
|
|
7800
|
+
const { isVisible, handleAction, label, canExecute, Icon, shortcutKeys } = useUndoRedo({
|
|
7803
7801
|
editor,
|
|
7804
7802
|
action,
|
|
7805
7803
|
hideWhenUnavailable,
|
|
@@ -7831,7 +7829,7 @@ var UndoRedoButton = React.forwardRef(
|
|
|
7831
7829
|
...buttonProps,
|
|
7832
7830
|
ref,
|
|
7833
7831
|
children: children ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7834
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7832
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "tiptap-button-icon" }),
|
|
7835
7833
|
text && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tiptap-button-text", children: text }),
|
|
7836
7834
|
showShortcut && /* @__PURE__ */ jsxRuntime.jsx(
|
|
7837
7835
|
HistoryShortcutBadge,
|
|
@@ -8233,8 +8231,8 @@ var MainToolbarContent = ({
|
|
|
8233
8231
|
/* @__PURE__ */ jsxRuntime.jsx(ToolbarSeparator, {})
|
|
8234
8232
|
] }),
|
|
8235
8233
|
onQuote && /* @__PURE__ */ jsxRuntime.jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectButton, { icon: /* @__PURE__ */ jsxRuntime.jsx(QuoteIcon, {}), tooltip: "\u5F15\u7528\u9009\u4E2D\u6587\u672C", onClick: onQuote, children: "\u5F15\u7528" }) }),
|
|
8236
|
-
onCreateAnnotation && /* @__PURE__ */ jsxRuntime.jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectButton, { icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8237
|
-
onCreateCollection && /* @__PURE__ */ jsxRuntime.jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectButton, { icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8234
|
+
onCreateAnnotation && /* @__PURE__ */ jsxRuntime.jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectButton, { icon: /* @__PURE__ */ jsxRuntime.jsx(icons.MessageOutlined, {}), tooltip: "\u6279\u6CE8", onClick: onCreateAnnotation, children: "\u6279\u6CE8" }) }),
|
|
8235
|
+
onCreateCollection && /* @__PURE__ */ jsxRuntime.jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectButton, { icon: /* @__PURE__ */ jsxRuntime.jsx(icons.BookOutlined, {}), tooltip: "\u6458\u5F55\u7B14\u8BB0", onClick: onCreateCollection, children: "\u6458\u5F55" }) }),
|
|
8238
8236
|
(tools.includes("heading") || tools.includes("list") || tools.includes("block")) && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
8239
8237
|
/* @__PURE__ */ jsxRuntime.jsxs(ToolbarGroup, { children: [
|
|
8240
8238
|
tools.includes("heading") && /* @__PURE__ */ jsxRuntime.jsx(HeadingDropdownMenu, { levels: [1, 2, 3, 4], portal: isMobile }),
|
|
@@ -8707,7 +8705,7 @@ var MarkdownEditor_default = ({
|
|
|
8707
8705
|
{
|
|
8708
8706
|
size: "small",
|
|
8709
8707
|
title: "\u6279\u6CE8\u5217\u8868",
|
|
8710
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8708
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.MessageOutlined, {}),
|
|
8711
8709
|
color: "primary",
|
|
8712
8710
|
variant: "text",
|
|
8713
8711
|
onClick: () => setShowAnnotation(!showAnnotation)
|
|
@@ -8719,7 +8717,7 @@ var MarkdownEditor_default = ({
|
|
|
8719
8717
|
style: { gap: "2px" },
|
|
8720
8718
|
size: "small",
|
|
8721
8719
|
title: "\u6458\u5F55\u5217\u8868",
|
|
8722
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8720
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.BookOutlined, {}),
|
|
8723
8721
|
color: "primary",
|
|
8724
8722
|
variant: "text",
|
|
8725
8723
|
onClick: () => setShowCollection(!showCollection),
|
|
@@ -8878,66 +8876,6 @@ function propsMerge(control, props) {
|
|
|
8878
8876
|
}
|
|
8879
8877
|
return null;
|
|
8880
8878
|
}
|
|
8881
|
-
var SpeechLoading_default = () => /* @__PURE__ */ jsxRuntime.jsxs("svg", { color: "currentColor", viewBox: "0 0 1000 1000", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
8882
|
-
/* @__PURE__ */ jsxRuntime.jsxs("rect", { fill: "currentColor", rx: "70", ry: "70", height: "250", width: "140", x: "0", y: "375", children: [
|
|
8883
|
-
/* @__PURE__ */ jsxRuntime.jsx("animate", { attributeName: "height", values: "250; 500; 250", keyTimes: "0; 0.5; 1", dur: "0.8s", begin: "0s", repeatCount: "indefinite" }),
|
|
8884
|
-
/* @__PURE__ */ jsxRuntime.jsx("animate", { attributeName: "y", values: "375; 250; 375", keyTimes: "0; 0.5; 1", dur: "0.8s", begin: "0s", repeatCount: "indefinite" })
|
|
8885
|
-
] }),
|
|
8886
|
-
/* @__PURE__ */ jsxRuntime.jsxs("rect", { fill: "currentColor", rx: "70", ry: "70", height: "250", width: "140", x: "286.66666666666663", y: "375", children: [
|
|
8887
|
-
/* @__PURE__ */ jsxRuntime.jsx("animate", { attributeName: "height", values: "250; 500; 250", keyTimes: "0; 0.5; 1", dur: "0.8s", begin: "0.2s", repeatCount: "indefinite" }),
|
|
8888
|
-
/* @__PURE__ */ jsxRuntime.jsx("animate", { attributeName: "y", values: "375; 250; 375", keyTimes: "0; 0.5; 1", dur: "0.8s", begin: "0.2s", repeatCount: "indefinite" })
|
|
8889
|
-
] }),
|
|
8890
|
-
/* @__PURE__ */ jsxRuntime.jsxs("rect", { fill: "currentColor", rx: "70", ry: "70", height: "250", width: "140", x: "573.3333333333333", y: "375", children: [
|
|
8891
|
-
/* @__PURE__ */ jsxRuntime.jsx("animate", { attributeName: "height", values: "250; 500; 250", keyTimes: "0; 0.5; 1", dur: "0.8s", begin: "0.4s", repeatCount: "indefinite" }),
|
|
8892
|
-
/* @__PURE__ */ jsxRuntime.jsx("animate", { attributeName: "y", values: "375; 250; 375", keyTimes: "0; 0.5; 1", dur: "0.8s", begin: "0.4s", repeatCount: "indefinite" })
|
|
8893
|
-
] }),
|
|
8894
|
-
/* @__PURE__ */ jsxRuntime.jsxs("rect", { fill: "currentColor", rx: "70", ry: "70", height: "250", width: "140", x: "859.9999999999999", y: "375", children: [
|
|
8895
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8896
|
-
"animate",
|
|
8897
|
-
{
|
|
8898
|
-
attributeName: "height",
|
|
8899
|
-
values: "250; 500; 250",
|
|
8900
|
-
keyTimes: "0; 0.5; 1",
|
|
8901
|
-
dur: "0.8s",
|
|
8902
|
-
begin: "0.6000000000000001s",
|
|
8903
|
-
repeatCount: "indefinite"
|
|
8904
|
-
}
|
|
8905
|
-
),
|
|
8906
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8907
|
-
"animate",
|
|
8908
|
-
{
|
|
8909
|
-
attributeName: "y",
|
|
8910
|
-
values: "375; 250; 375",
|
|
8911
|
-
keyTimes: "0; 0.5; 1",
|
|
8912
|
-
dur: "0.8s",
|
|
8913
|
-
begin: "0.6000000000000001s",
|
|
8914
|
-
repeatCount: "indefinite"
|
|
8915
|
-
}
|
|
8916
|
-
)
|
|
8917
|
-
] })
|
|
8918
|
-
] });
|
|
8919
|
-
var SpeechButton_default = (props) => {
|
|
8920
|
-
const { permission, isRecording, start, stop } = useSpeech_default(props);
|
|
8921
|
-
const disabled = permission === "denied" || permission === "unsupported";
|
|
8922
|
-
const handleClick = () => {
|
|
8923
|
-
if (isRecording) {
|
|
8924
|
-
stop();
|
|
8925
|
-
} else {
|
|
8926
|
-
start();
|
|
8927
|
-
}
|
|
8928
|
-
};
|
|
8929
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8930
|
-
antd.Button,
|
|
8931
|
-
{
|
|
8932
|
-
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",
|
|
8933
|
-
disabled,
|
|
8934
|
-
color: "primary",
|
|
8935
|
-
variant: "text",
|
|
8936
|
-
icon: isRecording ? /* @__PURE__ */ jsxRuntime.jsx(Icon__default.default, { style: { width: 16 }, component: SpeechLoading_default }) : disabled ? /* @__PURE__ */ jsxRuntime.jsx(Icon.AudioMutedOutlined, {}) : /* @__PURE__ */ jsxRuntime.jsx(Icon.AudioOutlined, {}),
|
|
8937
|
-
onClick: handleClick
|
|
8938
|
-
}
|
|
8939
|
-
);
|
|
8940
|
-
};
|
|
8941
8879
|
var UserAvatar_default = ({ size, avatarSrc, userName }) => {
|
|
8942
8880
|
return avatarSrc ? /* @__PURE__ */ jsxRuntime.jsx(antd.Avatar, { size, src: avatarSrc }) : /* @__PURE__ */ jsxRuntime.jsx(antd.Avatar, { size, className: "cursor-pointer", style: { backgroundColor: "var(--ant-color-primary)" }, children: userName?.slice(0, 1)?.toLocaleUpperCase() });
|
|
8943
8881
|
};
|
|
@@ -8975,7 +8913,6 @@ exports.RegTaxNo = RegTaxNo;
|
|
|
8975
8913
|
exports.RegTelePhone = RegTelePhone;
|
|
8976
8914
|
exports.RenderMarkdown = RenderMarkdown_default;
|
|
8977
8915
|
exports.RenderWrapper = RenderWrapper_default;
|
|
8978
|
-
exports.SpeechButton = SpeechButton_default;
|
|
8979
8916
|
exports.ThanNumLengthValidator = ThanNumLengthValidator;
|
|
8980
8917
|
exports.ThanNumValidator = ThanNumValidator;
|
|
8981
8918
|
exports.UserAvatar = UserAvatar_default;
|
|
@@ -9066,6 +9003,7 @@ exports.times = times;
|
|
|
9066
9003
|
exports.toFixed = toFixed;
|
|
9067
9004
|
exports.transform = transform;
|
|
9068
9005
|
exports.transforms = transforms;
|
|
9006
|
+
exports.useAsyncQueue = useAsyncQueue_default;
|
|
9069
9007
|
exports.useAutoRefresh = useAutoRefresh_default;
|
|
9070
9008
|
exports.useCountDown = useCountDown_default;
|
|
9071
9009
|
exports.useCreateValtioContext = useCreateValtioContext_default;
|
|
@@ -9073,7 +9011,6 @@ exports.useDebounce = useDebounce_default;
|
|
|
9073
9011
|
exports.useDeepEffect = useDeepEffect_default;
|
|
9074
9012
|
exports.useIframeRelayBridge = useIframeRelayBridge_default;
|
|
9075
9013
|
exports.useRefState = useRefState_default;
|
|
9076
|
-
exports.useSpeech = useSpeech_default;
|
|
9077
9014
|
exports.useSyncInput = useSyncInput_default;
|
|
9078
9015
|
exports.useThrottle = useThrottle_default;
|
|
9079
9016
|
exports.useWebSocket = useWebSocket_default;
|