@lingxiteam/lcdp-ueditor-react 1.0.3-alpha.18 → 1.0.3-alpha.2

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.
Files changed (104) hide show
  1. package/es/LcdpUeditor.d.ts +2 -12
  2. package/es/LcdpUeditor.d.ts.map +1 -1
  3. package/es/LcdpUeditor.js +16 -107
  4. package/es/type.d.ts +0 -21
  5. package/es/type.d.ts.map +1 -1
  6. package/lib/LcdpUeditor.d.ts +2 -12
  7. package/lib/LcdpUeditor.js +16 -93
  8. package/lib/type.d.ts +0 -21
  9. package/package.json +3 -8
  10. package/ueditor-resource/dialogs/anchor/anchor.html +1 -1
  11. package/ueditor-resource/dialogs/attachment/attachment.html +3 -3
  12. package/ueditor-resource/dialogs/attachment/attachment.js +1 -1
  13. package/ueditor-resource/dialogs/audio/audio.js +1 -1
  14. package/ueditor-resource/dialogs/background/background.html +2 -2
  15. package/ueditor-resource/dialogs/background/background.js +1 -1
  16. package/ueditor-resource/dialogs/contentimport/contentimport.html +3 -3
  17. package/ueditor-resource/dialogs/contentimport/contentimport.js +1 -1
  18. package/ueditor-resource/dialogs/emotion/emotion.html +2 -2
  19. package/ueditor-resource/dialogs/emotion/emotion.js +1 -1
  20. package/ueditor-resource/dialogs/formula/formula.html +4 -4
  21. package/ueditor-resource/dialogs/formula/formula.js +1 -1
  22. package/ueditor-resource/dialogs/help/help.html +2 -2
  23. package/ueditor-resource/dialogs/help/help.js +1 -1
  24. package/ueditor-resource/dialogs/image/image.js +1 -1
  25. package/ueditor-resource/dialogs/insertframe/insertframe.html +1 -1
  26. package/ueditor-resource/dialogs/internal.js +1 -1
  27. package/ueditor-resource/dialogs/preview/preview.html +2 -2
  28. package/ueditor-resource/dialogs/scrawl/scrawl.html +2 -2
  29. package/ueditor-resource/dialogs/scrawl/scrawl.js +1 -1
  30. package/ueditor-resource/dialogs/searchreplace/searchreplace.html +2 -2
  31. package/ueditor-resource/dialogs/searchreplace/searchreplace.js +1 -1
  32. package/ueditor-resource/dialogs/spechars/spechars.html +2 -2
  33. package/ueditor-resource/dialogs/spechars/spechars.js +1 -1
  34. package/ueditor-resource/dialogs/table/edittable.html +2 -2
  35. package/ueditor-resource/dialogs/table/edittable.js +1 -1
  36. package/ueditor-resource/dialogs/table/edittd.html +1 -1
  37. package/ueditor-resource/dialogs/table/edittip.html +1 -1
  38. package/ueditor-resource/dialogs/template/template.html +2 -2
  39. package/ueditor-resource/dialogs/template/template.js +1 -1
  40. package/ueditor-resource/dialogs/video/video.js +1 -1
  41. package/ueditor-resource/dialogs/wordimage/wordimage.html +4 -4
  42. package/ueditor-resource/dialogs/wordimage/wordimage.js +1 -1
  43. package/ueditor-resource/plugins/demo/demo.js +1 -3
  44. package/ueditor-resource/themes/default/css/ueditor.css +1 -1
  45. package/ueditor-resource/third-party/SyntaxHighlighter/shCore.js +3 -3
  46. package/ueditor-resource/third-party/clipboard/clipboard.js +1 -1
  47. package/ueditor-resource/third-party/codemirror/codemirror.js +2 -3
  48. package/ueditor-resource/third-party/jquery-3.5.1.js +3 -3
  49. package/ueditor-resource/third-party/jquery-3.5.1_1.js +3 -3
  50. package/ueditor-resource/ueditor.all.js +19 -22
  51. package/ueditor-resource/ueditor.config.js +1 -1
  52. package/ueditor-resource/ueditor.parse.js +1 -1
  53. package/es/ToolBottomBar/FormatModal/index.d.ts +0 -9
  54. package/es/ToolBottomBar/FormatModal/index.d.ts.map +0 -1
  55. package/es/ToolBottomBar/FormatModal/index.js +0 -543
  56. package/es/ToolBottomBar/FormatModal/index.less +0 -276
  57. package/es/ToolBottomBar/ProgressModal/index.d.ts +0 -10
  58. package/es/ToolBottomBar/ProgressModal/index.d.ts.map +0 -1
  59. package/es/ToolBottomBar/ProgressModal/index.js +0 -53
  60. package/es/ToolBottomBar/ProgressModal/index.less +0 -16
  61. package/es/ToolBottomBar/index.d.ts +0 -33
  62. package/es/ToolBottomBar/index.d.ts.map +0 -1
  63. package/es/ToolBottomBar/index.js +0 -296
  64. package/es/ToolBottomBar/index.less +0 -75
  65. package/es/icon/ExportPDF.d.ts +0 -3
  66. package/es/icon/ExportPDF.d.ts.map +0 -1
  67. package/es/icon/ExportPDF.js +0 -24
  68. package/es/icon/TextCopy.d.ts +0 -3
  69. package/es/icon/TextCopy.d.ts.map +0 -1
  70. package/es/icon/TextCopy.js +0 -25
  71. package/es/icon/TextFileIcon.d.ts +0 -3
  72. package/es/icon/TextFileIcon.d.ts.map +0 -1
  73. package/es/icon/TextFileIcon.js +0 -26
  74. package/es/icon/TextIcon.d.ts +0 -3
  75. package/es/icon/TextIcon.d.ts.map +0 -1
  76. package/es/icon/TextIcon.js +0 -28
  77. package/es/tools/exportPDF.d.ts +0 -27
  78. package/es/tools/exportPDF.d.ts.map +0 -1
  79. package/es/tools/exportPDF.js +0 -146
  80. package/es/tools/generateStylesFromSettings.d.ts +0 -38
  81. package/es/tools/generateStylesFromSettings.d.ts.map +0 -1
  82. package/es/tools/generateStylesFromSettings.js +0 -24
  83. package/lib/ToolBottomBar/FormatModal/index.d.ts +0 -9
  84. package/lib/ToolBottomBar/FormatModal/index.js +0 -261
  85. package/lib/ToolBottomBar/FormatModal/index.less +0 -276
  86. package/lib/ToolBottomBar/ProgressModal/index.d.ts +0 -10
  87. package/lib/ToolBottomBar/ProgressModal/index.js +0 -73
  88. package/lib/ToolBottomBar/ProgressModal/index.less +0 -16
  89. package/lib/ToolBottomBar/index.d.ts +0 -33
  90. package/lib/ToolBottomBar/index.js +0 -235
  91. package/lib/ToolBottomBar/index.less +0 -75
  92. package/lib/icon/ExportPDF.d.ts +0 -3
  93. package/lib/icon/ExportPDF.js +0 -57
  94. package/lib/icon/TextCopy.d.ts +0 -3
  95. package/lib/icon/TextCopy.js +0 -39
  96. package/lib/icon/TextFileIcon.d.ts +0 -3
  97. package/lib/icon/TextFileIcon.js +0 -39
  98. package/lib/icon/TextIcon.d.ts +0 -3
  99. package/lib/icon/TextIcon.js +0 -39
  100. package/lib/tools/exportPDF.d.ts +0 -27
  101. package/lib/tools/exportPDF.js +0 -95
  102. package/lib/tools/generateStylesFromSettings.d.ts +0 -38
  103. package/lib/tools/generateStylesFromSettings.js +0 -77
  104. package/ueditor-resource/plugins/browser-image-compression.js +0 -9
