@zero-library/common 3.1.4 → 3.1.6
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 +956 -255
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.mts +618 -34
- package/dist/index.d.ts +618 -34
- package/dist/index.esm.js +944 -255
- package/dist/index.esm.js.map +1 -1
- package/package.json +4 -2
package/dist/index.esm.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { createInstance } from 'i18next';
|
|
2
|
+
import { initReactI18next, useTranslation as useTranslation$1 } from 'react-i18next';
|
|
3
3
|
import { Typography, Spin, Input, Tooltip as Tooltip$1, Button, Flex, Form, Card, List, Space, Popconfirm, Empty, Modal, message, Alert, Skeleton, Result, Splitter, Image as Image$1, Drawer, Avatar, notification } from 'antd';
|
|
4
|
-
import classNames2 from 'classnames';
|
|
5
|
-
import { renderAsync } from 'docx-preview';
|
|
6
|
-
import * as React3 from 'react';
|
|
7
|
-
import React3__default, { useRef, useState, useEffect, forwardRef, useMemo, useCallback, createContext, isValidElement, version, cloneElement, memo, useImperativeHandle, useContext, Fragment as Fragment$1, lazy, Suspense } from 'react';
|
|
8
4
|
import copyToClipboard from 'copy-to-clipboard';
|
|
9
5
|
import AES from 'crypto-js/aes';
|
|
10
6
|
import encUtf8 from 'crypto-js/enc-utf8';
|
|
@@ -20,6 +16,12 @@ import Decimal from 'decimal.js';
|
|
|
20
16
|
import dayjs from 'dayjs';
|
|
21
17
|
import relativeTime from 'dayjs/plugin/relativeTime';
|
|
22
18
|
import axios from 'axios';
|
|
19
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
20
|
+
import { MessageOutlined, BookOutlined, EditOutlined, DeleteOutlined, CloseOutlined, MinusCircleOutlined, PlusCircleOutlined, RedoOutlined, FileUnknownOutlined, FileZipOutlined, FileMarkdownOutlined, FileGifOutlined, FileImageOutlined, FileJpgOutlined, NotificationOutlined, VideoCameraOutlined, FilePptOutlined, FileExcelOutlined, FileWordOutlined, FilePdfOutlined, FileTextOutlined, ColumnWidthOutlined, LeftOutlined, RightOutlined, MinusOutlined, PlusOutlined } from '@ant-design/icons';
|
|
21
|
+
import classNames2 from 'classnames';
|
|
22
|
+
import { renderAsync } from 'docx-preview';
|
|
23
|
+
import * as React3 from 'react';
|
|
24
|
+
import React3__default, { useRef, useState, useEffect, forwardRef, useMemo, useCallback, createContext, isValidElement, version, cloneElement, memo, useImperativeHandle, useContext, Fragment as Fragment$1, lazy, Suspense } from 'react';
|
|
23
25
|
import markdownItKatex from '@traptitech/markdown-it-katex';
|
|
24
26
|
import parse from 'html-react-parser';
|
|
25
27
|
import 'katex/dist/katex.min.css';
|
|
@@ -64,44 +66,7 @@ import { useHotkeys } from 'react-hotkeys-hook';
|
|
|
64
66
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
65
67
|
import throttle from 'lodash.throttle';
|
|
66
68
|
|
|
67
|
-
// src/
|
|
68
|
-
var styles_module_default = {
|
|
69
|
-
nsPreviewImage: "styles_module_nsPreviewImage",
|
|
70
|
-
nsPreviewPdf: "styles_module_nsPreviewPdf",
|
|
71
|
-
pdfToolbar: "styles_module_pdfToolbar",
|
|
72
|
-
nsPreviewPdfImage: "styles_module_nsPreviewPdfImage",
|
|
73
|
-
pdfImageNav: "styles_module_pdfImageNav",
|
|
74
|
-
pdfImageNavItem: "styles_module_pdfImageNavItem",
|
|
75
|
-
pdfImageNavItemImgWrapper: "styles_module_pdfImageNavItemImgWrapper",
|
|
76
|
-
pdfImageNavItemActive: "styles_module_pdfImageNavItemActive",
|
|
77
|
-
pdfImageNavItemImg: "styles_module_pdfImageNavItemImg",
|
|
78
|
-
pdfImageNavItemTip: "styles_module_pdfImageNavItemTip",
|
|
79
|
-
pdfImageBody: "styles_module_pdfImageBody",
|
|
80
|
-
pdfImageBodyToolbar: "styles_module_pdfImageBodyToolbar",
|
|
81
|
-
pdfImageBodyItem: "styles_module_pdfImageBodyItem",
|
|
82
|
-
pdfImageBodyItemInnerWrapper: "styles_module_pdfImageBodyItemInnerWrapper",
|
|
83
|
-
pdfImageBodyItemInner: "styles_module_pdfImageBodyItemInner",
|
|
84
|
-
pdfImageBodyItemActive: "styles_module_pdfImageBodyItemActive",
|
|
85
|
-
pdfImageBodyItemImg: "styles_module_pdfImageBodyItemImg",
|
|
86
|
-
nsPreviewVideo: "styles_module_nsPreviewVideo",
|
|
87
|
-
nsPreviewAudio: "styles_module_nsPreviewAudio",
|
|
88
|
-
nsPreviewDocx: "styles_module_nsPreviewDocx",
|
|
89
|
-
docxToolbar: "styles_module_docxToolbar",
|
|
90
|
-
docxContent: "styles_module_docxContent",
|
|
91
|
-
stateBody: "styles_module_stateBody",
|
|
92
|
-
pdfContainer: "styles_module_pdfContainer",
|
|
93
|
-
floatingToolbar: "styles_module_floatingToolbar",
|
|
94
|
-
divider: "styles_module_divider",
|
|
95
|
-
pdfBody: "styles_module_pdfBody",
|
|
96
|
-
pdfDocument: "styles_module_pdfDocument",
|
|
97
|
-
pdfPage: "styles_module_pdfPage"
|
|
98
|
-
};
|
|
99
|
-
var AudioPlayer_default = ({ fileUrl }) => {
|
|
100
|
-
return /* @__PURE__ */ jsxs("audio", { controls: true, className: styles_module_default.nsPreviewAudio, children: [
|
|
101
|
-
/* @__PURE__ */ jsx("source", { src: fileUrl, type: "audio/mpeg" }),
|
|
102
|
-
"\u60A8\u7684\u6D4F\u89C8\u5668\u4E0D\u652F\u6301 audio \u6807\u7B7E\u3002"
|
|
103
|
-
] }, fileUrl);
|
|
104
|
-
};
|
|
69
|
+
// src/i18n/index.ts
|
|
105
70
|
|
|
106
71
|
// src/utils/is.ts
|
|
107
72
|
var toString = Object.prototype.toString;
|
|
@@ -436,7 +401,7 @@ var arrToObj = (arr = [], key) => {
|
|
|
436
401
|
});
|
|
437
402
|
return obj;
|
|
438
403
|
};
|
|
439
|
-
var setInterval2 = (fn,
|
|
404
|
+
var setInterval2 = (fn, t2) => {
|
|
440
405
|
let timer = null;
|
|
441
406
|
let running = true;
|
|
442
407
|
const loop = () => {
|
|
@@ -444,7 +409,7 @@ var setInterval2 = (fn, t) => {
|
|
|
444
409
|
if (!running) return;
|
|
445
410
|
await fn();
|
|
446
411
|
if (running) loop();
|
|
447
|
-
},
|
|
412
|
+
}, t2);
|
|
448
413
|
};
|
|
449
414
|
loop();
|
|
450
415
|
return {
|
|
@@ -468,9 +433,9 @@ var genNonDuplicateID = () => {
|
|
|
468
433
|
return v.toString(16);
|
|
469
434
|
});
|
|
470
435
|
};
|
|
471
|
-
var copyText = async (text, prompt
|
|
436
|
+
var copyText = async (text, prompt) => {
|
|
472
437
|
await copyToClipboard(text);
|
|
473
|
-
if (prompt) message.success(prompt);
|
|
438
|
+
if (prompt !== "") message.success(prompt || t("common.copySuccess"));
|
|
474
439
|
};
|
|
475
440
|
function formatNumberWithCommas(number) {
|
|
476
441
|
const numericValue = parseFloat(number);
|
|
@@ -557,7 +522,7 @@ var buildUrlParams = (obj, url, format = "repeat") => {
|
|
|
557
522
|
};
|
|
558
523
|
var downloadFile = (url, name) => {
|
|
559
524
|
const a = document.createElement("a");
|
|
560
|
-
a.download = name || "
|
|
525
|
+
a.download = name || t("common.defaultFileName");
|
|
561
526
|
a.href = url;
|
|
562
527
|
document.body.appendChild(a);
|
|
563
528
|
a.click();
|
|
@@ -914,7 +879,7 @@ var isExpire = (date) => {
|
|
|
914
879
|
};
|
|
915
880
|
var createCachedMessage = () => {
|
|
916
881
|
const messageCache = {};
|
|
917
|
-
return ({ title = "
|
|
882
|
+
return ({ title = t("common.defaultTitle"), content, type = "warning", duration = 3, onClose, isCache = true, isOnly = false }) => {
|
|
918
883
|
if (!content) return;
|
|
919
884
|
const cacheKey = isOnly ? "unique-message-key" : content;
|
|
920
885
|
const handleClose = () => {
|
|
@@ -958,50 +923,72 @@ var cachedMessage = createCachedMessage();
|
|
|
958
923
|
// src/utils/pattern.ts
|
|
959
924
|
var RegMobile = {
|
|
960
925
|
pattern: /^1[3-9]\d{9}$/,
|
|
961
|
-
message
|
|
926
|
+
get message() {
|
|
927
|
+
return t("pattern.mobileInvalid");
|
|
928
|
+
}
|
|
962
929
|
};
|
|
963
930
|
var RegFixedTelePhone = {
|
|
964
931
|
pattern: /^0\d{2,3}-\d{7,8}$/,
|
|
965
|
-
message
|
|
932
|
+
get message() {
|
|
933
|
+
return t("pattern.phoneInvalid");
|
|
934
|
+
}
|
|
966
935
|
};
|
|
967
936
|
var RegTelePhone = {
|
|
968
937
|
pattern: /^[\\+\-\\(\\)\\(\\)\d]{1,20}$/,
|
|
969
|
-
message
|
|
938
|
+
get message() {
|
|
939
|
+
return t("pattern.phoneInvalid");
|
|
940
|
+
}
|
|
970
941
|
};
|
|
971
942
|
var RegTaxNo = {
|
|
972
943
|
pattern: /^[A-Z0-9]{15}$|^[A-Z0-9]{18}$|^[A-Z0-9]{20}$/,
|
|
973
|
-
message
|
|
944
|
+
get message() {
|
|
945
|
+
return t("pattern.taxNoInvalid");
|
|
946
|
+
}
|
|
974
947
|
};
|
|
975
948
|
var RegBankCardNo = {
|
|
976
949
|
pattern: /^[0-9]*$/,
|
|
977
|
-
message
|
|
950
|
+
get message() {
|
|
951
|
+
return t("pattern.bankCardInvalid");
|
|
952
|
+
}
|
|
978
953
|
};
|
|
979
954
|
var RegIdentityCardNo = {
|
|
980
955
|
pattern: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
|
|
981
|
-
message
|
|
956
|
+
get message() {
|
|
957
|
+
return t("pattern.idCardInvalid");
|
|
958
|
+
}
|
|
982
959
|
};
|
|
983
960
|
var RegNumNo = {
|
|
984
961
|
pattern: /^[0-9]*$/,
|
|
985
|
-
message
|
|
962
|
+
get message() {
|
|
963
|
+
return t("pattern.numberInvalid");
|
|
964
|
+
}
|
|
986
965
|
};
|
|
987
966
|
var RegSmsCode = {
|
|
988
967
|
pattern: /^[0-9]{6}$/,
|
|
989
|
-
message
|
|
968
|
+
get message() {
|
|
969
|
+
return t("pattern.smsCodeInvalid");
|
|
970
|
+
}
|
|
990
971
|
};
|
|
991
972
|
var RegEmail = {
|
|
992
973
|
pattern: /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,
|
|
993
|
-
message
|
|
974
|
+
get message() {
|
|
975
|
+
return t("pattern.emailInvalid");
|
|
976
|
+
}
|
|
994
977
|
};
|
|
995
978
|
var RegDetailAddress = {
|
|
996
979
|
pattern: /.*(街|路|村|乡|镇|道|巷|号).*/,
|
|
997
|
-
message
|
|
980
|
+
get message() {
|
|
981
|
+
return t("pattern.addressInvalid");
|
|
982
|
+
}
|
|
998
983
|
};
|
|
999
984
|
var RegPassword = {
|
|
1000
985
|
pattern: /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,26}$/,
|
|
1001
|
-
message
|
|
986
|
+
get message() {
|
|
987
|
+
return t("pattern.passwordInvalid");
|
|
988
|
+
}
|
|
1002
989
|
};
|
|
1003
|
-
var PhoneOrMobileValidator = (errMessage
|
|
1004
|
-
validator: (_, value) => !value || RegFixedTelePhone.pattern.test(value) || RegMobile.pattern.test(value) ? Promise.resolve() : Promise.reject(new Error(errMessage))
|
|
990
|
+
var PhoneOrMobileValidator = (errMessage) => ({
|
|
991
|
+
validator: (_, value) => !value || RegFixedTelePhone.pattern.test(value) || RegMobile.pattern.test(value) ? Promise.resolve() : Promise.reject(new Error(errMessage || t("pattern.phoneOrMobileInvalid")))
|
|
1005
992
|
});
|
|
1006
993
|
var ThanNumValidator = ({
|
|
1007
994
|
min,
|
|
@@ -1018,12 +1005,12 @@ var ThanNumValidator = ({
|
|
|
1018
1005
|
}
|
|
1019
1006
|
if (isNumberNoNaN(parseFloat(min))) {
|
|
1020
1007
|
if (!(Number(value) > Number(min) || equalMin && Number(value) === Number(min))) {
|
|
1021
|
-
return Promise.reject(new Error(minErrMessage || errMessage ||
|
|
1008
|
+
return Promise.reject(new Error(minErrMessage || errMessage || t(equalMin ? "lessThanOrEqual" : "lessThan", { value: min })));
|
|
1022
1009
|
}
|
|
1023
1010
|
}
|
|
1024
1011
|
if (isNumberNoNaN(parseFloat(max))) {
|
|
1025
1012
|
if (!(Number(value) < Number(max) || equalMax && Number(value) === Number(max))) {
|
|
1026
|
-
return Promise.reject(new Error(maxErrMessage || errMessage ||
|
|
1013
|
+
return Promise.reject(new Error(maxErrMessage || errMessage || t(equalMax ? "greaterThanOrEqual" : "greaterThan", { value: max })));
|
|
1027
1014
|
}
|
|
1028
1015
|
}
|
|
1029
1016
|
return Promise.resolve();
|
|
@@ -1043,17 +1030,17 @@ var ThanNumLengthValidator = ({
|
|
|
1043
1030
|
}
|
|
1044
1031
|
if (isNumber(length)) {
|
|
1045
1032
|
if (precision(value) > length) {
|
|
1046
|
-
return Promise.reject(new Error(lengthErrMessage ||
|
|
1033
|
+
return Promise.reject(new Error(lengthErrMessage || t("pattern.totalLengthExceed", { length })));
|
|
1047
1034
|
}
|
|
1048
1035
|
}
|
|
1049
1036
|
if (isNumber(integerLength)) {
|
|
1050
1037
|
if (precision(value) - decimalPlaces(value) > integerLength) {
|
|
1051
|
-
return Promise.reject(new Error(integerLengthErrMessage ||
|
|
1038
|
+
return Promise.reject(new Error(integerLengthErrMessage || t("pattern.integerLengthExceed", { length: integerLength })));
|
|
1052
1039
|
}
|
|
1053
1040
|
}
|
|
1054
1041
|
if (isNumber(decimalsLength)) {
|
|
1055
1042
|
if (decimalPlaces(value) > decimalsLength) {
|
|
1056
|
-
return Promise.reject(new Error(decimalsLengthErrMessage ||
|
|
1043
|
+
return Promise.reject(new Error(decimalsLengthErrMessage || t("pattern.decimalLengthExceed", { length: decimalsLength })));
|
|
1057
1044
|
}
|
|
1058
1045
|
}
|
|
1059
1046
|
return Promise.resolve();
|
|
@@ -1063,7 +1050,7 @@ var MultiEmailValidator = (max) => ({
|
|
|
1063
1050
|
validator: (_, value) => {
|
|
1064
1051
|
if (value) {
|
|
1065
1052
|
const emailArr = value.split(",").map((v) => v.trim()).filter((v) => v);
|
|
1066
|
-
if (emailArr.length > max) return Promise.reject(new Error(
|
|
1053
|
+
if (emailArr.length > max) return Promise.reject(new Error(t("pattern.maxEmailsExceed", { max })));
|
|
1067
1054
|
const noEmailArr = emailArr.filter((email) => !RegEmail.pattern.test(email));
|
|
1068
1055
|
if (noEmailArr.length) return Promise.reject(new Error(RegEmail.message));
|
|
1069
1056
|
}
|
|
@@ -1131,14 +1118,14 @@ function createRequest(config) {
|
|
|
1131
1118
|
return Promise.reject(err);
|
|
1132
1119
|
}
|
|
1133
1120
|
if (!err.response) {
|
|
1134
|
-
if (showError(err?.config?.showError)) cachedMessage({ content: "
|
|
1121
|
+
if (showError(err?.config?.showError)) cachedMessage({ content: t("request.networkError"), type: "error" });
|
|
1135
1122
|
} else {
|
|
1136
1123
|
switch (err.response?.status) {
|
|
1137
1124
|
case HttpStatus.UNAUTHORIZED:
|
|
1138
1125
|
if (showError(err?.config?.showError)) cachedMessage({ content: err.response?.data.message, type: "error" });
|
|
1139
1126
|
break;
|
|
1140
1127
|
default:
|
|
1141
|
-
if (showError(err?.config?.showError)) cachedMessage({ content: err.response?.data.message || "
|
|
1128
|
+
if (showError(err?.config?.showError)) cachedMessage({ content: err.response?.data.message || t("request.requestError"), type: "error" });
|
|
1142
1129
|
}
|
|
1143
1130
|
}
|
|
1144
1131
|
return Promise.reject(err);
|
|
@@ -1253,7 +1240,650 @@ function createTokenManager({ key, storage = localStorage }) {
|
|
|
1253
1240
|
clear: tokenManager.clear
|
|
1254
1241
|
};
|
|
1255
1242
|
}
|
|
1243
|
+
|
|
1244
|
+
// src/i18n/constants.ts
|
|
1245
|
+
var NS_COMMON = "common";
|
|
1246
|
+
|
|
1247
|
+
// src/i18n/zh-CN.ts
|
|
1248
|
+
var commonZhCN = {
|
|
1249
|
+
// 通用文案
|
|
1250
|
+
common: {
|
|
1251
|
+
copySuccess: "\u590D\u5236\u6210\u529F",
|
|
1252
|
+
confirm: "\u786E\u5B9A",
|
|
1253
|
+
cancel: "\u53D6\u6D88",
|
|
1254
|
+
download: "\u4E0B\u8F7D",
|
|
1255
|
+
save: "\u4FDD\u5B58",
|
|
1256
|
+
defaultFileName: "\u6587\u4EF6",
|
|
1257
|
+
defaultTitle: "\u63D0\u793A",
|
|
1258
|
+
loading: "\u52A0\u8F7D\u4E2D..."
|
|
1259
|
+
},
|
|
1260
|
+
// utils/request.ts
|
|
1261
|
+
request: {
|
|
1262
|
+
networkError: "\u7F51\u7EDC\u5F02\u5E38\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC",
|
|
1263
|
+
requestError: "\u8BF7\u6C42\u9519\u8BEF\uFF01"
|
|
1264
|
+
},
|
|
1265
|
+
// utils/pattern.ts — 验证消息
|
|
1266
|
+
pattern: {
|
|
1267
|
+
mobileInvalid: "\u624B\u673A\u53F7\u683C\u5F0F\u4E0D\u6B63\u786E\uFF01",
|
|
1268
|
+
phoneInvalid: "\u7535\u8BDD\u53F7\u7801\u683C\u5F0F\u4E0D\u6B63\u786E\uFF01",
|
|
1269
|
+
taxNoInvalid: "\u7A0E\u53F7\u683C\u5F0F\u6709\u8BEF\uFF01",
|
|
1270
|
+
bankCardInvalid: "\u94F6\u884C\u5361\u53F7\u683C\u5F0F\u6709\u8BEF\uFF01",
|
|
1271
|
+
idCardInvalid: "\u8EAB\u4EFD\u8BC1\u53F7\u683C\u5F0F\u6709\u8BEF\uFF01",
|
|
1272
|
+
numberInvalid: "\u683C\u5F0F\u6709\u8BEF\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165\uFF01",
|
|
1273
|
+
smsCodeInvalid: "\u9A8C\u8BC1\u7801\u4E3A6\u4F4D\u6570\u5B57",
|
|
1274
|
+
emailInvalid: "\u90AE\u7BB1\u683C\u5F0F\u6709\u8BEF\uFF01",
|
|
1275
|
+
addressInvalid: '\u5FC5\u987B\u5305\u542B"\u8857\u3001\u8DEF\u3001\u6751\u3001\u4E61\u3001\u9547\u3001\u9053\u3001\u5DF7\u3001\u53F7"\u7B49\u5173\u952E\u8BCD\u4E4B\u4E00',
|
|
1276
|
+
passwordInvalid: "\u5BC6\u7801\u4E3A8\u523026\u4F4D\u4E4B\u95F4\u6570\u5B57\u4E0E\u5B57\u6BCD\u7EC4\u5408",
|
|
1277
|
+
phoneOrMobileInvalid: "\u8054\u7CFB\u7535\u8BDD\u683C\u5F0F\u4E0D\u6B63\u786E",
|
|
1278
|
+
// 插值示例:{{value}} 会被替换为实际值
|
|
1279
|
+
lessThan: "\u4E0D\u80FD\u5C0F\u4E8E{{value}}",
|
|
1280
|
+
lessThanOrEqual: "\u4E0D\u80FD\u5C0F\u4E8E\u7B49\u4E8E{{value}}",
|
|
1281
|
+
greaterThan: "\u4E0D\u80FD\u5927\u4E8E{{value}}",
|
|
1282
|
+
greaterThanOrEqual: "\u4E0D\u80FD\u5927\u4E8E\u7B49\u4E8E{{value}}",
|
|
1283
|
+
totalLengthExceed: "\u603B\u4F4D\u6570\u4E0D\u80FD\u8D85\u8FC7{{length}}\u4F4D",
|
|
1284
|
+
integerLengthExceed: "\u6574\u6570\u4F4D\u4E0D\u80FD\u8D85\u8FC7{{length}}\u4F4D",
|
|
1285
|
+
decimalLengthExceed: "\u5C0F\u6570\u4F4D\u4E0D\u80FD\u8D85\u8FC7{{length}}\u4F4D",
|
|
1286
|
+
maxEmailsExceed: "\u6700\u591A\u8F93\u5165{{max}}\u4E2A\u90AE\u7BB1"
|
|
1287
|
+
},
|
|
1288
|
+
// utils/date.ts
|
|
1289
|
+
date: {
|
|
1290
|
+
yearMonthFormat: "YYYY\u5E74MM\u6708",
|
|
1291
|
+
yearMonthDayFormat: "YYYY\u5E74MM\u6708DD\u65E5"
|
|
1292
|
+
},
|
|
1293
|
+
// SpeechButton 语音按钮
|
|
1294
|
+
speechButton: {
|
|
1295
|
+
notSupported: "\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u8BED\u97F3\u8BC6\u522B",
|
|
1296
|
+
permissionDenied: "\u9EA6\u514B\u98CE\u6743\u9650\u5DF2\u62D2\u7EDD",
|
|
1297
|
+
stop: "\u505C\u6B62\u5F55\u97F3",
|
|
1298
|
+
start: "\u70B9\u51FB\u5F00\u59CB\u5F55\u97F3"
|
|
1299
|
+
},
|
|
1300
|
+
// MicroApp / Iframe
|
|
1301
|
+
microApp: {
|
|
1302
|
+
loading: "\u52A0\u8F7D\u4E2D..."
|
|
1303
|
+
},
|
|
1304
|
+
iframe: {
|
|
1305
|
+
loading: "\u52A0\u8F7D\u4E2D..."
|
|
1306
|
+
},
|
|
1307
|
+
// LazyComponent 延时加载组件
|
|
1308
|
+
lazyComponent: {
|
|
1309
|
+
unknownType: "\u672A\u77E5\u7C7B\u578B\uFF1A{{type}}",
|
|
1310
|
+
componentLoading: "\u7EC4\u4EF6\u52A0\u8F7D\u4E2D..."
|
|
1311
|
+
},
|
|
1312
|
+
// File 文件预览组件群
|
|
1313
|
+
filePreview: {
|
|
1314
|
+
title: "\u6587\u4EF6\u9884\u89C8",
|
|
1315
|
+
closePreview: "\u5173\u95ED\u9884\u89C8",
|
|
1316
|
+
previewImageAlt: "\u9884\u89C8\u56FE\u7247",
|
|
1317
|
+
previewNotSupported: "\u6682\u4E0D\u652F\u6301 {{suffix}} \u6587\u4EF6\u7684\u9884\u89C8",
|
|
1318
|
+
previewNotSupportedDownload: "{{suffix}} \u6587\u4EF6\u6682\u4E0D\u652F\u6301\u5728\u7EBF\u9884\u89C8\uFF0C\u8BF7\u4E0B\u8F7D\u6253\u5F00",
|
|
1319
|
+
previewGenerating: "\u9884\u89C8\u6587\u4EF6\u6B63\u5728\u751F\u6210\u4E2D...",
|
|
1320
|
+
audioNotSupported: "\u60A8\u7684\u6D4F\u89C8\u5668\u4E0D\u652F\u6301 audio \u6807\u7B7E\u3002",
|
|
1321
|
+
videoNotSupported: "\u60A8\u7684\u6D4F\u89C8\u5668\u4E0D\u652F\u6301 video \u6807\u7B7E\u3002",
|
|
1322
|
+
requestFailedWithStatus: "\u8BF7\u6C42\u5931\u8D25\uFF0C\u72B6\u6001\u7801: {{status}}",
|
|
1323
|
+
emptyResponse: "\u8FD4\u56DE\u5185\u5BB9\u4E3A\u7A7A",
|
|
1324
|
+
loadFileFailed: "\u52A0\u8F7D\u6587\u4EF6\u5931\u8D25",
|
|
1325
|
+
fileParseFailed: "\u52A0\u8F7D\u6216\u89E3\u6790\u6587\u4EF6\u5931\u8D25",
|
|
1326
|
+
fileUrlInvalid: "\u6587\u4EF6\u5730\u5740\u9519\u8BEF",
|
|
1327
|
+
htmlParseFailed: "\u52A0\u8F7D\u6216\u89E3\u6790 HTML \u5931\u8D25",
|
|
1328
|
+
docLoadFailed: "\u6587\u6863\u52A0\u8F7D\u5931\u8D25",
|
|
1329
|
+
pdfLoadFailed: "PDF \u52A0\u8F7D\u5931\u8D25",
|
|
1330
|
+
pdfParseFailed: "\u52A0\u8F7D\u6216\u89E3\u6790 pdf \u5931\u8D25",
|
|
1331
|
+
pdfUrlInvalid: "pdf\u5730\u5740\u9519\u8BEF",
|
|
1332
|
+
pdfPasswordInvalid: "\u5BC6\u7801\u65E0\u6548\u3002\u8BF7\u518D\u8BD5\u4E00\u6B21\uFF01",
|
|
1333
|
+
pdfPasswordPlaceholder: "\u8BF7\u8F93\u5165\u5BC6\u7801",
|
|
1334
|
+
pdfSubmit: "\u63D0 \u4EA4",
|
|
1335
|
+
pdfInvalidOrDamaged: "\u6587\u4EF6\u65E0\u6548\u6216\u5DF2\u635F\u574F",
|
|
1336
|
+
pdfFileNotFound: "\u6587\u4EF6\u4E0D\u5B58\u5728",
|
|
1337
|
+
pdfUnexpectedResponse: "\u610F\u5916\u7684\u670D\u52A1\u5668\u54CD\u5E94",
|
|
1338
|
+
pdfLoadDocumentFailed: "\u65E0\u6CD5\u52A0\u8F7D\u6587\u6863",
|
|
1339
|
+
zoomOut: "\u7F29\u5C0F",
|
|
1340
|
+
zoomIn: "\u653E\u5927",
|
|
1341
|
+
zoomReset: "\u8FD8\u539F",
|
|
1342
|
+
fitWidth: "\u9002\u5E94\u5BBD\u5EA6"
|
|
1343
|
+
},
|
|
1344
|
+
// MarkdownEditor 富文本编辑器
|
|
1345
|
+
markdownEditor: {
|
|
1346
|
+
mainArea: "\u4E3B\u5185\u5BB9\u533A\u57DF\uFF0C\u5F00\u59CB\u8F93\u5165\u6587\u672C...",
|
|
1347
|
+
unknown: "\u672A\u77E5",
|
|
1348
|
+
// 工具栏
|
|
1349
|
+
toolbar: {
|
|
1350
|
+
quote: "\u5F15\u7528\u9009\u4E2D\u6587\u672C",
|
|
1351
|
+
annotation: "\u6279\u6CE8",
|
|
1352
|
+
excerpt: "\u6458\u5F55\u7B14\u8BB0",
|
|
1353
|
+
undo: "\u64A4\u9500",
|
|
1354
|
+
redo: "\u91CD\u505A",
|
|
1355
|
+
alignLeft: "\u5DE6\u5BF9\u9F50",
|
|
1356
|
+
alignCenter: "\u5C45\u4E2D\u5BF9\u9F50",
|
|
1357
|
+
alignRight: "\u53F3\u5BF9\u9F50",
|
|
1358
|
+
alignJustify: "\u4E24\u7AEF\u5BF9\u9F50",
|
|
1359
|
+
bold: "\u7C97\u4F53",
|
|
1360
|
+
italic: "\u659C\u4F53",
|
|
1361
|
+
underline: "\u4E0B\u5212\u7EBF",
|
|
1362
|
+
strike: "\u5220\u9664\u7EBF",
|
|
1363
|
+
code: "\u4EE3\u7801",
|
|
1364
|
+
superscript: "\u4E0A\u89D2\u6807",
|
|
1365
|
+
subscript: "\u4E0B\u89D2\u6807",
|
|
1366
|
+
bulletList: "\u65E0\u5E8F\u5217\u8868",
|
|
1367
|
+
orderedList: "\u6709\u5E8F\u5217\u8868",
|
|
1368
|
+
taskList: "\u4EFB\u52A1\u5217\u8868",
|
|
1369
|
+
listOptions: "\u5217\u8868\u9009\u9879",
|
|
1370
|
+
list: "\u5217\u8868",
|
|
1371
|
+
blockquote: "\u5F15\u7528\u5757",
|
|
1372
|
+
codeBlock: "\u4EE3\u7801\u5757",
|
|
1373
|
+
heading: "\u6807\u9898",
|
|
1374
|
+
headingLevel: "\u6807\u9898 {{level}}",
|
|
1375
|
+
addImage: "\u6DFB\u52A0\u56FE\u7247",
|
|
1376
|
+
link: "\u94FE\u63A5",
|
|
1377
|
+
linkPlaceholder: "\u7C98\u8D34\u94FE\u63A5...",
|
|
1378
|
+
applyLink: "\u5E94\u7528\u94FE\u63A5",
|
|
1379
|
+
openInNewWindow: "\u5728\u65B0\u7A97\u53E3\u4E2D\u6253\u5F00",
|
|
1380
|
+
removeLink: "\u79FB\u9664\u94FE\u63A5"
|
|
1381
|
+
},
|
|
1382
|
+
// 高亮 / 背景色
|
|
1383
|
+
highlight: {
|
|
1384
|
+
toggle: "\u5207\u6362\u9AD8\u4EAE\u663E\u793A ({{color}})",
|
|
1385
|
+
label: "\u80CC\u666F\u8272",
|
|
1386
|
+
textLabel: "\u6587\u672C\u80CC\u666F\u8272",
|
|
1387
|
+
removeBackground: "\u79FB\u9664\u80CC\u666F",
|
|
1388
|
+
removeHighlight: "\u79FB\u9664\u9AD8\u4EAE",
|
|
1389
|
+
default: "\u9ED8\u8BA4\u80CC\u666F",
|
|
1390
|
+
gray: "\u7070\u8272\u80CC\u666F",
|
|
1391
|
+
brown: "\u68D5\u8272\u80CC\u666F",
|
|
1392
|
+
orange: "\u6A59\u8272\u80CC\u666F",
|
|
1393
|
+
yellow: "\u9EC4\u8272\u80CC\u666F",
|
|
1394
|
+
green: "\u7EFF\u8272\u80CC\u666F",
|
|
1395
|
+
blue: "\u84DD\u8272\u80CC\u666F",
|
|
1396
|
+
purple: "\u7D2B\u8272\u80CC\u666F",
|
|
1397
|
+
pink: "\u7C89\u8272\u80CC\u666F",
|
|
1398
|
+
red: "\u7EA2\u8272\u80CC\u666F"
|
|
1399
|
+
},
|
|
1400
|
+
// 批注
|
|
1401
|
+
annotation: {
|
|
1402
|
+
title: "\u6279\u6CE8",
|
|
1403
|
+
list: "\u6279\u6CE8\u5217\u8868",
|
|
1404
|
+
add: "\u6DFB\u52A0\u6279\u6CE8",
|
|
1405
|
+
content: "\u6279\u6CE8\u5185\u5BB9",
|
|
1406
|
+
required: "\u8BF7\u8F93\u5165\u6279\u6CE8\u5185\u5BB9",
|
|
1407
|
+
maxLength: "\u6279\u6CE8\u5185\u5BB9\u4E0D\u80FD\u8D85\u8FC7500\u4E2A\u5B57\u7B26",
|
|
1408
|
+
placeholder: "\u8BF7\u8F93\u5165\u60A8\u7684\u6279\u6CE8\u5185\u5BB9...",
|
|
1409
|
+
edit: "\u7F16\u8F91\u6279\u6CE8",
|
|
1410
|
+
delete: "\u5220\u9664\u6279\u6CE8",
|
|
1411
|
+
confirmDelete: "\u786E\u8BA4\u5220\u9664\u5F53\u524D\u6279\u6CE8\u5417?",
|
|
1412
|
+
empty: "\u6682\u65E0\u6279\u6CE8"
|
|
1413
|
+
},
|
|
1414
|
+
// 摘录
|
|
1415
|
+
collection: {
|
|
1416
|
+
title: "\u6458\u5F55",
|
|
1417
|
+
list: "\u6458\u5F55\u5217\u8868",
|
|
1418
|
+
delete: "\u5220\u9664\u6458\u5F55",
|
|
1419
|
+
confirmDelete: "\u786E\u8BA4\u5220\u9664\u5F53\u524D\u6458\u5F55\u5417?",
|
|
1420
|
+
empty: "\u6682\u65E0\u6458\u5F55"
|
|
1421
|
+
},
|
|
1422
|
+
// 文件 / 图片上传
|
|
1423
|
+
upload: {
|
|
1424
|
+
noFile: "\u672A\u63D0\u4F9B\u6587\u4EF6",
|
|
1425
|
+
canceled: "\u4E0A\u4F20\u5DF2\u53D6\u6D88",
|
|
1426
|
+
fileSizeExceeded: "\u6587\u4EF6\u5927\u5C0F\u8D85\u8FC7\u6700\u5927\u9650\u5236 ({{max}}MB)",
|
|
1427
|
+
undefined: "\u4E0A\u4F20\u529F\u80FD\u672A\u5B9A\u4E49",
|
|
1428
|
+
failedNoUrl: "\u4E0A\u4F20\u5931\u8D25\uFF1A\u672A\u8FD4\u56DEURL",
|
|
1429
|
+
failed: "\u4E0A\u4F20\u5931\u8D25",
|
|
1430
|
+
noFileToUpload: "\u6CA1\u6709\u6587\u4EF6\u53EF\u4E0A\u4F20",
|
|
1431
|
+
maxFileCount: "\u6700\u591A\u5141\u8BB8\u4E0A\u4F20 {{limit}} \u4E2A\u6587\u4EF6"
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
};
|
|
1435
|
+
|
|
1436
|
+
// src/i18n/en-US.ts
|
|
1437
|
+
var commonEnUS = {
|
|
1438
|
+
common: {
|
|
1439
|
+
copySuccess: "Copied successfully",
|
|
1440
|
+
confirm: "OK",
|
|
1441
|
+
cancel: "Cancel",
|
|
1442
|
+
download: "Download",
|
|
1443
|
+
save: "Save",
|
|
1444
|
+
defaultFileName: "file",
|
|
1445
|
+
defaultTitle: "Notice",
|
|
1446
|
+
loading: "Loading..."
|
|
1447
|
+
},
|
|
1448
|
+
request: {
|
|
1449
|
+
networkError: "Network error, please check your connection",
|
|
1450
|
+
requestError: "Request error!"
|
|
1451
|
+
},
|
|
1452
|
+
pattern: {
|
|
1453
|
+
mobileInvalid: "Invalid phone number!",
|
|
1454
|
+
phoneInvalid: "Invalid phone number!",
|
|
1455
|
+
taxNoInvalid: "Invalid tax number!",
|
|
1456
|
+
bankCardInvalid: "Invalid bank card number!",
|
|
1457
|
+
idCardInvalid: "Invalid ID card number!",
|
|
1458
|
+
numberInvalid: "Invalid format, please re-enter!",
|
|
1459
|
+
smsCodeInvalid: "SMS code must be 6 digits",
|
|
1460
|
+
emailInvalid: "Invalid email format!",
|
|
1461
|
+
addressInvalid: "Must contain one of: street, road, village, town, etc.",
|
|
1462
|
+
passwordInvalid: "Password must be 8-26 characters with letters and numbers",
|
|
1463
|
+
phoneOrMobileInvalid: "Invalid contact number",
|
|
1464
|
+
lessThan: "Cannot be less than {{value}}",
|
|
1465
|
+
lessThanOrEqual: "Cannot be less than or equal to {{value}}",
|
|
1466
|
+
greaterThan: "Cannot be greater than {{value}}",
|
|
1467
|
+
greaterThanOrEqual: "Cannot be greater than or equal to {{value}}",
|
|
1468
|
+
totalLengthExceed: "Total digits cannot exceed {{length}}",
|
|
1469
|
+
integerLengthExceed: "Integer digits cannot exceed {{length}}",
|
|
1470
|
+
decimalLengthExceed: "Decimal digits cannot exceed {{length}}",
|
|
1471
|
+
maxEmailsExceed: "Maximum {{max}} emails allowed"
|
|
1472
|
+
},
|
|
1473
|
+
date: {
|
|
1474
|
+
yearMonthFormat: "YYYY-MM",
|
|
1475
|
+
yearMonthDayFormat: "YYYY-MM-DD"
|
|
1476
|
+
},
|
|
1477
|
+
speechButton: {
|
|
1478
|
+
notSupported: "Speech recognition is not supported in this browser",
|
|
1479
|
+
permissionDenied: "Microphone permission denied",
|
|
1480
|
+
stop: "Stop Recording",
|
|
1481
|
+
start: "Click to Start Recording"
|
|
1482
|
+
},
|
|
1483
|
+
microApp: {
|
|
1484
|
+
loading: "Loading..."
|
|
1485
|
+
},
|
|
1486
|
+
iframe: {
|
|
1487
|
+
loading: "Loading..."
|
|
1488
|
+
},
|
|
1489
|
+
lazyComponent: {
|
|
1490
|
+
unknownType: "Unknown type: {{type}}",
|
|
1491
|
+
componentLoading: "Loading component..."
|
|
1492
|
+
},
|
|
1493
|
+
filePreview: {
|
|
1494
|
+
title: "File Preview",
|
|
1495
|
+
closePreview: "Close preview",
|
|
1496
|
+
previewImageAlt: "Preview image",
|
|
1497
|
+
previewNotSupported: "Preview of {{suffix}} files is not supported",
|
|
1498
|
+
previewNotSupportedDownload: "{{suffix}} files cannot be previewed online, please download and open",
|
|
1499
|
+
previewGenerating: "Preview file is being generated...",
|
|
1500
|
+
audioNotSupported: "Your browser does not support the audio tag.",
|
|
1501
|
+
videoNotSupported: "Your browser does not support the video tag.",
|
|
1502
|
+
requestFailedWithStatus: "Request failed, status code: {{status}}",
|
|
1503
|
+
emptyResponse: "Response content is empty",
|
|
1504
|
+
loadFileFailed: "Failed to load file",
|
|
1505
|
+
fileParseFailed: "Failed to load or parse file",
|
|
1506
|
+
fileUrlInvalid: "Invalid file URL",
|
|
1507
|
+
htmlParseFailed: "Failed to load or parse HTML",
|
|
1508
|
+
docLoadFailed: "Failed to load document",
|
|
1509
|
+
pdfLoadFailed: "Failed to load PDF",
|
|
1510
|
+
pdfParseFailed: "Failed to load or parse PDF",
|
|
1511
|
+
pdfUrlInvalid: "Invalid PDF URL",
|
|
1512
|
+
pdfPasswordInvalid: "Invalid password. Please try again!",
|
|
1513
|
+
pdfPasswordPlaceholder: "Please enter password",
|
|
1514
|
+
pdfSubmit: "Submit",
|
|
1515
|
+
pdfInvalidOrDamaged: "File is invalid or damaged",
|
|
1516
|
+
pdfFileNotFound: "File not found",
|
|
1517
|
+
pdfUnexpectedResponse: "Unexpected server response",
|
|
1518
|
+
pdfLoadDocumentFailed: "Unable to load document",
|
|
1519
|
+
zoomOut: "Zoom out",
|
|
1520
|
+
zoomIn: "Zoom in",
|
|
1521
|
+
zoomReset: "Reset",
|
|
1522
|
+
fitWidth: "Fit width"
|
|
1523
|
+
},
|
|
1524
|
+
markdownEditor: {
|
|
1525
|
+
mainArea: "Main content area, start typing...",
|
|
1526
|
+
unknown: "Unknown",
|
|
1527
|
+
toolbar: {
|
|
1528
|
+
quote: "Quote Selected Text",
|
|
1529
|
+
annotation: "Annotate",
|
|
1530
|
+
excerpt: "Excerpt Note",
|
|
1531
|
+
undo: "Undo",
|
|
1532
|
+
redo: "Redo",
|
|
1533
|
+
alignLeft: "Align Left",
|
|
1534
|
+
alignCenter: "Align Center",
|
|
1535
|
+
alignRight: "Align Right",
|
|
1536
|
+
alignJustify: "Justify",
|
|
1537
|
+
bold: "Bold",
|
|
1538
|
+
italic: "Italic",
|
|
1539
|
+
underline: "Underline",
|
|
1540
|
+
strike: "Strikethrough",
|
|
1541
|
+
code: "Code",
|
|
1542
|
+
superscript: "Superscript",
|
|
1543
|
+
subscript: "Subscript",
|
|
1544
|
+
bulletList: "Bullet List",
|
|
1545
|
+
orderedList: "Numbered List",
|
|
1546
|
+
taskList: "Task List",
|
|
1547
|
+
listOptions: "List Options",
|
|
1548
|
+
list: "List",
|
|
1549
|
+
blockquote: "Blockquote",
|
|
1550
|
+
codeBlock: "Code Block",
|
|
1551
|
+
heading: "Heading",
|
|
1552
|
+
headingLevel: "Heading {{level}}",
|
|
1553
|
+
addImage: "Add Image",
|
|
1554
|
+
link: "Link",
|
|
1555
|
+
linkPlaceholder: "Paste link...",
|
|
1556
|
+
applyLink: "Apply Link",
|
|
1557
|
+
openInNewWindow: "Open in New Window",
|
|
1558
|
+
removeLink: "Remove Link"
|
|
1559
|
+
},
|
|
1560
|
+
highlight: {
|
|
1561
|
+
toggle: "Toggle highlight ({{color}})",
|
|
1562
|
+
label: "Background color",
|
|
1563
|
+
textLabel: "Text background color",
|
|
1564
|
+
removeBackground: "Remove background",
|
|
1565
|
+
removeHighlight: "Remove highlight",
|
|
1566
|
+
default: "Default background",
|
|
1567
|
+
gray: "Gray background",
|
|
1568
|
+
brown: "Brown background",
|
|
1569
|
+
orange: "Orange background",
|
|
1570
|
+
yellow: "Yellow background",
|
|
1571
|
+
green: "Green background",
|
|
1572
|
+
blue: "Blue background",
|
|
1573
|
+
purple: "Purple background",
|
|
1574
|
+
pink: "Pink background",
|
|
1575
|
+
red: "Red background"
|
|
1576
|
+
},
|
|
1577
|
+
annotation: {
|
|
1578
|
+
title: "Annotations",
|
|
1579
|
+
list: "Annotations",
|
|
1580
|
+
add: "Add Annotation",
|
|
1581
|
+
content: "Annotation content",
|
|
1582
|
+
required: "Please enter annotation content",
|
|
1583
|
+
maxLength: "Annotation content cannot exceed 500 characters",
|
|
1584
|
+
placeholder: "Please enter your annotation...",
|
|
1585
|
+
edit: "Edit Annotation",
|
|
1586
|
+
delete: "Delete annotation",
|
|
1587
|
+
confirmDelete: "Delete this annotation?",
|
|
1588
|
+
empty: "No annotations"
|
|
1589
|
+
},
|
|
1590
|
+
collection: {
|
|
1591
|
+
title: "Excerpts",
|
|
1592
|
+
list: "Excerpts",
|
|
1593
|
+
delete: "Delete excerpt",
|
|
1594
|
+
confirmDelete: "Delete this excerpt?",
|
|
1595
|
+
empty: "No excerpts"
|
|
1596
|
+
},
|
|
1597
|
+
upload: {
|
|
1598
|
+
noFile: "No file provided",
|
|
1599
|
+
canceled: "Upload canceled",
|
|
1600
|
+
fileSizeExceeded: "File size exceeds the maximum limit ({{max}}MB)",
|
|
1601
|
+
undefined: "Upload function is not defined",
|
|
1602
|
+
failedNoUrl: "Upload failed: no URL returned",
|
|
1603
|
+
failed: "Upload failed",
|
|
1604
|
+
noFileToUpload: "No file to upload",
|
|
1605
|
+
maxFileCount: "A maximum of {{limit}} files can be uploaded"
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
};
|
|
1609
|
+
|
|
1610
|
+
// src/i18n/ja-JP.ts
|
|
1611
|
+
var commonJaJP = {
|
|
1612
|
+
// 共通文案
|
|
1613
|
+
common: {
|
|
1614
|
+
copySuccess: "\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F",
|
|
1615
|
+
confirm: "OK",
|
|
1616
|
+
cancel: "\u30AD\u30E3\u30F3\u30BB\u30EB",
|
|
1617
|
+
download: "\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9",
|
|
1618
|
+
save: "\u4FDD\u5B58",
|
|
1619
|
+
defaultFileName: "\u30D5\u30A1\u30A4\u30EB",
|
|
1620
|
+
defaultTitle: "\u30D2\u30F3\u30C8",
|
|
1621
|
+
loading: "\u8AAD\u307F\u8FBC\u307F\u4E2D..."
|
|
1622
|
+
},
|
|
1623
|
+
// utils/request.ts
|
|
1624
|
+
request: {
|
|
1625
|
+
networkError: "\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044",
|
|
1626
|
+
requestError: "\u30EA\u30AF\u30A8\u30B9\u30C8\u30A8\u30E9\u30FC\uFF01"
|
|
1627
|
+
},
|
|
1628
|
+
// utils/pattern.ts — バリデーションメッセージ
|
|
1629
|
+
pattern: {
|
|
1630
|
+
mobileInvalid: "\u643A\u5E2F\u96FB\u8A71\u756A\u53F7\u306E\u5F62\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093\uFF01",
|
|
1631
|
+
phoneInvalid: "\u96FB\u8A71\u756A\u53F7\u306E\u5F62\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093\uFF01",
|
|
1632
|
+
taxNoInvalid: "\u7A0E\u756A\u53F7\u306E\u5F62\u5F0F\u306B\u8AA4\u308A\u304C\u3042\u308A\u307E\u3059\uFF01",
|
|
1633
|
+
bankCardInvalid: "\u9280\u884C\u30AB\u30FC\u30C9\u756A\u53F7\u306E\u5F62\u5F0F\u306B\u8AA4\u308A\u304C\u3042\u308A\u307E\u3059\uFF01",
|
|
1634
|
+
idCardInvalid: "\u8EAB\u5206\u8A3C\u660E\u66F8\u756A\u53F7\u306E\u5F62\u5F0F\u306B\u8AA4\u308A\u304C\u3042\u308A\u307E\u3059\uFF01",
|
|
1635
|
+
numberInvalid: "\u5F62\u5F0F\u306B\u8AA4\u308A\u304C\u3042\u308A\u307E\u3059\u3002\u518D\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\uFF01",
|
|
1636
|
+
smsCodeInvalid: "\u8A8D\u8A3C\u30B3\u30FC\u30C9\u306F6\u6841\u306E\u6570\u5B57\u3067\u3059",
|
|
1637
|
+
emailInvalid: "\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u306E\u5F62\u5F0F\u306B\u8AA4\u308A\u304C\u3042\u308A\u307E\u3059\uFF01",
|
|
1638
|
+
addressInvalid: "\u300C\u8857\u300D\u300C\u9053\u8DEF\u300D\u300C\u6751\u300D\u300C\u753A\u300D\u300C\u9053\u300D\u300C\u8DEF\u5730\u300D\u300C\u756A\u53F7\u300D\u306A\u3069\u306E\u30AD\u30FC\u30EF\u30FC\u30C9\u3092\u542B\u3081\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059",
|
|
1639
|
+
passwordInvalid: "\u30D1\u30B9\u30EF\u30FC\u30C9\u306F8\u301C26\u6587\u5B57\u306E\u82F1\u6570\u5B57\u306E\u7D44\u307F\u5408\u308F\u305B\u3067\u3059",
|
|
1640
|
+
phoneOrMobileInvalid: "\u9023\u7D61\u5148\u96FB\u8A71\u756A\u53F7\u306E\u5F62\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093",
|
|
1641
|
+
// 補間例:{{value}} は実際の値に置換されます
|
|
1642
|
+
lessThan: "{{value}}\u672A\u6E80\u306B\u3067\u304D\u307E\u305B\u3093",
|
|
1643
|
+
lessThanOrEqual: "{{value}}\u4EE5\u4E0B\u306B\u3067\u304D\u307E\u305B\u3093",
|
|
1644
|
+
greaterThan: "{{value}}\u3092\u8D85\u3048\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093",
|
|
1645
|
+
greaterThanOrEqual: "{{value}}\u4EE5\u4E0A\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059",
|
|
1646
|
+
totalLengthExceed: "\u7DCF\u6841\u6570\u306F{{length}}\u6841\u3092\u8D85\u3048\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093",
|
|
1647
|
+
integerLengthExceed: "\u6574\u6570\u90E8\u306F{{length}}\u6841\u3092\u8D85\u3048\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093",
|
|
1648
|
+
decimalLengthExceed: "\u5C0F\u6570\u90E8\u306F{{length}}\u6841\u3092\u8D85\u3048\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093",
|
|
1649
|
+
maxEmailsExceed: "\u6700\u5927{{max}}\u4EF6\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u307E\u3067\u5165\u529B\u3067\u304D\u307E\u3059"
|
|
1650
|
+
},
|
|
1651
|
+
// utils/date.ts
|
|
1652
|
+
date: {
|
|
1653
|
+
yearMonthFormat: "YYYY\u5E74MM\u6708",
|
|
1654
|
+
yearMonthDayFormat: "YYYY\u5E74MM\u6708DD\u65E5"
|
|
1655
|
+
},
|
|
1656
|
+
// SpeechButton 音声ボタン
|
|
1657
|
+
speechButton: {
|
|
1658
|
+
notSupported: "\u73FE\u5728\u306E\u30D6\u30E9\u30A6\u30B6\u306F\u97F3\u58F0\u8A8D\u8B58\u306B\u5BFE\u5FDC\u3057\u3066\u3044\u307E\u305B\u3093",
|
|
1659
|
+
permissionDenied: "\u30DE\u30A4\u30AF\u306E\u6A29\u9650\u304C\u62D2\u5426\u3055\u308C\u307E\u3057\u305F",
|
|
1660
|
+
stop: "\u9332\u97F3\u3092\u505C\u6B62",
|
|
1661
|
+
start: "\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u9332\u97F3\u3092\u958B\u59CB"
|
|
1662
|
+
},
|
|
1663
|
+
// MicroApp / Iframe
|
|
1664
|
+
microApp: {
|
|
1665
|
+
loading: "\u8AAD\u307F\u8FBC\u307F\u4E2D..."
|
|
1666
|
+
},
|
|
1667
|
+
iframe: {
|
|
1668
|
+
loading: "\u8AAD\u307F\u8FBC\u307F\u4E2D..."
|
|
1669
|
+
},
|
|
1670
|
+
// LazyComponent 遅延読み込みコンポーネント
|
|
1671
|
+
lazyComponent: {
|
|
1672
|
+
unknownType: "\u4E0D\u660E\u306A\u30BF\u30A4\u30D7\uFF1A{{type}}",
|
|
1673
|
+
componentLoading: "\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u3092\u8AAD\u307F\u8FBC\u307F\u4E2D..."
|
|
1674
|
+
},
|
|
1675
|
+
// File ファイルプレビューコンポーネント群
|
|
1676
|
+
filePreview: {
|
|
1677
|
+
title: "\u30D5\u30A1\u30A4\u30EB\u30D7\u30EC\u30D3\u30E5\u30FC",
|
|
1678
|
+
closePreview: "\u30D7\u30EC\u30D3\u30E5\u30FC\u3092\u9589\u3058\u308B",
|
|
1679
|
+
previewImageAlt: "\u30D7\u30EC\u30D3\u30E5\u30FC\u753B\u50CF",
|
|
1680
|
+
previewNotSupported: "{{suffix}}\u30D5\u30A1\u30A4\u30EB\u306E\u30D7\u30EC\u30D3\u30E5\u30FC\u306B\u306F\u5BFE\u5FDC\u3057\u3066\u3044\u307E\u305B\u3093",
|
|
1681
|
+
previewNotSupportedDownload: "{{suffix}}\u30D5\u30A1\u30A4\u30EB\u306F\u30AA\u30F3\u30E9\u30A4\u30F3\u30D7\u30EC\u30D3\u30E5\u30FC\u306B\u5BFE\u5FDC\u3057\u3066\u3044\u307E\u305B\u3093\u3002\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u3057\u3066\u958B\u3044\u3066\u304F\u3060\u3055\u3044",
|
|
1682
|
+
previewGenerating: "\u30D7\u30EC\u30D3\u30E5\u30FC\u30D5\u30A1\u30A4\u30EB\u3092\u751F\u6210\u4E2D...",
|
|
1683
|
+
audioNotSupported: "\u304A\u4F7F\u3044\u306E\u30D6\u30E9\u30A6\u30B6\u306F audio \u30BF\u30B0\u306B\u5BFE\u5FDC\u3057\u3066\u3044\u307E\u305B\u3093\u3002",
|
|
1684
|
+
videoNotSupported: "\u304A\u4F7F\u3044\u306E\u30D6\u30E9\u30A6\u30B6\u306F video \u30BF\u30B0\u306B\u5BFE\u5FDC\u3057\u3066\u3044\u307E\u305B\u3093\u3002",
|
|
1685
|
+
requestFailedWithStatus: "\u30EA\u30AF\u30A8\u30B9\u30C8\u5931\u6557\u3001\u30B9\u30C6\u30FC\u30BF\u30B9\u30B3\u30FC\u30C9: {{status}}",
|
|
1686
|
+
emptyResponse: "\u8FD4\u4FE1\u5185\u5BB9\u304C\u7A7A\u3067\u3059",
|
|
1687
|
+
loadFileFailed: "\u30D5\u30A1\u30A4\u30EB\u306E\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
|
|
1688
|
+
fileParseFailed: "\u30D5\u30A1\u30A4\u30EB\u306E\u8AAD\u307F\u8FBC\u307F\u307E\u305F\u306F\u89E3\u6790\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
|
|
1689
|
+
fileUrlInvalid: "\u30D5\u30A1\u30A4\u30EBURL\u304C\u4E0D\u6B63\u3067\u3059",
|
|
1690
|
+
htmlParseFailed: "HTML\u306E\u8AAD\u307F\u8FBC\u307F\u307E\u305F\u306F\u89E3\u6790\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
|
|
1691
|
+
docLoadFailed: "\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
|
|
1692
|
+
pdfLoadFailed: "PDF\u306E\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
|
|
1693
|
+
pdfParseFailed: "PDF\u306E\u8AAD\u307F\u8FBC\u307F\u307E\u305F\u306F\u89E3\u6790\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
|
|
1694
|
+
pdfUrlInvalid: "PDF\u306EURL\u304C\u4E0D\u6B63\u3067\u3059",
|
|
1695
|
+
pdfPasswordInvalid: "\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u7121\u52B9\u3067\u3059\u3002\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\uFF01",
|
|
1696
|
+
pdfPasswordPlaceholder: "\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",
|
|
1697
|
+
pdfSubmit: "\u9001 \u4FE1",
|
|
1698
|
+
pdfInvalidOrDamaged: "\u30D5\u30A1\u30A4\u30EB\u304C\u7121\u52B9\u307E\u305F\u306F\u7834\u640D\u3057\u3066\u3044\u307E\u3059",
|
|
1699
|
+
pdfFileNotFound: "\u30D5\u30A1\u30A4\u30EB\u304C\u5B58\u5728\u3057\u307E\u305B\u3093",
|
|
1700
|
+
pdfUnexpectedResponse: "\u4E88\u671F\u3057\u306A\u3044\u30B5\u30FC\u30D0\u30FC\u30EC\u30B9\u30DD\u30F3\u30B9",
|
|
1701
|
+
pdfLoadDocumentFailed: "\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093",
|
|
1702
|
+
zoomOut: "\u7E2E\u5C0F",
|
|
1703
|
+
zoomIn: "\u62E1\u5927",
|
|
1704
|
+
zoomReset: "\u5143\u306B\u623B\u3059",
|
|
1705
|
+
fitWidth: "\u5E45\u306B\u5408\u308F\u305B\u308B"
|
|
1706
|
+
},
|
|
1707
|
+
// MarkdownEditor リッチテキストエディタ
|
|
1708
|
+
markdownEditor: {
|
|
1709
|
+
mainArea: "\u30E1\u30A4\u30F3\u30B3\u30F3\u30C6\u30F3\u30C4\u30A8\u30EA\u30A2\u3001\u30C6\u30AD\u30B9\u30C8\u3092\u5165\u529B...",
|
|
1710
|
+
unknown: "\u4E0D\u660E",
|
|
1711
|
+
// ツールバー
|
|
1712
|
+
toolbar: {
|
|
1713
|
+
quote: "\u9078\u629E\u30C6\u30AD\u30B9\u30C8\u3092\u5F15\u7528",
|
|
1714
|
+
annotation: "\u6CE8\u91C8",
|
|
1715
|
+
excerpt: "\u629C\u7C8B\u30E1\u30E2",
|
|
1716
|
+
undo: "\u5143\u306B\u623B\u3059",
|
|
1717
|
+
redo: "\u3084\u308A\u76F4\u3059",
|
|
1718
|
+
alignLeft: "\u5DE6\u63C3\u3048",
|
|
1719
|
+
alignCenter: "\u4E2D\u592E\u63C3\u3048",
|
|
1720
|
+
alignRight: "\u53F3\u63C3\u3048",
|
|
1721
|
+
alignJustify: "\u4E21\u7AEF\u63C3\u3048",
|
|
1722
|
+
bold: "\u592A\u5B57",
|
|
1723
|
+
italic: "\u659C\u4F53",
|
|
1724
|
+
underline: "\u4E0B\u7DDA",
|
|
1725
|
+
strike: "\u53D6\u308A\u6D88\u3057\u7DDA",
|
|
1726
|
+
code: "\u30B3\u30FC\u30C9",
|
|
1727
|
+
superscript: "\u4E0A\u4ED8\u304D\u6587\u5B57",
|
|
1728
|
+
subscript: "\u4E0B\u4ED8\u304D\u6587\u5B57",
|
|
1729
|
+
bulletList: "\u7B87\u6761\u66F8\u304D",
|
|
1730
|
+
orderedList: "\u756A\u53F7\u4ED8\u304D\u30EA\u30B9\u30C8",
|
|
1731
|
+
taskList: "\u30BF\u30B9\u30AF\u30EA\u30B9\u30C8",
|
|
1732
|
+
listOptions: "\u30EA\u30B9\u30C8\u30AA\u30D7\u30B7\u30E7\u30F3",
|
|
1733
|
+
list: "\u30EA\u30B9\u30C8",
|
|
1734
|
+
blockquote: "\u5F15\u7528\u30D6\u30ED\u30C3\u30AF",
|
|
1735
|
+
codeBlock: "\u30B3\u30FC\u30C9\u30D6\u30ED\u30C3\u30AF",
|
|
1736
|
+
heading: "\u898B\u51FA\u3057",
|
|
1737
|
+
headingLevel: "\u898B\u51FA\u3057 {{level}}",
|
|
1738
|
+
addImage: "\u753B\u50CF\u3092\u8FFD\u52A0",
|
|
1739
|
+
link: "\u30EA\u30F3\u30AF",
|
|
1740
|
+
linkPlaceholder: "\u30EA\u30F3\u30AF\u3092\u8CBC\u308A\u4ED8\u3051...",
|
|
1741
|
+
applyLink: "\u30EA\u30F3\u30AF\u3092\u9069\u7528",
|
|
1742
|
+
openInNewWindow: "\u65B0\u3057\u3044\u30A6\u30A3\u30F3\u30C9\u30A6\u3067\u958B\u304F",
|
|
1743
|
+
removeLink: "\u30EA\u30F3\u30AF\u3092\u524A\u9664"
|
|
1744
|
+
},
|
|
1745
|
+
// ハイライト / 背景色
|
|
1746
|
+
highlight: {
|
|
1747
|
+
toggle: "\u30CF\u30A4\u30E9\u30A4\u30C8\u8868\u793A\u3092\u5207\u308A\u66FF\u3048 ({{color}})",
|
|
1748
|
+
label: "\u80CC\u666F\u8272",
|
|
1749
|
+
textLabel: "\u30C6\u30AD\u30B9\u30C8\u80CC\u666F\u8272",
|
|
1750
|
+
removeBackground: "\u80CC\u666F\u3092\u524A\u9664",
|
|
1751
|
+
removeHighlight: "\u30CF\u30A4\u30E9\u30A4\u30C8\u3092\u524A\u9664",
|
|
1752
|
+
default: "\u30C7\u30D5\u30A9\u30EB\u30C8\u80CC\u666F",
|
|
1753
|
+
gray: "\u30B0\u30EC\u30FC\u80CC\u666F",
|
|
1754
|
+
brown: "\u30D6\u30E9\u30A6\u30F3\u80CC\u666F",
|
|
1755
|
+
orange: "\u30AA\u30EC\u30F3\u30B8\u80CC\u666F",
|
|
1756
|
+
yellow: "\u30A4\u30A8\u30ED\u30FC\u80CC\u666F",
|
|
1757
|
+
green: "\u30B0\u30EA\u30FC\u30F3\u80CC\u666F",
|
|
1758
|
+
blue: "\u30D6\u30EB\u30FC\u80CC\u666F",
|
|
1759
|
+
purple: "\u30D1\u30FC\u30D7\u30EB\u80CC\u666F",
|
|
1760
|
+
pink: "\u30D4\u30F3\u30AF\u80CC\u666F",
|
|
1761
|
+
red: "\u30EC\u30C3\u30C9\u80CC\u666F"
|
|
1762
|
+
},
|
|
1763
|
+
// 注釈
|
|
1764
|
+
annotation: {
|
|
1765
|
+
title: "\u6CE8\u91C8",
|
|
1766
|
+
list: "\u6CE8\u91C8\u30EA\u30B9\u30C8",
|
|
1767
|
+
add: "\u6CE8\u91C8\u3092\u8FFD\u52A0",
|
|
1768
|
+
content: "\u6CE8\u91C8\u5185\u5BB9",
|
|
1769
|
+
required: "\u6CE8\u91C8\u5185\u5BB9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",
|
|
1770
|
+
maxLength: "\u6CE8\u91C8\u5185\u5BB9\u306F500\u6587\u5B57\u4EE5\u5185\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",
|
|
1771
|
+
placeholder: "\u6CE8\u91C8\u5185\u5BB9\u3092\u5165\u529B...",
|
|
1772
|
+
edit: "\u6CE8\u91C8\u3092\u7DE8\u96C6",
|
|
1773
|
+
delete: "\u6CE8\u91C8\u3092\u524A\u9664",
|
|
1774
|
+
confirmDelete: "\u3053\u306E\u6CE8\u91C8\u3092\u524A\u9664\u3057\u307E\u3059\u304B\uFF1F",
|
|
1775
|
+
empty: "\u6CE8\u91C8\u306F\u3042\u308A\u307E\u305B\u3093"
|
|
1776
|
+
},
|
|
1777
|
+
// 抜粋
|
|
1778
|
+
collection: {
|
|
1779
|
+
title: "\u629C\u7C8B",
|
|
1780
|
+
list: "\u629C\u7C8B\u30EA\u30B9\u30C8",
|
|
1781
|
+
delete: "\u629C\u7C8B\u3092\u524A\u9664",
|
|
1782
|
+
confirmDelete: "\u3053\u306E\u629C\u7C8B\u3092\u524A\u9664\u3057\u307E\u3059\u304B\uFF1F",
|
|
1783
|
+
empty: "\u629C\u7C8B\u306F\u3042\u308A\u307E\u305B\u3093"
|
|
1784
|
+
},
|
|
1785
|
+
// ファイル / 画像アップロード
|
|
1786
|
+
upload: {
|
|
1787
|
+
noFile: "\u30D5\u30A1\u30A4\u30EB\u304C\u63D0\u4F9B\u3055\u308C\u3066\u3044\u307E\u305B\u3093",
|
|
1788
|
+
canceled: "\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306F\u30AD\u30E3\u30F3\u30BB\u30EB\u3055\u308C\u307E\u3057\u305F",
|
|
1789
|
+
fileSizeExceeded: "\u30D5\u30A1\u30A4\u30EB\u30B5\u30A4\u30BA\u304C\u6700\u5927\u5236\u9650\u3092\u8D85\u3048\u3066\u3044\u307E\u3059 ({{max}}MB)",
|
|
1790
|
+
undefined: "\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u6A5F\u80FD\u304C\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u307E\u305B\u3093",
|
|
1791
|
+
failedNoUrl: "\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u5931\u6557\uFF1AURL\u304C\u8FD4\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F",
|
|
1792
|
+
failed: "\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
|
|
1793
|
+
noFileToUpload: "\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3059\u308B\u30D5\u30A1\u30A4\u30EB\u304C\u3042\u308A\u307E\u305B\u3093",
|
|
1794
|
+
maxFileCount: "\u6700\u5927{{limit}}\u4EF6\u307E\u3067\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3067\u304D\u307E\u3059"
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
};
|
|
1798
|
+
|
|
1799
|
+
// src/i18n/index.ts
|
|
1800
|
+
var DEFAULT_LNG = "zh-CN";
|
|
1801
|
+
var LANG_KEY = "ns-lang";
|
|
1802
|
+
var langManager = createTokenManager({ key: LANG_KEY });
|
|
1803
|
+
function getLang() {
|
|
1804
|
+
return langManager.get() || DEFAULT_LNG;
|
|
1805
|
+
}
|
|
1806
|
+
var i18n = createInstance({
|
|
1807
|
+
lng: DEFAULT_LNG,
|
|
1808
|
+
fallbackLng: DEFAULT_LNG,
|
|
1809
|
+
defaultNS: NS_COMMON,
|
|
1810
|
+
interpolation: { escapeValue: false },
|
|
1811
|
+
resources: { [DEFAULT_LNG]: { [NS_COMMON]: commonZhCN } }
|
|
1812
|
+
}).use(initReactI18next);
|
|
1813
|
+
void i18n.init();
|
|
1814
|
+
function addBundledResource(lng, ns, res) {
|
|
1815
|
+
if (lng === DEFAULT_LNG && ns === NS_COMMON) return;
|
|
1816
|
+
i18n.addResourceBundle(lng, ns, res, true, true);
|
|
1817
|
+
}
|
|
1818
|
+
function initI18n(options = {}) {
|
|
1819
|
+
const { lng = getLang(), resources } = options;
|
|
1820
|
+
for (const [l, namespaces] of Object.entries(resources ?? {})) {
|
|
1821
|
+
for (const [ns, messages] of Object.entries(namespaces)) {
|
|
1822
|
+
i18n.addResourceBundle(l, ns, messages, true, true);
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
switchLang(lng);
|
|
1826
|
+
return i18n;
|
|
1827
|
+
}
|
|
1828
|
+
function switchLang(lng, reload = false) {
|
|
1829
|
+
langManager.set(lng);
|
|
1830
|
+
if (reload) {
|
|
1831
|
+
window?.top?.location.reload();
|
|
1832
|
+
} else {
|
|
1833
|
+
i18n.changeLanguage(lng);
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
function useTranslation(namespace) {
|
|
1837
|
+
return useTranslation$1(namespace, { useSuspense: false });
|
|
1838
|
+
}
|
|
1839
|
+
function getI18n() {
|
|
1840
|
+
return i18n;
|
|
1841
|
+
}
|
|
1842
|
+
function t(key, options) {
|
|
1843
|
+
return i18n.t(key, options);
|
|
1844
|
+
}
|
|
1845
|
+
|
|
1846
|
+
// src/components/File/styles.module.less
|
|
1847
|
+
var styles_module_default = {
|
|
1848
|
+
nsPreviewImage: "styles_module_nsPreviewImage",
|
|
1849
|
+
nsPreviewPdf: "styles_module_nsPreviewPdf",
|
|
1850
|
+
pdfToolbar: "styles_module_pdfToolbar",
|
|
1851
|
+
nsPreviewPdfImage: "styles_module_nsPreviewPdfImage",
|
|
1852
|
+
pdfImageNav: "styles_module_pdfImageNav",
|
|
1853
|
+
pdfImageNavItem: "styles_module_pdfImageNavItem",
|
|
1854
|
+
pdfImageNavItemImgWrapper: "styles_module_pdfImageNavItemImgWrapper",
|
|
1855
|
+
pdfImageNavItemActive: "styles_module_pdfImageNavItemActive",
|
|
1856
|
+
pdfImageNavItemImg: "styles_module_pdfImageNavItemImg",
|
|
1857
|
+
pdfImageNavItemTip: "styles_module_pdfImageNavItemTip",
|
|
1858
|
+
pdfImageBody: "styles_module_pdfImageBody",
|
|
1859
|
+
pdfImageBodyToolbar: "styles_module_pdfImageBodyToolbar",
|
|
1860
|
+
pdfImageBodyItem: "styles_module_pdfImageBodyItem",
|
|
1861
|
+
pdfImageBodyItemInnerWrapper: "styles_module_pdfImageBodyItemInnerWrapper",
|
|
1862
|
+
pdfImageBodyItemInner: "styles_module_pdfImageBodyItemInner",
|
|
1863
|
+
pdfImageBodyItemActive: "styles_module_pdfImageBodyItemActive",
|
|
1864
|
+
pdfImageBodyItemImg: "styles_module_pdfImageBodyItemImg",
|
|
1865
|
+
nsPreviewVideo: "styles_module_nsPreviewVideo",
|
|
1866
|
+
nsPreviewAudio: "styles_module_nsPreviewAudio",
|
|
1867
|
+
nsPreviewDocx: "styles_module_nsPreviewDocx",
|
|
1868
|
+
docxToolbar: "styles_module_docxToolbar",
|
|
1869
|
+
docxContent: "styles_module_docxContent",
|
|
1870
|
+
stateBody: "styles_module_stateBody",
|
|
1871
|
+
pdfContainer: "styles_module_pdfContainer",
|
|
1872
|
+
floatingToolbar: "styles_module_floatingToolbar",
|
|
1873
|
+
divider: "styles_module_divider",
|
|
1874
|
+
pdfBody: "styles_module_pdfBody",
|
|
1875
|
+
pdfDocument: "styles_module_pdfDocument",
|
|
1876
|
+
pdfPage: "styles_module_pdfPage"
|
|
1877
|
+
};
|
|
1878
|
+
var AudioPlayer_default = ({ fileUrl }) => {
|
|
1879
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
1880
|
+
return /* @__PURE__ */ jsxs("audio", { controls: true, className: styles_module_default.nsPreviewAudio, children: [
|
|
1881
|
+
/* @__PURE__ */ jsx("source", { src: fileUrl, type: "audio/mpeg" }),
|
|
1882
|
+
t2("filePreview.audioNotSupported")
|
|
1883
|
+
] }, fileUrl);
|
|
1884
|
+
};
|
|
1256
1885
|
var DocxPreview_default = ({ fileUrl, scale = 1 }) => {
|
|
1886
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
1257
1887
|
const containerRef = useRef(null);
|
|
1258
1888
|
const [zoomRatio, setZoomRatio] = useState(scale);
|
|
1259
1889
|
useEffect(() => {
|
|
@@ -1276,7 +1906,7 @@ var DocxPreview_default = ({ fileUrl, scale = 1 }) => {
|
|
|
1276
1906
|
});
|
|
1277
1907
|
}).catch((err) => {
|
|
1278
1908
|
console.error("docx-preview \u6E32\u67D3\u5931\u8D25:", err);
|
|
1279
|
-
if (containerRef.current) containerRef.current.innerHTML =
|
|
1909
|
+
if (containerRef.current) containerRef.current.innerHTML = `<p class="text-center">${t2("filePreview.docLoadFailed")}</p>`;
|
|
1280
1910
|
});
|
|
1281
1911
|
}, [fileUrl]);
|
|
1282
1912
|
const zoomIn = () => setZoomRatio((z) => Math.min(z + 0.1, 3));
|
|
@@ -1286,9 +1916,9 @@ var DocxPreview_default = ({ fileUrl, scale = 1 }) => {
|
|
|
1286
1916
|
};
|
|
1287
1917
|
return /* @__PURE__ */ jsxs("div", { className: classNames2(styles_module_default.nsPreviewDocx, "height-full", "width-full"), children: [
|
|
1288
1918
|
/* @__PURE__ */ jsxs(Flex, { gap: 6, align: "center", className: styles_module_default.docxToolbar, children: [
|
|
1289
|
-
/* @__PURE__ */ jsx(Button, { onClick: zoomOut, icon: /* @__PURE__ */ jsx(MinusCircleOutlined, {}), title: "
|
|
1290
|
-
/* @__PURE__ */ jsx(Button, { onClick: zoomIn, icon: /* @__PURE__ */ jsx(PlusCircleOutlined, {}), title: "
|
|
1291
|
-
/* @__PURE__ */ jsx(Button, { onClick: resetZoom, icon: /* @__PURE__ */ jsx(RedoOutlined, {}), title: "
|
|
1919
|
+
/* @__PURE__ */ jsx(Button, { onClick: zoomOut, icon: /* @__PURE__ */ jsx(MinusCircleOutlined, {}), title: t2("filePreview.zoomOut") }),
|
|
1920
|
+
/* @__PURE__ */ jsx(Button, { onClick: zoomIn, icon: /* @__PURE__ */ jsx(PlusCircleOutlined, {}), title: t2("filePreview.zoomIn") }),
|
|
1921
|
+
/* @__PURE__ */ jsx(Button, { onClick: resetZoom, icon: /* @__PURE__ */ jsx(RedoOutlined, {}), title: t2("filePreview.zoomReset") })
|
|
1292
1922
|
] }),
|
|
1293
1923
|
/* @__PURE__ */ jsx("div", { className: classNames2(styles_module_default.docxContent, "height-full", "scroll-fade-in"), children: /* @__PURE__ */ jsx(
|
|
1294
1924
|
"div",
|
|
@@ -1366,9 +1996,10 @@ var FileIcon_default = ({ suffix, fontSize = 22 }) => {
|
|
|
1366
1996
|
return /* @__PURE__ */ jsx("span", { style: styles, children: Icon });
|
|
1367
1997
|
};
|
|
1368
1998
|
var VideoPlayer_default = ({ fileUrl }) => {
|
|
1999
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
1369
2000
|
return /* @__PURE__ */ jsxs("video", { controls: true, className: styles_module_default.nsPreviewVideo, children: [
|
|
1370
2001
|
/* @__PURE__ */ jsx("source", { src: fileUrl, type: "video/mp4" }),
|
|
1371
|
-
"
|
|
2002
|
+
t2("filePreview.videoNotSupported")
|
|
1372
2003
|
] }, fileUrl);
|
|
1373
2004
|
};
|
|
1374
2005
|
|
|
@@ -1381,6 +2012,7 @@ var baseComponentMap = {
|
|
|
1381
2012
|
};
|
|
1382
2013
|
var lazyCache = /* @__PURE__ */ new Map();
|
|
1383
2014
|
var LazyComponent_default = ({ type, customComponents, unknownContent, ...rest }) => {
|
|
2015
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
1384
2016
|
const loader2 = customComponents?.[type] || baseComponentMap[type];
|
|
1385
2017
|
const LazyComponent = useMemo(() => {
|
|
1386
2018
|
if (!loader2) return null;
|
|
@@ -1390,11 +2022,11 @@ var LazyComponent_default = ({ type, customComponents, unknownContent, ...rest }
|
|
|
1390
2022
|
lazyCache.set(type, component);
|
|
1391
2023
|
return component;
|
|
1392
2024
|
}, [loader2]);
|
|
1393
|
-
if (!LazyComponent) return unknownContent || /* @__PURE__ */ jsx(Alert, { title:
|
|
2025
|
+
if (!LazyComponent) return unknownContent || /* @__PURE__ */ jsx(Alert, { title: t2("lazyComponent.unknownType", { type }), type: "warning" });
|
|
1394
2026
|
return /* @__PURE__ */ jsx(
|
|
1395
2027
|
Suspense,
|
|
1396
2028
|
{
|
|
1397
|
-
fallback: /* @__PURE__ */ jsx(Skeleton.Node, { active: true, className: styles_module_default2.skeleton, children: /* @__PURE__ */ jsx(Typography.Text, { type: "secondary", children: "
|
|
2029
|
+
fallback: /* @__PURE__ */ jsx(Skeleton.Node, { active: true, className: styles_module_default2.skeleton, children: /* @__PURE__ */ jsx(Typography.Text, { type: "secondary", children: t2("lazyComponent.componentLoading") }) }),
|
|
1398
2030
|
children: /* @__PURE__ */ jsx(LazyComponent, { ...rest })
|
|
1399
2031
|
}
|
|
1400
2032
|
);
|
|
@@ -1506,18 +2138,27 @@ var RenderMarkdown_default = ({ content = "", searchValue, customComponents, ...
|
|
|
1506
2138
|
return /* @__PURE__ */ jsx("div", { className: "ns-markdown", children: reactContent });
|
|
1507
2139
|
};
|
|
1508
2140
|
var MarkdownPreview_default = ({ fileUrl, searchValue, asPlainText }) => {
|
|
2141
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
1509
2142
|
const [content, setContent] = useState("");
|
|
1510
2143
|
const [error, setError] = useState("");
|
|
1511
2144
|
const fetchMarkdown = async () => {
|
|
1512
2145
|
const res = await fetch(fileUrl);
|
|
1513
2146
|
if (res.status !== 200) {
|
|
1514
|
-
throw new Error(
|
|
2147
|
+
throw new Error(t2("filePreview.requestFailedWithStatus", { status: res.status }));
|
|
1515
2148
|
}
|
|
1516
|
-
const
|
|
1517
|
-
|
|
1518
|
-
|
|
2149
|
+
const buffer = await res.arrayBuffer();
|
|
2150
|
+
let markdownText = "";
|
|
2151
|
+
try {
|
|
2152
|
+
const decoder = new TextDecoder("utf-8", { fatal: true });
|
|
2153
|
+
markdownText = decoder.decode(buffer);
|
|
2154
|
+
} catch (e) {
|
|
2155
|
+
const gbkDecoder = new TextDecoder("gbk");
|
|
2156
|
+
markdownText = gbkDecoder.decode(buffer);
|
|
1519
2157
|
}
|
|
1520
|
-
|
|
2158
|
+
if (!markdownText) {
|
|
2159
|
+
throw new Error(t2("filePreview.emptyResponse"));
|
|
2160
|
+
}
|
|
2161
|
+
return markdownText;
|
|
1521
2162
|
};
|
|
1522
2163
|
const init = async () => {
|
|
1523
2164
|
setContent("");
|
|
@@ -1527,10 +2168,10 @@ var MarkdownPreview_default = ({ fileUrl, searchValue, asPlainText }) => {
|
|
|
1527
2168
|
const content2 = await fetchMarkdown();
|
|
1528
2169
|
setContent(content2);
|
|
1529
2170
|
} catch {
|
|
1530
|
-
setError("
|
|
2171
|
+
setError(t2("filePreview.fileParseFailed"));
|
|
1531
2172
|
}
|
|
1532
2173
|
} else {
|
|
1533
|
-
setError("
|
|
2174
|
+
setError(t2("filePreview.fileUrlInvalid"));
|
|
1534
2175
|
}
|
|
1535
2176
|
};
|
|
1536
2177
|
useEffect(() => {
|
|
@@ -2200,17 +2841,18 @@ var THUMB_IMG_HEIGHT = 514;
|
|
|
2200
2841
|
var MAIN_IMG_HEIGHT = 800;
|
|
2201
2842
|
var MAIN_IMG_WIDTH = 600;
|
|
2202
2843
|
var PdfImagePreview_default = ({ fileUrl, pageNo, scale = 1, isHasThumbnails = true, onSetPageNo }) => {
|
|
2844
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
2203
2845
|
const [images, setImages] = useState([]);
|
|
2204
2846
|
const [currentIndex, setCurrentIndex, getCurrentIndex] = useRefState_default(0);
|
|
2205
2847
|
const [error, setError] = useState("");
|
|
2206
2848
|
const fetchPdfImages = async () => {
|
|
2207
2849
|
const res = await fetch(fileUrl);
|
|
2208
2850
|
if (res.status !== 200) {
|
|
2209
|
-
throw new Error(
|
|
2851
|
+
throw new Error(t2("filePreview.requestFailedWithStatus", { status: res.status }));
|
|
2210
2852
|
}
|
|
2211
2853
|
const { data } = await res.json();
|
|
2212
2854
|
if (!data?.items?.length) {
|
|
2213
|
-
throw new Error("
|
|
2855
|
+
throw new Error(t2("filePreview.emptyResponse"));
|
|
2214
2856
|
}
|
|
2215
2857
|
setImages(data.items);
|
|
2216
2858
|
};
|
|
@@ -2222,10 +2864,10 @@ var PdfImagePreview_default = ({ fileUrl, pageNo, scale = 1, isHasThumbnails = t
|
|
|
2222
2864
|
try {
|
|
2223
2865
|
await fetchPdfImages();
|
|
2224
2866
|
} catch (error2) {
|
|
2225
|
-
setError("
|
|
2867
|
+
setError(t2("filePreview.pdfParseFailed"));
|
|
2226
2868
|
}
|
|
2227
2869
|
} else {
|
|
2228
|
-
setError("
|
|
2870
|
+
setError(t2("filePreview.pdfUrlInvalid"));
|
|
2229
2871
|
}
|
|
2230
2872
|
};
|
|
2231
2873
|
useEffect(() => {
|
|
@@ -2365,9 +3007,9 @@ var PdfImagePreview_default = ({ fileUrl, pageNo, scale = 1, isHasThumbnails = t
|
|
|
2365
3007
|
) }) }),
|
|
2366
3008
|
/* @__PURE__ */ jsx(Splitter.Panel, { children: /* @__PURE__ */ jsxs("div", { className: classNames2("height-full", styles_module_default.pdfImageBody), children: [
|
|
2367
3009
|
/* @__PURE__ */ jsxs(Flex, { gap: 6, align: "center", className: styles_module_default.pdfImageBodyToolbar, children: [
|
|
2368
|
-
/* @__PURE__ */ jsx(Button, { onClick: zoomOut, icon: /* @__PURE__ */ jsx(MinusCircleOutlined, {}), title: "
|
|
2369
|
-
/* @__PURE__ */ jsx(Button, { onClick: zoomIn, icon: /* @__PURE__ */ jsx(PlusCircleOutlined, {}), title: "
|
|
2370
|
-
/* @__PURE__ */ jsx(Button, { onClick: zoomFitWidth, icon: /* @__PURE__ */ jsx(ColumnWidthOutlined, {}), title: "
|
|
3010
|
+
/* @__PURE__ */ jsx(Button, { onClick: zoomOut, icon: /* @__PURE__ */ jsx(MinusCircleOutlined, {}), title: t2("filePreview.zoomOut") }),
|
|
3011
|
+
/* @__PURE__ */ jsx(Button, { onClick: zoomIn, icon: /* @__PURE__ */ jsx(PlusCircleOutlined, {}), title: t2("filePreview.zoomIn") }),
|
|
3012
|
+
/* @__PURE__ */ jsx(Button, { onClick: zoomFitWidth, icon: /* @__PURE__ */ jsx(ColumnWidthOutlined, {}), title: t2("filePreview.fitWidth") })
|
|
2371
3013
|
] }),
|
|
2372
3014
|
/* @__PURE__ */ jsx("div", { ref: containerRef, className: "height-full scroll-fade-in", children: /* @__PURE__ */ jsx(
|
|
2373
3015
|
"div",
|
|
@@ -2415,6 +3057,7 @@ var ProtectedView = ({
|
|
|
2415
3057
|
verifyPassword,
|
|
2416
3058
|
onVerifyPasswordEnd
|
|
2417
3059
|
}) => {
|
|
3060
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
2418
3061
|
const [form] = Form.useForm();
|
|
2419
3062
|
const onSubmit = () => {
|
|
2420
3063
|
form.validateFields().then((values) => {
|
|
@@ -2425,10 +3068,10 @@ var ProtectedView = ({
|
|
|
2425
3068
|
});
|
|
2426
3069
|
};
|
|
2427
3070
|
return /* @__PURE__ */ jsx(Flex, { justify: "center", align: "center", className: "height-full", children: /* @__PURE__ */ jsxs("div", { style: { width: 300 }, children: [
|
|
2428
|
-
passwordStatus === PasswordStatus.WrongPassword && /* @__PURE__ */ jsx(Alert, { title: "
|
|
3071
|
+
passwordStatus === PasswordStatus.WrongPassword && /* @__PURE__ */ jsx(Alert, { title: t2("filePreview.pdfPasswordInvalid"), type: "error" }),
|
|
2429
3072
|
/* @__PURE__ */ jsxs(Form, { form, size: "large", className: "m-t-24", children: [
|
|
2430
|
-
/* @__PURE__ */ jsx(Form.Item, { name: "password", rules: [{ required: true, message: "
|
|
2431
|
-
/* @__PURE__ */ jsx(Flex, { justify: "center", children: /* @__PURE__ */ jsx(Button, { type: "primary", onClick: onSubmit, children: "
|
|
3073
|
+
/* @__PURE__ */ jsx(Form.Item, { name: "password", rules: [{ required: true, message: t2("filePreview.pdfPasswordPlaceholder") }], children: /* @__PURE__ */ jsx(Input.Password, { autoComplete: "new-password", placeholder: t2("filePreview.pdfPasswordPlaceholder") }) }),
|
|
3074
|
+
/* @__PURE__ */ jsx(Flex, { justify: "center", children: /* @__PURE__ */ jsx(Button, { type: "primary", onClick: onSubmit, children: t2("filePreview.pdfSubmit") }) })
|
|
2432
3075
|
] })
|
|
2433
3076
|
] }) });
|
|
2434
3077
|
};
|
|
@@ -2447,6 +3090,7 @@ var openLinksNewTabPlugin = () => {
|
|
|
2447
3090
|
};
|
|
2448
3091
|
};
|
|
2449
3092
|
var PdfPreview_default = ({ password, fileUrl, pageNo = 1, scale = 1, isHasThumbnails = true, onSetPassword, onSetPageNo }) => {
|
|
3093
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
2450
3094
|
const embedRef = useRef(null);
|
|
2451
3095
|
const [sizes, setSizes] = useState([0]);
|
|
2452
3096
|
const [docLoaded, setDocLoaded, getDocLoaded] = useRefState_default(false);
|
|
@@ -2520,19 +3164,19 @@ var PdfPreview_default = ({ password, fileUrl, pageNo = 1, scale = 1, isHasThumb
|
|
|
2520
3164
|
let message3 = "";
|
|
2521
3165
|
switch (error.name) {
|
|
2522
3166
|
case "InvalidPDFException":
|
|
2523
|
-
message3 = "
|
|
3167
|
+
message3 = t2("filePreview.pdfInvalidOrDamaged");
|
|
2524
3168
|
break;
|
|
2525
3169
|
case "MissingPDFException":
|
|
2526
|
-
message3 = "
|
|
3170
|
+
message3 = t2("filePreview.pdfFileNotFound");
|
|
2527
3171
|
break;
|
|
2528
3172
|
case "UnexpectedResponseException":
|
|
2529
|
-
message3 = "
|
|
3173
|
+
message3 = t2("filePreview.pdfUnexpectedResponse");
|
|
2530
3174
|
break;
|
|
2531
3175
|
// case 'CMapReaderFactory not initialized':
|
|
2532
3176
|
// message = '字体映射文件加载失败,请刷新页面重试'
|
|
2533
3177
|
// break
|
|
2534
3178
|
default:
|
|
2535
|
-
message3 = "
|
|
3179
|
+
message3 = t2("filePreview.pdfLoadDocumentFailed");
|
|
2536
3180
|
break;
|
|
2537
3181
|
}
|
|
2538
3182
|
return /* @__PURE__ */ jsx(Flex, { className: "height-full", justify: "center", align: "center", children: /* @__PURE__ */ jsx(Alert, { title: message3, type: "error", showIcon: true }) });
|
|
@@ -2603,6 +3247,7 @@ var PdfPreview_default = ({ password, fileUrl, pageNo = 1, scale = 1, isHasThumb
|
|
|
2603
3247
|
] }) }) });
|
|
2604
3248
|
};
|
|
2605
3249
|
var FilePreview_default = ({ suffix, fileUrl, pdfParams, password, searchValue, emptyProps, onSetPassword }) => {
|
|
3250
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
2606
3251
|
const Preview = useMemo(() => {
|
|
2607
3252
|
if (!fileUrl) {
|
|
2608
3253
|
return /* @__PURE__ */ jsx(Empty, { ...emptyProps });
|
|
@@ -2612,7 +3257,7 @@ var FilePreview_default = ({ suffix, fileUrl, pdfParams, password, searchValue,
|
|
|
2612
3257
|
case "JPG":
|
|
2613
3258
|
case "JPEG":
|
|
2614
3259
|
case "GIF":
|
|
2615
|
-
return /* @__PURE__ */ jsx(Image$1, { classNames: { root: styles_module_default.nsPreviewImage }, src: fileUrl, alt: "
|
|
3260
|
+
return /* @__PURE__ */ jsx(Image$1, { classNames: { root: styles_module_default.nsPreviewImage }, src: fileUrl, alt: t2("filePreview.previewImageAlt") });
|
|
2616
3261
|
case "PDF":
|
|
2617
3262
|
return /* @__PURE__ */ jsx(PdfPreview_default, { fileUrl, ...pdfParams, password, onSetPassword });
|
|
2618
3263
|
case "PDF_IMG":
|
|
@@ -2632,11 +3277,25 @@ var FilePreview_default = ({ suffix, fileUrl, pdfParams, password, searchValue,
|
|
|
2632
3277
|
case "DOCX":
|
|
2633
3278
|
return /* @__PURE__ */ jsx(DocxPreview_default, { fileUrl });
|
|
2634
3279
|
default:
|
|
2635
|
-
return /* @__PURE__ */ jsx(Result, { subTitle:
|
|
3280
|
+
return /* @__PURE__ */ jsx(Result, { subTitle: t2("filePreview.previewNotSupported", { suffix: suffix || "" }) });
|
|
2636
3281
|
}
|
|
2637
3282
|
}, [suffix, fileUrl, pdfParams]);
|
|
2638
3283
|
return /* @__PURE__ */ jsx(Flex, { justify: "center", align: "center", className: "height-full", children: Preview });
|
|
2639
3284
|
};
|
|
3285
|
+
var FilePreviewDrawer_default = ({ open, title, onClose, ...props }) => {
|
|
3286
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
3287
|
+
return /* @__PURE__ */ jsx(
|
|
3288
|
+
Drawer,
|
|
3289
|
+
{
|
|
3290
|
+
title: title || t2("filePreview.title"),
|
|
3291
|
+
push: false,
|
|
3292
|
+
size: "100%",
|
|
3293
|
+
open,
|
|
3294
|
+
onClose,
|
|
3295
|
+
children: /* @__PURE__ */ jsx(FilePreview_default, { ...props })
|
|
3296
|
+
}
|
|
3297
|
+
);
|
|
3298
|
+
};
|
|
2640
3299
|
loader.config({ monaco });
|
|
2641
3300
|
var getLanguage = (suffix) => {
|
|
2642
3301
|
switch (suffix.toLowerCase()) {
|
|
@@ -2676,6 +3335,7 @@ var getLanguage = (suffix) => {
|
|
|
2676
3335
|
}
|
|
2677
3336
|
};
|
|
2678
3337
|
var CodePreview = ({ fileUrl, suffix }) => {
|
|
3338
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
2679
3339
|
const [content, setContent] = useState("");
|
|
2680
3340
|
const [error, setError] = useState("");
|
|
2681
3341
|
const [loading, setLoading] = useState(false);
|
|
@@ -2685,7 +3345,7 @@ var CodePreview = ({ fileUrl, suffix }) => {
|
|
|
2685
3345
|
};
|
|
2686
3346
|
const res = await fetch(fileUrl, { headers, signal });
|
|
2687
3347
|
if (res.status !== 200) {
|
|
2688
|
-
throw new Error(
|
|
3348
|
+
throw new Error(t2("filePreview.requestFailedWithStatus", { status: res.status }));
|
|
2689
3349
|
}
|
|
2690
3350
|
const buffer = await res.arrayBuffer();
|
|
2691
3351
|
let text = "";
|
|
@@ -2709,7 +3369,7 @@ var CodePreview = ({ fileUrl, suffix }) => {
|
|
|
2709
3369
|
await fetchContent(controller.signal);
|
|
2710
3370
|
} catch (error2) {
|
|
2711
3371
|
if (!controller.signal.aborted) {
|
|
2712
|
-
setError("
|
|
3372
|
+
setError(t2("filePreview.loadFileFailed"));
|
|
2713
3373
|
}
|
|
2714
3374
|
} finally {
|
|
2715
3375
|
if (!controller.signal.aborted) {
|
|
@@ -2749,7 +3409,7 @@ var CodePreview = ({ fileUrl, suffix }) => {
|
|
|
2749
3409
|
var CodePreview_default = CodePreview;
|
|
2750
3410
|
var { Text } = Typography;
|
|
2751
3411
|
pdfjsLib.GlobalWorkerOptions.workerSrc = "https://unpkg.com/pdfjs-dist@5.4.296/legacy/build/pdf.worker.min.mjs";
|
|
2752
|
-
var MIN_SCALE = 0.
|
|
3412
|
+
var MIN_SCALE = 0.1;
|
|
2753
3413
|
var MAX_SCALE = 1.5;
|
|
2754
3414
|
var SCALE_STEP = 0.1;
|
|
2755
3415
|
var PdfPage = React3__default.memo(({ pdf, pageNumber, scale, scrollContainerRef, defaultSize }) => {
|
|
@@ -2859,6 +3519,7 @@ var PdfPage = React3__default.memo(({ pdf, pageNumber, scale, scrollContainerRef
|
|
|
2859
3519
|
);
|
|
2860
3520
|
});
|
|
2861
3521
|
var DocumentPreview = ({ fileUrl, previewEnabled = true }) => {
|
|
3522
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
2862
3523
|
const [loading, setLoading] = useState(false);
|
|
2863
3524
|
const [pdf, setPdf] = useState(null);
|
|
2864
3525
|
const [numPages, setNumPages] = useState(0);
|
|
@@ -2918,9 +3579,9 @@ var DocumentPreview = ({ fileUrl, previewEnabled = true }) => {
|
|
|
2918
3579
|
if (aborted) return;
|
|
2919
3580
|
const message3 = e?.message;
|
|
2920
3581
|
if (typeof message3 === "string" && message3.includes("cancelled")) ; else if (typeof message3 === "string" && message3.includes("(903)")) {
|
|
2921
|
-
setError("
|
|
3582
|
+
setError(t2("filePreview.previewGenerating"));
|
|
2922
3583
|
} else {
|
|
2923
|
-
setError(message3 || "
|
|
3584
|
+
setError(message3 || t2("filePreview.pdfLoadFailed"));
|
|
2924
3585
|
}
|
|
2925
3586
|
} finally {
|
|
2926
3587
|
if (!aborted) {
|
|
@@ -3025,7 +3686,7 @@ var DocumentPreview = ({ fileUrl, previewEnabled = true }) => {
|
|
|
3025
3686
|
/* @__PURE__ */ jsx(Button, { type: "text", icon: /* @__PURE__ */ jsx(PlusOutlined, {}), size: "small", onClick: onZoomIn, disabled: scale >= MAX_SCALE })
|
|
3026
3687
|
] });
|
|
3027
3688
|
if (!previewEnabled) {
|
|
3028
|
-
return /* @__PURE__ */ jsx(Flex, { className: styles_module_default.stateBody, children: "
|
|
3689
|
+
return /* @__PURE__ */ jsx(Flex, { className: styles_module_default.stateBody, children: t2("filePreview.closePreview") });
|
|
3029
3690
|
}
|
|
3030
3691
|
return /* @__PURE__ */ jsxs("div", { className: styles_module_default.pdfContainer, children: [
|
|
3031
3692
|
toolbar,
|
|
@@ -3034,6 +3695,7 @@ var DocumentPreview = ({ fileUrl, previewEnabled = true }) => {
|
|
|
3034
3695
|
};
|
|
3035
3696
|
var DocumentPreview_default = DocumentPreview;
|
|
3036
3697
|
var HtmlPreview = ({ fileUrl }) => {
|
|
3698
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
3037
3699
|
const [content, setContent] = useState("");
|
|
3038
3700
|
const [error, setError] = useState("");
|
|
3039
3701
|
const [loading, setLoading] = useState(false);
|
|
@@ -3046,7 +3708,7 @@ var HtmlPreview = ({ fileUrl }) => {
|
|
|
3046
3708
|
signal
|
|
3047
3709
|
});
|
|
3048
3710
|
if (res.status !== 200) {
|
|
3049
|
-
throw new Error(
|
|
3711
|
+
throw new Error(t2("filePreview.requestFailedWithStatus", { status: res.status }));
|
|
3050
3712
|
}
|
|
3051
3713
|
const buffer = await res.arrayBuffer();
|
|
3052
3714
|
let htmlText = "";
|
|
@@ -3058,7 +3720,7 @@ var HtmlPreview = ({ fileUrl }) => {
|
|
|
3058
3720
|
htmlText = gbkDecoder.decode(buffer);
|
|
3059
3721
|
}
|
|
3060
3722
|
if (!htmlText) {
|
|
3061
|
-
throw new Error("
|
|
3723
|
+
throw new Error(t2("filePreview.emptyResponse"));
|
|
3062
3724
|
}
|
|
3063
3725
|
setContent(htmlText);
|
|
3064
3726
|
};
|
|
@@ -3073,7 +3735,7 @@ var HtmlPreview = ({ fileUrl }) => {
|
|
|
3073
3735
|
await fetchHtml(controller.signal);
|
|
3074
3736
|
} catch (error2) {
|
|
3075
3737
|
if (!controller.signal.aborted) {
|
|
3076
|
-
setError("
|
|
3738
|
+
setError(t2("filePreview.htmlParseFailed"));
|
|
3077
3739
|
}
|
|
3078
3740
|
} finally {
|
|
3079
3741
|
if (!controller.signal.aborted) {
|
|
@@ -3099,6 +3761,7 @@ var HtmlPreview = ({ fileUrl }) => {
|
|
|
3099
3761
|
};
|
|
3100
3762
|
var HtmlPreview_default = HtmlPreview;
|
|
3101
3763
|
var luyaFilePreview_default = ({ suffix, fileUrl, emptyProps, fileName }) => {
|
|
3764
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
3102
3765
|
const extension = suffix ? suffix : getFileSuffixName(fileName || "");
|
|
3103
3766
|
const Preview = useMemo(() => {
|
|
3104
3767
|
if (!fileUrl) {
|
|
@@ -3114,7 +3777,7 @@ var luyaFilePreview_default = ({ suffix, fileUrl, emptyProps, fileName }) => {
|
|
|
3114
3777
|
case "SVG":
|
|
3115
3778
|
case "ICO":
|
|
3116
3779
|
case "TIFF":
|
|
3117
|
-
return /* @__PURE__ */ jsx(Image$1, { classNames: { root: styles_module_default.nsPreviewImage }, src: fileUrl, alt: "
|
|
3780
|
+
return /* @__PURE__ */ jsx(Image$1, { classNames: { root: styles_module_default.nsPreviewImage }, src: fileUrl, alt: t2("filePreview.previewImageAlt") });
|
|
3118
3781
|
case "DOC":
|
|
3119
3782
|
case "DOCX":
|
|
3120
3783
|
case "PDF":
|
|
@@ -3159,30 +3822,18 @@ var luyaFilePreview_default = ({ suffix, fileUrl, emptyProps, fileName }) => {
|
|
|
3159
3822
|
case "TXT":
|
|
3160
3823
|
return /* @__PURE__ */ jsx(MarkdownPreview_default, { fileUrl, asPlainText: true });
|
|
3161
3824
|
default:
|
|
3162
|
-
return /* @__PURE__ */ jsx(Result, { subTitle:
|
|
3825
|
+
return /* @__PURE__ */ jsx(Result, { subTitle: t2("filePreview.previewNotSupportedDownload", { suffix: suffix || "" }) });
|
|
3163
3826
|
}
|
|
3164
3827
|
}, [suffix, fileUrl, fileName]);
|
|
3165
3828
|
return /* @__PURE__ */ jsx(Flex, { justify: "center", align: "center", className: "height-full p-t-16 p-b-16 p-l-16", children: Preview });
|
|
3166
3829
|
};
|
|
3167
|
-
var FilePreviewDrawer_default = ({ open, title = "\u6587\u4EF6\u9884\u89C8", onClose, ...props }) => {
|
|
3168
|
-
return /* @__PURE__ */ jsx(
|
|
3169
|
-
Drawer,
|
|
3170
|
-
{
|
|
3171
|
-
title,
|
|
3172
|
-
push: false,
|
|
3173
|
-
size: "100%",
|
|
3174
|
-
open,
|
|
3175
|
-
onClose,
|
|
3176
|
-
children: /* @__PURE__ */ jsx(FilePreview_default, { ...props })
|
|
3177
|
-
}
|
|
3178
|
-
);
|
|
3179
|
-
};
|
|
3180
3830
|
|
|
3181
3831
|
// src/components/MicroApp/styles.module.less
|
|
3182
3832
|
var styles_module_default3 = {
|
|
3183
3833
|
microApp: "styles_module_microApp"
|
|
3184
3834
|
};
|
|
3185
3835
|
var MicroApp_default = ({ name, url, className, onMounted, onError, data, ...rest }) => {
|
|
3836
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
3186
3837
|
const [loading, setLoading] = useState(false);
|
|
3187
3838
|
useEffect(() => {
|
|
3188
3839
|
setLoading(true);
|
|
@@ -3197,10 +3848,10 @@ var MicroApp_default = ({ name, url, className, onMounted, onError, data, ...res
|
|
|
3197
3848
|
};
|
|
3198
3849
|
const microAppData = useMemo(() => {
|
|
3199
3850
|
const parentMainSource = window?.microApp?.getData?.()?.mainSource || [];
|
|
3200
|
-
return { mainSource: [...parentMainSource, name], ...data };
|
|
3851
|
+
return { [LANG_KEY]: getLang(), mainSource: [...parentMainSource, name], ...data };
|
|
3201
3852
|
}, [data, name]);
|
|
3202
3853
|
const TagName = microApp.tagName || "micro-app";
|
|
3203
|
-
return /* @__PURE__ */ jsxCustomEvent(Spin, { spinning: loading, classNames: { root: "full-spin" }, description: "
|
|
3854
|
+
return /* @__PURE__ */ jsxCustomEvent(Spin, { spinning: loading, classNames: { root: "full-spin" }, description: t2("microApp.loading") }, /* @__PURE__ */ jsxCustomEvent(
|
|
3204
3855
|
TagName,
|
|
3205
3856
|
{
|
|
3206
3857
|
name,
|
|
@@ -3289,10 +3940,12 @@ var styles_module_default4 = {
|
|
|
3289
3940
|
iframe: "styles_module_iframe"
|
|
3290
3941
|
};
|
|
3291
3942
|
var Iframe_default = forwardRef(({ defaultMainSource, id, src, className, onLoad }, ref) => {
|
|
3943
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
3292
3944
|
const [loading, setLoading] = useState(false);
|
|
3293
3945
|
const finalSrc = useMemo(() => {
|
|
3294
|
-
|
|
3295
|
-
|
|
3946
|
+
const baseUrl = addUrlLastSlash(setUrlMainSource(src, location.href, defaultMainSource));
|
|
3947
|
+
return buildUrlParams({ v: Date.now(), [LANG_KEY]: getLang() }, baseUrl);
|
|
3948
|
+
}, [src, defaultMainSource]);
|
|
3296
3949
|
const onHandleLoad = () => {
|
|
3297
3950
|
setLoading(false);
|
|
3298
3951
|
onLoad?.();
|
|
@@ -3300,7 +3953,7 @@ var Iframe_default = forwardRef(({ defaultMainSource, id, src, className, onLoad
|
|
|
3300
3953
|
useEffect(() => {
|
|
3301
3954
|
setLoading(true);
|
|
3302
3955
|
}, [src]);
|
|
3303
|
-
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Spin, { spinning: loading, classNames: { root: "full-spin" }, description: "
|
|
3956
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Spin, { spinning: loading, classNames: { root: "full-spin" }, description: t2("iframe.loading"), children: /* @__PURE__ */ jsx(
|
|
3304
3957
|
"iframe",
|
|
3305
3958
|
{
|
|
3306
3959
|
id,
|
|
@@ -3980,24 +4633,37 @@ function useIsBreakpoint(mode = "max", breakpoint = 768) {
|
|
|
3980
4633
|
}
|
|
3981
4634
|
var { TextArea } = Input;
|
|
3982
4635
|
var AnnotationModal_default = ({ visible, onCancel, onConfirm }) => {
|
|
4636
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
3983
4637
|
const [form] = Form.useForm();
|
|
3984
4638
|
const handleOk = async () => {
|
|
3985
4639
|
const values = await form.validateFields();
|
|
3986
4640
|
onConfirm(values.content.trim());
|
|
3987
4641
|
onCancel();
|
|
3988
4642
|
};
|
|
3989
|
-
return /* @__PURE__ */ jsx(
|
|
3990
|
-
|
|
4643
|
+
return /* @__PURE__ */ jsx(
|
|
4644
|
+
Modal,
|
|
3991
4645
|
{
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
4646
|
+
title: t2("markdownEditor.annotation.add"),
|
|
4647
|
+
open: visible,
|
|
4648
|
+
onOk: handleOk,
|
|
4649
|
+
onCancel,
|
|
4650
|
+
destroyOnHidden: true,
|
|
4651
|
+
okText: t2("common.confirm"),
|
|
4652
|
+
cancelText: t2("common.cancel"),
|
|
4653
|
+
children: /* @__PURE__ */ jsx(Form, { form, layout: "vertical", children: /* @__PURE__ */ jsx(
|
|
4654
|
+
Form.Item,
|
|
4655
|
+
{
|
|
4656
|
+
name: "content",
|
|
4657
|
+
label: t2("markdownEditor.annotation.content"),
|
|
4658
|
+
rules: [
|
|
4659
|
+
{ whitespace: true, required: true, message: t2("markdownEditor.annotation.required") },
|
|
4660
|
+
{ max: 500, message: t2("markdownEditor.annotation.maxLength") }
|
|
4661
|
+
],
|
|
4662
|
+
children: /* @__PURE__ */ jsx(TextArea, { rows: 4, placeholder: t2("markdownEditor.annotation.placeholder"), showCount: true, maxLength: 500 })
|
|
4663
|
+
}
|
|
4664
|
+
) })
|
|
3999
4665
|
}
|
|
4000
|
-
)
|
|
4666
|
+
);
|
|
4001
4667
|
};
|
|
4002
4668
|
|
|
4003
4669
|
// src/components/MarkdownEditor/annotation/constant.ts
|
|
@@ -4022,6 +4688,7 @@ var AnnotationSidebar_default = ({
|
|
|
4022
4688
|
annotationConfig,
|
|
4023
4689
|
onClose
|
|
4024
4690
|
}) => {
|
|
4691
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
4025
4692
|
const [form] = Form.useForm();
|
|
4026
4693
|
const [editingId, setEditingId] = useState();
|
|
4027
4694
|
const itemRefs = useRef({});
|
|
@@ -4058,7 +4725,7 @@ var AnnotationSidebar_default = ({
|
|
|
4058
4725
|
/* @__PURE__ */ jsxs(Space, { children: [
|
|
4059
4726
|
/* @__PURE__ */ jsx(MessageOutlined, {}),
|
|
4060
4727
|
/* @__PURE__ */ jsxs("span", { children: [
|
|
4061
|
-
"
|
|
4728
|
+
t2("markdownEditor.annotation.title"),
|
|
4062
4729
|
annotations.length > 0 && `\uFF08${annotations.length}\uFF09`
|
|
4063
4730
|
] })
|
|
4064
4731
|
] }),
|
|
@@ -4093,15 +4760,15 @@ var AnnotationSidebar_default = ({
|
|
|
4093
4760
|
{
|
|
4094
4761
|
name: "content",
|
|
4095
4762
|
rules: [
|
|
4096
|
-
{ whitespace: true, required: true, message: "
|
|
4097
|
-
{ max: 500, message: "
|
|
4763
|
+
{ whitespace: true, required: true, message: t2("markdownEditor.annotation.required") },
|
|
4764
|
+
{ max: 500, message: t2("markdownEditor.annotation.maxLength") }
|
|
4098
4765
|
],
|
|
4099
|
-
children: /* @__PURE__ */ jsx(TextArea2, { autoFocus: true, rows: 2, placeholder: "
|
|
4766
|
+
children: /* @__PURE__ */ jsx(TextArea2, { autoFocus: true, rows: 2, placeholder: t2("markdownEditor.annotation.placeholder"), showCount: true, maxLength: 500 })
|
|
4100
4767
|
}
|
|
4101
4768
|
) }),
|
|
4102
4769
|
/* @__PURE__ */ jsxs(Space, { children: [
|
|
4103
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "primary", onClick: handleSaveEdit, children: "
|
|
4104
|
-
/* @__PURE__ */ jsx(Button, { size: "small", onClick: handleCancelEdit, children: "
|
|
4770
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "primary", onClick: handleSaveEdit, children: t2("common.save") }),
|
|
4771
|
+
/* @__PURE__ */ jsx(Button, { size: "small", onClick: handleCancelEdit, children: t2("common.cancel") })
|
|
4105
4772
|
] })
|
|
4106
4773
|
] }) : /* @__PURE__ */ jsxs(Flex, { gap: 8, vertical: true, children: [
|
|
4107
4774
|
/* @__PURE__ */ jsx(Text2, { children: annotation.content }),
|
|
@@ -4111,7 +4778,7 @@ var AnnotationSidebar_default = ({
|
|
|
4111
4778
|
{
|
|
4112
4779
|
type: "text",
|
|
4113
4780
|
size: "small",
|
|
4114
|
-
title: "
|
|
4781
|
+
title: t2("markdownEditor.annotation.edit"),
|
|
4115
4782
|
icon: /* @__PURE__ */ jsx(EditOutlined, {}),
|
|
4116
4783
|
onClick: (e) => {
|
|
4117
4784
|
handleEdit(annotation);
|
|
@@ -4121,12 +4788,12 @@ var AnnotationSidebar_default = ({
|
|
|
4121
4788
|
/* @__PURE__ */ jsx(
|
|
4122
4789
|
Popconfirm,
|
|
4123
4790
|
{
|
|
4124
|
-
title: "
|
|
4125
|
-
okText: "
|
|
4126
|
-
cancelText: "
|
|
4127
|
-
description: "
|
|
4791
|
+
title: t2("common.defaultTitle"),
|
|
4792
|
+
okText: t2("common.confirm"),
|
|
4793
|
+
cancelText: t2("common.cancel"),
|
|
4794
|
+
description: t2("markdownEditor.annotation.confirmDelete"),
|
|
4128
4795
|
onConfirm: () => onDeleteAnnotation(annotation[ANNOTATION_ATTRS[0]]),
|
|
4129
|
-
children: /* @__PURE__ */ jsx(Button, { type: "text", size: "small", title: "
|
|
4796
|
+
children: /* @__PURE__ */ jsx(Button, { type: "text", size: "small", title: t2("markdownEditor.annotation.delete"), icon: /* @__PURE__ */ jsx(DeleteOutlined, {}) })
|
|
4130
4797
|
}
|
|
4131
4798
|
)
|
|
4132
4799
|
] })
|
|
@@ -4135,7 +4802,7 @@ var AnnotationSidebar_default = ({
|
|
|
4135
4802
|
}
|
|
4136
4803
|
)
|
|
4137
4804
|
}
|
|
4138
|
-
) : /* @__PURE__ */ jsx(Flex, { vertical: true, justify: "center", align: "center", className: "height-full", children: /* @__PURE__ */ jsx(Empty, { description: "
|
|
4805
|
+
) : /* @__PURE__ */ jsx(Flex, { vertical: true, justify: "center", align: "center", className: "height-full", children: /* @__PURE__ */ jsx(Empty, { description: t2("markdownEditor.annotation.empty") }) })
|
|
4139
4806
|
}
|
|
4140
4807
|
);
|
|
4141
4808
|
const container = annotationConfig?.getContainer?.();
|
|
@@ -4420,7 +5087,7 @@ var useAnnotations = (annotationConfig) => {
|
|
|
4420
5087
|
const id = genNonDuplicateID();
|
|
4421
5088
|
editor.current.chain().focus().setMark(ANNOTATION_KEY, {
|
|
4422
5089
|
"annotation-id": id,
|
|
4423
|
-
"user-name": annotationConfig?.user?.name || "
|
|
5090
|
+
"user-name": annotationConfig?.user?.name || t("markdownEditor.unknown"),
|
|
4424
5091
|
"user-id": annotationConfig?.user.id || "0000",
|
|
4425
5092
|
"update-time": getTimestamp(),
|
|
4426
5093
|
content
|
|
@@ -4702,6 +5369,7 @@ var collectionSidebar_default = ({
|
|
|
4702
5369
|
collectionConfig,
|
|
4703
5370
|
onClose
|
|
4704
5371
|
}) => {
|
|
5372
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
4705
5373
|
const itemRefs = useRef({});
|
|
4706
5374
|
useEffect(() => {
|
|
4707
5375
|
if (selectedCollectionId) {
|
|
@@ -4723,7 +5391,7 @@ var collectionSidebar_default = ({
|
|
|
4723
5391
|
/* @__PURE__ */ jsxs(Space, { children: [
|
|
4724
5392
|
/* @__PURE__ */ jsx(BookOutlined, {}),
|
|
4725
5393
|
/* @__PURE__ */ jsxs("span", { children: [
|
|
4726
|
-
"
|
|
5394
|
+
t2("markdownEditor.collection.title"),
|
|
4727
5395
|
collections.length > 0 && `\uFF08${collections.length}\uFF09`
|
|
4728
5396
|
] })
|
|
4729
5397
|
] }),
|
|
@@ -4766,12 +5434,12 @@ var collectionSidebar_default = ({
|
|
|
4766
5434
|
!disabled && selectedCollectionId === collection[COLLECTION_ATTRS[0]] && /* @__PURE__ */ jsx(Space, { children: /* @__PURE__ */ jsx(
|
|
4767
5435
|
Popconfirm,
|
|
4768
5436
|
{
|
|
4769
|
-
title: "
|
|
4770
|
-
okText: "
|
|
4771
|
-
cancelText: "
|
|
4772
|
-
description: "
|
|
5437
|
+
title: t2("common.defaultTitle"),
|
|
5438
|
+
okText: t2("common.confirm"),
|
|
5439
|
+
cancelText: t2("common.cancel"),
|
|
5440
|
+
description: t2("markdownEditor.collection.confirmDelete"),
|
|
4773
5441
|
onConfirm: () => onDeleteCollection(collection[COLLECTION_ATTRS[0]]),
|
|
4774
|
-
children: /* @__PURE__ */ jsx(Button, { type: "text", size: "small", title: "
|
|
5442
|
+
children: /* @__PURE__ */ jsx(Button, { type: "text", size: "small", title: t2("markdownEditor.collection.delete"), icon: /* @__PURE__ */ jsx(DeleteOutlined, {}) })
|
|
4775
5443
|
}
|
|
4776
5444
|
) })
|
|
4777
5445
|
] })
|
|
@@ -4780,7 +5448,7 @@ var collectionSidebar_default = ({
|
|
|
4780
5448
|
);
|
|
4781
5449
|
}
|
|
4782
5450
|
}
|
|
4783
|
-
) : /* @__PURE__ */ jsx(Flex, { vertical: true, justify: "center", align: "center", className: "height-full", children: /* @__PURE__ */ jsx(Empty, { description: "
|
|
5451
|
+
) : /* @__PURE__ */ jsx(Flex, { vertical: true, justify: "center", align: "center", className: "height-full", children: /* @__PURE__ */ jsx(Empty, { description: t2("markdownEditor.collection.empty") }) })
|
|
4784
5452
|
}
|
|
4785
5453
|
);
|
|
4786
5454
|
const container = collectionConfig?.getContainer?.();
|
|
@@ -4821,7 +5489,7 @@ var useCollections = (collectionConfig) => {
|
|
|
4821
5489
|
}
|
|
4822
5490
|
editor.current.chain().focus().setMark(COLLECTION_KEY, {
|
|
4823
5491
|
"collection-id": remoteId,
|
|
4824
|
-
"user-name": collectionConfig?.user?.name || "
|
|
5492
|
+
"user-name": collectionConfig?.user?.name || t("markdownEditor.unknown"),
|
|
4825
5493
|
"user-id": collectionConfig?.user.id || "0000",
|
|
4826
5494
|
"update-time": getTimestamp(),
|
|
4827
5495
|
"page-no": pageIndex
|
|
@@ -5370,6 +6038,7 @@ var BlockquoteButton = forwardRef(
|
|
|
5370
6038
|
hideWhenUnavailable,
|
|
5371
6039
|
onToggled
|
|
5372
6040
|
});
|
|
6041
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
5373
6042
|
const handleClick = useCallback(
|
|
5374
6043
|
(event) => {
|
|
5375
6044
|
onClick?.(event);
|
|
@@ -5393,7 +6062,7 @@ var BlockquoteButton = forwardRef(
|
|
|
5393
6062
|
"data-disabled": !canToggle3,
|
|
5394
6063
|
"aria-label": label,
|
|
5395
6064
|
"aria-pressed": isActive,
|
|
5396
|
-
tooltip: "
|
|
6065
|
+
tooltip: t2("markdownEditor.toolbar.blockquote"),
|
|
5397
6066
|
onClick: handleClick,
|
|
5398
6067
|
...buttonProps,
|
|
5399
6068
|
ref,
|
|
@@ -5561,7 +6230,7 @@ function useBlockquote(config) {
|
|
|
5561
6230
|
isActive,
|
|
5562
6231
|
handleToggle,
|
|
5563
6232
|
canToggle: canToggle3,
|
|
5564
|
-
label: "
|
|
6233
|
+
label: t("markdownEditor.toolbar.blockquote"),
|
|
5565
6234
|
shortcutKeys: BLOCKQUOTE_SHORTCUT_KEY,
|
|
5566
6235
|
Icon: BlockquoteIcon
|
|
5567
6236
|
};
|
|
@@ -5596,6 +6265,7 @@ var CodeBlockButton = forwardRef(
|
|
|
5596
6265
|
hideWhenUnavailable,
|
|
5597
6266
|
onToggled
|
|
5598
6267
|
});
|
|
6268
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
5599
6269
|
const handleClick = useCallback(
|
|
5600
6270
|
(event) => {
|
|
5601
6271
|
onClick?.(event);
|
|
@@ -5619,7 +6289,7 @@ var CodeBlockButton = forwardRef(
|
|
|
5619
6289
|
tabIndex: -1,
|
|
5620
6290
|
"aria-label": label,
|
|
5621
6291
|
"aria-pressed": isActive,
|
|
5622
|
-
tooltip: "
|
|
6292
|
+
tooltip: t2("markdownEditor.toolbar.codeBlock"),
|
|
5623
6293
|
onClick: handleClick,
|
|
5624
6294
|
...buttonProps,
|
|
5625
6295
|
ref,
|
|
@@ -5778,7 +6448,7 @@ function useCodeBlock(config) {
|
|
|
5778
6448
|
isActive,
|
|
5779
6449
|
handleToggle,
|
|
5780
6450
|
canToggle: canToggleState,
|
|
5781
|
-
label: "
|
|
6451
|
+
label: t("markdownEditor.toolbar.codeBlock"),
|
|
5782
6452
|
shortcutKeys: CODE_BLOCK_SHORTCUT_KEY,
|
|
5783
6453
|
Icon: CodeBlockIcon
|
|
5784
6454
|
};
|
|
@@ -5939,6 +6609,7 @@ var ColorHighlightButton = forwardRef(
|
|
|
5939
6609
|
style,
|
|
5940
6610
|
...buttonProps
|
|
5941
6611
|
}, ref) => {
|
|
6612
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
5942
6613
|
const { editor } = useTiptapEditor(providedEditor);
|
|
5943
6614
|
const {
|
|
5944
6615
|
isVisible,
|
|
@@ -5950,7 +6621,7 @@ var ColorHighlightButton = forwardRef(
|
|
|
5950
6621
|
} = useColorHighlight({
|
|
5951
6622
|
editor,
|
|
5952
6623
|
highlightColor,
|
|
5953
|
-
label: text ||
|
|
6624
|
+
label: text || t2("markdownEditor.highlight.toggle", { color: highlightColor }),
|
|
5954
6625
|
hideWhenUnavailable,
|
|
5955
6626
|
mode,
|
|
5956
6627
|
onApplied
|
|
@@ -6009,52 +6680,52 @@ ColorHighlightButton.displayName = "ColorHighlightButton";
|
|
|
6009
6680
|
var COLOR_HIGHLIGHT_SHORTCUT_KEY = "mod+shift+h";
|
|
6010
6681
|
var HIGHLIGHT_COLORS = [
|
|
6011
6682
|
{
|
|
6012
|
-
|
|
6683
|
+
labelKey: "markdownEditor.highlight.default",
|
|
6013
6684
|
value: "var(--tt-bg-color)",
|
|
6014
6685
|
border: "var(--tt-bg-color-contrast)"
|
|
6015
6686
|
},
|
|
6016
6687
|
{
|
|
6017
|
-
|
|
6688
|
+
labelKey: "markdownEditor.highlight.gray",
|
|
6018
6689
|
value: "var(--tt-color-highlight-gray)",
|
|
6019
6690
|
border: "var(--tt-color-highlight-gray-contrast)"
|
|
6020
6691
|
},
|
|
6021
6692
|
{
|
|
6022
|
-
|
|
6693
|
+
labelKey: "markdownEditor.highlight.brown",
|
|
6023
6694
|
value: "var(--tt-color-highlight-brown)",
|
|
6024
6695
|
border: "var(--tt-color-highlight-brown-contrast)"
|
|
6025
6696
|
},
|
|
6026
6697
|
{
|
|
6027
|
-
|
|
6698
|
+
labelKey: "markdownEditor.highlight.orange",
|
|
6028
6699
|
value: "var(--tt-color-highlight-orange)",
|
|
6029
6700
|
border: "var(--tt-color-highlight-orange-contrast)"
|
|
6030
6701
|
},
|
|
6031
6702
|
{
|
|
6032
|
-
|
|
6703
|
+
labelKey: "markdownEditor.highlight.yellow",
|
|
6033
6704
|
value: "var(--tt-color-highlight-yellow)",
|
|
6034
6705
|
border: "var(--tt-color-highlight-yellow-contrast)"
|
|
6035
6706
|
},
|
|
6036
6707
|
{
|
|
6037
|
-
|
|
6708
|
+
labelKey: "markdownEditor.highlight.green",
|
|
6038
6709
|
value: "var(--tt-color-highlight-green)",
|
|
6039
6710
|
border: "var(--tt-color-highlight-green-contrast)"
|
|
6040
6711
|
},
|
|
6041
6712
|
{
|
|
6042
|
-
|
|
6713
|
+
labelKey: "markdownEditor.highlight.blue",
|
|
6043
6714
|
value: "var(--tt-color-highlight-blue)",
|
|
6044
6715
|
border: "var(--tt-color-highlight-blue-contrast)"
|
|
6045
6716
|
},
|
|
6046
6717
|
{
|
|
6047
|
-
|
|
6718
|
+
labelKey: "markdownEditor.highlight.purple",
|
|
6048
6719
|
value: "var(--tt-color-highlight-purple)",
|
|
6049
6720
|
border: "var(--tt-color-highlight-purple-contrast)"
|
|
6050
6721
|
},
|
|
6051
6722
|
{
|
|
6052
|
-
|
|
6723
|
+
labelKey: "markdownEditor.highlight.pink",
|
|
6053
6724
|
value: "var(--tt-color-highlight-pink)",
|
|
6054
6725
|
border: "var(--tt-color-highlight-pink-contrast)"
|
|
6055
6726
|
},
|
|
6056
6727
|
{
|
|
6057
|
-
|
|
6728
|
+
labelKey: "markdownEditor.highlight.red",
|
|
6058
6729
|
value: "var(--tt-color-highlight-red)",
|
|
6059
6730
|
border: "var(--tt-color-highlight-red-contrast)"
|
|
6060
6731
|
}
|
|
@@ -6180,7 +6851,7 @@ function useColorHighlight(config) {
|
|
|
6180
6851
|
const handleRemoveHighlight = useCallback(() => {
|
|
6181
6852
|
const success = removeHighlight(editor, mode);
|
|
6182
6853
|
if (success) {
|
|
6183
|
-
onApplied?.({ color: "", label: "
|
|
6854
|
+
onApplied?.({ color: "", label: t("markdownEditor.highlight.removeBackground"), mode });
|
|
6184
6855
|
}
|
|
6185
6856
|
return success;
|
|
6186
6857
|
}, [editor, onApplied, mode]);
|
|
@@ -6202,28 +6873,31 @@ function useColorHighlight(config) {
|
|
|
6202
6873
|
handleColorHighlight,
|
|
6203
6874
|
handleRemoveHighlight,
|
|
6204
6875
|
canColorHighlight: canColorHighlightState,
|
|
6205
|
-
label: label ||
|
|
6876
|
+
label: label || t("markdownEditor.highlight.label"),
|
|
6206
6877
|
shortcutKeys: COLOR_HIGHLIGHT_SHORTCUT_KEY,
|
|
6207
6878
|
Icon: HighlighterIcon,
|
|
6208
6879
|
mode
|
|
6209
6880
|
};
|
|
6210
6881
|
}
|
|
6211
|
-
var ColorHighlightPopoverButton = forwardRef(({ className, children, ...props }, ref) =>
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
)
|
|
6882
|
+
var ColorHighlightPopoverButton = forwardRef(({ className, children, ...props }, ref) => {
|
|
6883
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
6884
|
+
return /* @__PURE__ */ jsx(
|
|
6885
|
+
Button7,
|
|
6886
|
+
{
|
|
6887
|
+
type: "button",
|
|
6888
|
+
className,
|
|
6889
|
+
"data-style": "ghost",
|
|
6890
|
+
"data-appearance": "default",
|
|
6891
|
+
role: "button",
|
|
6892
|
+
tabIndex: -1,
|
|
6893
|
+
"aria-label": t2("markdownEditor.highlight.textLabel"),
|
|
6894
|
+
tooltip: t2("markdownEditor.highlight.label"),
|
|
6895
|
+
ref,
|
|
6896
|
+
...props,
|
|
6897
|
+
children: children ?? /* @__PURE__ */ jsx(HighlighterIcon, { className: "tiptap-button-icon" })
|
|
6898
|
+
}
|
|
6899
|
+
);
|
|
6900
|
+
});
|
|
6227
6901
|
ColorHighlightPopoverButton.displayName = "ColorHighlightPopoverButton";
|
|
6228
6902
|
function ColorHighlightPopoverContent({
|
|
6229
6903
|
editor,
|
|
@@ -6238,9 +6912,10 @@ function ColorHighlightPopoverContent({
|
|
|
6238
6912
|
const { handleRemoveHighlight } = useColorHighlight({ editor });
|
|
6239
6913
|
const isMobile = useIsBreakpoint();
|
|
6240
6914
|
const containerRef = useRef(null);
|
|
6915
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
6241
6916
|
const menuItems = useMemo(
|
|
6242
|
-
() => [...colors, { label: "
|
|
6243
|
-
[colors]
|
|
6917
|
+
() => [...colors.map((c) => ({ ...c, label: t2(c.labelKey) })), { label: t2("markdownEditor.highlight.removeHighlight"), value: "none" }],
|
|
6918
|
+
[colors, t2]
|
|
6244
6919
|
);
|
|
6245
6920
|
const { selectedIndex } = useMenuNavigation({
|
|
6246
6921
|
containerRef,
|
|
@@ -6269,8 +6944,8 @@ function ColorHighlightPopoverContent({
|
|
|
6269
6944
|
{
|
|
6270
6945
|
editor,
|
|
6271
6946
|
highlightColor: color.value,
|
|
6272
|
-
tooltip: color.
|
|
6273
|
-
"aria-label": `${color.
|
|
6947
|
+
tooltip: t2(color.labelKey),
|
|
6948
|
+
"aria-label": `${t2(color.labelKey)} highlight color`,
|
|
6274
6949
|
tabIndex: index === selectedIndex ? 0 : -1,
|
|
6275
6950
|
"data-highlighted": selectedIndex === index
|
|
6276
6951
|
},
|
|
@@ -6281,8 +6956,8 @@ function ColorHighlightPopoverContent({
|
|
|
6281
6956
|
Button7,
|
|
6282
6957
|
{
|
|
6283
6958
|
onClick: handleRemoveHighlight,
|
|
6284
|
-
"aria-label": "
|
|
6285
|
-
tooltip: "
|
|
6959
|
+
"aria-label": t2("markdownEditor.highlight.removeBackground"),
|
|
6960
|
+
tooltip: t2("markdownEditor.highlight.removeBackground"),
|
|
6286
6961
|
tabIndex: selectedIndex === colors.length ? 0 : -1,
|
|
6287
6962
|
type: "button",
|
|
6288
6963
|
role: "menuitem",
|
|
@@ -6308,6 +6983,7 @@ function ColorHighlightPopover({
|
|
|
6308
6983
|
onApplied,
|
|
6309
6984
|
...props
|
|
6310
6985
|
}) {
|
|
6986
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
6311
6987
|
const { editor } = useTiptapEditor(providedEditor);
|
|
6312
6988
|
const [isOpen, setIsOpen] = useState(false);
|
|
6313
6989
|
const { isVisible, canColorHighlight: canColorHighlight2, isActive, label, Icon } = useColorHighlight({
|
|
@@ -6330,7 +7006,7 @@ function ColorHighlightPopover({
|
|
|
6330
7006
|
children: /* @__PURE__ */ jsx(Icon, { className: "tiptap-button-icon" })
|
|
6331
7007
|
}
|
|
6332
7008
|
) }),
|
|
6333
|
-
/* @__PURE__ */ jsx(PopoverContent, { "aria-label": "
|
|
7009
|
+
/* @__PURE__ */ jsx(PopoverContent, { "aria-label": t2("markdownEditor.highlight.label"), children: /* @__PURE__ */ jsx(ColorHighlightPopoverContent, { editor, colors }) })
|
|
6334
7010
|
] });
|
|
6335
7011
|
}
|
|
6336
7012
|
var ChevronDownIcon = memo(({ className, ...props }) => {
|
|
@@ -6813,6 +7489,7 @@ var HeadingDropdownMenu = forwardRef(
|
|
|
6813
7489
|
}, ref) => {
|
|
6814
7490
|
const { editor } = useTiptapEditor(providedEditor);
|
|
6815
7491
|
const [isOpen, setIsOpen] = useState(false);
|
|
7492
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
6816
7493
|
const { isVisible, isActive, canToggle: canToggle3, Icon } = useHeadingDropdownMenu({
|
|
6817
7494
|
editor,
|
|
6818
7495
|
levels,
|
|
@@ -6842,7 +7519,7 @@ var HeadingDropdownMenu = forwardRef(
|
|
|
6842
7519
|
"data-disabled": !canToggle3,
|
|
6843
7520
|
"aria-label": "Format text as heading",
|
|
6844
7521
|
"aria-pressed": isActive,
|
|
6845
|
-
tooltip: "
|
|
7522
|
+
tooltip: t2("markdownEditor.toolbar.heading"),
|
|
6846
7523
|
...buttonProps,
|
|
6847
7524
|
ref,
|
|
6848
7525
|
children: [
|
|
@@ -6856,10 +7533,10 @@ var HeadingDropdownMenu = forwardRef(
|
|
|
6856
7533
|
{
|
|
6857
7534
|
editor,
|
|
6858
7535
|
level,
|
|
6859
|
-
text:
|
|
7536
|
+
text: t2("markdownEditor.toolbar.headingLevel", { level }),
|
|
6860
7537
|
showTooltip: false
|
|
6861
7538
|
}
|
|
6862
|
-
) },
|
|
7539
|
+
) }, level)) }) }) }) })
|
|
6863
7540
|
] });
|
|
6864
7541
|
}
|
|
6865
7542
|
);
|
|
@@ -6922,7 +7599,7 @@ function useHeadingDropdownMenu(config) {
|
|
|
6922
7599
|
isActive,
|
|
6923
7600
|
canToggle: canToggleState,
|
|
6924
7601
|
levels,
|
|
6925
|
-
label: "
|
|
7602
|
+
label: t("markdownEditor.toolbar.heading"),
|
|
6926
7603
|
Icon: activeLevel ? headingIcons[activeLevel] : HeadingIcon
|
|
6927
7604
|
};
|
|
6928
7605
|
}
|
|
@@ -7048,6 +7725,7 @@ function InputGroup({
|
|
|
7048
7725
|
}
|
|
7049
7726
|
var LinkButton = forwardRef(
|
|
7050
7727
|
({ className, children, ...props }, ref) => {
|
|
7728
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
7051
7729
|
return /* @__PURE__ */ jsx(
|
|
7052
7730
|
Button7,
|
|
7053
7731
|
{
|
|
@@ -7056,8 +7734,8 @@ var LinkButton = forwardRef(
|
|
|
7056
7734
|
"data-style": "ghost",
|
|
7057
7735
|
role: "button",
|
|
7058
7736
|
tabIndex: -1,
|
|
7059
|
-
"aria-label": "
|
|
7060
|
-
tooltip: "
|
|
7737
|
+
"aria-label": t2("markdownEditor.toolbar.link"),
|
|
7738
|
+
tooltip: t2("markdownEditor.toolbar.link"),
|
|
7061
7739
|
ref,
|
|
7062
7740
|
...props,
|
|
7063
7741
|
children: children || /* @__PURE__ */ jsx(LinkIcon, { className: "tiptap-button-icon" })
|
|
@@ -7075,6 +7753,7 @@ var LinkMain = ({
|
|
|
7075
7753
|
isActive
|
|
7076
7754
|
}) => {
|
|
7077
7755
|
const isMobile = useIsBreakpoint();
|
|
7756
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
7078
7757
|
const handleKeyDown = (event) => {
|
|
7079
7758
|
if (event.key === "Enter") {
|
|
7080
7759
|
event.preventDefault();
|
|
@@ -7098,7 +7777,7 @@ var LinkMain = ({
|
|
|
7098
7777
|
Input4,
|
|
7099
7778
|
{
|
|
7100
7779
|
type: "url",
|
|
7101
|
-
placeholder: "
|
|
7780
|
+
placeholder: t2("markdownEditor.toolbar.linkPlaceholder"),
|
|
7102
7781
|
value: url,
|
|
7103
7782
|
onChange: (e) => setUrl(e.target.value),
|
|
7104
7783
|
onKeyDown: handleKeyDown,
|
|
@@ -7113,7 +7792,7 @@ var LinkMain = ({
|
|
|
7113
7792
|
{
|
|
7114
7793
|
type: "button",
|
|
7115
7794
|
onClick: setLink,
|
|
7116
|
-
title: "
|
|
7795
|
+
title: t2("markdownEditor.toolbar.applyLink"),
|
|
7117
7796
|
disabled: !url && !isActive,
|
|
7118
7797
|
"data-style": "ghost",
|
|
7119
7798
|
children: /* @__PURE__ */ jsx(CornerDownLeftIcon, { className: "tiptap-button-icon" })
|
|
@@ -7126,7 +7805,7 @@ var LinkMain = ({
|
|
|
7126
7805
|
{
|
|
7127
7806
|
type: "button",
|
|
7128
7807
|
onClick: openLink,
|
|
7129
|
-
title: "
|
|
7808
|
+
title: t2("markdownEditor.toolbar.openInNewWindow"),
|
|
7130
7809
|
disabled: !url && !isActive,
|
|
7131
7810
|
"data-style": "ghost",
|
|
7132
7811
|
children: /* @__PURE__ */ jsx(ExternalLinkIcon, { className: "tiptap-button-icon" })
|
|
@@ -7137,7 +7816,7 @@ var LinkMain = ({
|
|
|
7137
7816
|
{
|
|
7138
7817
|
type: "button",
|
|
7139
7818
|
onClick: removeLink,
|
|
7140
|
-
title: "
|
|
7819
|
+
title: t2("markdownEditor.toolbar.removeLink"),
|
|
7141
7820
|
disabled: !url && !isActive,
|
|
7142
7821
|
"data-style": "ghost",
|
|
7143
7822
|
children: /* @__PURE__ */ jsx(TrashIcon, { className: "tiptap-button-icon" })
|
|
@@ -7651,10 +8330,10 @@ var listIcons = {
|
|
|
7651
8330
|
orderedList: ListOrderedIcon,
|
|
7652
8331
|
taskList: ListTodoIcon
|
|
7653
8332
|
};
|
|
7654
|
-
var
|
|
7655
|
-
bulletList: "
|
|
7656
|
-
orderedList: "
|
|
7657
|
-
taskList: "
|
|
8333
|
+
var listLabelKeys = {
|
|
8334
|
+
bulletList: "markdownEditor.toolbar.bulletList",
|
|
8335
|
+
orderedList: "markdownEditor.toolbar.orderedList",
|
|
8336
|
+
taskList: "markdownEditor.toolbar.taskList"
|
|
7658
8337
|
};
|
|
7659
8338
|
var LIST_SHORTCUT_KEYS = {
|
|
7660
8339
|
bulletList: "mod+shift+8",
|
|
@@ -7801,24 +8480,24 @@ function useList(config) {
|
|
|
7801
8480
|
isActive,
|
|
7802
8481
|
handleToggle,
|
|
7803
8482
|
canToggle: canToggle3,
|
|
7804
|
-
label:
|
|
8483
|
+
label: t(listLabelKeys[type]),
|
|
7805
8484
|
shortcutKeys: LIST_SHORTCUT_KEYS[type],
|
|
7806
8485
|
Icon: listIcons[type]
|
|
7807
8486
|
};
|
|
7808
8487
|
}
|
|
7809
8488
|
var listOptions = [
|
|
7810
8489
|
{
|
|
7811
|
-
|
|
8490
|
+
labelKey: "markdownEditor.toolbar.bulletList",
|
|
7812
8491
|
type: "bulletList",
|
|
7813
8492
|
icon: ListIcon
|
|
7814
8493
|
},
|
|
7815
8494
|
{
|
|
7816
|
-
|
|
8495
|
+
labelKey: "markdownEditor.toolbar.orderedList",
|
|
7817
8496
|
type: "orderedList",
|
|
7818
8497
|
icon: ListOrderedIcon
|
|
7819
8498
|
},
|
|
7820
8499
|
{
|
|
7821
|
-
|
|
8500
|
+
labelKey: "markdownEditor.toolbar.taskList",
|
|
7822
8501
|
type: "taskList",
|
|
7823
8502
|
icon: ListTodoIcon
|
|
7824
8503
|
}
|
|
@@ -7859,7 +8538,13 @@ function useListDropdownMenu(config) {
|
|
|
7859
8538
|
const { editor } = useTiptapEditor(providedEditor);
|
|
7860
8539
|
const [isVisible, setIsVisible] = useState(true);
|
|
7861
8540
|
const listInSchema = types.some((type) => isNodeInSchema(type, editor));
|
|
7862
|
-
const filteredLists = useMemo(
|
|
8541
|
+
const filteredLists = useMemo(
|
|
8542
|
+
() => getFilteredListOptions(types).map((option) => ({
|
|
8543
|
+
...option,
|
|
8544
|
+
label: t(option.labelKey)
|
|
8545
|
+
})),
|
|
8546
|
+
[types]
|
|
8547
|
+
);
|
|
7863
8548
|
const canToggleAny = canToggleAnyList(editor, types);
|
|
7864
8549
|
const isAnyActive = isAnyListActive(editor, types);
|
|
7865
8550
|
const activeType = getActiveListType(editor, types);
|
|
@@ -7889,7 +8574,7 @@ function useListDropdownMenu(config) {
|
|
|
7889
8574
|
canToggle: canToggleAny,
|
|
7890
8575
|
types,
|
|
7891
8576
|
filteredLists,
|
|
7892
|
-
label: "
|
|
8577
|
+
label: t("markdownEditor.toolbar.list"),
|
|
7893
8578
|
Icon: activeList ? listIcons[activeList.type] : ListIcon
|
|
7894
8579
|
};
|
|
7895
8580
|
}
|
|
@@ -7903,6 +8588,7 @@ function ListDropdownMenu({
|
|
|
7903
8588
|
}) {
|
|
7904
8589
|
const { editor } = useTiptapEditor(providedEditor);
|
|
7905
8590
|
const [isOpen, setIsOpen] = useState(false);
|
|
8591
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
7906
8592
|
const { filteredLists, canToggle: canToggle3, isActive, isVisible, Icon } = useListDropdownMenu({
|
|
7907
8593
|
editor,
|
|
7908
8594
|
types,
|
|
@@ -7929,8 +8615,8 @@ function ListDropdownMenu({
|
|
|
7929
8615
|
tabIndex: -1,
|
|
7930
8616
|
disabled: !canToggle3,
|
|
7931
8617
|
"data-disabled": !canToggle3,
|
|
7932
|
-
"aria-label": "
|
|
7933
|
-
tooltip: "
|
|
8618
|
+
"aria-label": t2("markdownEditor.toolbar.listOptions"),
|
|
8619
|
+
tooltip: t2("markdownEditor.toolbar.list"),
|
|
7934
8620
|
...props,
|
|
7935
8621
|
children: [
|
|
7936
8622
|
/* @__PURE__ */ jsx(Icon, { className: "tiptap-button-icon" }),
|
|
@@ -8266,14 +8952,14 @@ var MARK_SHORTCUT_KEYS = {
|
|
|
8266
8952
|
superscript: "mod+.",
|
|
8267
8953
|
subscript: "mod+,"
|
|
8268
8954
|
};
|
|
8269
|
-
var
|
|
8270
|
-
bold: "
|
|
8271
|
-
italic: "
|
|
8272
|
-
underline: "
|
|
8273
|
-
strike: "
|
|
8274
|
-
code: "
|
|
8275
|
-
superscript: "
|
|
8276
|
-
subscript: "
|
|
8955
|
+
var MARK_ACTION_LABEL_KEYS = {
|
|
8956
|
+
bold: "markdownEditor.toolbar.bold",
|
|
8957
|
+
italic: "markdownEditor.toolbar.italic",
|
|
8958
|
+
underline: "markdownEditor.toolbar.underline",
|
|
8959
|
+
strike: "markdownEditor.toolbar.strike",
|
|
8960
|
+
code: "markdownEditor.toolbar.code",
|
|
8961
|
+
superscript: "markdownEditor.toolbar.superscript",
|
|
8962
|
+
subscript: "markdownEditor.toolbar.subscript"
|
|
8277
8963
|
};
|
|
8278
8964
|
function canToggleMark(editor, type) {
|
|
8279
8965
|
if (!editor || !editor.isEditable) return false;
|
|
@@ -8300,7 +8986,8 @@ function shouldShowButton6(props) {
|
|
|
8300
8986
|
return true;
|
|
8301
8987
|
}
|
|
8302
8988
|
function getFormattedMarkName(type) {
|
|
8303
|
-
|
|
8989
|
+
const labelKey = MARK_ACTION_LABEL_KEYS[type];
|
|
8990
|
+
return labelKey ? t(labelKey) : type.charAt(0).toUpperCase() + type.slice(1);
|
|
8304
8991
|
}
|
|
8305
8992
|
function useMark(config) {
|
|
8306
8993
|
const {
|
|
@@ -8610,11 +9297,11 @@ var textAlignIcons = {
|
|
|
8610
9297
|
right: AlignRightIcon,
|
|
8611
9298
|
justify: AlignJustifyIcon
|
|
8612
9299
|
};
|
|
8613
|
-
var
|
|
8614
|
-
left: "
|
|
8615
|
-
center: "
|
|
8616
|
-
right: "
|
|
8617
|
-
justify: "
|
|
9300
|
+
var textAlignLabelKeys = {
|
|
9301
|
+
left: "markdownEditor.toolbar.alignLeft",
|
|
9302
|
+
center: "markdownEditor.toolbar.alignCenter",
|
|
9303
|
+
right: "markdownEditor.toolbar.alignRight",
|
|
9304
|
+
justify: "markdownEditor.toolbar.alignJustify"
|
|
8618
9305
|
};
|
|
8619
9306
|
function canSetTextAlign(editor, align) {
|
|
8620
9307
|
if (!editor || !editor.isEditable) return false;
|
|
@@ -8682,7 +9369,7 @@ function useTextAlign(config) {
|
|
|
8682
9369
|
isActive,
|
|
8683
9370
|
handleTextAlign,
|
|
8684
9371
|
canAlign,
|
|
8685
|
-
label:
|
|
9372
|
+
label: t(textAlignLabelKeys[align]),
|
|
8686
9373
|
shortcutKeys: TEXT_ALIGN_SHORTCUT_KEYS[align],
|
|
8687
9374
|
Icon: textAlignIcons[align]
|
|
8688
9375
|
};
|
|
@@ -8807,9 +9494,9 @@ var UNDO_REDO_SHORTCUT_KEYS = {
|
|
|
8807
9494
|
undo: "mod+z",
|
|
8808
9495
|
redo: "mod+shift+z"
|
|
8809
9496
|
};
|
|
8810
|
-
var
|
|
8811
|
-
undo: "
|
|
8812
|
-
redo: "
|
|
9497
|
+
var historyActionLabelKeys = {
|
|
9498
|
+
undo: "markdownEditor.toolbar.undo",
|
|
9499
|
+
redo: "markdownEditor.toolbar.redo"
|
|
8813
9500
|
};
|
|
8814
9501
|
var historyIcons = {
|
|
8815
9502
|
undo: Undo2Icon,
|
|
@@ -8867,7 +9554,7 @@ function useUndoRedo(config) {
|
|
|
8867
9554
|
isVisible,
|
|
8868
9555
|
handleAction,
|
|
8869
9556
|
canExecute,
|
|
8870
|
-
label:
|
|
9557
|
+
label: t(historyActionLabelKeys[action]),
|
|
8871
9558
|
shortcutKeys: UNDO_REDO_SHORTCUT_KEYS[action],
|
|
8872
9559
|
Icon: historyIcons[action]
|
|
8873
9560
|
};
|
|
@@ -9130,6 +9817,7 @@ var MainToolbarContent = ({
|
|
|
9130
9817
|
isMobile,
|
|
9131
9818
|
isBubble
|
|
9132
9819
|
}) => {
|
|
9820
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
9133
9821
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9134
9822
|
/* @__PURE__ */ jsx(Spacer, {}),
|
|
9135
9823
|
!isBubble && tools.includes("undo-redo") && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -9139,9 +9827,9 @@ var MainToolbarContent = ({
|
|
|
9139
9827
|
] }),
|
|
9140
9828
|
/* @__PURE__ */ jsx(ToolbarSeparator, {})
|
|
9141
9829
|
] }),
|
|
9142
|
-
onQuote && /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(SelectButton, { icon: /* @__PURE__ */ jsx(QuoteIcon, {}), tooltip: "
|
|
9143
|
-
onCreateAnnotation && /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(SelectButton, { icon: /* @__PURE__ */ jsx(MessageOutlined, {}), tooltip: "
|
|
9144
|
-
onCreateCollection && /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(SelectButton, { icon: /* @__PURE__ */ jsx(BookOutlined, {}), tooltip: "
|
|
9830
|
+
onQuote && /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(SelectButton, { icon: /* @__PURE__ */ jsx(QuoteIcon, {}), tooltip: t2("markdownEditor.toolbar.quote"), onClick: onQuote, children: t2("markdownEditor.toolbar.quote") }) }),
|
|
9831
|
+
onCreateAnnotation && /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(SelectButton, { icon: /* @__PURE__ */ jsx(MessageOutlined, {}), tooltip: t2("markdownEditor.toolbar.annotation"), onClick: onCreateAnnotation, children: t2("markdownEditor.toolbar.annotation") }) }),
|
|
9832
|
+
onCreateCollection && /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(SelectButton, { icon: /* @__PURE__ */ jsx(BookOutlined, {}), tooltip: t2("markdownEditor.toolbar.excerpt"), onClick: onCreateCollection, children: t2("markdownEditor.toolbar.excerpt") }) }),
|
|
9145
9833
|
(tools.includes("heading") || tools.includes("list") || tools.includes("block")) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9146
9834
|
/* @__PURE__ */ jsxs(ToolbarGroup, { children: [
|
|
9147
9835
|
tools.includes("heading") && /* @__PURE__ */ jsx(HeadingDropdownMenu, { levels: [1, 2, 3, 4], portal: isMobile }),
|
|
@@ -9382,9 +10070,9 @@ var SearchAndReplace = Extension.create({
|
|
|
9382
10070
|
addProseMirrorPlugins() {
|
|
9383
10071
|
const editor = this.editor;
|
|
9384
10072
|
const { searchResultClass, disableRegex } = this.options;
|
|
9385
|
-
const setLastSearchTerm = (
|
|
9386
|
-
const setLastCaseSensitive = (
|
|
9387
|
-
const setLastResultIndex = (
|
|
10073
|
+
const setLastSearchTerm = (t2) => editor.storage.searchAndReplace.lastSearchTerm = t2;
|
|
10074
|
+
const setLastCaseSensitive = (t2) => editor.storage.searchAndReplace.lastCaseSensitive = t2;
|
|
10075
|
+
const setLastResultIndex = (t2) => editor.storage.searchAndReplace.lastResultIndex = t2;
|
|
9388
10076
|
return [
|
|
9389
10077
|
new Plugin({
|
|
9390
10078
|
key: searchAndReplacePluginKey,
|
|
@@ -9485,6 +10173,7 @@ var MarkdownEditor_default = forwardRef(
|
|
|
9485
10173
|
collectionConfig,
|
|
9486
10174
|
pageNoConfig
|
|
9487
10175
|
}, ref) => {
|
|
10176
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
9488
10177
|
const isMobile = useIsBreakpoint();
|
|
9489
10178
|
const lastContentRef = useRef("");
|
|
9490
10179
|
const { setPageNoEditor, onPageChange } = usePageNo(pageNoConfig);
|
|
@@ -9521,7 +10210,7 @@ var MarkdownEditor_default = forwardRef(
|
|
|
9521
10210
|
autocomplete: "off",
|
|
9522
10211
|
autocorrect: "off",
|
|
9523
10212
|
autocapitalize: "off",
|
|
9524
|
-
"aria-label": "
|
|
10213
|
+
"aria-label": t2("markdownEditor.mainArea")
|
|
9525
10214
|
}
|
|
9526
10215
|
},
|
|
9527
10216
|
extensions: [
|
|
@@ -9682,7 +10371,7 @@ var MarkdownEditor_default = forwardRef(
|
|
|
9682
10371
|
Button,
|
|
9683
10372
|
{
|
|
9684
10373
|
size: "small",
|
|
9685
|
-
title: "
|
|
10374
|
+
title: t2("markdownEditor.annotation.list"),
|
|
9686
10375
|
icon: /* @__PURE__ */ jsx(MessageOutlined, {}),
|
|
9687
10376
|
color: "primary",
|
|
9688
10377
|
variant: "text",
|
|
@@ -9694,15 +10383,15 @@ var MarkdownEditor_default = forwardRef(
|
|
|
9694
10383
|
{
|
|
9695
10384
|
style: { gap: "2px" },
|
|
9696
10385
|
size: "small",
|
|
9697
|
-
title: "
|
|
10386
|
+
title: t2("markdownEditor.collection.list"),
|
|
9698
10387
|
icon: /* @__PURE__ */ jsx(BookOutlined, {}),
|
|
9699
10388
|
color: "primary",
|
|
9700
10389
|
variant: "text",
|
|
9701
10390
|
onClick: () => setShowCollection(!showCollection),
|
|
9702
|
-
children: "
|
|
10391
|
+
children: t2("markdownEditor.collection.title")
|
|
9703
10392
|
}
|
|
9704
10393
|
),
|
|
9705
|
-
onDownloadFile && /* @__PURE__ */ jsx(Button, { size: "small", color: "primary", variant: "text", onClick: downloadFile2, children: "
|
|
10394
|
+
onDownloadFile && /* @__PURE__ */ jsx(Button, { size: "small", color: "primary", variant: "text", onClick: downloadFile2, children: t2("common.download") }),
|
|
9706
10395
|
extraNav
|
|
9707
10396
|
] })
|
|
9708
10397
|
] }),
|
|
@@ -9859,6 +10548,6 @@ var UserAvatar_default = ({ size, avatarSrc, userName }) => {
|
|
|
9859
10548
|
return avatarSrc ? /* @__PURE__ */ jsx(Avatar, { size, src: avatarSrc }) : /* @__PURE__ */ jsx(Avatar, { size, className: "cursor-pointer", style: { backgroundColor: "var(--ant-color-primary)" }, children: userName?.slice(0, 1)?.toLocaleUpperCase() });
|
|
9860
10549
|
};
|
|
9861
10550
|
|
|
9862
|
-
export { AudioPlayer_default as AudioPlayer, BusinessCode, DEFAULT_DATE_FORMAT, DEFAULT_DATE_TIME_FORMAT, DEFAULT_YEAR_MONTH_DAY_FORMAT, DEFAULT_YEAR_MONTH_FORMAT, DocxPreview_default as DocxPreview, FileIcon_default as FileIcon, FilePreview_default as FilePreview, FilePreviewDrawer_default as FilePreviewDrawer, HttpStatus, Iframe_default as Iframe, LazyComponent_default as LazyComponent, luyaFilePreview_default as LuyaFilePreview, MarkDrawing_default as MarkDrawing, MarkdownEditor_default as MarkdownEditor, MarkdownPreview_default as MarkdownPreview, MicroApp_default as MicroApp, Drawer_default as MicroAppDrawer, Window_default as MicroAppWindow, MultiEmailValidator, PdfImagePreview_default as PdfImagePreview, PdfPreview_default as PdfPreview, PhoneOrMobileValidator, RegBankCardNo, RegDetailAddress, RegEmail, RegFixedTelePhone, RegIdentityCardNo, RegMobile, RegNumNo, RegPassword, RegSmsCode, RegTaxNo, RegTelePhone, RenderMarkdown_default as RenderMarkdown, RenderWrapper_default as RenderWrapper, ThanNumLengthValidator, ThanNumValidator, UserAvatar_default as UserAvatar, VideoPlayer_default as VideoPlayer, absVal, addUrlLastSlash, aesDecrypt, aesEncrypt, arrToObj, buildUrlParams, cachedMessage, calculate, compareNum, convertCurrency, convertNewlineToBr, copyText, createRequest, createSecureManager, createTokenManager, decimalPlaces, deepCopy, deepEqual, deepMerge, dividedBy, downloadFile, emit, emitToChild, executeScript, findTreeNodesByIds, formatDate, formatNumberWithCommas, formatSize, genNonDuplicateID, generateRandomNumbers, getAllUrlParams, getDeviceId, getEndOfTimestamp, getFileName, getFileSuffixName, getRowSpanCount, getStartOfTimestamp, getTimestamp, getWebSocketUrl, htmlToMarkdown, htmlToText, importThirdPartyFile, is, isArray, isBlob, isBoolean, isDate, isDef, isElement, isEmpty, isEmptyObj, isExpire, isExternal, isFunction, isInteger, isJson, isLocalhost, isMap, isNegative, isNull, isNullOrUnDef, isNumber, isNumberNoNaN, isObject, isPromise, isReferenceType, isRegExp, isScriptSafe, isSet, isString, isUnDef, isWindow, markdownToText, minus, objToOptions, plus, precision, processItemList, propsMerge, safeParseJson, setInterval2 as setInterval, setUrlMainSource, shouldRender, times, toFixed, transform, transforms, useAsyncQueue_default as useAsyncQueue, useAutoRefresh_default as useAutoRefresh, useCountDown_default as useCountDown, useCreateValtioContext_default as useCreateValtioContext, useDebounce_default as useDebounce, useDeepEffect_default as useDeepEffect, useIframeRelayBridge_default as useIframeRelayBridge, useRefState_default as useRefState, useSyncInput_default as useSyncInput, useThrottle_default as useThrottle, useWebSocket_default as useWebSocket };
|
|
10551
|
+
export { AudioPlayer_default as AudioPlayer, BusinessCode, DEFAULT_DATE_FORMAT, DEFAULT_DATE_TIME_FORMAT, DEFAULT_YEAR_MONTH_DAY_FORMAT, DEFAULT_YEAR_MONTH_FORMAT, DocxPreview_default as DocxPreview, FileIcon_default as FileIcon, FilePreview_default as FilePreview, FilePreviewDrawer_default as FilePreviewDrawer, HttpStatus, Iframe_default as Iframe, LANG_KEY, LazyComponent_default as LazyComponent, luyaFilePreview_default as LuyaFilePreview, MarkDrawing_default as MarkDrawing, MarkdownEditor_default as MarkdownEditor, MarkdownPreview_default as MarkdownPreview, MicroApp_default as MicroApp, Drawer_default as MicroAppDrawer, Window_default as MicroAppWindow, MultiEmailValidator, NS_COMMON, PdfImagePreview_default as PdfImagePreview, PdfPreview_default as PdfPreview, PhoneOrMobileValidator, RegBankCardNo, RegDetailAddress, RegEmail, RegFixedTelePhone, RegIdentityCardNo, RegMobile, RegNumNo, RegPassword, RegSmsCode, RegTaxNo, RegTelePhone, RenderMarkdown_default as RenderMarkdown, RenderWrapper_default as RenderWrapper, ThanNumLengthValidator, ThanNumValidator, UserAvatar_default as UserAvatar, VideoPlayer_default as VideoPlayer, absVal, addBundledResource, addUrlLastSlash, aesDecrypt, aesEncrypt, arrToObj, buildUrlParams, cachedMessage, calculate, commonEnUS, commonJaJP, commonZhCN, compareNum, convertCurrency, convertNewlineToBr, copyText, createRequest, createSecureManager, createTokenManager, decimalPlaces, deepCopy, deepEqual, deepMerge, dividedBy, downloadFile, emit, emitToChild, executeScript, findTreeNodesByIds, formatDate, formatNumberWithCommas, formatSize, genNonDuplicateID, generateRandomNumbers, getAllUrlParams, getDeviceId, getEndOfTimestamp, getFileName, getFileSuffixName, getI18n, getLang, getRowSpanCount, getStartOfTimestamp, getTimestamp, getWebSocketUrl, htmlToMarkdown, htmlToText, importThirdPartyFile, initI18n, is, isArray, isBlob, isBoolean, isDate, isDef, isElement, isEmpty, isEmptyObj, isExpire, isExternal, isFunction, isInteger, isJson, isLocalhost, isMap, isNegative, isNull, isNullOrUnDef, isNumber, isNumberNoNaN, isObject, isPromise, isReferenceType, isRegExp, isScriptSafe, isSet, isString, isUnDef, isWindow, markdownToText, minus, objToOptions, plus, precision, processItemList, propsMerge, safeParseJson, setInterval2 as setInterval, setUrlMainSource, shouldRender, switchLang, t, times, toFixed, transform, transforms, useAsyncQueue_default as useAsyncQueue, useAutoRefresh_default as useAutoRefresh, useCountDown_default as useCountDown, useCreateValtioContext_default as useCreateValtioContext, useDebounce_default as useDebounce, useDeepEffect_default as useDeepEffect, useIframeRelayBridge_default as useIframeRelayBridge, useRefState_default as useRefState, useSyncInput_default as useSyncInput, useThrottle_default as useThrottle, useTranslation, useWebSocket_default as useWebSocket };
|
|
9863
10552
|
//# sourceMappingURL=index.esm.js.map
|
|
9864
10553
|
//# sourceMappingURL=index.esm.js.map
|