@zero-library/common 2.2.2 → 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 -98
- 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 +82 -37
- package/dist/index.d.ts +82 -37
- package/dist/index.esm.js +254 -85
- 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: [
|
|
@@ -1154,17 +1206,6 @@ function aesDecrypt(data, key) {
|
|
|
1154
1206
|
return null;
|
|
1155
1207
|
}
|
|
1156
1208
|
}
|
|
1157
|
-
var formatKB = (kbNum) => {
|
|
1158
|
-
if (!isNumber(kbNum)) return kbNum;
|
|
1159
|
-
const units = ["KB", "MB", "GB", "TB"];
|
|
1160
|
-
let size = kbNum;
|
|
1161
|
-
let index = 0;
|
|
1162
|
-
while (size >= 1024 && index < units.length - 1) {
|
|
1163
|
-
size /= 1024;
|
|
1164
|
-
index++;
|
|
1165
|
-
}
|
|
1166
|
-
return `${size.toFixed(2)} ${units[index]}`;
|
|
1167
|
-
};
|
|
1168
1209
|
function formatSize(value, options = {}) {
|
|
1169
1210
|
if (isNullOrUnDef(value) || !isNumberNoNaN(Number(value))) return value;
|
|
1170
1211
|
const UNIT_LIST = ["B", "KB", "MB", "GB", "TB", "PB"];
|
|
@@ -1208,6 +1249,90 @@ var useRefState_default = (init) => {
|
|
|
1208
1249
|
const getState = () => stateRef.current;
|
|
1209
1250
|
return [state, setProxy, getState];
|
|
1210
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
|
+
};
|
|
1211
1336
|
var useSyncInput_default = (storeValue, setStoreValue) => {
|
|
1212
1337
|
const [inputValue, setInputValue] = React16.useState(storeValue);
|
|
1213
1338
|
React16.useEffect(() => {
|
|
@@ -1942,27 +2067,22 @@ var FilePreview_default = ({ suffix, fileUrl, pdfParams, password, searchValue }
|
|
|
1942
2067
|
case "MP4":
|
|
1943
2068
|
return /* @__PURE__ */ jsxRuntime.jsx(VideoPlayer_default, { fileUrl });
|
|
1944
2069
|
case "MP3":
|
|
2070
|
+
case "WAV":
|
|
2071
|
+
case "M4A":
|
|
2072
|
+
case "ACC":
|
|
1945
2073
|
return /* @__PURE__ */ jsxRuntime.jsx(AudioPlayer_default, { fileUrl });
|
|
1946
2074
|
case "MD":
|
|
1947
2075
|
case "MARKDOWN":
|
|
1948
2076
|
return /* @__PURE__ */ jsxRuntime.jsx(MarkdownPreview_default, { fileUrl, searchValue });
|
|
2077
|
+
case "DOCX":
|
|
2078
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DocxPreview_default, { fileUrl });
|
|
1949
2079
|
default:
|
|
1950
2080
|
return /* @__PURE__ */ jsxRuntime.jsx(antd.Result, { subTitle: `\u6682\u4E0D\u652F\u6301 ${suffix || ""} \u6587\u4EF6\u7684\u9884\u89C8` });
|
|
1951
2081
|
}
|
|
1952
2082
|
}, [suffix, fileUrl, pdfParams]);
|
|
1953
2083
|
return /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { justify: "center", align: "center", className: "height-full", children: Preview });
|
|
1954
2084
|
};
|
|
1955
|
-
var FilePreviewDrawer_default = ({
|
|
1956
|
-
open,
|
|
1957
|
-
fileUrl,
|
|
1958
|
-
suffix,
|
|
1959
|
-
title = "\u6587\u4EF6\u9884\u89C8",
|
|
1960
|
-
onClose,
|
|
1961
|
-
password,
|
|
1962
|
-
fileParams,
|
|
1963
|
-
pdfParams,
|
|
1964
|
-
onSetPassSuccess
|
|
1965
|
-
}) => {
|
|
2085
|
+
var FilePreviewDrawer_default = ({ open, title = "\u6587\u4EF6\u9884\u89C8", onClose, ...props }) => {
|
|
1966
2086
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1967
2087
|
antd.Drawer,
|
|
1968
2088
|
{
|
|
@@ -1971,17 +2091,7 @@ var FilePreviewDrawer_default = ({
|
|
|
1971
2091
|
width: "100%",
|
|
1972
2092
|
open,
|
|
1973
2093
|
onClose,
|
|
1974
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1975
|
-
FilePreview_default,
|
|
1976
|
-
{
|
|
1977
|
-
fileUrl,
|
|
1978
|
-
suffix,
|
|
1979
|
-
password,
|
|
1980
|
-
fileParams,
|
|
1981
|
-
pdfParams,
|
|
1982
|
-
onSetPassSuccess
|
|
1983
|
-
}
|
|
1984
|
-
)
|
|
2094
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(FilePreview_default, { ...props })
|
|
1985
2095
|
}
|
|
1986
2096
|
);
|
|
1987
2097
|
};
|
|
@@ -2008,7 +2118,7 @@ var Iframe_default = React16.forwardRef(({ defaultMainSource, id, src, className
|
|
|
2008
2118
|
id,
|
|
2009
2119
|
ref,
|
|
2010
2120
|
src: finalSrc,
|
|
2011
|
-
className:
|
|
2121
|
+
className: classNames__default.default(styles_module_default2.iframe, className),
|
|
2012
2122
|
onLoad: onHandleLoad,
|
|
2013
2123
|
allow: "clipboard-write"
|
|
2014
2124
|
}
|
|
@@ -2282,7 +2392,7 @@ var ShortcutDisplay = ({ shortcuts }) => {
|
|
|
2282
2392
|
/* @__PURE__ */ jsxRuntime.jsx("kbd", { children: key })
|
|
2283
2393
|
] }, index)) });
|
|
2284
2394
|
};
|
|
2285
|
-
var
|
|
2395
|
+
var Button3 = React16__namespace.forwardRef(
|
|
2286
2396
|
({ className = "", children, tooltip, showTooltip = true, shortcutKeys, "aria-label": ariaLabel, ...props }, ref) => {
|
|
2287
2397
|
const isMac = React16__namespace.useMemo(() => typeof navigator !== "undefined" && navigator.platform.toLowerCase().includes("mac"), []);
|
|
2288
2398
|
const shortcuts = React16__namespace.useMemo(() => parseShortcutKeys(shortcutKeys, isMac), [shortcutKeys, isMac]);
|
|
@@ -2298,7 +2408,7 @@ var Button2 = React16__namespace.forwardRef(
|
|
|
2298
2408
|
] });
|
|
2299
2409
|
}
|
|
2300
2410
|
);
|
|
2301
|
-
|
|
2411
|
+
Button3.displayName = "Button";
|
|
2302
2412
|
var Spacer = React16__namespace.forwardRef(
|
|
2303
2413
|
({ orientation = "horizontal", size, className = "", style = {}, ...props }, ref) => {
|
|
2304
2414
|
const computedStyle = {
|
|
@@ -2756,14 +2866,14 @@ function useHeadingState(editor, level, disabled = false) {
|
|
|
2756
2866
|
const headingInSchema = isNodeInSchema("heading", editor);
|
|
2757
2867
|
const isDisabled = isHeadingButtonDisabled(editor, level, disabled);
|
|
2758
2868
|
const isActive = isHeadingActive(editor, level);
|
|
2759
|
-
const
|
|
2869
|
+
const Icon2 = headingIcons[level];
|
|
2760
2870
|
const shortcutKey = headingShortcutKeys[level];
|
|
2761
2871
|
const formattedName = getFormattedHeadingName(level);
|
|
2762
2872
|
return {
|
|
2763
2873
|
headingInSchema,
|
|
2764
2874
|
isDisabled,
|
|
2765
2875
|
isActive,
|
|
2766
|
-
Icon,
|
|
2876
|
+
Icon: Icon2,
|
|
2767
2877
|
shortcutKey,
|
|
2768
2878
|
formattedName
|
|
2769
2879
|
};
|
|
@@ -2771,7 +2881,7 @@ function useHeadingState(editor, level, disabled = false) {
|
|
|
2771
2881
|
var HeadingButton = React16__namespace.forwardRef(
|
|
2772
2882
|
({ editor: providedEditor, level, text, hideWhenUnavailable = false, className = "", disabled, onClick, children, ...buttonProps }, ref) => {
|
|
2773
2883
|
const editor = useTiptapEditor(providedEditor);
|
|
2774
|
-
const { headingInSchema, isDisabled, isActive, Icon, shortcutKey, formattedName } = useHeadingState(editor, level, disabled);
|
|
2884
|
+
const { headingInSchema, isDisabled, isActive, Icon: Icon2, shortcutKey, formattedName } = useHeadingState(editor, level, disabled);
|
|
2775
2885
|
const handleClick = React16__namespace.useCallback(
|
|
2776
2886
|
(e) => {
|
|
2777
2887
|
onClick?.(e);
|
|
@@ -2792,7 +2902,7 @@ var HeadingButton = React16__namespace.forwardRef(
|
|
|
2792
2902
|
return null;
|
|
2793
2903
|
}
|
|
2794
2904
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2795
|
-
|
|
2905
|
+
Button3,
|
|
2796
2906
|
{
|
|
2797
2907
|
type: "button",
|
|
2798
2908
|
className: className.trim(),
|
|
@@ -2810,7 +2920,7 @@ var HeadingButton = React16__namespace.forwardRef(
|
|
|
2810
2920
|
...buttonProps,
|
|
2811
2921
|
ref,
|
|
2812
2922
|
children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2813
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2923
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "tiptap-button-icon" }),
|
|
2814
2924
|
text && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tiptap-button-text", children: text })
|
|
2815
2925
|
] })
|
|
2816
2926
|
}
|
|
@@ -3071,7 +3181,7 @@ function HeadingDropdownMenu({
|
|
|
3071
3181
|
}
|
|
3072
3182
|
return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { open: isOpen, onOpenChange: handleOnOpenChange, children: [
|
|
3073
3183
|
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3074
|
-
|
|
3184
|
+
Button3,
|
|
3075
3185
|
{
|
|
3076
3186
|
type: "button",
|
|
3077
3187
|
disabled: isDisabled,
|
|
@@ -3444,7 +3554,7 @@ var HighlightButton = React16__namespace.forwardRef(
|
|
|
3444
3554
|
return null;
|
|
3445
3555
|
}
|
|
3446
3556
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3447
|
-
|
|
3557
|
+
Button3,
|
|
3448
3558
|
{
|
|
3449
3559
|
type: "button",
|
|
3450
3560
|
className: className.trim(),
|
|
@@ -3497,7 +3607,7 @@ var DEFAULT_HIGHLIGHT_COLORS = [
|
|
|
3497
3607
|
}
|
|
3498
3608
|
];
|
|
3499
3609
|
var HighlighterButton = React16__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3500
|
-
|
|
3610
|
+
Button3,
|
|
3501
3611
|
{
|
|
3502
3612
|
type: "button",
|
|
3503
3613
|
className,
|
|
@@ -3550,7 +3660,7 @@ function HighlightContent({ editor: providedEditor, colors = DEFAULT_HIGHLIGHT_C
|
|
|
3550
3660
|
)) }),
|
|
3551
3661
|
/* @__PURE__ */ jsxRuntime.jsx(Separator, {}),
|
|
3552
3662
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "tiptap-button-group", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3553
|
-
|
|
3663
|
+
Button3,
|
|
3554
3664
|
{
|
|
3555
3665
|
onClick: removeHighlight,
|
|
3556
3666
|
"aria-label": "Remove highlight",
|
|
@@ -3728,7 +3838,7 @@ var useLinkHandler = (props) => {
|
|
|
3728
3838
|
};
|
|
3729
3839
|
};
|
|
3730
3840
|
var LinkButton = React16__namespace.forwardRef(({ className, children, ...props }, ref) => {
|
|
3731
|
-
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" }) });
|
|
3732
3842
|
});
|
|
3733
3843
|
var LinkContent = ({ editor: providedEditor }) => {
|
|
3734
3844
|
const editor = useTiptapEditor(providedEditor);
|
|
@@ -3759,11 +3869,11 @@ var LinkMain = ({ url, setUrl, setLink, removeLink, isActive }) => {
|
|
|
3759
3869
|
className: "tiptap-input tiptap-input-clamp"
|
|
3760
3870
|
}
|
|
3761
3871
|
),
|
|
3762
|
-
/* @__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" }) }) }),
|
|
3763
3873
|
/* @__PURE__ */ jsxRuntime.jsx(Separator, {}),
|
|
3764
3874
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tiptap-button-group", "data-orientation": "horizontal", children: [
|
|
3765
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3766
|
-
/* @__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" }) })
|
|
3767
3877
|
] })
|
|
3768
3878
|
] });
|
|
3769
3879
|
};
|
|
@@ -4090,7 +4200,7 @@ var ListButton = React16__namespace.forwardRef(
|
|
|
4090
4200
|
({ editor: providedEditor, type, hideWhenUnavailable = false, className = "", onClick, text, children, ...buttonProps }, ref) => {
|
|
4091
4201
|
const editor = useTiptapEditor(providedEditor);
|
|
4092
4202
|
const { listInSchema, listOption, isActive, shortcutKey } = useListState(editor, type);
|
|
4093
|
-
const
|
|
4203
|
+
const Icon2 = listOption?.icon || ListIcon;
|
|
4094
4204
|
const handleClick = React16__namespace.useCallback(
|
|
4095
4205
|
(e) => {
|
|
4096
4206
|
onClick?.(e);
|
|
@@ -4112,7 +4222,7 @@ var ListButton = React16__namespace.forwardRef(
|
|
|
4112
4222
|
return null;
|
|
4113
4223
|
}
|
|
4114
4224
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4115
|
-
|
|
4225
|
+
Button3,
|
|
4116
4226
|
{
|
|
4117
4227
|
type: "button",
|
|
4118
4228
|
className: className.trim(),
|
|
@@ -4128,7 +4238,7 @@ var ListButton = React16__namespace.forwardRef(
|
|
|
4128
4238
|
...buttonProps,
|
|
4129
4239
|
ref,
|
|
4130
4240
|
children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4131
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4241
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "tiptap-button-icon" }),
|
|
4132
4242
|
text && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tiptap-button-text", children: text })
|
|
4133
4243
|
] })
|
|
4134
4244
|
}
|
|
@@ -4209,7 +4319,7 @@ function ListDropdownMenu({
|
|
|
4209
4319
|
}
|
|
4210
4320
|
return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { open: isOpen, onOpenChange: handleOnOpenChange, children: [
|
|
4211
4321
|
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4212
|
-
|
|
4322
|
+
Button3,
|
|
4213
4323
|
{
|
|
4214
4324
|
type: "button",
|
|
4215
4325
|
"data-style": "ghost",
|
|
@@ -4440,14 +4550,14 @@ function useMarkState(editor, type, disabled = false) {
|
|
|
4440
4550
|
const markInSchema = isMarkInSchema(type, editor);
|
|
4441
4551
|
const isDisabled = isMarkButtonDisabled(editor, type, disabled);
|
|
4442
4552
|
const isActive = isMarkActive(editor, type);
|
|
4443
|
-
const
|
|
4553
|
+
const Icon2 = markIcons[type];
|
|
4444
4554
|
const shortcutKey = markShortcutKeys[type];
|
|
4445
4555
|
const formattedName = getFormattedMarkName(type);
|
|
4446
4556
|
return {
|
|
4447
4557
|
markInSchema,
|
|
4448
4558
|
isDisabled,
|
|
4449
4559
|
isActive,
|
|
4450
|
-
Icon,
|
|
4560
|
+
Icon: Icon2,
|
|
4451
4561
|
shortcutKey,
|
|
4452
4562
|
formattedName
|
|
4453
4563
|
};
|
|
@@ -4455,7 +4565,7 @@ function useMarkState(editor, type, disabled = false) {
|
|
|
4455
4565
|
var MarkButton = React16__namespace.forwardRef(
|
|
4456
4566
|
({ editor: providedEditor, type, text, hideWhenUnavailable = false, className = "", disabled, onClick, children, ...buttonProps }, ref) => {
|
|
4457
4567
|
const editor = useTiptapEditor(providedEditor);
|
|
4458
|
-
const { markInSchema, isDisabled, isActive, Icon, shortcutKey, formattedName } = useMarkState(editor, type, disabled);
|
|
4568
|
+
const { markInSchema, isDisabled, isActive, Icon: Icon2, shortcutKey, formattedName } = useMarkState(editor, type, disabled);
|
|
4459
4569
|
const handleClick = React16__namespace.useCallback(
|
|
4460
4570
|
(e) => {
|
|
4461
4571
|
onClick?.(e);
|
|
@@ -4477,7 +4587,7 @@ var MarkButton = React16__namespace.forwardRef(
|
|
|
4477
4587
|
return null;
|
|
4478
4588
|
}
|
|
4479
4589
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4480
|
-
|
|
4590
|
+
Button3,
|
|
4481
4591
|
{
|
|
4482
4592
|
type: "button",
|
|
4483
4593
|
className: className.trim(),
|
|
@@ -4495,7 +4605,7 @@ var MarkButton = React16__namespace.forwardRef(
|
|
|
4495
4605
|
...buttonProps,
|
|
4496
4606
|
ref,
|
|
4497
4607
|
children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4498
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4608
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "tiptap-button-icon" }),
|
|
4499
4609
|
text && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tiptap-button-text", children: text })
|
|
4500
4610
|
] })
|
|
4501
4611
|
}
|
|
@@ -4646,7 +4756,7 @@ function useNodeState(editor, type, disabled = false, hideWhenUnavailable = fals
|
|
|
4646
4756
|
}
|
|
4647
4757
|
return false;
|
|
4648
4758
|
}, [editor, type, isDisabled]);
|
|
4649
|
-
const
|
|
4759
|
+
const Icon2 = nodeIcons[type];
|
|
4650
4760
|
const shortcutKey = nodeShortcutKeys[type];
|
|
4651
4761
|
const label = nodeLabels[type];
|
|
4652
4762
|
return {
|
|
@@ -4656,7 +4766,7 @@ function useNodeState(editor, type, disabled = false, hideWhenUnavailable = fals
|
|
|
4656
4766
|
isActive,
|
|
4657
4767
|
shouldShow,
|
|
4658
4768
|
handleToggle,
|
|
4659
|
-
Icon,
|
|
4769
|
+
Icon: Icon2,
|
|
4660
4770
|
shortcutKey,
|
|
4661
4771
|
label
|
|
4662
4772
|
};
|
|
@@ -4664,7 +4774,7 @@ function useNodeState(editor, type, disabled = false, hideWhenUnavailable = fals
|
|
|
4664
4774
|
var NodeButton = React16__namespace.forwardRef(
|
|
4665
4775
|
({ editor: providedEditor, type, text, hideWhenUnavailable = false, className = "", disabled, onClick, children, ...buttonProps }, ref) => {
|
|
4666
4776
|
const editor = useTiptapEditor(providedEditor);
|
|
4667
|
-
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);
|
|
4668
4778
|
const handleClick = React16__namespace.useCallback(
|
|
4669
4779
|
(e) => {
|
|
4670
4780
|
onClick?.(e);
|
|
@@ -4678,7 +4788,7 @@ var NodeButton = React16__namespace.forwardRef(
|
|
|
4678
4788
|
return null;
|
|
4679
4789
|
}
|
|
4680
4790
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4681
|
-
|
|
4791
|
+
Button3,
|
|
4682
4792
|
{
|
|
4683
4793
|
type: "button",
|
|
4684
4794
|
className: className.trim(),
|
|
@@ -4696,7 +4806,7 @@ var NodeButton = React16__namespace.forwardRef(
|
|
|
4696
4806
|
...buttonProps,
|
|
4697
4807
|
ref,
|
|
4698
4808
|
children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4699
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4809
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "tiptap-button-icon" }),
|
|
4700
4810
|
text && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tiptap-button-text", children: text })
|
|
4701
4811
|
] })
|
|
4702
4812
|
}
|
|
@@ -4758,7 +4868,7 @@ var QuoteButton = React16__namespace.forwardRef(
|
|
|
4758
4868
|
);
|
|
4759
4869
|
if (!shouldShow || !editor || !editor.isEditable) return null;
|
|
4760
4870
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4761
|
-
|
|
4871
|
+
Button3,
|
|
4762
4872
|
{
|
|
4763
4873
|
type: "button",
|
|
4764
4874
|
className: className.trim(),
|
|
@@ -4976,7 +5086,7 @@ function useTextAlign(editor, align, disabled = false, hideWhenUnavailable = fal
|
|
|
4976
5086
|
return setTextAlign(editor, align);
|
|
4977
5087
|
}, [alignAvailable, editor, isDisabled, align]);
|
|
4978
5088
|
const shouldShow = React16__namespace.useMemo(() => shouldShowTextAlignButton(editor, canAlign, hideWhenUnavailable), [editor, canAlign, hideWhenUnavailable]);
|
|
4979
|
-
const
|
|
5089
|
+
const Icon2 = textAlignIcons[align];
|
|
4980
5090
|
const shortcutKey = textAlignShortcutKeys[align];
|
|
4981
5091
|
const label = textAlignLabels[align];
|
|
4982
5092
|
return {
|
|
@@ -4986,7 +5096,7 @@ function useTextAlign(editor, align, disabled = false, hideWhenUnavailable = fal
|
|
|
4986
5096
|
isActive,
|
|
4987
5097
|
handleAlignment,
|
|
4988
5098
|
shouldShow,
|
|
4989
|
-
Icon,
|
|
5099
|
+
Icon: Icon2,
|
|
4990
5100
|
shortcutKey,
|
|
4991
5101
|
label
|
|
4992
5102
|
};
|
|
@@ -4994,7 +5104,7 @@ function useTextAlign(editor, align, disabled = false, hideWhenUnavailable = fal
|
|
|
4994
5104
|
var TextAlignButton = React16__namespace.forwardRef(
|
|
4995
5105
|
({ editor: providedEditor, align, text, hideWhenUnavailable = false, className = "", disabled, onClick, children, ...buttonProps }, ref) => {
|
|
4996
5106
|
const editor = useTiptapEditor(providedEditor);
|
|
4997
|
-
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);
|
|
4998
5108
|
const handleClick = React16__namespace.useCallback(
|
|
4999
5109
|
(e) => {
|
|
5000
5110
|
onClick?.(e);
|
|
@@ -5008,7 +5118,7 @@ var TextAlignButton = React16__namespace.forwardRef(
|
|
|
5008
5118
|
return null;
|
|
5009
5119
|
}
|
|
5010
5120
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5011
|
-
|
|
5121
|
+
Button3,
|
|
5012
5122
|
{
|
|
5013
5123
|
type: "button",
|
|
5014
5124
|
className: className.trim(),
|
|
@@ -5026,7 +5136,7 @@ var TextAlignButton = React16__namespace.forwardRef(
|
|
|
5026
5136
|
...buttonProps,
|
|
5027
5137
|
ref,
|
|
5028
5138
|
children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5029
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5139
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "tiptap-button-icon" }),
|
|
5030
5140
|
text && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tiptap-button-text", children: text })
|
|
5031
5141
|
] })
|
|
5032
5142
|
}
|
|
@@ -5090,14 +5200,14 @@ function useHistoryAction(editor, action, disabled = false) {
|
|
|
5090
5200
|
if (!editor || isDisabled) return;
|
|
5091
5201
|
executeHistoryAction(editor, action);
|
|
5092
5202
|
}, [editor, action, isDisabled]);
|
|
5093
|
-
const
|
|
5203
|
+
const Icon2 = historyIcons[action];
|
|
5094
5204
|
const actionLabel = historyActionLabels[action];
|
|
5095
5205
|
const shortcutKey = historyShortcutKeys[action];
|
|
5096
5206
|
return {
|
|
5097
5207
|
canExecute,
|
|
5098
5208
|
isDisabled,
|
|
5099
5209
|
handleAction,
|
|
5100
|
-
Icon,
|
|
5210
|
+
Icon: Icon2,
|
|
5101
5211
|
actionLabel,
|
|
5102
5212
|
shortcutKey
|
|
5103
5213
|
};
|
|
@@ -5105,7 +5215,7 @@ function useHistoryAction(editor, action, disabled = false) {
|
|
|
5105
5215
|
var UndoRedoButton = React16__namespace.forwardRef(
|
|
5106
5216
|
({ editor: providedEditor, action, text, className = "", disabled, onClick, children, ...buttonProps }, ref) => {
|
|
5107
5217
|
const editor = useTiptapEditor(providedEditor);
|
|
5108
|
-
const { isDisabled, handleAction, Icon, actionLabel, shortcutKey } = useHistoryAction(editor, action, disabled);
|
|
5218
|
+
const { isDisabled, handleAction, Icon: Icon2, actionLabel, shortcutKey } = useHistoryAction(editor, action, disabled);
|
|
5109
5219
|
const handleClick = React16__namespace.useCallback(
|
|
5110
5220
|
(e) => {
|
|
5111
5221
|
onClick?.(e);
|
|
@@ -5119,7 +5229,7 @@ var UndoRedoButton = React16__namespace.forwardRef(
|
|
|
5119
5229
|
return null;
|
|
5120
5230
|
}
|
|
5121
5231
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5122
|
-
|
|
5232
|
+
Button3,
|
|
5123
5233
|
{
|
|
5124
5234
|
ref,
|
|
5125
5235
|
type: "button",
|
|
@@ -5135,7 +5245,7 @@ var UndoRedoButton = React16__namespace.forwardRef(
|
|
|
5135
5245
|
onClick: handleClick,
|
|
5136
5246
|
...buttonProps,
|
|
5137
5247
|
children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5138
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5248
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "tiptap-button-icon" }),
|
|
5139
5249
|
text && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tiptap-button-text", children: text })
|
|
5140
5250
|
] })
|
|
5141
5251
|
}
|
|
@@ -5561,7 +5671,7 @@ var MainToolbarContent = ({
|
|
|
5561
5671
|
] });
|
|
5562
5672
|
};
|
|
5563
5673
|
var MobileToolbarContent = ({ type, onBack }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5564
|
-
/* @__PURE__ */ jsxRuntime.jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5674
|
+
/* @__PURE__ */ jsxRuntime.jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxRuntime.jsxs(Button3, { "data-style": "ghost", onClick: onBack, children: [
|
|
5565
5675
|
/* @__PURE__ */ jsxRuntime.jsx(ArrowLeftIcon, { className: "tiptap-button-icon" }),
|
|
5566
5676
|
type === "highlighter" ? /* @__PURE__ */ jsxRuntime.jsx(HighlighterIcon, { className: "tiptap-button-icon" }) : /* @__PURE__ */ jsxRuntime.jsx(LinkIcon, { className: "tiptap-button-icon" })
|
|
5567
5677
|
] }) }),
|
|
@@ -5760,7 +5870,7 @@ var MarkdownEditor_default = ({
|
|
|
5760
5870
|
const downloadFile2 = () => {
|
|
5761
5871
|
onDownloadFile?.(getMarkdown(), "docx");
|
|
5762
5872
|
};
|
|
5763
|
-
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: [
|
|
5764
5874
|
showToolbar && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5765
5875
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "end", align: "center", children: [
|
|
5766
5876
|
NsToolBar({ isBubble: false }),
|
|
@@ -5776,7 +5886,7 @@ var MarkdownEditor_default = ({
|
|
|
5776
5886
|
{
|
|
5777
5887
|
editor,
|
|
5778
5888
|
role: "presentation",
|
|
5779
|
-
className:
|
|
5889
|
+
className: classNames__default.default("simple-editor-content ns-markdown", { "no-toolbar": !showToolbar })
|
|
5780
5890
|
}
|
|
5781
5891
|
) })
|
|
5782
5892
|
] }) });
|
|
@@ -5817,6 +5927,66 @@ function propsMerge(control, props) {
|
|
|
5817
5927
|
}
|
|
5818
5928
|
return null;
|
|
5819
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
|
+
};
|
|
5820
5990
|
var UserAvatar_default = ({ size, avatarSrc, userName }) => {
|
|
5821
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() });
|
|
5822
5992
|
};
|
|
@@ -5827,6 +5997,7 @@ exports.DEFAULT_DATE_FORMAT = DEFAULT_DATE_FORMAT;
|
|
|
5827
5997
|
exports.DEFAULT_DATE_TIME_FORMAT = DEFAULT_DATE_TIME_FORMAT;
|
|
5828
5998
|
exports.DEFAULT_YEAR_MONTH_DAY_FORMAT = DEFAULT_YEAR_MONTH_DAY_FORMAT;
|
|
5829
5999
|
exports.DEFAULT_YEAR_MONTH_FORMAT = DEFAULT_YEAR_MONTH_FORMAT;
|
|
6000
|
+
exports.DocxPreview = DocxPreview_default;
|
|
5830
6001
|
exports.FileIcon = FileIcon_default;
|
|
5831
6002
|
exports.FilePreview = FilePreview_default;
|
|
5832
6003
|
exports.FilePreviewDrawer = FilePreviewDrawer_default;
|
|
@@ -5851,6 +6022,7 @@ exports.RegTaxNo = RegTaxNo;
|
|
|
5851
6022
|
exports.RegTelePhone = RegTelePhone;
|
|
5852
6023
|
exports.RenderMarkdown = RenderMarkdown_default;
|
|
5853
6024
|
exports.RenderWrapper = RenderWrapper_default;
|
|
6025
|
+
exports.SpeechButton = SpeechButton_default;
|
|
5854
6026
|
exports.ThanNumLengthValidator = ThanNumLengthValidator;
|
|
5855
6027
|
exports.ThanNumValidator = ThanNumValidator;
|
|
5856
6028
|
exports.UserAvatar = UserAvatar_default;
|
|
@@ -5880,7 +6052,6 @@ exports.emit = emit;
|
|
|
5880
6052
|
exports.emitToChild = emitToChild;
|
|
5881
6053
|
exports.executeScript = executeScript;
|
|
5882
6054
|
exports.formatDate = formatDate;
|
|
5883
|
-
exports.formatKB = formatKB;
|
|
5884
6055
|
exports.formatNumberWithCommas = formatNumberWithCommas;
|
|
5885
6056
|
exports.formatSize = formatSize;
|
|
5886
6057
|
exports.genNonDuplicateID = genNonDuplicateID;
|
|
@@ -5945,6 +6116,7 @@ exports.useDebounce = useDebounce_default;
|
|
|
5945
6116
|
exports.useDeepEffect = useDeepEffect_default;
|
|
5946
6117
|
exports.useIframeRelayBridge = useIframeRelayBridge_default;
|
|
5947
6118
|
exports.useRefState = useRefState_default;
|
|
6119
|
+
exports.useSpeech = useSpeech_default;
|
|
5948
6120
|
exports.useSyncInput = useSyncInput_default;
|
|
5949
6121
|
exports.useThrottle = useThrottle_default;
|
|
5950
6122
|
exports.useWebSocket = useWebSocket_default;
|