@@ -1,235 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // src/ToolBottomBar/index.tsx
30
- var ToolBottomBar_exports = {};
31
- __export(ToolBottomBar_exports, {
32
- default: () => ToolBottomBar_default
33
- });
34
- module.exports = __toCommonJS(ToolBottomBar_exports);
35
- var import_react = __toESM(require("react"));
36
- var import_debounce = __toESM(require("lodash/debounce"));
37
- var import_icons = __toESM(require("@ant-design/icons"));
38
- var import_antd = require("antd");
39
- var import_ExportPDF = __toESM(require("../icon/ExportPDF"));
40
- var import_TextFileIcon = __toESM(require("../icon/TextFileIcon"));
41
- var import_TextIcon = __toESM(require("../icon/TextIcon"));
42
- var import_TextCopy = __toESM(require("../icon/TextCopy"));
43
- var import_exportPDF = require("../tools/exportPDF");
44
- var import_FormatModal = __toESM(require("./FormatModal"));
45
- var import_generateStylesFromSettings = require("../tools/generateStylesFromSettings");
46
- var import_index = require("./index.less");
47
- var import_ProgressModal = __toESM(require("./ProgressModal"));
48
- var MENU_OPTIONS = {
49
- a3: "A3",
50
- a4: "A4",
51
- a5: "A5",
52
- a0: "铺满"
53
- };
54
- var STYLE_ID = "ueditor-custom-styles";
55
- var ToolBottomBar = (props) => {
56
- const { ueditorInst, prefixCls, containerRef, defaultFormatSetting, onFormatChange, isReady, bottomTypes, exportFileName } = props;
57
- const { id: uiId } = ueditorInst.ui || {};
58
- const [chineseTextCount, setChineseTextCount] = (0, import_react.useState)(0);
59
- const [totalTextCount, setTotalTextCount] = (0, import_react.useState)(0);
60
- const [innerFullScreen, setInnerFullScreen] = (0, import_react.useState)(false);
61
- const [isCopying, setIsCopying] = (0, import_react.useState)(false);
62
- const [pageWidth, setPageWidth] = (0, import_react.useState)(void 0);
63
- const timer = (0, import_react.useRef)(void 0);
64
- const progressModalRef = (0, import_react.useRef)(null);
65
- const debounceContentChange = (0, import_debounce.default)(() => {
66
- var _a;
67
- try {
68
- const plainTxt = ueditorInst.getContentTxt() || "";
69
- const chineseTextCount2 = ((_a = plainTxt.match(/[\u4e00-\u9fa5]/g)) == null ? void 0 : _a.length) || 0;
70
- const totalTextCount2 = plainTxt.length;
71
- setChineseTextCount(chineseTextCount2);
72
- setTotalTextCount(totalTextCount2);
73
- } catch (e) {
74
- }
75
- }, 300);
76
- (0, import_react.useEffect)(() => {
77
- if (isReady) {
78
- ueditorInst.addListener("beforefullscreenchange", (_, v) => {
79
- setInnerFullScreen(v);
80
- });
81
- ueditorInst.addListener("contentChange", () => {
82
- debounceContentChange();
83
- });
84
- setTimeout(() => {
85
- debounceContentChange();
86
- }, 1e3);
87
- }
88
- }, [ueditorInst, isReady]);
89
- (0, import_react.useEffect)(() => {
90
- return () => {
91
- if (timer.current) {
92
- clearTimeout(timer.current);
93
- }
94
- };
95
- }, []);
96
- const getStatusBarItem = (params) => {
97
- const { icon, content, onClick, extraNode, className = "" } = params;
98
- return /* @__PURE__ */ import_react.default.createElement("span", { className: `ueditor-rich-status-bar-item ${className}`, onClick }, /* @__PURE__ */ import_react.default.createElement("span", { className: "ueditor-rich-status-bar-icon" }, icon), /* @__PURE__ */ import_react.default.createElement("span", { className: "ueditor-rich-status-bar-content" }, content), extraNode && /* @__PURE__ */ import_react.default.createElement("span", { className: "ueditor-rich-status-bar-extra" }, extraNode));
99
- };
100
- const copyAll = () => {
101
- const txt = ueditorInst.getPlainTxt();
102
- const copy = (t) => {
103
- const input = document.createElement("textarea");
104
- input.value = t;
105
- document.body.appendChild(input);
106
- input.select();
107
- document.execCommand("copy");
108
- document.body.removeChild(input);
109
- setIsCopying(true);
110
- };
111
- if (txt) {
112
- try {
113
- navigator.clipboard.writeText(txt).then(() => {
114
- setIsCopying(true);
115
- }).catch(() => {
116
- copy(txt);
117
- });
118
- } catch (e) {
119
- copy(txt);
120
- }
121
- timer.current = setTimeout(() => {
122
- setIsCopying(false);
123
- }, 1e3);
124
- }
125
- };
126
- const handleApply = (settings, isUpdate = true) => {
127
- var _a, _b, _c;
128
- const cssStyles = (0, import_generateStylesFromSettings.generateStylesFromSettings)(settings);
129
- const frame = ueditorInst.frame || ((_a = containerRef == null ? void 0 : containerRef.current) == null ? void 0 : _a.querySelector(`#${uiId}_iframeholder > iframe`));
130
- if ((_b = frame == null ? void 0 : frame.contentDocument) == null ? void 0 : _b.documentElement) {
131
- let styleEl = (_c = frame == null ? void 0 : frame.contentDocument) == null ? void 0 : _c.getElementById(STYLE_ID);
132
- if (!styleEl) {
133
- styleEl = document.createElement("style");
134
- styleEl.id = STYLE_ID;
135
- frame.contentDocument.head.appendChild(styleEl);
136
- }
137
- styleEl.textContent = cssStyles;
138
- }
139
- if (isUpdate) {
140
- onFormatChange == null ? void 0 : onFormatChange(settings);
141
- }
142
- };
143
- (0, import_react.useEffect)(() => {
144
- if (defaultFormatSetting) {
145
- handleApply(defaultFormatSetting, false);
146
- }
147
- }, [defaultFormatSetting]);
148
- const onProgress = (progress, title) => {
149
- var _a;
150
- (_a = progressModalRef.current) == null ? void 0 : _a.updateProgress(progress, title);
151
- };
152
- return /* @__PURE__ */ import_react.default.createElement(import_antd.ConfigProvider, { prefixCls }, /* @__PURE__ */ import_react.default.createElement("div", { className: "ueditor-rich-status-bar" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "ueditor-rich-status-bar-box" }, (bottomTypes == null ? void 0 : bottomTypes.includes("charCount")) && getStatusBarItem({
153
- icon: /* @__PURE__ */ import_react.default.createElement(import_icons.default, { component: import_TextIcon.default, className: "ueditor-rich-status-bar-icon-svg" }),
154
- content: `${totalTextCount} 字符`,
155
- className: "ueditor-rich-status-bar-text"
156
- }), (bottomTypes == null ? void 0 : bottomTypes.includes("chineseCount")) && getStatusBarItem({
157
- icon: /* @__PURE__ */ import_react.default.createElement(import_icons.default, { component: import_TextFileIcon.default, className: "ueditor-rich-status-bar-icon-svg" }),
158
- content: `${chineseTextCount} 中文`,
159
- className: "ueditor-rich-status-bar-text"
160
- })), /* @__PURE__ */ import_react.default.createElement("div", { className: "ueditor-rich-status-bar-box" }, (bottomTypes == null ? void 0 : bottomTypes.includes("pageWidth")) && /* @__PURE__ */ import_react.default.createElement(
161
- import_antd.Dropdown,
162
- {
163
- trigger: ["click"],
164
- overlay: /* @__PURE__ */ import_react.default.createElement(
165
- import_antd.Menu,
166
- {
167
- onClick: ({ key }) => {
168
- const newClass = `ueditor-rich-status-content-${key}`;
169
- const oldClass = `ueditor-rich-status-content-${pageWidth}`;
170
- if (containerRef == null ? void 0 : containerRef.current) {
171
- const frame = containerRef.current.querySelector(`#${uiId}_iframeholder`);
172
- const frameContainer = ueditorInst.container || containerRef.current.querySelector(`#${uiId}`);
173
- if (frame) {
174
- frame.classList.remove(oldClass);
175
- frame.classList.add(newClass);
176
- }
177
- if (frameContainer) {
178
- if (key === "a0") {
179
- frameContainer.classList.remove("ueditor-rich-status-not-full");
180
- } else {
181
- frameContainer.classList.add("ueditor-rich-status-not-full");
182
- }
183
- }
184
- }
185
- setPageWidth(key);
186
- }
187
- },
188
- Object.keys(MENU_OPTIONS).map((k) => /* @__PURE__ */ import_react.default.createElement(import_antd.Menu.Item, { key: k }, /* @__PURE__ */ import_react.default.createElement("span", null, "页面宽度 ", MENU_OPTIONS[k])))
189
- )
190
- },
191
- getStatusBarItem({
192
- content: `页面宽度${pageWidth ? ` ${MENU_OPTIONS[pageWidth]}` : ""}`,
193
- extraNode: /* @__PURE__ */ import_react.default.createElement(import_icons.DownOutlined, null)
194
- })
195
- ), (bottomTypes == null ? void 0 : bottomTypes.includes("formatSetting")) && /* @__PURE__ */ import_react.default.createElement(
196
- import_FormatModal.default,
197
- {
198
- onApply: handleApply,
199
- initialSettings: defaultFormatSetting
200
- },
201
- getStatusBarItem({
202
- icon: /* @__PURE__ */ import_react.default.createElement(import_icons.SettingOutlined, null),
203
- content: "格式设置"
204
- })
205
- ), (bottomTypes == null ? void 0 : bottomTypes.includes("copy")) && getStatusBarItem({
206
- icon: isCopying ? /* @__PURE__ */ import_react.default.createElement(import_icons.CheckOutlined, null) : /* @__PURE__ */ import_react.default.createElement(import_icons.default, { component: import_TextCopy.default, className: "ueditor-rich-status-bar-icon-svg" }),
207
- content: "复制全文",
208
- onClick: copyAll,
209
- className: isCopying ? "isActive" : void 0
210
- }), (bottomTypes == null ? void 0 : bottomTypes.includes("fullScreen")) && getStatusBarItem({
211
- icon: innerFullScreen ? /* @__PURE__ */ import_react.default.createElement(import_icons.FullscreenExitOutlined, null) : /* @__PURE__ */ import_react.default.createElement(import_icons.FullscreenOutlined, null),
212
- content: innerFullScreen ? "退出全屏" : "全屏预览",
213
- onClick: () => {
214
- ueditorInst.ui.setFullScreen(!innerFullScreen);
215
- }
216
- }), (bottomTypes == null ? void 0 : bottomTypes.includes("exportPdf")) && getStatusBarItem({
217
- icon: /* @__PURE__ */ import_react.default.createElement(import_icons.default, { component: import_ExportPDF.default, className: "ueditor-rich-status-bar-icon-svg" }),
218
- content: "导出文档",
219
- onClick: async () => {
220
- var _a, _b;
221
- if (containerRef == null ? void 0 : containerRef.current) {
222
- const frame = ueditorInst.frame || containerRef.current.querySelector(`#${uiId}_iframeholder > iframe`);
223
- if ((_a = frame == null ? void 0 : frame.contentDocument) == null ? void 0 : _a.body) {
224
- await (0, import_exportPDF.domloadPdf)((_b = frame == null ? void 0 : frame.contentDocument) == null ? void 0 : _b.body, pageWidth || "a0", exportFileName, onProgress);
225
- onProgress(100, "导出完成");
226
- }
227
- setTimeout(() => {
228
- var _a2;
229
- (_a2 = progressModalRef.current) == null ? void 0 : _a2.updateVisible(false);
230
- }, 500);
231
- }
232
- }
233
- }), /* @__PURE__ */ import_react.default.createElement(import_ProgressModal.default, { ref: progressModalRef }))));
234
- };
235
- var ToolBottomBar_default = ToolBottomBar;
@@ -1,75 +0,0 @@
1
- .ueditor-bottom-bar-with-status {
2
- .edui-default {
3
- display: none;
4
- }
5
- }
6
- .ueditor-rich-status-bar {
7
- display: flex;
8
- align-items: center;
9
- justify-content: space-between;
10
- padding: 4px 12px;
11
- background-color: #f0f0f0;
12
- border-top: 1px solid #e0e0e0;
13
- min-height: 32px;
14
- .ueditor-rich-status-bar-box {
15
- display: flex;
16
- gap: 16px;
17
- color: #666;
18
- .ueditor-rich-status-bar-item:not(.ueditor-rich-status-bar-text) {
19
- display: flex;
20
- align-items: center;
21
- cursor: pointer;
22
- border-radius: 4px;
23
- padding: 4px 10px;
24
- &:hover {
25
- background-color: rgba(0, 0, 0, 0.05);
26
- color: #1a73e8;
27
- }
28
- &.isActive {
29
- color: #52c41a;
30
- }
31
- }
32
- .ueditor-rich-status-bar-text {
33
- display: flex;
34
- align-items: center;
35
- }
36
- .ueditor-rich-status-bar-icon {
37
- margin-right: 4px;
38
- font-size: 14px;
39
- display: flex;
40
- align-items: center;
41
- }
42
- .ueditor-rich-status-bar-extra {
43
- margin-left: 12px;
44
- color: rgba(0, 0, 0, 0.25);
45
- font-size: 12px;
46
- display: flex;
47
- align-items: center;
48
- }
49
- }
50
- }
51
-
52
- .edui-default .edui-editor {
53
- &.ueditor-rich-status-not-full {
54
- background-color: #fafbfc;
55
- .edui-editor-iframeholder {
56
- box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
57
- margin: 20px auto;
58
- background-color: #fff;
59
- }
60
- }
61
- }
62
-
63
- .edui-default .edui-editor-iframeholder {
64
- &.ueditor-rich-status-content {
65
- &-a3 {
66
- width: 80% !important;
67
- }
68
- &-a4 {
69
- width: 60% !important;
70
- }
71
- &-a5 {
72
- width: 40% !important;
73
- }
74
- }
75
- }
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- declare const ExportFile: () => JSX.Element;
3
- export default ExportFile;
@@ -1,57 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // src/icon/ExportPDF.tsx
30
- var ExportPDF_exports = {};
31
- __export(ExportPDF_exports, {
32
- default: () => ExportPDF_default
33
- });
34
- module.exports = __toCommonJS(ExportPDF_exports);
35
- var import_react = __toESM(require("react"));
36
- var ExportFile = () => {
37
- return /* @__PURE__ */ import_react.default.createElement(
38
- "svg",
39
- {
40
- xmlns: "http://www.w3.org/2000/svg",
41
- width: "14",
42
- height: "14",
43
- viewBox: "0 0 24 24",
44
- fill: "none",
45
- stroke: "currentColor",
46
- strokeWidth: "2",
47
- strokeLinecap: "round",
48
- strokeLinejoin: "round",
49
- className: "lucide lucide-file-down"
50
- },
51
- /* @__PURE__ */ import_react.default.createElement("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
52
- /* @__PURE__ */ import_react.default.createElement("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
53
- /* @__PURE__ */ import_react.default.createElement("path", { d: "M12 18v-6" }),
54
- /* @__PURE__ */ import_react.default.createElement("path", { d: "m9 15 3 3 3-3" })
55
- );
56
- };
57
- var ExportPDF_default = ExportFile;
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- declare const TextIcon: () => JSX.Element;
3
- export default TextIcon;
@@ -1,39 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // src/icon/TextCopy.tsx
30
- var TextCopy_exports = {};
31
- __export(TextCopy_exports, {
32
- default: () => TextCopy_default
33
- });
34
- module.exports = __toCommonJS(TextCopy_exports);
35
- var import_react = __toESM(require("react"));
36
- var TextIcon = () => {
37
- return /* @__PURE__ */ import_react.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "lucide lucide-copy" }, /* @__PURE__ */ import_react.default.createElement("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" }), /* @__PURE__ */ import_react.default.createElement("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" }));
38
- };
39
- var TextCopy_default = TextIcon;
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- declare const TextIcon: () => JSX.Element;
3
- export default TextIcon;
@@ -1,39 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // src/icon/TextFileIcon.tsx
30
- var TextFileIcon_exports = {};
31
- __export(TextFileIcon_exports, {
32
- default: () => TextFileIcon_default
33
- });
34
- module.exports = __toCommonJS(TextFileIcon_exports);
35
- var import_react = __toESM(require("react"));
36
- var TextIcon = () => {
37
- return /* @__PURE__ */ import_react.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "lucide lucide-file-text" }, /* @__PURE__ */ import_react.default.createElement("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }), /* @__PURE__ */ import_react.default.createElement("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }), /* @__PURE__ */ import_react.default.createElement("path", { d: "M10 9H8" }), /* @__PURE__ */ import_react.default.createElement("path", { d: "M16 13H8" }), /* @__PURE__ */ import_react.default.createElement("path", { d: "M16 17H8" }));
38
- };
39
- var TextFileIcon_default = TextIcon;
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- declare const TextIcon: () => JSX.Element;
3
- export default TextIcon;
@@ -1,39 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // src/icon/TextIcon.tsx
30
- var TextIcon_exports = {};
31
- __export(TextIcon_exports, {
32
- default: () => TextIcon_default
33
- });
34
- module.exports = __toCommonJS(TextIcon_exports);
35
- var import_react = __toESM(require("react"));
36
- var TextIcon = () => {
37
- return /* @__PURE__ */ import_react.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "lucide lucide-type" }, /* @__PURE__ */ import_react.default.createElement("polyline", { points: "4 7 4 4 20 4 20 7" }), /* @__PURE__ */ import_react.default.createElement("line", { x1: "9", x2: "15", y1: "20", y2: "20" }), /* @__PURE__ */ import_react.default.createElement("line", { x1: "12", x2: "12", y1: "4", y2: "20" }));
38
- };
39
- var TextIcon_default = TextIcon;
@@ -1,27 +0,0 @@
1
- /**
2
- * 将HTML内容转换为PDF文档流
3
- * @param htmlElement HTML元素
4
- * @param options 配置选项
5
- * @returns PDF文档的Blob对象
6
- */
7
- export declare const html2pdf: (htmlElement: HTMLElement, options?: {
8
- filename?: string;
9
- margin?: number;
10
- image?: {
11
- type?: 'jpeg' | 'png';
12
- quality?: number;
13
- };
14
- jsPDF?: {
15
- orientation?: 'portrait' | 'landscape';
16
- unit?: 'pt' | 'mm' | 'cm' | 'in';
17
- format?: 'a4' | 'a3' | 'a5' | 'a0';
18
- };
19
- }, onProgress?: ((progress: number, title: string) => void) | undefined) => Promise<Blob>;
20
- /**
21
- * 将HTML元素转换为PDF文档流并下载
22
- * @param dom HTML元素
23
- * @param pageWidth 页面宽度
24
- * @param fileName 文件名
25
- * @returns 下载的PDF文件
26
- */
27
- export declare const domloadPdf: (dom: HTMLElement, pageWidth: 'a4' | 'a3' | 'a5' | 'a0', fileName?: string, onProgress?: ((progress: number, title: string) => void) | undefined) => Promise<void>;
@@ -1,95 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // src/tools/exportPDF.ts
30
- var exportPDF_exports = {};
31
- __export(exportPDF_exports, {
32
- domloadPdf: () => domloadPdf,
33
- html2pdf: () => html2pdf
34
- });
35
- module.exports = __toCommonJS(exportPDF_exports);
36
- var html2pdf = async (htmlElement, options = {}, onProgress) => {
37
- var _a, _b, _c, _d, _e;
38
- const { jsPDF: JS_PDF } = await import(
39
- /* webpackChunkName: "jspdf" */
40
- "jspdf"
41
- );
42
- const pdf = new JS_PDF({
43
- orientation: ((_a = options.jsPDF) == null ? void 0 : _a.orientation) || "portrait",
44
- unit: ((_b = options.jsPDF) == null ? void 0 : _b.unit) || "pt",
45
- format: ((_c = options.jsPDF) == null ? void 0 : _c.format) || "a4"
46
- });
47
- const { default: html2canvas } = await import("html2canvas");
48
- onProgress == null ? void 0 : onProgress(20, "渲染页面内容...");
49
- const canvas = await html2canvas(htmlElement, {
50
- scale: 2,
51
- // 提高清晰度
52
- useCORS: true,
53
- // 允许跨域图片
54
- logging: false
55
- });
56
- const imageType = ((_d = options.image) == null ? void 0 : _d.type) || "jpeg";
57
- const imageQuality = ((_e = options.image) == null ? void 0 : _e.quality) || 1;
58
- const imgData = canvas.toDataURL(`image/${imageType}`, imageQuality);
59
- const margin = options.margin || 20;
60
- const pdfWidth = pdf.internal.pageSize.getWidth();
61
- const pdfHeight = pdf.internal.pageSize.getHeight();
62
- const imgWidth = pdfWidth - margin * 2;
63
- const imgHeight = canvas.height * imgWidth / canvas.width;
64
- let heightLeft = imgHeight;
65
- let position = margin;
66
- const pageHeight = pdfHeight - margin * 2;
67
- pdf.addImage(imgData, imageType.toUpperCase(), margin, position, imgWidth, imgHeight);
68
- heightLeft -= pageHeight;
69
- while (heightLeft >= 0) {
70
- position = heightLeft - imgHeight;
71
- pdf.addPage();
72
- pdf.addImage(imgData, imageType.toUpperCase(), margin, position, imgWidth, imgHeight);
73
- heightLeft -= pageHeight;
74
- }
75
- onProgress == null ? void 0 : onProgress(50, "转换HTML内容...");
76
- return pdf.output("blob");
77
- };
78
- var domloadPdf = async (dom, pageWidth, fileName = "未命名", onProgress) => {
79
- const { saveAs } = await import("file-saver");
80
- onProgress == null ? void 0 : onProgress(5, "初始化...");
81
- const blob = await html2pdf(dom, {
82
- jsPDF: {
83
- orientation: "portrait",
84
- unit: "pt",
85
- format: pageWidth
86
- }
87
- }, onProgress);
88
- onProgress == null ? void 0 : onProgress(80, "生成PDF...");
89
- return saveAs(blob, `${fileName}.pdf`);
90
- };
91
- // Annotate the CommonJS export names for ESM import in node:
92
- 0 && (module.exports = {
93
- domloadPdf,
94
- html2pdf
95
- });
@@ -1,38 +0,0 @@
1
- interface HeadingStyle extends TextStyle {
2
- marginTop: string;
3
- marginBottom: string;
4
- }
5
- export interface TextStyle {
6
- fontSize: string;
7
- fontFamily: string;
8
- fontWeight: string;
9
- lineHeight: string;
10
- color: string;
11
- }
12
- interface ListStyle extends TextStyle {
13
- paddingLeft: string;
14
- marginTop: string;
15
- marginBottom: string;
16
- }
17
- export interface FormatSettings {
18
- headings: {
19
- h1: HeadingStyle;
20
- h2: HeadingStyle;
21
- h3: HeadingStyle;
22
- h4: HeadingStyle;
23
- h5: HeadingStyle;
24
- h6: HeadingStyle;
25
- };
26
- paragraph: TextStyle;
27
- lists: {
28
- ul: ListStyle;
29
- ol: ListStyle;
30
- };
31
- }
32
- /**
33
- * 生成CSS样式内容
34
- * @param settings 格式设置
35
- * @returns CSS样式字符串
36
- */
37
- export declare const generateStylesFromSettings: (settings: FormatSettings) => string;
38
- export {};