@zero-library/common 3.1.5 → 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 +945 -252
- 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 +933 -252
- package/dist/index.esm.js.map +1 -1
- package/package.json +3 -1
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,12 +2138,13 @@ 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
2149
|
const buffer = await res.arrayBuffer();
|
|
1517
2150
|
let markdownText = "";
|
|
@@ -1523,7 +2156,7 @@ var MarkdownPreview_default = ({ fileUrl, searchValue, asPlainText }) => {
|
|
|
1523
2156
|
markdownText = gbkDecoder.decode(buffer);
|
|
1524
2157
|
}
|
|
1525
2158
|
if (!markdownText) {
|
|
1526
|
-
throw new Error("
|
|
2159
|
+
throw new Error(t2("filePreview.emptyResponse"));
|
|
1527
2160
|
}
|
|
1528
2161
|
return markdownText;
|
|
1529
2162
|
};
|
|
@@ -1535,10 +2168,10 @@ var MarkdownPreview_default = ({ fileUrl, searchValue, asPlainText }) => {
|
|
|
1535
2168
|
const content2 = await fetchMarkdown();
|
|
1536
2169
|
setContent(content2);
|
|
1537
2170
|
} catch {
|
|
1538
|
-
setError("
|
|
2171
|
+
setError(t2("filePreview.fileParseFailed"));
|
|
1539
2172
|
}
|
|
1540
2173
|
} else {
|
|
1541
|
-
setError("
|
|
2174
|
+
setError(t2("filePreview.fileUrlInvalid"));
|
|
1542
2175
|
}
|
|
1543
2176
|
};
|
|
1544
2177
|
useEffect(() => {
|
|
@@ -2208,17 +2841,18 @@ var THUMB_IMG_HEIGHT = 514;
|
|
|
2208
2841
|
var MAIN_IMG_HEIGHT = 800;
|
|
2209
2842
|
var MAIN_IMG_WIDTH = 600;
|
|
2210
2843
|
var PdfImagePreview_default = ({ fileUrl, pageNo, scale = 1, isHasThumbnails = true, onSetPageNo }) => {
|
|
2844
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
2211
2845
|
const [images, setImages] = useState([]);
|
|
2212
2846
|
const [currentIndex, setCurrentIndex, getCurrentIndex] = useRefState_default(0);
|
|
2213
2847
|
const [error, setError] = useState("");
|
|
2214
2848
|
const fetchPdfImages = async () => {
|
|
2215
2849
|
const res = await fetch(fileUrl);
|
|
2216
2850
|
if (res.status !== 200) {
|
|
2217
|
-
throw new Error(
|
|
2851
|
+
throw new Error(t2("filePreview.requestFailedWithStatus", { status: res.status }));
|
|
2218
2852
|
}
|
|
2219
2853
|
const { data } = await res.json();
|
|
2220
2854
|
if (!data?.items?.length) {
|
|
2221
|
-
throw new Error("
|
|
2855
|
+
throw new Error(t2("filePreview.emptyResponse"));
|
|
2222
2856
|
}
|
|
2223
2857
|
setImages(data.items);
|
|
2224
2858
|
};
|
|
@@ -2230,10 +2864,10 @@ var PdfImagePreview_default = ({ fileUrl, pageNo, scale = 1, isHasThumbnails = t
|
|
|
2230
2864
|
try {
|
|
2231
2865
|
await fetchPdfImages();
|
|
2232
2866
|
} catch (error2) {
|
|
2233
|
-
setError("
|
|
2867
|
+
setError(t2("filePreview.pdfParseFailed"));
|
|
2234
2868
|
}
|
|
2235
2869
|
} else {
|
|
2236
|
-
setError("
|
|
2870
|
+
setError(t2("filePreview.pdfUrlInvalid"));
|
|
2237
2871
|
}
|
|
2238
2872
|
};
|
|
2239
2873
|
useEffect(() => {
|
|
@@ -2373,9 +3007,9 @@ var PdfImagePreview_default = ({ fileUrl, pageNo, scale = 1, isHasThumbnails = t
|
|
|
2373
3007
|
) }) }),
|
|
2374
3008
|
/* @__PURE__ */ jsx(Splitter.Panel, { children: /* @__PURE__ */ jsxs("div", { className: classNames2("height-full", styles_module_default.pdfImageBody), children: [
|
|
2375
3009
|
/* @__PURE__ */ jsxs(Flex, { gap: 6, align: "center", className: styles_module_default.pdfImageBodyToolbar, children: [
|
|
2376
|
-
/* @__PURE__ */ jsx(Button, { onClick: zoomOut, icon: /* @__PURE__ */ jsx(MinusCircleOutlined, {}), title: "
|
|
2377
|
-
/* @__PURE__ */ jsx(Button, { onClick: zoomIn, icon: /* @__PURE__ */ jsx(PlusCircleOutlined, {}), title: "
|
|
2378
|
-
/* @__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") })
|
|
2379
3013
|
] }),
|
|
2380
3014
|
/* @__PURE__ */ jsx("div", { ref: containerRef, className: "height-full scroll-fade-in", children: /* @__PURE__ */ jsx(
|
|
2381
3015
|
"div",
|
|
@@ -2423,6 +3057,7 @@ var ProtectedView = ({
|
|
|
2423
3057
|
verifyPassword,
|
|
2424
3058
|
onVerifyPasswordEnd
|
|
2425
3059
|
}) => {
|
|
3060
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
2426
3061
|
const [form] = Form.useForm();
|
|
2427
3062
|
const onSubmit = () => {
|
|
2428
3063
|
form.validateFields().then((values) => {
|
|
@@ -2433,10 +3068,10 @@ var ProtectedView = ({
|
|
|
2433
3068
|
});
|
|
2434
3069
|
};
|
|
2435
3070
|
return /* @__PURE__ */ jsx(Flex, { justify: "center", align: "center", className: "height-full", children: /* @__PURE__ */ jsxs("div", { style: { width: 300 }, children: [
|
|
2436
|
-
passwordStatus === PasswordStatus.WrongPassword && /* @__PURE__ */ jsx(Alert, { title: "
|
|
3071
|
+
passwordStatus === PasswordStatus.WrongPassword && /* @__PURE__ */ jsx(Alert, { title: t2("filePreview.pdfPasswordInvalid"), type: "error" }),
|
|
2437
3072
|
/* @__PURE__ */ jsxs(Form, { form, size: "large", className: "m-t-24", children: [
|
|
2438
|
-
/* @__PURE__ */ jsx(Form.Item, { name: "password", rules: [{ required: true, message: "
|
|
2439
|
-
/* @__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") }) })
|
|
2440
3075
|
] })
|
|
2441
3076
|
] }) });
|
|
2442
3077
|
};
|
|
@@ -2455,6 +3090,7 @@ var openLinksNewTabPlugin = () => {
|
|
|
2455
3090
|
};
|
|
2456
3091
|
};
|
|
2457
3092
|
var PdfPreview_default = ({ password, fileUrl, pageNo = 1, scale = 1, isHasThumbnails = true, onSetPassword, onSetPageNo }) => {
|
|
3093
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
2458
3094
|
const embedRef = useRef(null);
|
|
2459
3095
|
const [sizes, setSizes] = useState([0]);
|
|
2460
3096
|
const [docLoaded, setDocLoaded, getDocLoaded] = useRefState_default(false);
|
|
@@ -2528,19 +3164,19 @@ var PdfPreview_default = ({ password, fileUrl, pageNo = 1, scale = 1, isHasThumb
|
|
|
2528
3164
|
let message3 = "";
|
|
2529
3165
|
switch (error.name) {
|
|
2530
3166
|
case "InvalidPDFException":
|
|
2531
|
-
message3 = "
|
|
3167
|
+
message3 = t2("filePreview.pdfInvalidOrDamaged");
|
|
2532
3168
|
break;
|
|
2533
3169
|
case "MissingPDFException":
|
|
2534
|
-
message3 = "
|
|
3170
|
+
message3 = t2("filePreview.pdfFileNotFound");
|
|
2535
3171
|
break;
|
|
2536
3172
|
case "UnexpectedResponseException":
|
|
2537
|
-
message3 = "
|
|
3173
|
+
message3 = t2("filePreview.pdfUnexpectedResponse");
|
|
2538
3174
|
break;
|
|
2539
3175
|
// case 'CMapReaderFactory not initialized':
|
|
2540
3176
|
// message = '字体映射文件加载失败,请刷新页面重试'
|
|
2541
3177
|
// break
|
|
2542
3178
|
default:
|
|
2543
|
-
message3 = "
|
|
3179
|
+
message3 = t2("filePreview.pdfLoadDocumentFailed");
|
|
2544
3180
|
break;
|
|
2545
3181
|
}
|
|
2546
3182
|
return /* @__PURE__ */ jsx(Flex, { className: "height-full", justify: "center", align: "center", children: /* @__PURE__ */ jsx(Alert, { title: message3, type: "error", showIcon: true }) });
|
|
@@ -2611,6 +3247,7 @@ var PdfPreview_default = ({ password, fileUrl, pageNo = 1, scale = 1, isHasThumb
|
|
|
2611
3247
|
] }) }) });
|
|
2612
3248
|
};
|
|
2613
3249
|
var FilePreview_default = ({ suffix, fileUrl, pdfParams, password, searchValue, emptyProps, onSetPassword }) => {
|
|
3250
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
2614
3251
|
const Preview = useMemo(() => {
|
|
2615
3252
|
if (!fileUrl) {
|
|
2616
3253
|
return /* @__PURE__ */ jsx(Empty, { ...emptyProps });
|
|
@@ -2620,7 +3257,7 @@ var FilePreview_default = ({ suffix, fileUrl, pdfParams, password, searchValue,
|
|
|
2620
3257
|
case "JPG":
|
|
2621
3258
|
case "JPEG":
|
|
2622
3259
|
case "GIF":
|
|
2623
|
-
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") });
|
|
2624
3261
|
case "PDF":
|
|
2625
3262
|
return /* @__PURE__ */ jsx(PdfPreview_default, { fileUrl, ...pdfParams, password, onSetPassword });
|
|
2626
3263
|
case "PDF_IMG":
|
|
@@ -2640,11 +3277,25 @@ var FilePreview_default = ({ suffix, fileUrl, pdfParams, password, searchValue,
|
|
|
2640
3277
|
case "DOCX":
|
|
2641
3278
|
return /* @__PURE__ */ jsx(DocxPreview_default, { fileUrl });
|
|
2642
3279
|
default:
|
|
2643
|
-
return /* @__PURE__ */ jsx(Result, { subTitle:
|
|
3280
|
+
return /* @__PURE__ */ jsx(Result, { subTitle: t2("filePreview.previewNotSupported", { suffix: suffix || "" }) });
|
|
2644
3281
|
}
|
|
2645
3282
|
}, [suffix, fileUrl, pdfParams]);
|
|
2646
3283
|
return /* @__PURE__ */ jsx(Flex, { justify: "center", align: "center", className: "height-full", children: Preview });
|
|
2647
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
|
+
};
|
|
2648
3299
|
loader.config({ monaco });
|
|
2649
3300
|
var getLanguage = (suffix) => {
|
|
2650
3301
|
switch (suffix.toLowerCase()) {
|
|
@@ -2684,6 +3335,7 @@ var getLanguage = (suffix) => {
|
|
|
2684
3335
|
}
|
|
2685
3336
|
};
|
|
2686
3337
|
var CodePreview = ({ fileUrl, suffix }) => {
|
|
3338
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
2687
3339
|
const [content, setContent] = useState("");
|
|
2688
3340
|
const [error, setError] = useState("");
|
|
2689
3341
|
const [loading, setLoading] = useState(false);
|
|
@@ -2693,7 +3345,7 @@ var CodePreview = ({ fileUrl, suffix }) => {
|
|
|
2693
3345
|
};
|
|
2694
3346
|
const res = await fetch(fileUrl, { headers, signal });
|
|
2695
3347
|
if (res.status !== 200) {
|
|
2696
|
-
throw new Error(
|
|
3348
|
+
throw new Error(t2("filePreview.requestFailedWithStatus", { status: res.status }));
|
|
2697
3349
|
}
|
|
2698
3350
|
const buffer = await res.arrayBuffer();
|
|
2699
3351
|
let text = "";
|
|
@@ -2717,7 +3369,7 @@ var CodePreview = ({ fileUrl, suffix }) => {
|
|
|
2717
3369
|
await fetchContent(controller.signal);
|
|
2718
3370
|
} catch (error2) {
|
|
2719
3371
|
if (!controller.signal.aborted) {
|
|
2720
|
-
setError("
|
|
3372
|
+
setError(t2("filePreview.loadFileFailed"));
|
|
2721
3373
|
}
|
|
2722
3374
|
} finally {
|
|
2723
3375
|
if (!controller.signal.aborted) {
|
|
@@ -2757,7 +3409,7 @@ var CodePreview = ({ fileUrl, suffix }) => {
|
|
|
2757
3409
|
var CodePreview_default = CodePreview;
|
|
2758
3410
|
var { Text } = Typography;
|
|
2759
3411
|
pdfjsLib.GlobalWorkerOptions.workerSrc = "https://unpkg.com/pdfjs-dist@5.4.296/legacy/build/pdf.worker.min.mjs";
|
|
2760
|
-
var MIN_SCALE = 0.
|
|
3412
|
+
var MIN_SCALE = 0.1;
|
|
2761
3413
|
var MAX_SCALE = 1.5;
|
|
2762
3414
|
var SCALE_STEP = 0.1;
|
|
2763
3415
|
var PdfPage = React3__default.memo(({ pdf, pageNumber, scale, scrollContainerRef, defaultSize }) => {
|
|
@@ -2867,6 +3519,7 @@ var PdfPage = React3__default.memo(({ pdf, pageNumber, scale, scrollContainerRef
|
|
|
2867
3519
|
);
|
|
2868
3520
|
});
|
|
2869
3521
|
var DocumentPreview = ({ fileUrl, previewEnabled = true }) => {
|
|
3522
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
2870
3523
|
const [loading, setLoading] = useState(false);
|
|
2871
3524
|
const [pdf, setPdf] = useState(null);
|
|
2872
3525
|
const [numPages, setNumPages] = useState(0);
|
|
@@ -2926,9 +3579,9 @@ var DocumentPreview = ({ fileUrl, previewEnabled = true }) => {
|
|
|
2926
3579
|
if (aborted) return;
|
|
2927
3580
|
const message3 = e?.message;
|
|
2928
3581
|
if (typeof message3 === "string" && message3.includes("cancelled")) ; else if (typeof message3 === "string" && message3.includes("(903)")) {
|
|
2929
|
-
setError("
|
|
3582
|
+
setError(t2("filePreview.previewGenerating"));
|
|
2930
3583
|
} else {
|
|
2931
|
-
setError(message3 || "
|
|
3584
|
+
setError(message3 || t2("filePreview.pdfLoadFailed"));
|
|
2932
3585
|
}
|
|
2933
3586
|
} finally {
|
|
2934
3587
|
if (!aborted) {
|
|
@@ -3033,7 +3686,7 @@ var DocumentPreview = ({ fileUrl, previewEnabled = true }) => {
|
|
|
3033
3686
|
/* @__PURE__ */ jsx(Button, { type: "text", icon: /* @__PURE__ */ jsx(PlusOutlined, {}), size: "small", onClick: onZoomIn, disabled: scale >= MAX_SCALE })
|
|
3034
3687
|
] });
|
|
3035
3688
|
if (!previewEnabled) {
|
|
3036
|
-
return /* @__PURE__ */ jsx(Flex, { className: styles_module_default.stateBody, children: "
|
|
3689
|
+
return /* @__PURE__ */ jsx(Flex, { className: styles_module_default.stateBody, children: t2("filePreview.closePreview") });
|
|
3037
3690
|
}
|
|
3038
3691
|
return /* @__PURE__ */ jsxs("div", { className: styles_module_default.pdfContainer, children: [
|
|
3039
3692
|
toolbar,
|
|
@@ -3042,6 +3695,7 @@ var DocumentPreview = ({ fileUrl, previewEnabled = true }) => {
|
|
|
3042
3695
|
};
|
|
3043
3696
|
var DocumentPreview_default = DocumentPreview;
|
|
3044
3697
|
var HtmlPreview = ({ fileUrl }) => {
|
|
3698
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
3045
3699
|
const [content, setContent] = useState("");
|
|
3046
3700
|
const [error, setError] = useState("");
|
|
3047
3701
|
const [loading, setLoading] = useState(false);
|
|
@@ -3054,7 +3708,7 @@ var HtmlPreview = ({ fileUrl }) => {
|
|
|
3054
3708
|
signal
|
|
3055
3709
|
});
|
|
3056
3710
|
if (res.status !== 200) {
|
|
3057
|
-
throw new Error(
|
|
3711
|
+
throw new Error(t2("filePreview.requestFailedWithStatus", { status: res.status }));
|
|
3058
3712
|
}
|
|
3059
3713
|
const buffer = await res.arrayBuffer();
|
|
3060
3714
|
let htmlText = "";
|
|
@@ -3066,7 +3720,7 @@ var HtmlPreview = ({ fileUrl }) => {
|
|
|
3066
3720
|
htmlText = gbkDecoder.decode(buffer);
|
|
3067
3721
|
}
|
|
3068
3722
|
if (!htmlText) {
|
|
3069
|
-
throw new Error("
|
|
3723
|
+
throw new Error(t2("filePreview.emptyResponse"));
|
|
3070
3724
|
}
|
|
3071
3725
|
setContent(htmlText);
|
|
3072
3726
|
};
|
|
@@ -3081,7 +3735,7 @@ var HtmlPreview = ({ fileUrl }) => {
|
|
|
3081
3735
|
await fetchHtml(controller.signal);
|
|
3082
3736
|
} catch (error2) {
|
|
3083
3737
|
if (!controller.signal.aborted) {
|
|
3084
|
-
setError("
|
|
3738
|
+
setError(t2("filePreview.htmlParseFailed"));
|
|
3085
3739
|
}
|
|
3086
3740
|
} finally {
|
|
3087
3741
|
if (!controller.signal.aborted) {
|
|
@@ -3107,6 +3761,7 @@ var HtmlPreview = ({ fileUrl }) => {
|
|
|
3107
3761
|
};
|
|
3108
3762
|
var HtmlPreview_default = HtmlPreview;
|
|
3109
3763
|
var luyaFilePreview_default = ({ suffix, fileUrl, emptyProps, fileName }) => {
|
|
3764
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
3110
3765
|
const extension = suffix ? suffix : getFileSuffixName(fileName || "");
|
|
3111
3766
|
const Preview = useMemo(() => {
|
|
3112
3767
|
if (!fileUrl) {
|
|
@@ -3122,7 +3777,7 @@ var luyaFilePreview_default = ({ suffix, fileUrl, emptyProps, fileName }) => {
|
|
|
3122
3777
|
case "SVG":
|
|
3123
3778
|
case "ICO":
|
|
3124
3779
|
case "TIFF":
|
|
3125
|
-
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") });
|
|
3126
3781
|
case "DOC":
|
|
3127
3782
|
case "DOCX":
|
|
3128
3783
|
case "PDF":
|
|
@@ -3167,30 +3822,18 @@ var luyaFilePreview_default = ({ suffix, fileUrl, emptyProps, fileName }) => {
|
|
|
3167
3822
|
case "TXT":
|
|
3168
3823
|
return /* @__PURE__ */ jsx(MarkdownPreview_default, { fileUrl, asPlainText: true });
|
|
3169
3824
|
default:
|
|
3170
|
-
return /* @__PURE__ */ jsx(Result, { subTitle:
|
|
3825
|
+
return /* @__PURE__ */ jsx(Result, { subTitle: t2("filePreview.previewNotSupportedDownload", { suffix: suffix || "" }) });
|
|
3171
3826
|
}
|
|
3172
3827
|
}, [suffix, fileUrl, fileName]);
|
|
3173
3828
|
return /* @__PURE__ */ jsx(Flex, { justify: "center", align: "center", className: "height-full p-t-16 p-b-16 p-l-16", children: Preview });
|
|
3174
3829
|
};
|
|
3175
|
-
var FilePreviewDrawer_default = ({ open, title = "\u6587\u4EF6\u9884\u89C8", onClose, ...props }) => {
|
|
3176
|
-
return /* @__PURE__ */ jsx(
|
|
3177
|
-
Drawer,
|
|
3178
|
-
{
|
|
3179
|
-
title,
|
|
3180
|
-
push: false,
|
|
3181
|
-
size: "100%",
|
|
3182
|
-
open,
|
|
3183
|
-
onClose,
|
|
3184
|
-
children: /* @__PURE__ */ jsx(FilePreview_default, { ...props })
|
|
3185
|
-
}
|
|
3186
|
-
);
|
|
3187
|
-
};
|
|
3188
3830
|
|
|
3189
3831
|
// src/components/MicroApp/styles.module.less
|
|
3190
3832
|
var styles_module_default3 = {
|
|
3191
3833
|
microApp: "styles_module_microApp"
|
|
3192
3834
|
};
|
|
3193
3835
|
var MicroApp_default = ({ name, url, className, onMounted, onError, data, ...rest }) => {
|
|
3836
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
3194
3837
|
const [loading, setLoading] = useState(false);
|
|
3195
3838
|
useEffect(() => {
|
|
3196
3839
|
setLoading(true);
|
|
@@ -3205,10 +3848,10 @@ var MicroApp_default = ({ name, url, className, onMounted, onError, data, ...res
|
|
|
3205
3848
|
};
|
|
3206
3849
|
const microAppData = useMemo(() => {
|
|
3207
3850
|
const parentMainSource = window?.microApp?.getData?.()?.mainSource || [];
|
|
3208
|
-
return { mainSource: [...parentMainSource, name], ...data };
|
|
3851
|
+
return { [LANG_KEY]: getLang(), mainSource: [...parentMainSource, name], ...data };
|
|
3209
3852
|
}, [data, name]);
|
|
3210
3853
|
const TagName = microApp.tagName || "micro-app";
|
|
3211
|
-
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(
|
|
3212
3855
|
TagName,
|
|
3213
3856
|
{
|
|
3214
3857
|
name,
|
|
@@ -3297,10 +3940,12 @@ var styles_module_default4 = {
|
|
|
3297
3940
|
iframe: "styles_module_iframe"
|
|
3298
3941
|
};
|
|
3299
3942
|
var Iframe_default = forwardRef(({ defaultMainSource, id, src, className, onLoad }, ref) => {
|
|
3943
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
3300
3944
|
const [loading, setLoading] = useState(false);
|
|
3301
3945
|
const finalSrc = useMemo(() => {
|
|
3302
|
-
|
|
3303
|
-
|
|
3946
|
+
const baseUrl = addUrlLastSlash(setUrlMainSource(src, location.href, defaultMainSource));
|
|
3947
|
+
return buildUrlParams({ v: Date.now(), [LANG_KEY]: getLang() }, baseUrl);
|
|
3948
|
+
}, [src, defaultMainSource]);
|
|
3304
3949
|
const onHandleLoad = () => {
|
|
3305
3950
|
setLoading(false);
|
|
3306
3951
|
onLoad?.();
|
|
@@ -3308,7 +3953,7 @@ var Iframe_default = forwardRef(({ defaultMainSource, id, src, className, onLoad
|
|
|
3308
3953
|
useEffect(() => {
|
|
3309
3954
|
setLoading(true);
|
|
3310
3955
|
}, [src]);
|
|
3311
|
-
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(
|
|
3312
3957
|
"iframe",
|
|
3313
3958
|
{
|
|
3314
3959
|
id,
|
|
@@ -3988,24 +4633,37 @@ function useIsBreakpoint(mode = "max", breakpoint = 768) {
|
|
|
3988
4633
|
}
|
|
3989
4634
|
var { TextArea } = Input;
|
|
3990
4635
|
var AnnotationModal_default = ({ visible, onCancel, onConfirm }) => {
|
|
4636
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
3991
4637
|
const [form] = Form.useForm();
|
|
3992
4638
|
const handleOk = async () => {
|
|
3993
4639
|
const values = await form.validateFields();
|
|
3994
4640
|
onConfirm(values.content.trim());
|
|
3995
4641
|
onCancel();
|
|
3996
4642
|
};
|
|
3997
|
-
return /* @__PURE__ */ jsx(
|
|
3998
|
-
|
|
4643
|
+
return /* @__PURE__ */ jsx(
|
|
4644
|
+
Modal,
|
|
3999
4645
|
{
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
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
|
+
) })
|
|
4007
4665
|
}
|
|
4008
|
-
)
|
|
4666
|
+
);
|
|
4009
4667
|
};
|
|
4010
4668
|
|
|
4011
4669
|
// src/components/MarkdownEditor/annotation/constant.ts
|
|
@@ -4030,6 +4688,7 @@ var AnnotationSidebar_default = ({
|
|
|
4030
4688
|
annotationConfig,
|
|
4031
4689
|
onClose
|
|
4032
4690
|
}) => {
|
|
4691
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
4033
4692
|
const [form] = Form.useForm();
|
|
4034
4693
|
const [editingId, setEditingId] = useState();
|
|
4035
4694
|
const itemRefs = useRef({});
|
|
@@ -4066,7 +4725,7 @@ var AnnotationSidebar_default = ({
|
|
|
4066
4725
|
/* @__PURE__ */ jsxs(Space, { children: [
|
|
4067
4726
|
/* @__PURE__ */ jsx(MessageOutlined, {}),
|
|
4068
4727
|
/* @__PURE__ */ jsxs("span", { children: [
|
|
4069
|
-
"
|
|
4728
|
+
t2("markdownEditor.annotation.title"),
|
|
4070
4729
|
annotations.length > 0 && `\uFF08${annotations.length}\uFF09`
|
|
4071
4730
|
] })
|
|
4072
4731
|
] }),
|
|
@@ -4101,15 +4760,15 @@ var AnnotationSidebar_default = ({
|
|
|
4101
4760
|
{
|
|
4102
4761
|
name: "content",
|
|
4103
4762
|
rules: [
|
|
4104
|
-
{ whitespace: true, required: true, message: "
|
|
4105
|
-
{ max: 500, message: "
|
|
4763
|
+
{ whitespace: true, required: true, message: t2("markdownEditor.annotation.required") },
|
|
4764
|
+
{ max: 500, message: t2("markdownEditor.annotation.maxLength") }
|
|
4106
4765
|
],
|
|
4107
|
-
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 })
|
|
4108
4767
|
}
|
|
4109
4768
|
) }),
|
|
4110
4769
|
/* @__PURE__ */ jsxs(Space, { children: [
|
|
4111
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "primary", onClick: handleSaveEdit, children: "
|
|
4112
|
-
/* @__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") })
|
|
4113
4772
|
] })
|
|
4114
4773
|
] }) : /* @__PURE__ */ jsxs(Flex, { gap: 8, vertical: true, children: [
|
|
4115
4774
|
/* @__PURE__ */ jsx(Text2, { children: annotation.content }),
|
|
@@ -4119,7 +4778,7 @@ var AnnotationSidebar_default = ({
|
|
|
4119
4778
|
{
|
|
4120
4779
|
type: "text",
|
|
4121
4780
|
size: "small",
|
|
4122
|
-
title: "
|
|
4781
|
+
title: t2("markdownEditor.annotation.edit"),
|
|
4123
4782
|
icon: /* @__PURE__ */ jsx(EditOutlined, {}),
|
|
4124
4783
|
onClick: (e) => {
|
|
4125
4784
|
handleEdit(annotation);
|
|
@@ -4129,12 +4788,12 @@ var AnnotationSidebar_default = ({
|
|
|
4129
4788
|
/* @__PURE__ */ jsx(
|
|
4130
4789
|
Popconfirm,
|
|
4131
4790
|
{
|
|
4132
|
-
title: "
|
|
4133
|
-
okText: "
|
|
4134
|
-
cancelText: "
|
|
4135
|
-
description: "
|
|
4791
|
+
title: t2("common.defaultTitle"),
|
|
4792
|
+
okText: t2("common.confirm"),
|
|
4793
|
+
cancelText: t2("common.cancel"),
|
|
4794
|
+
description: t2("markdownEditor.annotation.confirmDelete"),
|
|
4136
4795
|
onConfirm: () => onDeleteAnnotation(annotation[ANNOTATION_ATTRS[0]]),
|
|
4137
|
-
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, {}) })
|
|
4138
4797
|
}
|
|
4139
4798
|
)
|
|
4140
4799
|
] })
|
|
@@ -4143,7 +4802,7 @@ var AnnotationSidebar_default = ({
|
|
|
4143
4802
|
}
|
|
4144
4803
|
)
|
|
4145
4804
|
}
|
|
4146
|
-
) : /* @__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") }) })
|
|
4147
4806
|
}
|
|
4148
4807
|
);
|
|
4149
4808
|
const container = annotationConfig?.getContainer?.();
|
|
@@ -4428,7 +5087,7 @@ var useAnnotations = (annotationConfig) => {
|
|
|
4428
5087
|
const id = genNonDuplicateID();
|
|
4429
5088
|
editor.current.chain().focus().setMark(ANNOTATION_KEY, {
|
|
4430
5089
|
"annotation-id": id,
|
|
4431
|
-
"user-name": annotationConfig?.user?.name || "
|
|
5090
|
+
"user-name": annotationConfig?.user?.name || t("markdownEditor.unknown"),
|
|
4432
5091
|
"user-id": annotationConfig?.user.id || "0000",
|
|
4433
5092
|
"update-time": getTimestamp(),
|
|
4434
5093
|
content
|
|
@@ -4710,6 +5369,7 @@ var collectionSidebar_default = ({
|
|
|
4710
5369
|
collectionConfig,
|
|
4711
5370
|
onClose
|
|
4712
5371
|
}) => {
|
|
5372
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
4713
5373
|
const itemRefs = useRef({});
|
|
4714
5374
|
useEffect(() => {
|
|
4715
5375
|
if (selectedCollectionId) {
|
|
@@ -4731,7 +5391,7 @@ var collectionSidebar_default = ({
|
|
|
4731
5391
|
/* @__PURE__ */ jsxs(Space, { children: [
|
|
4732
5392
|
/* @__PURE__ */ jsx(BookOutlined, {}),
|
|
4733
5393
|
/* @__PURE__ */ jsxs("span", { children: [
|
|
4734
|
-
"
|
|
5394
|
+
t2("markdownEditor.collection.title"),
|
|
4735
5395
|
collections.length > 0 && `\uFF08${collections.length}\uFF09`
|
|
4736
5396
|
] })
|
|
4737
5397
|
] }),
|
|
@@ -4774,12 +5434,12 @@ var collectionSidebar_default = ({
|
|
|
4774
5434
|
!disabled && selectedCollectionId === collection[COLLECTION_ATTRS[0]] && /* @__PURE__ */ jsx(Space, { children: /* @__PURE__ */ jsx(
|
|
4775
5435
|
Popconfirm,
|
|
4776
5436
|
{
|
|
4777
|
-
title: "
|
|
4778
|
-
okText: "
|
|
4779
|
-
cancelText: "
|
|
4780
|
-
description: "
|
|
5437
|
+
title: t2("common.defaultTitle"),
|
|
5438
|
+
okText: t2("common.confirm"),
|
|
5439
|
+
cancelText: t2("common.cancel"),
|
|
5440
|
+
description: t2("markdownEditor.collection.confirmDelete"),
|
|
4781
5441
|
onConfirm: () => onDeleteCollection(collection[COLLECTION_ATTRS[0]]),
|
|
4782
|
-
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, {}) })
|
|
4783
5443
|
}
|
|
4784
5444
|
) })
|
|
4785
5445
|
] })
|
|
@@ -4788,7 +5448,7 @@ var collectionSidebar_default = ({
|
|
|
4788
5448
|
);
|
|
4789
5449
|
}
|
|
4790
5450
|
}
|
|
4791
|
-
) : /* @__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") }) })
|
|
4792
5452
|
}
|
|
4793
5453
|
);
|
|
4794
5454
|
const container = collectionConfig?.getContainer?.();
|
|
@@ -4829,7 +5489,7 @@ var useCollections = (collectionConfig) => {
|
|
|
4829
5489
|
}
|
|
4830
5490
|
editor.current.chain().focus().setMark(COLLECTION_KEY, {
|
|
4831
5491
|
"collection-id": remoteId,
|
|
4832
|
-
"user-name": collectionConfig?.user?.name || "
|
|
5492
|
+
"user-name": collectionConfig?.user?.name || t("markdownEditor.unknown"),
|
|
4833
5493
|
"user-id": collectionConfig?.user.id || "0000",
|
|
4834
5494
|
"update-time": getTimestamp(),
|
|
4835
5495
|
"page-no": pageIndex
|
|
@@ -5378,6 +6038,7 @@ var BlockquoteButton = forwardRef(
|
|
|
5378
6038
|
hideWhenUnavailable,
|
|
5379
6039
|
onToggled
|
|
5380
6040
|
});
|
|
6041
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
5381
6042
|
const handleClick = useCallback(
|
|
5382
6043
|
(event) => {
|
|
5383
6044
|
onClick?.(event);
|
|
@@ -5401,7 +6062,7 @@ var BlockquoteButton = forwardRef(
|
|
|
5401
6062
|
"data-disabled": !canToggle3,
|
|
5402
6063
|
"aria-label": label,
|
|
5403
6064
|
"aria-pressed": isActive,
|
|
5404
|
-
tooltip: "
|
|
6065
|
+
tooltip: t2("markdownEditor.toolbar.blockquote"),
|
|
5405
6066
|
onClick: handleClick,
|
|
5406
6067
|
...buttonProps,
|
|
5407
6068
|
ref,
|
|
@@ -5569,7 +6230,7 @@ function useBlockquote(config) {
|
|
|
5569
6230
|
isActive,
|
|
5570
6231
|
handleToggle,
|
|
5571
6232
|
canToggle: canToggle3,
|
|
5572
|
-
label: "
|
|
6233
|
+
label: t("markdownEditor.toolbar.blockquote"),
|
|
5573
6234
|
shortcutKeys: BLOCKQUOTE_SHORTCUT_KEY,
|
|
5574
6235
|
Icon: BlockquoteIcon
|
|
5575
6236
|
};
|
|
@@ -5604,6 +6265,7 @@ var CodeBlockButton = forwardRef(
|
|
|
5604
6265
|
hideWhenUnavailable,
|
|
5605
6266
|
onToggled
|
|
5606
6267
|
});
|
|
6268
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
5607
6269
|
const handleClick = useCallback(
|
|
5608
6270
|
(event) => {
|
|
5609
6271
|
onClick?.(event);
|
|
@@ -5627,7 +6289,7 @@ var CodeBlockButton = forwardRef(
|
|
|
5627
6289
|
tabIndex: -1,
|
|
5628
6290
|
"aria-label": label,
|
|
5629
6291
|
"aria-pressed": isActive,
|
|
5630
|
-
tooltip: "
|
|
6292
|
+
tooltip: t2("markdownEditor.toolbar.codeBlock"),
|
|
5631
6293
|
onClick: handleClick,
|
|
5632
6294
|
...buttonProps,
|
|
5633
6295
|
ref,
|
|
@@ -5786,7 +6448,7 @@ function useCodeBlock(config) {
|
|
|
5786
6448
|
isActive,
|
|
5787
6449
|
handleToggle,
|
|
5788
6450
|
canToggle: canToggleState,
|
|
5789
|
-
label: "
|
|
6451
|
+
label: t("markdownEditor.toolbar.codeBlock"),
|
|
5790
6452
|
shortcutKeys: CODE_BLOCK_SHORTCUT_KEY,
|
|
5791
6453
|
Icon: CodeBlockIcon
|
|
5792
6454
|
};
|
|
@@ -5947,6 +6609,7 @@ var ColorHighlightButton = forwardRef(
|
|
|
5947
6609
|
style,
|
|
5948
6610
|
...buttonProps
|
|
5949
6611
|
}, ref) => {
|
|
6612
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
5950
6613
|
const { editor } = useTiptapEditor(providedEditor);
|
|
5951
6614
|
const {
|
|
5952
6615
|
isVisible,
|
|
@@ -5958,7 +6621,7 @@ var ColorHighlightButton = forwardRef(
|
|
|
5958
6621
|
} = useColorHighlight({
|
|
5959
6622
|
editor,
|
|
5960
6623
|
highlightColor,
|
|
5961
|
-
label: text ||
|
|
6624
|
+
label: text || t2("markdownEditor.highlight.toggle", { color: highlightColor }),
|
|
5962
6625
|
hideWhenUnavailable,
|
|
5963
6626
|
mode,
|
|
5964
6627
|
onApplied
|
|
@@ -6017,52 +6680,52 @@ ColorHighlightButton.displayName = "ColorHighlightButton";
|
|
|
6017
6680
|
var COLOR_HIGHLIGHT_SHORTCUT_KEY = "mod+shift+h";
|
|
6018
6681
|
var HIGHLIGHT_COLORS = [
|
|
6019
6682
|
{
|
|
6020
|
-
|
|
6683
|
+
labelKey: "markdownEditor.highlight.default",
|
|
6021
6684
|
value: "var(--tt-bg-color)",
|
|
6022
6685
|
border: "var(--tt-bg-color-contrast)"
|
|
6023
6686
|
},
|
|
6024
6687
|
{
|
|
6025
|
-
|
|
6688
|
+
labelKey: "markdownEditor.highlight.gray",
|
|
6026
6689
|
value: "var(--tt-color-highlight-gray)",
|
|
6027
6690
|
border: "var(--tt-color-highlight-gray-contrast)"
|
|
6028
6691
|
},
|
|
6029
6692
|
{
|
|
6030
|
-
|
|
6693
|
+
labelKey: "markdownEditor.highlight.brown",
|
|
6031
6694
|
value: "var(--tt-color-highlight-brown)",
|
|
6032
6695
|
border: "var(--tt-color-highlight-brown-contrast)"
|
|
6033
6696
|
},
|
|
6034
6697
|
{
|
|
6035
|
-
|
|
6698
|
+
labelKey: "markdownEditor.highlight.orange",
|
|
6036
6699
|
value: "var(--tt-color-highlight-orange)",
|
|
6037
6700
|
border: "var(--tt-color-highlight-orange-contrast)"
|
|
6038
6701
|
},
|
|
6039
6702
|
{
|
|
6040
|
-
|
|
6703
|
+
labelKey: "markdownEditor.highlight.yellow",
|
|
6041
6704
|
value: "var(--tt-color-highlight-yellow)",
|
|
6042
6705
|
border: "var(--tt-color-highlight-yellow-contrast)"
|
|
6043
6706
|
},
|
|
6044
6707
|
{
|
|
6045
|
-
|
|
6708
|
+
labelKey: "markdownEditor.highlight.green",
|
|
6046
6709
|
value: "var(--tt-color-highlight-green)",
|
|
6047
6710
|
border: "var(--tt-color-highlight-green-contrast)"
|
|
6048
6711
|
},
|
|
6049
6712
|
{
|
|
6050
|
-
|
|
6713
|
+
labelKey: "markdownEditor.highlight.blue",
|
|
6051
6714
|
value: "var(--tt-color-highlight-blue)",
|
|
6052
6715
|
border: "var(--tt-color-highlight-blue-contrast)"
|
|
6053
6716
|
},
|
|
6054
6717
|
{
|
|
6055
|
-
|
|
6718
|
+
labelKey: "markdownEditor.highlight.purple",
|
|
6056
6719
|
value: "var(--tt-color-highlight-purple)",
|
|
6057
6720
|
border: "var(--tt-color-highlight-purple-contrast)"
|
|
6058
6721
|
},
|
|
6059
6722
|
{
|
|
6060
|
-
|
|
6723
|
+
labelKey: "markdownEditor.highlight.pink",
|
|
6061
6724
|
value: "var(--tt-color-highlight-pink)",
|
|
6062
6725
|
border: "var(--tt-color-highlight-pink-contrast)"
|
|
6063
6726
|
},
|
|
6064
6727
|
{
|
|
6065
|
-
|
|
6728
|
+
labelKey: "markdownEditor.highlight.red",
|
|
6066
6729
|
value: "var(--tt-color-highlight-red)",
|
|
6067
6730
|
border: "var(--tt-color-highlight-red-contrast)"
|
|
6068
6731
|
}
|
|
@@ -6188,7 +6851,7 @@ function useColorHighlight(config) {
|
|
|
6188
6851
|
const handleRemoveHighlight = useCallback(() => {
|
|
6189
6852
|
const success = removeHighlight(editor, mode);
|
|
6190
6853
|
if (success) {
|
|
6191
|
-
onApplied?.({ color: "", label: "
|
|
6854
|
+
onApplied?.({ color: "", label: t("markdownEditor.highlight.removeBackground"), mode });
|
|
6192
6855
|
}
|
|
6193
6856
|
return success;
|
|
6194
6857
|
}, [editor, onApplied, mode]);
|
|
@@ -6210,28 +6873,31 @@ function useColorHighlight(config) {
|
|
|
6210
6873
|
handleColorHighlight,
|
|
6211
6874
|
handleRemoveHighlight,
|
|
6212
6875
|
canColorHighlight: canColorHighlightState,
|
|
6213
|
-
label: label ||
|
|
6876
|
+
label: label || t("markdownEditor.highlight.label"),
|
|
6214
6877
|
shortcutKeys: COLOR_HIGHLIGHT_SHORTCUT_KEY,
|
|
6215
6878
|
Icon: HighlighterIcon,
|
|
6216
6879
|
mode
|
|
6217
6880
|
};
|
|
6218
6881
|
}
|
|
6219
|
-
var ColorHighlightPopoverButton = forwardRef(({ className, children, ...props }, ref) =>
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
)
|
|
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
|
+
});
|
|
6235
6901
|
ColorHighlightPopoverButton.displayName = "ColorHighlightPopoverButton";
|
|
6236
6902
|
function ColorHighlightPopoverContent({
|
|
6237
6903
|
editor,
|
|
@@ -6246,9 +6912,10 @@ function ColorHighlightPopoverContent({
|
|
|
6246
6912
|
const { handleRemoveHighlight } = useColorHighlight({ editor });
|
|
6247
6913
|
const isMobile = useIsBreakpoint();
|
|
6248
6914
|
const containerRef = useRef(null);
|
|
6915
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
6249
6916
|
const menuItems = useMemo(
|
|
6250
|
-
() => [...colors, { label: "
|
|
6251
|
-
[colors]
|
|
6917
|
+
() => [...colors.map((c) => ({ ...c, label: t2(c.labelKey) })), { label: t2("markdownEditor.highlight.removeHighlight"), value: "none" }],
|
|
6918
|
+
[colors, t2]
|
|
6252
6919
|
);
|
|
6253
6920
|
const { selectedIndex } = useMenuNavigation({
|
|
6254
6921
|
containerRef,
|
|
@@ -6277,8 +6944,8 @@ function ColorHighlightPopoverContent({
|
|
|
6277
6944
|
{
|
|
6278
6945
|
editor,
|
|
6279
6946
|
highlightColor: color.value,
|
|
6280
|
-
tooltip: color.
|
|
6281
|
-
"aria-label": `${color.
|
|
6947
|
+
tooltip: t2(color.labelKey),
|
|
6948
|
+
"aria-label": `${t2(color.labelKey)} highlight color`,
|
|
6282
6949
|
tabIndex: index === selectedIndex ? 0 : -1,
|
|
6283
6950
|
"data-highlighted": selectedIndex === index
|
|
6284
6951
|
},
|
|
@@ -6289,8 +6956,8 @@ function ColorHighlightPopoverContent({
|
|
|
6289
6956
|
Button7,
|
|
6290
6957
|
{
|
|
6291
6958
|
onClick: handleRemoveHighlight,
|
|
6292
|
-
"aria-label": "
|
|
6293
|
-
tooltip: "
|
|
6959
|
+
"aria-label": t2("markdownEditor.highlight.removeBackground"),
|
|
6960
|
+
tooltip: t2("markdownEditor.highlight.removeBackground"),
|
|
6294
6961
|
tabIndex: selectedIndex === colors.length ? 0 : -1,
|
|
6295
6962
|
type: "button",
|
|
6296
6963
|
role: "menuitem",
|
|
@@ -6316,6 +6983,7 @@ function ColorHighlightPopover({
|
|
|
6316
6983
|
onApplied,
|
|
6317
6984
|
...props
|
|
6318
6985
|
}) {
|
|
6986
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
6319
6987
|
const { editor } = useTiptapEditor(providedEditor);
|
|
6320
6988
|
const [isOpen, setIsOpen] = useState(false);
|
|
6321
6989
|
const { isVisible, canColorHighlight: canColorHighlight2, isActive, label, Icon } = useColorHighlight({
|
|
@@ -6338,7 +7006,7 @@ function ColorHighlightPopover({
|
|
|
6338
7006
|
children: /* @__PURE__ */ jsx(Icon, { className: "tiptap-button-icon" })
|
|
6339
7007
|
}
|
|
6340
7008
|
) }),
|
|
6341
|
-
/* @__PURE__ */ jsx(PopoverContent, { "aria-label": "
|
|
7009
|
+
/* @__PURE__ */ jsx(PopoverContent, { "aria-label": t2("markdownEditor.highlight.label"), children: /* @__PURE__ */ jsx(ColorHighlightPopoverContent, { editor, colors }) })
|
|
6342
7010
|
] });
|
|
6343
7011
|
}
|
|
6344
7012
|
var ChevronDownIcon = memo(({ className, ...props }) => {
|
|
@@ -6821,6 +7489,7 @@ var HeadingDropdownMenu = forwardRef(
|
|
|
6821
7489
|
}, ref) => {
|
|
6822
7490
|
const { editor } = useTiptapEditor(providedEditor);
|
|
6823
7491
|
const [isOpen, setIsOpen] = useState(false);
|
|
7492
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
6824
7493
|
const { isVisible, isActive, canToggle: canToggle3, Icon } = useHeadingDropdownMenu({
|
|
6825
7494
|
editor,
|
|
6826
7495
|
levels,
|
|
@@ -6850,7 +7519,7 @@ var HeadingDropdownMenu = forwardRef(
|
|
|
6850
7519
|
"data-disabled": !canToggle3,
|
|
6851
7520
|
"aria-label": "Format text as heading",
|
|
6852
7521
|
"aria-pressed": isActive,
|
|
6853
|
-
tooltip: "
|
|
7522
|
+
tooltip: t2("markdownEditor.toolbar.heading"),
|
|
6854
7523
|
...buttonProps,
|
|
6855
7524
|
ref,
|
|
6856
7525
|
children: [
|
|
@@ -6864,10 +7533,10 @@ var HeadingDropdownMenu = forwardRef(
|
|
|
6864
7533
|
{
|
|
6865
7534
|
editor,
|
|
6866
7535
|
level,
|
|
6867
|
-
text:
|
|
7536
|
+
text: t2("markdownEditor.toolbar.headingLevel", { level }),
|
|
6868
7537
|
showTooltip: false
|
|
6869
7538
|
}
|
|
6870
|
-
) },
|
|
7539
|
+
) }, level)) }) }) }) })
|
|
6871
7540
|
] });
|
|
6872
7541
|
}
|
|
6873
7542
|
);
|
|
@@ -6930,7 +7599,7 @@ function useHeadingDropdownMenu(config) {
|
|
|
6930
7599
|
isActive,
|
|
6931
7600
|
canToggle: canToggleState,
|
|
6932
7601
|
levels,
|
|
6933
|
-
label: "
|
|
7602
|
+
label: t("markdownEditor.toolbar.heading"),
|
|
6934
7603
|
Icon: activeLevel ? headingIcons[activeLevel] : HeadingIcon
|
|
6935
7604
|
};
|
|
6936
7605
|
}
|
|
@@ -7056,6 +7725,7 @@ function InputGroup({
|
|
|
7056
7725
|
}
|
|
7057
7726
|
var LinkButton = forwardRef(
|
|
7058
7727
|
({ className, children, ...props }, ref) => {
|
|
7728
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
7059
7729
|
return /* @__PURE__ */ jsx(
|
|
7060
7730
|
Button7,
|
|
7061
7731
|
{
|
|
@@ -7064,8 +7734,8 @@ var LinkButton = forwardRef(
|
|
|
7064
7734
|
"data-style": "ghost",
|
|
7065
7735
|
role: "button",
|
|
7066
7736
|
tabIndex: -1,
|
|
7067
|
-
"aria-label": "
|
|
7068
|
-
tooltip: "
|
|
7737
|
+
"aria-label": t2("markdownEditor.toolbar.link"),
|
|
7738
|
+
tooltip: t2("markdownEditor.toolbar.link"),
|
|
7069
7739
|
ref,
|
|
7070
7740
|
...props,
|
|
7071
7741
|
children: children || /* @__PURE__ */ jsx(LinkIcon, { className: "tiptap-button-icon" })
|
|
@@ -7083,6 +7753,7 @@ var LinkMain = ({
|
|
|
7083
7753
|
isActive
|
|
7084
7754
|
}) => {
|
|
7085
7755
|
const isMobile = useIsBreakpoint();
|
|
7756
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
7086
7757
|
const handleKeyDown = (event) => {
|
|
7087
7758
|
if (event.key === "Enter") {
|
|
7088
7759
|
event.preventDefault();
|
|
@@ -7106,7 +7777,7 @@ var LinkMain = ({
|
|
|
7106
7777
|
Input4,
|
|
7107
7778
|
{
|
|
7108
7779
|
type: "url",
|
|
7109
|
-
placeholder: "
|
|
7780
|
+
placeholder: t2("markdownEditor.toolbar.linkPlaceholder"),
|
|
7110
7781
|
value: url,
|
|
7111
7782
|
onChange: (e) => setUrl(e.target.value),
|
|
7112
7783
|
onKeyDown: handleKeyDown,
|
|
@@ -7121,7 +7792,7 @@ var LinkMain = ({
|
|
|
7121
7792
|
{
|
|
7122
7793
|
type: "button",
|
|
7123
7794
|
onClick: setLink,
|
|
7124
|
-
title: "
|
|
7795
|
+
title: t2("markdownEditor.toolbar.applyLink"),
|
|
7125
7796
|
disabled: !url && !isActive,
|
|
7126
7797
|
"data-style": "ghost",
|
|
7127
7798
|
children: /* @__PURE__ */ jsx(CornerDownLeftIcon, { className: "tiptap-button-icon" })
|
|
@@ -7134,7 +7805,7 @@ var LinkMain = ({
|
|
|
7134
7805
|
{
|
|
7135
7806
|
type: "button",
|
|
7136
7807
|
onClick: openLink,
|
|
7137
|
-
title: "
|
|
7808
|
+
title: t2("markdownEditor.toolbar.openInNewWindow"),
|
|
7138
7809
|
disabled: !url && !isActive,
|
|
7139
7810
|
"data-style": "ghost",
|
|
7140
7811
|
children: /* @__PURE__ */ jsx(ExternalLinkIcon, { className: "tiptap-button-icon" })
|
|
@@ -7145,7 +7816,7 @@ var LinkMain = ({
|
|
|
7145
7816
|
{
|
|
7146
7817
|
type: "button",
|
|
7147
7818
|
onClick: removeLink,
|
|
7148
|
-
title: "
|
|
7819
|
+
title: t2("markdownEditor.toolbar.removeLink"),
|
|
7149
7820
|
disabled: !url && !isActive,
|
|
7150
7821
|
"data-style": "ghost",
|
|
7151
7822
|
children: /* @__PURE__ */ jsx(TrashIcon, { className: "tiptap-button-icon" })
|
|
@@ -7659,10 +8330,10 @@ var listIcons = {
|
|
|
7659
8330
|
orderedList: ListOrderedIcon,
|
|
7660
8331
|
taskList: ListTodoIcon
|
|
7661
8332
|
};
|
|
7662
|
-
var
|
|
7663
|
-
bulletList: "
|
|
7664
|
-
orderedList: "
|
|
7665
|
-
taskList: "
|
|
8333
|
+
var listLabelKeys = {
|
|
8334
|
+
bulletList: "markdownEditor.toolbar.bulletList",
|
|
8335
|
+
orderedList: "markdownEditor.toolbar.orderedList",
|
|
8336
|
+
taskList: "markdownEditor.toolbar.taskList"
|
|
7666
8337
|
};
|
|
7667
8338
|
var LIST_SHORTCUT_KEYS = {
|
|
7668
8339
|
bulletList: "mod+shift+8",
|
|
@@ -7809,24 +8480,24 @@ function useList(config) {
|
|
|
7809
8480
|
isActive,
|
|
7810
8481
|
handleToggle,
|
|
7811
8482
|
canToggle: canToggle3,
|
|
7812
|
-
label:
|
|
8483
|
+
label: t(listLabelKeys[type]),
|
|
7813
8484
|
shortcutKeys: LIST_SHORTCUT_KEYS[type],
|
|
7814
8485
|
Icon: listIcons[type]
|
|
7815
8486
|
};
|
|
7816
8487
|
}
|
|
7817
8488
|
var listOptions = [
|
|
7818
8489
|
{
|
|
7819
|
-
|
|
8490
|
+
labelKey: "markdownEditor.toolbar.bulletList",
|
|
7820
8491
|
type: "bulletList",
|
|
7821
8492
|
icon: ListIcon
|
|
7822
8493
|
},
|
|
7823
8494
|
{
|
|
7824
|
-
|
|
8495
|
+
labelKey: "markdownEditor.toolbar.orderedList",
|
|
7825
8496
|
type: "orderedList",
|
|
7826
8497
|
icon: ListOrderedIcon
|
|
7827
8498
|
},
|
|
7828
8499
|
{
|
|
7829
|
-
|
|
8500
|
+
labelKey: "markdownEditor.toolbar.taskList",
|
|
7830
8501
|
type: "taskList",
|
|
7831
8502
|
icon: ListTodoIcon
|
|
7832
8503
|
}
|
|
@@ -7867,7 +8538,13 @@ function useListDropdownMenu(config) {
|
|
|
7867
8538
|
const { editor } = useTiptapEditor(providedEditor);
|
|
7868
8539
|
const [isVisible, setIsVisible] = useState(true);
|
|
7869
8540
|
const listInSchema = types.some((type) => isNodeInSchema(type, editor));
|
|
7870
|
-
const filteredLists = useMemo(
|
|
8541
|
+
const filteredLists = useMemo(
|
|
8542
|
+
() => getFilteredListOptions(types).map((option) => ({
|
|
8543
|
+
...option,
|
|
8544
|
+
label: t(option.labelKey)
|
|
8545
|
+
})),
|
|
8546
|
+
[types]
|
|
8547
|
+
);
|
|
7871
8548
|
const canToggleAny = canToggleAnyList(editor, types);
|
|
7872
8549
|
const isAnyActive = isAnyListActive(editor, types);
|
|
7873
8550
|
const activeType = getActiveListType(editor, types);
|
|
@@ -7897,7 +8574,7 @@ function useListDropdownMenu(config) {
|
|
|
7897
8574
|
canToggle: canToggleAny,
|
|
7898
8575
|
types,
|
|
7899
8576
|
filteredLists,
|
|
7900
|
-
label: "
|
|
8577
|
+
label: t("markdownEditor.toolbar.list"),
|
|
7901
8578
|
Icon: activeList ? listIcons[activeList.type] : ListIcon
|
|
7902
8579
|
};
|
|
7903
8580
|
}
|
|
@@ -7911,6 +8588,7 @@ function ListDropdownMenu({
|
|
|
7911
8588
|
}) {
|
|
7912
8589
|
const { editor } = useTiptapEditor(providedEditor);
|
|
7913
8590
|
const [isOpen, setIsOpen] = useState(false);
|
|
8591
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
7914
8592
|
const { filteredLists, canToggle: canToggle3, isActive, isVisible, Icon } = useListDropdownMenu({
|
|
7915
8593
|
editor,
|
|
7916
8594
|
types,
|
|
@@ -7937,8 +8615,8 @@ function ListDropdownMenu({
|
|
|
7937
8615
|
tabIndex: -1,
|
|
7938
8616
|
disabled: !canToggle3,
|
|
7939
8617
|
"data-disabled": !canToggle3,
|
|
7940
|
-
"aria-label": "
|
|
7941
|
-
tooltip: "
|
|
8618
|
+
"aria-label": t2("markdownEditor.toolbar.listOptions"),
|
|
8619
|
+
tooltip: t2("markdownEditor.toolbar.list"),
|
|
7942
8620
|
...props,
|
|
7943
8621
|
children: [
|
|
7944
8622
|
/* @__PURE__ */ jsx(Icon, { className: "tiptap-button-icon" }),
|
|
@@ -8274,14 +8952,14 @@ var MARK_SHORTCUT_KEYS = {
|
|
|
8274
8952
|
superscript: "mod+.",
|
|
8275
8953
|
subscript: "mod+,"
|
|
8276
8954
|
};
|
|
8277
|
-
var
|
|
8278
|
-
bold: "
|
|
8279
|
-
italic: "
|
|
8280
|
-
underline: "
|
|
8281
|
-
strike: "
|
|
8282
|
-
code: "
|
|
8283
|
-
superscript: "
|
|
8284
|
-
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"
|
|
8285
8963
|
};
|
|
8286
8964
|
function canToggleMark(editor, type) {
|
|
8287
8965
|
if (!editor || !editor.isEditable) return false;
|
|
@@ -8308,7 +8986,8 @@ function shouldShowButton6(props) {
|
|
|
8308
8986
|
return true;
|
|
8309
8987
|
}
|
|
8310
8988
|
function getFormattedMarkName(type) {
|
|
8311
|
-
|
|
8989
|
+
const labelKey = MARK_ACTION_LABEL_KEYS[type];
|
|
8990
|
+
return labelKey ? t(labelKey) : type.charAt(0).toUpperCase() + type.slice(1);
|
|
8312
8991
|
}
|
|
8313
8992
|
function useMark(config) {
|
|
8314
8993
|
const {
|
|
@@ -8618,11 +9297,11 @@ var textAlignIcons = {
|
|
|
8618
9297
|
right: AlignRightIcon,
|
|
8619
9298
|
justify: AlignJustifyIcon
|
|
8620
9299
|
};
|
|
8621
|
-
var
|
|
8622
|
-
left: "
|
|
8623
|
-
center: "
|
|
8624
|
-
right: "
|
|
8625
|
-
justify: "
|
|
9300
|
+
var textAlignLabelKeys = {
|
|
9301
|
+
left: "markdownEditor.toolbar.alignLeft",
|
|
9302
|
+
center: "markdownEditor.toolbar.alignCenter",
|
|
9303
|
+
right: "markdownEditor.toolbar.alignRight",
|
|
9304
|
+
justify: "markdownEditor.toolbar.alignJustify"
|
|
8626
9305
|
};
|
|
8627
9306
|
function canSetTextAlign(editor, align) {
|
|
8628
9307
|
if (!editor || !editor.isEditable) return false;
|
|
@@ -8690,7 +9369,7 @@ function useTextAlign(config) {
|
|
|
8690
9369
|
isActive,
|
|
8691
9370
|
handleTextAlign,
|
|
8692
9371
|
canAlign,
|
|
8693
|
-
label:
|
|
9372
|
+
label: t(textAlignLabelKeys[align]),
|
|
8694
9373
|
shortcutKeys: TEXT_ALIGN_SHORTCUT_KEYS[align],
|
|
8695
9374
|
Icon: textAlignIcons[align]
|
|
8696
9375
|
};
|
|
@@ -8815,9 +9494,9 @@ var UNDO_REDO_SHORTCUT_KEYS = {
|
|
|
8815
9494
|
undo: "mod+z",
|
|
8816
9495
|
redo: "mod+shift+z"
|
|
8817
9496
|
};
|
|
8818
|
-
var
|
|
8819
|
-
undo: "
|
|
8820
|
-
redo: "
|
|
9497
|
+
var historyActionLabelKeys = {
|
|
9498
|
+
undo: "markdownEditor.toolbar.undo",
|
|
9499
|
+
redo: "markdownEditor.toolbar.redo"
|
|
8821
9500
|
};
|
|
8822
9501
|
var historyIcons = {
|
|
8823
9502
|
undo: Undo2Icon,
|
|
@@ -8875,7 +9554,7 @@ function useUndoRedo(config) {
|
|
|
8875
9554
|
isVisible,
|
|
8876
9555
|
handleAction,
|
|
8877
9556
|
canExecute,
|
|
8878
|
-
label:
|
|
9557
|
+
label: t(historyActionLabelKeys[action]),
|
|
8879
9558
|
shortcutKeys: UNDO_REDO_SHORTCUT_KEYS[action],
|
|
8880
9559
|
Icon: historyIcons[action]
|
|
8881
9560
|
};
|
|
@@ -9138,6 +9817,7 @@ var MainToolbarContent = ({
|
|
|
9138
9817
|
isMobile,
|
|
9139
9818
|
isBubble
|
|
9140
9819
|
}) => {
|
|
9820
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
9141
9821
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9142
9822
|
/* @__PURE__ */ jsx(Spacer, {}),
|
|
9143
9823
|
!isBubble && tools.includes("undo-redo") && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -9147,9 +9827,9 @@ var MainToolbarContent = ({
|
|
|
9147
9827
|
] }),
|
|
9148
9828
|
/* @__PURE__ */ jsx(ToolbarSeparator, {})
|
|
9149
9829
|
] }),
|
|
9150
|
-
onQuote && /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(SelectButton, { icon: /* @__PURE__ */ jsx(QuoteIcon, {}), tooltip: "
|
|
9151
|
-
onCreateAnnotation && /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(SelectButton, { icon: /* @__PURE__ */ jsx(MessageOutlined, {}), tooltip: "
|
|
9152
|
-
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") }) }),
|
|
9153
9833
|
(tools.includes("heading") || tools.includes("list") || tools.includes("block")) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9154
9834
|
/* @__PURE__ */ jsxs(ToolbarGroup, { children: [
|
|
9155
9835
|
tools.includes("heading") && /* @__PURE__ */ jsx(HeadingDropdownMenu, { levels: [1, 2, 3, 4], portal: isMobile }),
|
|
@@ -9390,9 +10070,9 @@ var SearchAndReplace = Extension.create({
|
|
|
9390
10070
|
addProseMirrorPlugins() {
|
|
9391
10071
|
const editor = this.editor;
|
|
9392
10072
|
const { searchResultClass, disableRegex } = this.options;
|
|
9393
|
-
const setLastSearchTerm = (
|
|
9394
|
-
const setLastCaseSensitive = (
|
|
9395
|
-
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;
|
|
9396
10076
|
return [
|
|
9397
10077
|
new Plugin({
|
|
9398
10078
|
key: searchAndReplacePluginKey,
|
|
@@ -9493,6 +10173,7 @@ var MarkdownEditor_default = forwardRef(
|
|
|
9493
10173
|
collectionConfig,
|
|
9494
10174
|
pageNoConfig
|
|
9495
10175
|
}, ref) => {
|
|
10176
|
+
const { t: t2 } = useTranslation(NS_COMMON);
|
|
9496
10177
|
const isMobile = useIsBreakpoint();
|
|
9497
10178
|
const lastContentRef = useRef("");
|
|
9498
10179
|
const { setPageNoEditor, onPageChange } = usePageNo(pageNoConfig);
|
|
@@ -9529,7 +10210,7 @@ var MarkdownEditor_default = forwardRef(
|
|
|
9529
10210
|
autocomplete: "off",
|
|
9530
10211
|
autocorrect: "off",
|
|
9531
10212
|
autocapitalize: "off",
|
|
9532
|
-
"aria-label": "
|
|
10213
|
+
"aria-label": t2("markdownEditor.mainArea")
|
|
9533
10214
|
}
|
|
9534
10215
|
},
|
|
9535
10216
|
extensions: [
|
|
@@ -9690,7 +10371,7 @@ var MarkdownEditor_default = forwardRef(
|
|
|
9690
10371
|
Button,
|
|
9691
10372
|
{
|
|
9692
10373
|
size: "small",
|
|
9693
|
-
title: "
|
|
10374
|
+
title: t2("markdownEditor.annotation.list"),
|
|
9694
10375
|
icon: /* @__PURE__ */ jsx(MessageOutlined, {}),
|
|
9695
10376
|
color: "primary",
|
|
9696
10377
|
variant: "text",
|
|
@@ -9702,15 +10383,15 @@ var MarkdownEditor_default = forwardRef(
|
|
|
9702
10383
|
{
|
|
9703
10384
|
style: { gap: "2px" },
|
|
9704
10385
|
size: "small",
|
|
9705
|
-
title: "
|
|
10386
|
+
title: t2("markdownEditor.collection.list"),
|
|
9706
10387
|
icon: /* @__PURE__ */ jsx(BookOutlined, {}),
|
|
9707
10388
|
color: "primary",
|
|
9708
10389
|
variant: "text",
|
|
9709
10390
|
onClick: () => setShowCollection(!showCollection),
|
|
9710
|
-
children: "
|
|
10391
|
+
children: t2("markdownEditor.collection.title")
|
|
9711
10392
|
}
|
|
9712
10393
|
),
|
|
9713
|
-
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") }),
|
|
9714
10395
|
extraNav
|
|
9715
10396
|
] })
|
|
9716
10397
|
] }),
|
|
@@ -9867,6 +10548,6 @@ var UserAvatar_default = ({ size, avatarSrc, userName }) => {
|
|
|
9867
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() });
|
|
9868
10549
|
};
|
|
9869
10550
|
|
|
9870
|
-
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 };
|
|
9871
10552
|
//# sourceMappingURL=index.esm.js.map
|
|
9872
10553
|
//# sourceMappingURL=index.esm.js.map
|