@zero-library/common 2.2.3 → 2.2.4
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.cjs.js +270 -86
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +14 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +66 -36
- package/dist/index.d.ts +66 -36
- package/dist/index.esm.js +254 -74
- package/dist/index.esm.js.map +1 -1
- package/package.json +3 -2
package/dist/index.cjs.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var
|
|
5
|
-
var React16 = require('react');
|
|
4
|
+
var Icon = require('@ant-design/icons');
|
|
6
5
|
var antd = require('antd');
|
|
6
|
+
var classNames = require('classnames');
|
|
7
|
+
var docxPreview = require('docx-preview');
|
|
8
|
+
var React16 = require('react');
|
|
7
9
|
var parse = require('html-react-parser');
|
|
8
10
|
var jsonrepair = require('jsonrepair');
|
|
9
11
|
var markdownit = require('markdown-it');
|
|
@@ -22,7 +24,6 @@ var relativeTime = require('dayjs/plugin/relativeTime');
|
|
|
22
24
|
var axios = require('axios');
|
|
23
25
|
require('@react-pdf-viewer/thumbnail/lib/styles/index.css');
|
|
24
26
|
require('@react-pdf-viewer/zoom/lib/styles/index.css');
|
|
25
|
-
var classNames2 = require('classnames');
|
|
26
27
|
var react = require('@tiptap/react');
|
|
27
28
|
var tiptapMarkdown = require('tiptap-markdown');
|
|
28
29
|
var extensionHighlight = require('@tiptap/extension-highlight');
|
|
@@ -65,6 +66,8 @@ function _interopNamespace(e) {
|
|
|
65
66
|
return Object.freeze(n);
|
|
66
67
|
}
|
|
67
68
|
|
|
69
|
+
var Icon__default = /*#__PURE__*/_interopDefault(Icon);
|
|
70
|
+
var classNames__default = /*#__PURE__*/_interopDefault(classNames);
|
|
68
71
|
var React16__namespace = /*#__PURE__*/_interopNamespace(React16);
|
|
69
72
|
var parse__default = /*#__PURE__*/_interopDefault(parse);
|
|
70
73
|
var markdownit__default = /*#__PURE__*/_interopDefault(markdownit);
|
|
@@ -75,7 +78,6 @@ var Decimal__default = /*#__PURE__*/_interopDefault(Decimal);
|
|
|
75
78
|
var dayjs__default = /*#__PURE__*/_interopDefault(dayjs);
|
|
76
79
|
var relativeTime__default = /*#__PURE__*/_interopDefault(relativeTime);
|
|
77
80
|
var axios__default = /*#__PURE__*/_interopDefault(axios);
|
|
78
|
-
var classNames2__default = /*#__PURE__*/_interopDefault(classNames2);
|
|
79
81
|
var Table__default = /*#__PURE__*/_interopDefault(Table);
|
|
80
82
|
var TableCell__default = /*#__PURE__*/_interopDefault(TableCell);
|
|
81
83
|
var TableHeader__default = /*#__PURE__*/_interopDefault(TableHeader);
|
|
@@ -88,7 +90,10 @@ var styles_module_default = {
|
|
|
88
90
|
nsPreviewPdf: "styles_module_nsPreviewPdf",
|
|
89
91
|
pdfToolbar: "styles_module_pdfToolbar",
|
|
90
92
|
nsPreviewVideo: "styles_module_nsPreviewVideo",
|
|
91
|
-
nsPreviewAudio: "styles_module_nsPreviewAudio"
|
|
93
|
+
nsPreviewAudio: "styles_module_nsPreviewAudio",
|
|
94
|
+
nsPreviewDocx: "styles_module_nsPreviewDocx",
|
|
95
|
+
docxToolbar: "styles_module_docxToolbar",
|
|
96
|
+
docxContent: "styles_module_docxContent"
|
|
92
97
|
};
|
|
93
98
|
var AudioPlayer_default = ({ fileUrl }) => {
|
|
94
99
|
return /* @__PURE__ */ jsxRuntime.jsxs("audio", { controls: true, className: styles_module_default.nsPreviewAudio, children: [
|
|
@@ -96,51 +101,98 @@ var AudioPlayer_default = ({ fileUrl }) => {
|
|
|
96
101
|
"\u60A8\u7684\u6D4F\u89C8\u5668\u4E0D\u652F\u6301 audio \u6807\u7B7E\u3002"
|
|
97
102
|
] });
|
|
98
103
|
};
|
|
104
|
+
var DocxPreview_default = ({ fileUrl, scale = 1 }) => {
|
|
105
|
+
const containerRef = React16.useRef(null);
|
|
106
|
+
const [zoomRatio, setZoomRatio] = React16.useState(scale);
|
|
107
|
+
React16.useEffect(() => {
|
|
108
|
+
if (!fileUrl || !containerRef.current) return;
|
|
109
|
+
containerRef.current.innerHTML = "";
|
|
110
|
+
fetch(fileUrl).then((res) => res.arrayBuffer()).then(
|
|
111
|
+
(arrayBuffer) => docxPreview.renderAsync(arrayBuffer, containerRef.current, null, {
|
|
112
|
+
breakPages: true,
|
|
113
|
+
renderHeaders: true,
|
|
114
|
+
renderFooters: true,
|
|
115
|
+
ignoreWidth: false,
|
|
116
|
+
ignoreHeight: false
|
|
117
|
+
})
|
|
118
|
+
).catch((err) => {
|
|
119
|
+
console.error("docx-preview \u6E32\u67D3\u5931\u8D25:", err);
|
|
120
|
+
if (containerRef.current) containerRef.current.innerHTML = '<p class="text-center">\u6587\u6863\u52A0\u8F7D\u5931\u8D25</p>';
|
|
121
|
+
});
|
|
122
|
+
}, [fileUrl]);
|
|
123
|
+
const zoomIn = () => setZoomRatio((z) => Math.min(z + 0.1, 3));
|
|
124
|
+
const zoomOut = () => setZoomRatio((z) => Math.max(z - 0.1, 0.3));
|
|
125
|
+
const resetZoom = () => {
|
|
126
|
+
setZoomRatio(1);
|
|
127
|
+
};
|
|
128
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames__default.default(styles_module_default.nsPreviewDocx, "height-full"), children: [
|
|
129
|
+
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 6, align: "center", className: styles_module_default.docxToolbar, children: [
|
|
130
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Button, { onClick: zoomOut, icon: /* @__PURE__ */ jsxRuntime.jsx(Icon.MinusCircleOutlined, {}), title: "\u7F29\u5C0F" }),
|
|
131
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Button, { onClick: zoomIn, icon: /* @__PURE__ */ jsxRuntime.jsx(Icon.PlusCircleOutlined, {}), title: "\u653E\u5927" }),
|
|
132
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Button, { onClick: resetZoom, icon: /* @__PURE__ */ jsxRuntime.jsx(Icon.RedoOutlined, {}), title: "\u8FD8\u539F" })
|
|
133
|
+
] }),
|
|
134
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames__default.default(styles_module_default.docxContent, "height-full", "scroll-fade-in"), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
135
|
+
"div",
|
|
136
|
+
{
|
|
137
|
+
ref: containerRef,
|
|
138
|
+
style: {
|
|
139
|
+
transform: `scale(${zoomRatio})`,
|
|
140
|
+
transformOrigin: "top center"
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
) })
|
|
144
|
+
] });
|
|
145
|
+
};
|
|
99
146
|
var FileIcon_default = ({ suffix, fontSize = 22 }) => {
|
|
100
147
|
const styles = { fontSize, color: "var(--ant-color-primary)" };
|
|
101
|
-
const
|
|
148
|
+
const Icon2 = React16.useMemo(() => {
|
|
102
149
|
switch (suffix?.toUpperCase()) {
|
|
103
150
|
case "TXT":
|
|
104
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
151
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Icon.FileTextOutlined, {});
|
|
105
152
|
case "PDF":
|
|
106
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
153
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Icon.FilePdfOutlined, {});
|
|
107
154
|
case "DOC":
|
|
108
155
|
case "DOCX":
|
|
109
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
156
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Icon.FileWordOutlined, {});
|
|
110
157
|
case "XLS":
|
|
111
158
|
case "XLSX":
|
|
112
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
159
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Icon.FileExcelOutlined, {});
|
|
113
160
|
case "PPT":
|
|
114
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
161
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Icon.FilePptOutlined, {});
|
|
115
162
|
case "MP4":
|
|
116
163
|
case "MOV":
|
|
164
|
+
case "MKV":
|
|
117
165
|
case "AVI":
|
|
118
166
|
case "FLV":
|
|
119
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
167
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Icon.VideoCameraOutlined, {});
|
|
120
168
|
case "MP3":
|
|
121
|
-
|
|
169
|
+
case "WAV":
|
|
170
|
+
case "M4A":
|
|
171
|
+
case "ACC":
|
|
172
|
+
case "WMA":
|
|
173
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Icon.NotificationOutlined, {});
|
|
122
174
|
case "JPG":
|
|
123
175
|
case "JPEG":
|
|
124
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
176
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Icon.FileJpgOutlined, {});
|
|
125
177
|
case "PNG":
|
|
126
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
178
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Icon.FileImageOutlined, {});
|
|
127
179
|
case "GIF":
|
|
128
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
180
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Icon.FileGifOutlined, {});
|
|
129
181
|
case "MD":
|
|
130
182
|
case "MARKDOWN":
|
|
131
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
183
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Icon.FileMarkdownOutlined, {});
|
|
132
184
|
case "ZIP":
|
|
133
185
|
case "RAR":
|
|
134
186
|
case "7Z":
|
|
135
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
187
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Icon.FileZipOutlined, {});
|
|
136
188
|
case "CATALOG":
|
|
137
189
|
return /* @__PURE__ */ jsxRuntime.jsx("i", { style: styles, className: "iconfont icon-wenjianjia" });
|
|
138
190
|
// 文件夹图标
|
|
139
191
|
default:
|
|
140
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
192
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Icon.FileUnknownOutlined, {});
|
|
141
193
|
}
|
|
142
194
|
}, [suffix]);
|
|
143
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { style: styles, children:
|
|
195
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { style: styles, children: Icon2 });
|
|
144
196
|
};
|
|
145
197
|
var VideoPlayer_default = ({ fileUrl }) => {
|
|
146
198
|
return /* @__PURE__ */ jsxRuntime.jsxs("video", { controls: true, className: styles_module_default.nsPreviewVideo, children: [
|
|
@@ -1197,6 +1249,90 @@ var useRefState_default = (init) => {
|
|
|
1197
1249
|
const getState = () => stateRef.current;
|
|
1198
1250
|
return [state, setProxy, getState];
|
|
1199
1251
|
};
|
|
1252
|
+
var useSpeech_default = ({ onResult, lang = "zh-CN" }) => {
|
|
1253
|
+
const [permission, setPermission] = React16.useState("prompt");
|
|
1254
|
+
const [isRecording, setIsRecording] = React16.useState(false);
|
|
1255
|
+
const recognitionRef = React16.useRef(null);
|
|
1256
|
+
React16.useEffect(() => {
|
|
1257
|
+
const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
|
|
1258
|
+
if (!SpeechRecognition) {
|
|
1259
|
+
setPermission("unsupported");
|
|
1260
|
+
return;
|
|
1261
|
+
}
|
|
1262
|
+
const recognition = new SpeechRecognition();
|
|
1263
|
+
recognition.continuous = true;
|
|
1264
|
+
recognition.interimResults = false;
|
|
1265
|
+
recognition.lang = lang;
|
|
1266
|
+
recognition.onresult = (event) => {
|
|
1267
|
+
let transcript = "";
|
|
1268
|
+
for (let i = event.resultIndex; i < event.results.length; i++) {
|
|
1269
|
+
transcript += event.results[i][0].transcript;
|
|
1270
|
+
}
|
|
1271
|
+
onResult?.(transcript.trim());
|
|
1272
|
+
};
|
|
1273
|
+
recognition.onend = () => {
|
|
1274
|
+
setIsRecording(false);
|
|
1275
|
+
};
|
|
1276
|
+
recognition.onerror = (error) => {
|
|
1277
|
+
setIsRecording(false);
|
|
1278
|
+
console.error("Speech recognition error:", error);
|
|
1279
|
+
};
|
|
1280
|
+
recognitionRef.current = recognition;
|
|
1281
|
+
return () => {
|
|
1282
|
+
recognition.stop?.();
|
|
1283
|
+
recognition.onresult = null;
|
|
1284
|
+
recognition.onend = null;
|
|
1285
|
+
recognition.onerror = null;
|
|
1286
|
+
};
|
|
1287
|
+
}, [lang, onResult]);
|
|
1288
|
+
React16.useEffect(() => {
|
|
1289
|
+
if (!navigator.permissions) return;
|
|
1290
|
+
navigator.permissions.query({ name: "microphone" }).then((status) => {
|
|
1291
|
+
setPermission(status.state);
|
|
1292
|
+
status.onchange = () => setPermission(status.state);
|
|
1293
|
+
});
|
|
1294
|
+
}, []);
|
|
1295
|
+
const requestPermission = React16.useCallback(async () => {
|
|
1296
|
+
try {
|
|
1297
|
+
await navigator.mediaDevices.getUserMedia({ audio: true });
|
|
1298
|
+
setPermission("granted");
|
|
1299
|
+
} catch {
|
|
1300
|
+
setPermission("denied");
|
|
1301
|
+
}
|
|
1302
|
+
}, []);
|
|
1303
|
+
const start = React16.useCallback(() => {
|
|
1304
|
+
if (permission === "prompt") {
|
|
1305
|
+
requestPermission();
|
|
1306
|
+
return;
|
|
1307
|
+
}
|
|
1308
|
+
if (permission !== "granted") return;
|
|
1309
|
+
if (!isRecording) {
|
|
1310
|
+
recognitionRef.current?.start();
|
|
1311
|
+
setIsRecording(true);
|
|
1312
|
+
}
|
|
1313
|
+
}, [permission, isRecording, requestPermission]);
|
|
1314
|
+
const stop = React16.useCallback(() => {
|
|
1315
|
+
try {
|
|
1316
|
+
recognitionRef.current?.stop();
|
|
1317
|
+
} finally {
|
|
1318
|
+
setIsRecording(false);
|
|
1319
|
+
}
|
|
1320
|
+
}, []);
|
|
1321
|
+
return {
|
|
1322
|
+
/**
|
|
1323
|
+
* 权限状态
|
|
1324
|
+
*/
|
|
1325
|
+
permission,
|
|
1326
|
+
/**
|
|
1327
|
+
* 录音状态
|
|
1328
|
+
*/
|
|
1329
|
+
isRecording,
|
|
1330
|
+
/** 开始语音识别 */
|
|
1331
|
+
start,
|
|
1332
|
+
/** 停止语音识别 */
|
|
1333
|
+
stop
|
|
1334
|
+
};
|
|
1335
|
+
};
|
|
1200
1336
|
var useSyncInput_default = (storeValue, setStoreValue) => {
|
|
1201
1337
|
const [inputValue, setInputValue] = React16.useState(storeValue);
|
|
1202
1338
|
React16.useEffect(() => {
|
|
@@ -1931,27 +2067,22 @@ var FilePreview_default = ({ suffix, fileUrl, pdfParams, password, searchValue }
|
|
|
1931
2067
|
case "MP4":
|
|
1932
2068
|
return /* @__PURE__ */ jsxRuntime.jsx(VideoPlayer_default, { fileUrl });
|
|
1933
2069
|
case "MP3":
|
|
2070
|
+
case "WAV":
|
|
2071
|
+
case "M4A":
|
|
2072
|
+
case "ACC":
|
|
1934
2073
|
return /* @__PURE__ */ jsxRuntime.jsx(AudioPlayer_default, { fileUrl });
|
|
1935
2074
|
case "MD":
|
|
1936
2075
|
case "MARKDOWN":
|
|
1937
2076
|
return /* @__PURE__ */ jsxRuntime.jsx(MarkdownPreview_default, { fileUrl, searchValue });
|
|
2077
|
+
case "DOCX":
|
|
2078
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DocxPreview_default, { fileUrl });
|
|
1938
2079
|
default:
|
|
1939
2080
|
return /* @__PURE__ */ jsxRuntime.jsx(antd.Result, { subTitle: `\u6682\u4E0D\u652F\u6301 ${suffix || ""} \u6587\u4EF6\u7684\u9884\u89C8` });
|
|
1940
2081
|
}
|
|
1941
2082
|
}, [suffix, fileUrl, pdfParams]);
|
|
1942
2083
|
return /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { justify: "center", align: "center", className: "height-full", children: Preview });
|
|
1943
2084
|
};
|
|
1944
|
-
var FilePreviewDrawer_default = ({
|
|
1945
|
-
open,
|
|
1946
|
-
fileUrl,
|
|
1947
|
-
suffix,
|
|
1948
|
-
title = "\u6587\u4EF6\u9884\u89C8",
|
|
1949
|
-
onClose,
|
|
1950
|
-
password,
|
|
1951
|
-
fileParams,
|
|
1952
|
-
pdfParams,
|
|
1953
|
-
onSetPassSuccess
|
|
1954
|
-
}) => {
|
|
2085
|
+
var FilePreviewDrawer_default = ({ open, title = "\u6587\u4EF6\u9884\u89C8", onClose, ...props }) => {
|
|
1955
2086
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1956
2087
|
antd.Drawer,
|
|
1957
2088
|
{
|
|
@@ -1960,17 +2091,7 @@ var FilePreviewDrawer_default = ({
|
|
|
1960
2091
|
width: "100%",
|
|
1961
2092
|
open,
|
|
1962
2093
|
onClose,
|
|
1963
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1964
|
-
FilePreview_default,
|
|
1965
|
-
{
|
|
1966
|
-
fileUrl,
|
|
1967
|
-
suffix,
|
|
1968
|
-
password,
|
|
1969
|
-
fileParams,
|
|
1970
|
-
pdfParams,
|
|
1971
|
-
onSetPassSuccess
|
|
1972
|
-
}
|
|
1973
|
-
)
|
|
2094
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(FilePreview_default, { ...props })
|
|
1974
2095
|
}
|
|
1975
2096
|
);
|
|
1976
2097
|
};
|
|
@@ -1997,7 +2118,7 @@ var Iframe_default = React16.forwardRef(({ defaultMainSource, id, src, className
|
|
|
1997
2118
|
id,
|
|
1998
2119
|
ref,
|
|
1999
2120
|
src: finalSrc,
|
|
2000
|
-
className:
|
|
2121
|
+
className: classNames__default.default(styles_module_default2.iframe, className),
|
|
2001
2122
|
onLoad: onHandleLoad,
|
|
2002
2123
|
allow: "clipboard-write"
|
|
2003
2124
|
}
|
|
@@ -2271,7 +2392,7 @@ var ShortcutDisplay = ({ shortcuts }) => {
|
|
|
2271
2392
|
/* @__PURE__ */ jsxRuntime.jsx("kbd", { children: key })
|
|
2272
2393
|
] }, index)) });
|
|
2273
2394
|
};
|
|
2274
|
-
var
|
|
2395
|
+
var Button3 = React16__namespace.forwardRef(
|
|
2275
2396
|
({ className = "", children, tooltip, showTooltip = true, shortcutKeys, "aria-label": ariaLabel, ...props }, ref) => {
|
|
2276
2397
|
const isMac = React16__namespace.useMemo(() => typeof navigator !== "undefined" && navigator.platform.toLowerCase().includes("mac"), []);
|
|
2277
2398
|
const shortcuts = React16__namespace.useMemo(() => parseShortcutKeys(shortcutKeys, isMac), [shortcutKeys, isMac]);
|
|
@@ -2287,7 +2408,7 @@ var Button2 = React16__namespace.forwardRef(
|
|
|
2287
2408
|
] });
|
|
2288
2409
|
}
|
|
2289
2410
|
);
|
|
2290
|
-
|
|
2411
|
+
Button3.displayName = "Button";
|
|
2291
2412
|
var Spacer = React16__namespace.forwardRef(
|
|
2292
2413
|
({ orientation = "horizontal", size, className = "", style = {}, ...props }, ref) => {
|
|
2293
2414
|
const computedStyle = {
|
|
@@ -2745,14 +2866,14 @@ function useHeadingState(editor, level, disabled = false) {
|
|
|
2745
2866
|
const headingInSchema = isNodeInSchema("heading", editor);
|
|
2746
2867
|
const isDisabled = isHeadingButtonDisabled(editor, level, disabled);
|
|
2747
2868
|
const isActive = isHeadingActive(editor, level);
|
|
2748
|
-
const
|
|
2869
|
+
const Icon2 = headingIcons[level];
|
|
2749
2870
|
const shortcutKey = headingShortcutKeys[level];
|
|
2750
2871
|
const formattedName = getFormattedHeadingName(level);
|
|
2751
2872
|
return {
|
|
2752
2873
|
headingInSchema,
|
|
2753
2874
|
isDisabled,
|
|
2754
2875
|
isActive,
|
|
2755
|
-
Icon,
|
|
2876
|
+
Icon: Icon2,
|
|
2756
2877
|
shortcutKey,
|
|
2757
2878
|
formattedName
|
|
2758
2879
|
};
|
|
@@ -2760,7 +2881,7 @@ function useHeadingState(editor, level, disabled = false) {
|
|
|
2760
2881
|
var HeadingButton = React16__namespace.forwardRef(
|
|
2761
2882
|
({ editor: providedEditor, level, text, hideWhenUnavailable = false, className = "", disabled, onClick, children, ...buttonProps }, ref) => {
|
|
2762
2883
|
const editor = useTiptapEditor(providedEditor);
|
|
2763
|
-
const { headingInSchema, isDisabled, isActive, Icon, shortcutKey, formattedName } = useHeadingState(editor, level, disabled);
|
|
2884
|
+
const { headingInSchema, isDisabled, isActive, Icon: Icon2, shortcutKey, formattedName } = useHeadingState(editor, level, disabled);
|
|
2764
2885
|
const handleClick = React16__namespace.useCallback(
|
|
2765
2886
|
(e) => {
|
|
2766
2887
|
onClick?.(e);
|
|
@@ -2781,7 +2902,7 @@ var HeadingButton = React16__namespace.forwardRef(
|
|
|
2781
2902
|
return null;
|
|
2782
2903
|
}
|
|
2783
2904
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2784
|
-
|
|
2905
|
+
Button3,
|
|
2785
2906
|
{
|
|
2786
2907
|
type: "button",
|
|
2787
2908
|
className: className.trim(),
|
|
@@ -2799,7 +2920,7 @@ var HeadingButton = React16__namespace.forwardRef(
|
|
|
2799
2920
|
...buttonProps,
|
|
2800
2921
|
ref,
|
|
2801
2922
|
children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2802
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2923
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "tiptap-button-icon" }),
|
|
2803
2924
|
text && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tiptap-button-text", children: text })
|
|
2804
2925
|
] })
|
|
2805
2926
|
}
|
|
@@ -3060,7 +3181,7 @@ function HeadingDropdownMenu({
|
|
|
3060
3181
|
}
|
|
3061
3182
|
return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { open: isOpen, onOpenChange: handleOnOpenChange, children: [
|
|
3062
3183
|
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3063
|
-
|
|
3184
|
+
Button3,
|
|
3064
3185
|
{
|
|
3065
3186
|
type: "button",
|
|
3066
3187
|
disabled: isDisabled,
|
|
@@ -3433,7 +3554,7 @@ var HighlightButton = React16__namespace.forwardRef(
|
|
|
3433
3554
|
return null;
|
|
3434
3555
|
}
|
|
3435
3556
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3436
|
-
|
|
3557
|
+
Button3,
|
|
3437
3558
|
{
|
|
3438
3559
|
type: "button",
|
|
3439
3560
|
className: className.trim(),
|
|
@@ -3486,7 +3607,7 @@ var DEFAULT_HIGHLIGHT_COLORS = [
|
|
|
3486
3607
|
}
|
|
3487
3608
|
];
|
|
3488
3609
|
var HighlighterButton = React16__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3489
|
-
|
|
3610
|
+
Button3,
|
|
3490
3611
|
{
|
|
3491
3612
|
type: "button",
|
|
3492
3613
|
className,
|
|
@@ -3539,7 +3660,7 @@ function HighlightContent({ editor: providedEditor, colors = DEFAULT_HIGHLIGHT_C
|
|
|
3539
3660
|
)) }),
|
|
3540
3661
|
/* @__PURE__ */ jsxRuntime.jsx(Separator, {}),
|
|
3541
3662
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "tiptap-button-group", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3542
|
-
|
|
3663
|
+
Button3,
|
|
3543
3664
|
{
|
|
3544
3665
|
onClick: removeHighlight,
|
|
3545
3666
|
"aria-label": "Remove highlight",
|
|
@@ -3717,7 +3838,7 @@ var useLinkHandler = (props) => {
|
|
|
3717
3838
|
};
|
|
3718
3839
|
};
|
|
3719
3840
|
var LinkButton = React16__namespace.forwardRef(({ className, children, ...props }, ref) => {
|
|
3720
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3841
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Button3, { type: "button", className, "data-style": "ghost", role: "button", tabIndex: -1, "aria-label": "Link", tooltip: "\u94FE\u63A5", ref, ...props, children: children || /* @__PURE__ */ jsxRuntime.jsx(LinkIcon, { className: "tiptap-button-icon" }) });
|
|
3721
3842
|
});
|
|
3722
3843
|
var LinkContent = ({ editor: providedEditor }) => {
|
|
3723
3844
|
const editor = useTiptapEditor(providedEditor);
|
|
@@ -3748,11 +3869,11 @@ var LinkMain = ({ url, setUrl, setLink, removeLink, isActive }) => {
|
|
|
3748
3869
|
className: "tiptap-input tiptap-input-clamp"
|
|
3749
3870
|
}
|
|
3750
3871
|
),
|
|
3751
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "tiptap-button-group", "data-orientation": "horizontal", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3872
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "tiptap-button-group", "data-orientation": "horizontal", children: /* @__PURE__ */ jsxRuntime.jsx(Button3, { type: "button", onClick: setLink, title: "\u786E\u8BA4", disabled: !url && !isActive, "data-style": "ghost", children: /* @__PURE__ */ jsxRuntime.jsx(CornerDownLeftIcon, { className: "tiptap-button-icon" }) }) }),
|
|
3752
3873
|
/* @__PURE__ */ jsxRuntime.jsx(Separator, {}),
|
|
3753
3874
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tiptap-button-group", "data-orientation": "horizontal", children: [
|
|
3754
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3755
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3875
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button3, { type: "button", onClick: () => window.open(url, "_blank"), title: "\u65B0\u7A97\u53E3\u6253\u5F00", disabled: !url && !isActive, "data-style": "ghost", children: /* @__PURE__ */ jsxRuntime.jsx(ExternalLinkIcon, { className: "tiptap-button-icon" }) }),
|
|
3876
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button3, { type: "button", onClick: removeLink, title: "\u5220\u9664\u94FE\u63A5", disabled: !url && !isActive, "data-style": "ghost", children: /* @__PURE__ */ jsxRuntime.jsx(TrashIcon, { className: "tiptap-button-icon" }) })
|
|
3756
3877
|
] })
|
|
3757
3878
|
] });
|
|
3758
3879
|
};
|
|
@@ -4079,7 +4200,7 @@ var ListButton = React16__namespace.forwardRef(
|
|
|
4079
4200
|
({ editor: providedEditor, type, hideWhenUnavailable = false, className = "", onClick, text, children, ...buttonProps }, ref) => {
|
|
4080
4201
|
const editor = useTiptapEditor(providedEditor);
|
|
4081
4202
|
const { listInSchema, listOption, isActive, shortcutKey } = useListState(editor, type);
|
|
4082
|
-
const
|
|
4203
|
+
const Icon2 = listOption?.icon || ListIcon;
|
|
4083
4204
|
const handleClick = React16__namespace.useCallback(
|
|
4084
4205
|
(e) => {
|
|
4085
4206
|
onClick?.(e);
|
|
@@ -4101,7 +4222,7 @@ var ListButton = React16__namespace.forwardRef(
|
|
|
4101
4222
|
return null;
|
|
4102
4223
|
}
|
|
4103
4224
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4104
|
-
|
|
4225
|
+
Button3,
|
|
4105
4226
|
{
|
|
4106
4227
|
type: "button",
|
|
4107
4228
|
className: className.trim(),
|
|
@@ -4117,7 +4238,7 @@ var ListButton = React16__namespace.forwardRef(
|
|
|
4117
4238
|
...buttonProps,
|
|
4118
4239
|
ref,
|
|
4119
4240
|
children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4120
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4241
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "tiptap-button-icon" }),
|
|
4121
4242
|
text && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tiptap-button-text", children: text })
|
|
4122
4243
|
] })
|
|
4123
4244
|
}
|
|
@@ -4198,7 +4319,7 @@ function ListDropdownMenu({
|
|
|
4198
4319
|
}
|
|
4199
4320
|
return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { open: isOpen, onOpenChange: handleOnOpenChange, children: [
|
|
4200
4321
|
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4201
|
-
|
|
4322
|
+
Button3,
|
|
4202
4323
|
{
|
|
4203
4324
|
type: "button",
|
|
4204
4325
|
"data-style": "ghost",
|
|
@@ -4429,14 +4550,14 @@ function useMarkState(editor, type, disabled = false) {
|
|
|
4429
4550
|
const markInSchema = isMarkInSchema(type, editor);
|
|
4430
4551
|
const isDisabled = isMarkButtonDisabled(editor, type, disabled);
|
|
4431
4552
|
const isActive = isMarkActive(editor, type);
|
|
4432
|
-
const
|
|
4553
|
+
const Icon2 = markIcons[type];
|
|
4433
4554
|
const shortcutKey = markShortcutKeys[type];
|
|
4434
4555
|
const formattedName = getFormattedMarkName(type);
|
|
4435
4556
|
return {
|
|
4436
4557
|
markInSchema,
|
|
4437
4558
|
isDisabled,
|
|
4438
4559
|
isActive,
|
|
4439
|
-
Icon,
|
|
4560
|
+
Icon: Icon2,
|
|
4440
4561
|
shortcutKey,
|
|
4441
4562
|
formattedName
|
|
4442
4563
|
};
|
|
@@ -4444,7 +4565,7 @@ function useMarkState(editor, type, disabled = false) {
|
|
|
4444
4565
|
var MarkButton = React16__namespace.forwardRef(
|
|
4445
4566
|
({ editor: providedEditor, type, text, hideWhenUnavailable = false, className = "", disabled, onClick, children, ...buttonProps }, ref) => {
|
|
4446
4567
|
const editor = useTiptapEditor(providedEditor);
|
|
4447
|
-
const { markInSchema, isDisabled, isActive, Icon, shortcutKey, formattedName } = useMarkState(editor, type, disabled);
|
|
4568
|
+
const { markInSchema, isDisabled, isActive, Icon: Icon2, shortcutKey, formattedName } = useMarkState(editor, type, disabled);
|
|
4448
4569
|
const handleClick = React16__namespace.useCallback(
|
|
4449
4570
|
(e) => {
|
|
4450
4571
|
onClick?.(e);
|
|
@@ -4466,7 +4587,7 @@ var MarkButton = React16__namespace.forwardRef(
|
|
|
4466
4587
|
return null;
|
|
4467
4588
|
}
|
|
4468
4589
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4469
|
-
|
|
4590
|
+
Button3,
|
|
4470
4591
|
{
|
|
4471
4592
|
type: "button",
|
|
4472
4593
|
className: className.trim(),
|
|
@@ -4484,7 +4605,7 @@ var MarkButton = React16__namespace.forwardRef(
|
|
|
4484
4605
|
...buttonProps,
|
|
4485
4606
|
ref,
|
|
4486
4607
|
children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4487
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4608
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "tiptap-button-icon" }),
|
|
4488
4609
|
text && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tiptap-button-text", children: text })
|
|
4489
4610
|
] })
|
|
4490
4611
|
}
|
|
@@ -4635,7 +4756,7 @@ function useNodeState(editor, type, disabled = false, hideWhenUnavailable = fals
|
|
|
4635
4756
|
}
|
|
4636
4757
|
return false;
|
|
4637
4758
|
}, [editor, type, isDisabled]);
|
|
4638
|
-
const
|
|
4759
|
+
const Icon2 = nodeIcons[type];
|
|
4639
4760
|
const shortcutKey = nodeShortcutKeys[type];
|
|
4640
4761
|
const label = nodeLabels[type];
|
|
4641
4762
|
return {
|
|
@@ -4645,7 +4766,7 @@ function useNodeState(editor, type, disabled = false, hideWhenUnavailable = fals
|
|
|
4645
4766
|
isActive,
|
|
4646
4767
|
shouldShow,
|
|
4647
4768
|
handleToggle,
|
|
4648
|
-
Icon,
|
|
4769
|
+
Icon: Icon2,
|
|
4649
4770
|
shortcutKey,
|
|
4650
4771
|
label
|
|
4651
4772
|
};
|
|
@@ -4653,7 +4774,7 @@ function useNodeState(editor, type, disabled = false, hideWhenUnavailable = fals
|
|
|
4653
4774
|
var NodeButton = React16__namespace.forwardRef(
|
|
4654
4775
|
({ editor: providedEditor, type, text, hideWhenUnavailable = false, className = "", disabled, onClick, children, ...buttonProps }, ref) => {
|
|
4655
4776
|
const editor = useTiptapEditor(providedEditor);
|
|
4656
|
-
const { isDisabled, isActive, shouldShow, handleToggle, Icon, shortcutKey, label } = useNodeState(editor, type, disabled, hideWhenUnavailable);
|
|
4777
|
+
const { isDisabled, isActive, shouldShow, handleToggle, Icon: Icon2, shortcutKey, label } = useNodeState(editor, type, disabled, hideWhenUnavailable);
|
|
4657
4778
|
const handleClick = React16__namespace.useCallback(
|
|
4658
4779
|
(e) => {
|
|
4659
4780
|
onClick?.(e);
|
|
@@ -4667,7 +4788,7 @@ var NodeButton = React16__namespace.forwardRef(
|
|
|
4667
4788
|
return null;
|
|
4668
4789
|
}
|
|
4669
4790
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4670
|
-
|
|
4791
|
+
Button3,
|
|
4671
4792
|
{
|
|
4672
4793
|
type: "button",
|
|
4673
4794
|
className: className.trim(),
|
|
@@ -4685,7 +4806,7 @@ var NodeButton = React16__namespace.forwardRef(
|
|
|
4685
4806
|
...buttonProps,
|
|
4686
4807
|
ref,
|
|
4687
4808
|
children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4688
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4809
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "tiptap-button-icon" }),
|
|
4689
4810
|
text && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tiptap-button-text", children: text })
|
|
4690
4811
|
] })
|
|
4691
4812
|
}
|
|
@@ -4747,7 +4868,7 @@ var QuoteButton = React16__namespace.forwardRef(
|
|
|
4747
4868
|
);
|
|
4748
4869
|
if (!shouldShow || !editor || !editor.isEditable) return null;
|
|
4749
4870
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4750
|
-
|
|
4871
|
+
Button3,
|
|
4751
4872
|
{
|
|
4752
4873
|
type: "button",
|
|
4753
4874
|
className: className.trim(),
|
|
@@ -4965,7 +5086,7 @@ function useTextAlign(editor, align, disabled = false, hideWhenUnavailable = fal
|
|
|
4965
5086
|
return setTextAlign(editor, align);
|
|
4966
5087
|
}, [alignAvailable, editor, isDisabled, align]);
|
|
4967
5088
|
const shouldShow = React16__namespace.useMemo(() => shouldShowTextAlignButton(editor, canAlign, hideWhenUnavailable), [editor, canAlign, hideWhenUnavailable]);
|
|
4968
|
-
const
|
|
5089
|
+
const Icon2 = textAlignIcons[align];
|
|
4969
5090
|
const shortcutKey = textAlignShortcutKeys[align];
|
|
4970
5091
|
const label = textAlignLabels[align];
|
|
4971
5092
|
return {
|
|
@@ -4975,7 +5096,7 @@ function useTextAlign(editor, align, disabled = false, hideWhenUnavailable = fal
|
|
|
4975
5096
|
isActive,
|
|
4976
5097
|
handleAlignment,
|
|
4977
5098
|
shouldShow,
|
|
4978
|
-
Icon,
|
|
5099
|
+
Icon: Icon2,
|
|
4979
5100
|
shortcutKey,
|
|
4980
5101
|
label
|
|
4981
5102
|
};
|
|
@@ -4983,7 +5104,7 @@ function useTextAlign(editor, align, disabled = false, hideWhenUnavailable = fal
|
|
|
4983
5104
|
var TextAlignButton = React16__namespace.forwardRef(
|
|
4984
5105
|
({ editor: providedEditor, align, text, hideWhenUnavailable = false, className = "", disabled, onClick, children, ...buttonProps }, ref) => {
|
|
4985
5106
|
const editor = useTiptapEditor(providedEditor);
|
|
4986
|
-
const { isDisabled, isActive, handleAlignment, shouldShow, Icon, shortcutKey, label } = useTextAlign(editor, align, disabled, hideWhenUnavailable);
|
|
5107
|
+
const { isDisabled, isActive, handleAlignment, shouldShow, Icon: Icon2, shortcutKey, label } = useTextAlign(editor, align, disabled, hideWhenUnavailable);
|
|
4987
5108
|
const handleClick = React16__namespace.useCallback(
|
|
4988
5109
|
(e) => {
|
|
4989
5110
|
onClick?.(e);
|
|
@@ -4997,7 +5118,7 @@ var TextAlignButton = React16__namespace.forwardRef(
|
|
|
4997
5118
|
return null;
|
|
4998
5119
|
}
|
|
4999
5120
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5000
|
-
|
|
5121
|
+
Button3,
|
|
5001
5122
|
{
|
|
5002
5123
|
type: "button",
|
|
5003
5124
|
className: className.trim(),
|
|
@@ -5015,7 +5136,7 @@ var TextAlignButton = React16__namespace.forwardRef(
|
|
|
5015
5136
|
...buttonProps,
|
|
5016
5137
|
ref,
|
|
5017
5138
|
children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5018
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5139
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "tiptap-button-icon" }),
|
|
5019
5140
|
text && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tiptap-button-text", children: text })
|
|
5020
5141
|
] })
|
|
5021
5142
|
}
|
|
@@ -5079,14 +5200,14 @@ function useHistoryAction(editor, action, disabled = false) {
|
|
|
5079
5200
|
if (!editor || isDisabled) return;
|
|
5080
5201
|
executeHistoryAction(editor, action);
|
|
5081
5202
|
}, [editor, action, isDisabled]);
|
|
5082
|
-
const
|
|
5203
|
+
const Icon2 = historyIcons[action];
|
|
5083
5204
|
const actionLabel = historyActionLabels[action];
|
|
5084
5205
|
const shortcutKey = historyShortcutKeys[action];
|
|
5085
5206
|
return {
|
|
5086
5207
|
canExecute,
|
|
5087
5208
|
isDisabled,
|
|
5088
5209
|
handleAction,
|
|
5089
|
-
Icon,
|
|
5210
|
+
Icon: Icon2,
|
|
5090
5211
|
actionLabel,
|
|
5091
5212
|
shortcutKey
|
|
5092
5213
|
};
|
|
@@ -5094,7 +5215,7 @@ function useHistoryAction(editor, action, disabled = false) {
|
|
|
5094
5215
|
var UndoRedoButton = React16__namespace.forwardRef(
|
|
5095
5216
|
({ editor: providedEditor, action, text, className = "", disabled, onClick, children, ...buttonProps }, ref) => {
|
|
5096
5217
|
const editor = useTiptapEditor(providedEditor);
|
|
5097
|
-
const { isDisabled, handleAction, Icon, actionLabel, shortcutKey } = useHistoryAction(editor, action, disabled);
|
|
5218
|
+
const { isDisabled, handleAction, Icon: Icon2, actionLabel, shortcutKey } = useHistoryAction(editor, action, disabled);
|
|
5098
5219
|
const handleClick = React16__namespace.useCallback(
|
|
5099
5220
|
(e) => {
|
|
5100
5221
|
onClick?.(e);
|
|
@@ -5108,7 +5229,7 @@ var UndoRedoButton = React16__namespace.forwardRef(
|
|
|
5108
5229
|
return null;
|
|
5109
5230
|
}
|
|
5110
5231
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5111
|
-
|
|
5232
|
+
Button3,
|
|
5112
5233
|
{
|
|
5113
5234
|
ref,
|
|
5114
5235
|
type: "button",
|
|
@@ -5124,7 +5245,7 @@ var UndoRedoButton = React16__namespace.forwardRef(
|
|
|
5124
5245
|
onClick: handleClick,
|
|
5125
5246
|
...buttonProps,
|
|
5126
5247
|
children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5127
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5248
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "tiptap-button-icon" }),
|
|
5128
5249
|
text && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tiptap-button-text", children: text })
|
|
5129
5250
|
] })
|
|
5130
5251
|
}
|
|
@@ -5550,7 +5671,7 @@ var MainToolbarContent = ({
|
|
|
5550
5671
|
] });
|
|
5551
5672
|
};
|
|
5552
5673
|
var MobileToolbarContent = ({ type, onBack }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5553
|
-
/* @__PURE__ */ jsxRuntime.jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5674
|
+
/* @__PURE__ */ jsxRuntime.jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxRuntime.jsxs(Button3, { "data-style": "ghost", onClick: onBack, children: [
|
|
5554
5675
|
/* @__PURE__ */ jsxRuntime.jsx(ArrowLeftIcon, { className: "tiptap-button-icon" }),
|
|
5555
5676
|
type === "highlighter" ? /* @__PURE__ */ jsxRuntime.jsx(HighlighterIcon, { className: "tiptap-button-icon" }) : /* @__PURE__ */ jsxRuntime.jsx(LinkIcon, { className: "tiptap-button-icon" })
|
|
5556
5677
|
] }) }),
|
|
@@ -5749,7 +5870,7 @@ var MarkdownEditor_default = ({
|
|
|
5749
5870
|
const downloadFile2 = () => {
|
|
5750
5871
|
onDownloadFile?.(getMarkdown(), "docx");
|
|
5751
5872
|
};
|
|
5752
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
5873
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames__default.default("height-full", "editor-parent"), children: /* @__PURE__ */ jsxRuntime.jsxs(react.EditorContext.Provider, { value: { editor }, children: [
|
|
5753
5874
|
showToolbar && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5754
5875
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "end", align: "center", children: [
|
|
5755
5876
|
NsToolBar({ isBubble: false }),
|
|
@@ -5765,7 +5886,7 @@ var MarkdownEditor_default = ({
|
|
|
5765
5886
|
{
|
|
5766
5887
|
editor,
|
|
5767
5888
|
role: "presentation",
|
|
5768
|
-
className:
|
|
5889
|
+
className: classNames__default.default("simple-editor-content ns-markdown", { "no-toolbar": !showToolbar })
|
|
5769
5890
|
}
|
|
5770
5891
|
) })
|
|
5771
5892
|
] }) });
|
|
@@ -5806,6 +5927,66 @@ function propsMerge(control, props) {
|
|
|
5806
5927
|
}
|
|
5807
5928
|
return null;
|
|
5808
5929
|
}
|
|
5930
|
+
var SpeechLoading_default = () => /* @__PURE__ */ jsxRuntime.jsxs("svg", { color: "currentColor", viewBox: "0 0 1000 1000", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
5931
|
+
/* @__PURE__ */ jsxRuntime.jsxs("rect", { fill: "currentColor", rx: "70", ry: "70", height: "250", width: "140", x: "0", y: "375", children: [
|
|
5932
|
+
/* @__PURE__ */ jsxRuntime.jsx("animate", { attributeName: "height", values: "250; 500; 250", keyTimes: "0; 0.5; 1", dur: "0.8s", begin: "0s", repeatCount: "indefinite" }),
|
|
5933
|
+
/* @__PURE__ */ jsxRuntime.jsx("animate", { attributeName: "y", values: "375; 250; 375", keyTimes: "0; 0.5; 1", dur: "0.8s", begin: "0s", repeatCount: "indefinite" })
|
|
5934
|
+
] }),
|
|
5935
|
+
/* @__PURE__ */ jsxRuntime.jsxs("rect", { fill: "currentColor", rx: "70", ry: "70", height: "250", width: "140", x: "286.66666666666663", y: "375", children: [
|
|
5936
|
+
/* @__PURE__ */ jsxRuntime.jsx("animate", { attributeName: "height", values: "250; 500; 250", keyTimes: "0; 0.5; 1", dur: "0.8s", begin: "0.2s", repeatCount: "indefinite" }),
|
|
5937
|
+
/* @__PURE__ */ jsxRuntime.jsx("animate", { attributeName: "y", values: "375; 250; 375", keyTimes: "0; 0.5; 1", dur: "0.8s", begin: "0.2s", repeatCount: "indefinite" })
|
|
5938
|
+
] }),
|
|
5939
|
+
/* @__PURE__ */ jsxRuntime.jsxs("rect", { fill: "currentColor", rx: "70", ry: "70", height: "250", width: "140", x: "573.3333333333333", y: "375", children: [
|
|
5940
|
+
/* @__PURE__ */ jsxRuntime.jsx("animate", { attributeName: "height", values: "250; 500; 250", keyTimes: "0; 0.5; 1", dur: "0.8s", begin: "0.4s", repeatCount: "indefinite" }),
|
|
5941
|
+
/* @__PURE__ */ jsxRuntime.jsx("animate", { attributeName: "y", values: "375; 250; 375", keyTimes: "0; 0.5; 1", dur: "0.8s", begin: "0.4s", repeatCount: "indefinite" })
|
|
5942
|
+
] }),
|
|
5943
|
+
/* @__PURE__ */ jsxRuntime.jsxs("rect", { fill: "currentColor", rx: "70", ry: "70", height: "250", width: "140", x: "859.9999999999999", y: "375", children: [
|
|
5944
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5945
|
+
"animate",
|
|
5946
|
+
{
|
|
5947
|
+
attributeName: "height",
|
|
5948
|
+
values: "250; 500; 250",
|
|
5949
|
+
keyTimes: "0; 0.5; 1",
|
|
5950
|
+
dur: "0.8s",
|
|
5951
|
+
begin: "0.6000000000000001s",
|
|
5952
|
+
repeatCount: "indefinite"
|
|
5953
|
+
}
|
|
5954
|
+
),
|
|
5955
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5956
|
+
"animate",
|
|
5957
|
+
{
|
|
5958
|
+
attributeName: "y",
|
|
5959
|
+
values: "375; 250; 375",
|
|
5960
|
+
keyTimes: "0; 0.5; 1",
|
|
5961
|
+
dur: "0.8s",
|
|
5962
|
+
begin: "0.6000000000000001s",
|
|
5963
|
+
repeatCount: "indefinite"
|
|
5964
|
+
}
|
|
5965
|
+
)
|
|
5966
|
+
] })
|
|
5967
|
+
] });
|
|
5968
|
+
var SpeechButton_default = (props) => {
|
|
5969
|
+
const { permission, isRecording, start, stop } = useSpeech_default(props);
|
|
5970
|
+
const disabled = permission === "denied" || permission === "unsupported";
|
|
5971
|
+
const handleClick = () => {
|
|
5972
|
+
if (isRecording) {
|
|
5973
|
+
stop();
|
|
5974
|
+
} else {
|
|
5975
|
+
start();
|
|
5976
|
+
}
|
|
5977
|
+
};
|
|
5978
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5979
|
+
antd.Button,
|
|
5980
|
+
{
|
|
5981
|
+
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",
|
|
5982
|
+
disabled,
|
|
5983
|
+
color: "primary",
|
|
5984
|
+
variant: "text",
|
|
5985
|
+
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, {}),
|
|
5986
|
+
onClick: handleClick
|
|
5987
|
+
}
|
|
5988
|
+
);
|
|
5989
|
+
};
|
|
5809
5990
|
var UserAvatar_default = ({ size, avatarSrc, userName }) => {
|
|
5810
5991
|
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() });
|
|
5811
5992
|
};
|
|
@@ -5816,6 +5997,7 @@ exports.DEFAULT_DATE_FORMAT = DEFAULT_DATE_FORMAT;
|
|
|
5816
5997
|
exports.DEFAULT_DATE_TIME_FORMAT = DEFAULT_DATE_TIME_FORMAT;
|
|
5817
5998
|
exports.DEFAULT_YEAR_MONTH_DAY_FORMAT = DEFAULT_YEAR_MONTH_DAY_FORMAT;
|
|
5818
5999
|
exports.DEFAULT_YEAR_MONTH_FORMAT = DEFAULT_YEAR_MONTH_FORMAT;
|
|
6000
|
+
exports.DocxPreview = DocxPreview_default;
|
|
5819
6001
|
exports.FileIcon = FileIcon_default;
|
|
5820
6002
|
exports.FilePreview = FilePreview_default;
|
|
5821
6003
|
exports.FilePreviewDrawer = FilePreviewDrawer_default;
|
|
@@ -5840,6 +6022,7 @@ exports.RegTaxNo = RegTaxNo;
|
|
|
5840
6022
|
exports.RegTelePhone = RegTelePhone;
|
|
5841
6023
|
exports.RenderMarkdown = RenderMarkdown_default;
|
|
5842
6024
|
exports.RenderWrapper = RenderWrapper_default;
|
|
6025
|
+
exports.SpeechButton = SpeechButton_default;
|
|
5843
6026
|
exports.ThanNumLengthValidator = ThanNumLengthValidator;
|
|
5844
6027
|
exports.ThanNumValidator = ThanNumValidator;
|
|
5845
6028
|
exports.UserAvatar = UserAvatar_default;
|
|
@@ -5933,6 +6116,7 @@ exports.useDebounce = useDebounce_default;
|
|
|
5933
6116
|
exports.useDeepEffect = useDeepEffect_default;
|
|
5934
6117
|
exports.useIframeRelayBridge = useIframeRelayBridge_default;
|
|
5935
6118
|
exports.useRefState = useRefState_default;
|
|
6119
|
+
exports.useSpeech = useSpeech_default;
|
|
5936
6120
|
exports.useSyncInput = useSyncInput_default;
|
|
5937
6121
|
exports.useThrottle = useThrottle_default;
|
|
5938
6122
|
exports.useWebSocket = useWebSocket_default;
|