@lingxiteam/lcdp-ueditor-react 1.0.3-alpha.9 → 1.0.4-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.
- package/es/LcdpUeditor.d.ts +10 -4
- package/es/LcdpUeditor.d.ts.map +1 -0
- package/es/LcdpUeditor.js +78 -11
- package/es/ToolBottomBar/FormatModal/index.d.ts +9 -0
- package/es/ToolBottomBar/FormatModal/index.d.ts.map +1 -0
- package/es/ToolBottomBar/FormatModal/index.js +543 -0
- package/es/ToolBottomBar/FormatModal/index.less +276 -0
- package/es/ToolBottomBar/ProgressModal/index.d.ts +10 -0
- package/es/ToolBottomBar/ProgressModal/index.d.ts.map +1 -0
- package/es/ToolBottomBar/ProgressModal/index.js +53 -0
- package/es/ToolBottomBar/ProgressModal/index.less +16 -0
- package/es/ToolBottomBar/index.d.ts +32 -0
- package/es/ToolBottomBar/index.d.ts.map +1 -0
- package/es/ToolBottomBar/index.js +319 -0
- package/es/ToolBottomBar/index.less +75 -0
- package/es/const.d.ts.map +1 -0
- package/es/icon/ExportPDF.d.ts +3 -0
- package/es/icon/ExportPDF.d.ts.map +1 -0
- package/es/icon/ExportPDF.js +24 -0
- package/es/icon/TextCopy.d.ts +3 -0
- package/es/icon/TextCopy.d.ts.map +1 -0
- package/es/icon/TextCopy.js +25 -0
- package/es/icon/TextFileIcon.d.ts +3 -0
- package/es/icon/TextFileIcon.d.ts.map +1 -0
- package/es/icon/TextFileIcon.js +26 -0
- package/es/icon/TextIcon.d.ts +3 -0
- package/es/icon/TextIcon.d.ts.map +1 -0
- package/es/icon/TextIcon.js +28 -0
- package/es/index.d.ts.map +1 -0
- package/es/tools/UeditorResourceLoader.d.ts.map +1 -0
- package/es/tools/exportPDF.d.ts +27 -0
- package/es/tools/exportPDF.d.ts.map +1 -0
- package/es/tools/exportPDF.js +146 -0
- package/es/tools/filterHtmlNode.d.ts.map +1 -0
- package/es/tools/generateStylesFromSettings.d.ts +38 -0
- package/es/tools/generateStylesFromSettings.d.ts.map +1 -0
- package/es/tools/generateStylesFromSettings.js +24 -0
- package/es/tools/loadScript.d.ts.map +1 -0
- package/es/type.d.ts +20 -0
- package/es/type.d.ts.map +1 -0
- package/lib/LcdpUeditor.d.ts +10 -4
- package/lib/LcdpUeditor.js +63 -8
- package/lib/ToolBottomBar/FormatModal/index.d.ts +9 -0
- package/lib/ToolBottomBar/FormatModal/index.js +261 -0
- package/lib/ToolBottomBar/FormatModal/index.less +276 -0
- package/lib/ToolBottomBar/ProgressModal/index.d.ts +10 -0
- package/lib/ToolBottomBar/ProgressModal/index.js +73 -0
- package/lib/ToolBottomBar/ProgressModal/index.less +16 -0
- package/lib/ToolBottomBar/index.d.ts +32 -0
- package/lib/ToolBottomBar/index.js +254 -0
- package/lib/ToolBottomBar/index.less +75 -0
- package/lib/icon/ExportPDF.d.ts +3 -0
- package/lib/icon/ExportPDF.js +57 -0
- package/lib/icon/TextCopy.d.ts +3 -0
- package/lib/icon/TextCopy.js +39 -0
- package/lib/icon/TextFileIcon.d.ts +3 -0
- package/lib/icon/TextFileIcon.js +39 -0
- package/lib/icon/TextIcon.d.ts +3 -0
- package/lib/icon/TextIcon.js +39 -0
- package/lib/tools/exportPDF.d.ts +27 -0
- package/lib/tools/exportPDF.js +95 -0
- package/lib/tools/generateStylesFromSettings.d.ts +38 -0
- package/lib/tools/generateStylesFromSettings.js +77 -0
- package/lib/type.d.ts +20 -0
- package/package.json +8 -3
- package/ueditor-resource/themes/default/css/ueditor.css +1 -1
- package/ueditor-resource/ueditor.all.js +1 -1
|
@@ -0,0 +1,254 @@
|
|
|
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, defaultSetting, onSettingChange, 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 [formatSetting, setFormatSetting] = (0, import_react.useState)(void 0);
|
|
66
|
+
const debounceContentChange = (0, import_debounce.default)(() => {
|
|
67
|
+
var _a;
|
|
68
|
+
try {
|
|
69
|
+
const plainTxt = ueditorInst.getContentTxt() || "";
|
|
70
|
+
const chineseTextCount2 = ((_a = plainTxt.match(/[\u4e00-\u9fa5]/g)) == null ? void 0 : _a.length) || 0;
|
|
71
|
+
const totalTextCount2 = plainTxt.length;
|
|
72
|
+
setChineseTextCount(chineseTextCount2);
|
|
73
|
+
setTotalTextCount(totalTextCount2);
|
|
74
|
+
} catch (e) {
|
|
75
|
+
}
|
|
76
|
+
}, 300);
|
|
77
|
+
(0, import_react.useEffect)(() => {
|
|
78
|
+
if (isReady) {
|
|
79
|
+
ueditorInst.addListener("beforefullscreenchange", (_, v) => {
|
|
80
|
+
setInnerFullScreen(v);
|
|
81
|
+
});
|
|
82
|
+
ueditorInst.addListener("contentChange", () => {
|
|
83
|
+
debounceContentChange();
|
|
84
|
+
});
|
|
85
|
+
setTimeout(() => {
|
|
86
|
+
debounceContentChange();
|
|
87
|
+
}, 1e3);
|
|
88
|
+
}
|
|
89
|
+
}, [ueditorInst, isReady]);
|
|
90
|
+
(0, import_react.useEffect)(() => {
|
|
91
|
+
return () => {
|
|
92
|
+
if (timer.current) {
|
|
93
|
+
clearTimeout(timer.current);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}, []);
|
|
97
|
+
const getStatusBarItem = (params) => {
|
|
98
|
+
const { icon, content, onClick, extraNode, className = "" } = params;
|
|
99
|
+
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));
|
|
100
|
+
};
|
|
101
|
+
const copyAll = () => {
|
|
102
|
+
const txt = ueditorInst.getPlainTxt();
|
|
103
|
+
const copy = (t) => {
|
|
104
|
+
const input = document.createElement("textarea");
|
|
105
|
+
input.value = t;
|
|
106
|
+
document.body.appendChild(input);
|
|
107
|
+
input.select();
|
|
108
|
+
document.execCommand("copy");
|
|
109
|
+
document.body.removeChild(input);
|
|
110
|
+
setIsCopying(true);
|
|
111
|
+
};
|
|
112
|
+
if (txt) {
|
|
113
|
+
try {
|
|
114
|
+
navigator.clipboard.writeText(txt).then(() => {
|
|
115
|
+
setIsCopying(true);
|
|
116
|
+
}).catch(() => {
|
|
117
|
+
copy(txt);
|
|
118
|
+
});
|
|
119
|
+
} catch (e) {
|
|
120
|
+
copy(txt);
|
|
121
|
+
}
|
|
122
|
+
timer.current = setTimeout(() => {
|
|
123
|
+
setIsCopying(false);
|
|
124
|
+
}, 1e3);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const handleApply = (settings, isUpdate = true) => {
|
|
128
|
+
var _a, _b, _c;
|
|
129
|
+
const cssStyles = (0, import_generateStylesFromSettings.generateStylesFromSettings)(settings);
|
|
130
|
+
const frame = ueditorInst.frame || ((_a = containerRef == null ? void 0 : containerRef.current) == null ? void 0 : _a.querySelector(`#${uiId}_iframeholder > iframe`));
|
|
131
|
+
if ((_b = frame == null ? void 0 : frame.contentDocument) == null ? void 0 : _b.documentElement) {
|
|
132
|
+
let styleEl = (_c = frame == null ? void 0 : frame.contentDocument) == null ? void 0 : _c.getElementById(STYLE_ID);
|
|
133
|
+
if (!styleEl) {
|
|
134
|
+
styleEl = document.createElement("style");
|
|
135
|
+
styleEl.id = STYLE_ID;
|
|
136
|
+
frame.contentDocument.head.appendChild(styleEl);
|
|
137
|
+
}
|
|
138
|
+
styleEl.textContent = cssStyles;
|
|
139
|
+
}
|
|
140
|
+
setFormatSetting(settings);
|
|
141
|
+
if (isUpdate) {
|
|
142
|
+
onSettingChange == null ? void 0 : onSettingChange({
|
|
143
|
+
formatSetting: settings,
|
|
144
|
+
pageWidth
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
(0, import_react.useEffect)(() => {
|
|
149
|
+
if (defaultSetting == null ? void 0 : defaultSetting.formatSetting) {
|
|
150
|
+
handleApply(defaultSetting.formatSetting, false);
|
|
151
|
+
}
|
|
152
|
+
}, [defaultSetting == null ? void 0 : defaultSetting.formatSetting]);
|
|
153
|
+
const handlePageWidthChange = (key, isUpdate = true) => {
|
|
154
|
+
const newClass = `ueditor-rich-status-content-${key}`;
|
|
155
|
+
const oldClass = `ueditor-rich-status-content-${pageWidth}`;
|
|
156
|
+
if (containerRef == null ? void 0 : containerRef.current) {
|
|
157
|
+
const frame = containerRef.current.querySelector(`#${uiId}_iframeholder`);
|
|
158
|
+
const frameContainer = ueditorInst.container || containerRef.current.querySelector(`#${uiId}`);
|
|
159
|
+
if (frame) {
|
|
160
|
+
frame.classList.remove(oldClass);
|
|
161
|
+
frame.classList.add(newClass);
|
|
162
|
+
}
|
|
163
|
+
if (frameContainer) {
|
|
164
|
+
if (key === "a0") {
|
|
165
|
+
frameContainer.classList.remove("ueditor-rich-status-not-full");
|
|
166
|
+
} else {
|
|
167
|
+
frameContainer.classList.add("ueditor-rich-status-not-full");
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
setPageWidth(key);
|
|
172
|
+
if (isUpdate) {
|
|
173
|
+
onSettingChange == null ? void 0 : onSettingChange({
|
|
174
|
+
pageWidth: key,
|
|
175
|
+
formatSetting
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
(0, import_react.useEffect)(() => {
|
|
180
|
+
if (defaultSetting == null ? void 0 : defaultSetting.pageWidth) {
|
|
181
|
+
handlePageWidthChange(defaultSetting.pageWidth, false);
|
|
182
|
+
}
|
|
183
|
+
}, [defaultSetting == null ? void 0 : defaultSetting.pageWidth]);
|
|
184
|
+
const onProgress = (progress, title) => {
|
|
185
|
+
var _a;
|
|
186
|
+
(_a = progressModalRef.current) == null ? void 0 : _a.updateProgress(progress, title);
|
|
187
|
+
};
|
|
188
|
+
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({
|
|
189
|
+
icon: /* @__PURE__ */ import_react.default.createElement(import_icons.default, { component: import_TextIcon.default, className: "ueditor-rich-status-bar-icon-svg" }),
|
|
190
|
+
content: `${totalTextCount} 字符`,
|
|
191
|
+
className: "ueditor-rich-status-bar-text"
|
|
192
|
+
}), (bottomTypes == null ? void 0 : bottomTypes.includes("chineseCount")) && getStatusBarItem({
|
|
193
|
+
icon: /* @__PURE__ */ import_react.default.createElement(import_icons.default, { component: import_TextFileIcon.default, className: "ueditor-rich-status-bar-icon-svg" }),
|
|
194
|
+
content: `${chineseTextCount} 中文`,
|
|
195
|
+
className: "ueditor-rich-status-bar-text"
|
|
196
|
+
})), /* @__PURE__ */ import_react.default.createElement("div", { className: "ueditor-rich-status-bar-box" }, (bottomTypes == null ? void 0 : bottomTypes.includes("pageWidth")) && /* @__PURE__ */ import_react.default.createElement(
|
|
197
|
+
import_antd.Dropdown,
|
|
198
|
+
{
|
|
199
|
+
trigger: ["click"],
|
|
200
|
+
overlay: /* @__PURE__ */ import_react.default.createElement(
|
|
201
|
+
import_antd.Menu,
|
|
202
|
+
{
|
|
203
|
+
onClick: ({ key }) => {
|
|
204
|
+
handlePageWidthChange(key);
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
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])))
|
|
208
|
+
)
|
|
209
|
+
},
|
|
210
|
+
getStatusBarItem({
|
|
211
|
+
content: `页面宽度${pageWidth ? ` ${MENU_OPTIONS[pageWidth]}` : ""}`,
|
|
212
|
+
extraNode: /* @__PURE__ */ import_react.default.createElement(import_icons.DownOutlined, null)
|
|
213
|
+
})
|
|
214
|
+
), (bottomTypes == null ? void 0 : bottomTypes.includes("formatSetting")) && /* @__PURE__ */ import_react.default.createElement(
|
|
215
|
+
import_FormatModal.default,
|
|
216
|
+
{
|
|
217
|
+
onApply: handleApply,
|
|
218
|
+
initialSettings: defaultSetting == null ? void 0 : defaultSetting.formatSetting
|
|
219
|
+
},
|
|
220
|
+
getStatusBarItem({
|
|
221
|
+
icon: /* @__PURE__ */ import_react.default.createElement(import_icons.SettingOutlined, null),
|
|
222
|
+
content: "格式设置"
|
|
223
|
+
})
|
|
224
|
+
), (bottomTypes == null ? void 0 : bottomTypes.includes("copy")) && getStatusBarItem({
|
|
225
|
+
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" }),
|
|
226
|
+
content: "复制全文",
|
|
227
|
+
onClick: copyAll,
|
|
228
|
+
className: isCopying ? "isActive" : void 0
|
|
229
|
+
}), (bottomTypes == null ? void 0 : bottomTypes.includes("fullScreen")) && getStatusBarItem({
|
|
230
|
+
icon: innerFullScreen ? /* @__PURE__ */ import_react.default.createElement(import_icons.FullscreenExitOutlined, null) : /* @__PURE__ */ import_react.default.createElement(import_icons.FullscreenOutlined, null),
|
|
231
|
+
content: innerFullScreen ? "退出全屏" : "全屏预览",
|
|
232
|
+
onClick: () => {
|
|
233
|
+
ueditorInst.ui.setFullScreen(!innerFullScreen);
|
|
234
|
+
}
|
|
235
|
+
}), (bottomTypes == null ? void 0 : bottomTypes.includes("exportPdf")) && getStatusBarItem({
|
|
236
|
+
icon: /* @__PURE__ */ import_react.default.createElement(import_icons.default, { component: import_ExportPDF.default, className: "ueditor-rich-status-bar-icon-svg" }),
|
|
237
|
+
content: "导出文档",
|
|
238
|
+
onClick: async () => {
|
|
239
|
+
var _a, _b;
|
|
240
|
+
if (containerRef == null ? void 0 : containerRef.current) {
|
|
241
|
+
const frame = ueditorInst.frame || containerRef.current.querySelector(`#${uiId}_iframeholder > iframe`);
|
|
242
|
+
if ((_a = frame == null ? void 0 : frame.contentDocument) == null ? void 0 : _a.body) {
|
|
243
|
+
await (0, import_exportPDF.domloadPdf)((_b = frame == null ? void 0 : frame.contentDocument) == null ? void 0 : _b.body, pageWidth || "a0", exportFileName, onProgress);
|
|
244
|
+
onProgress(100, "导出完成");
|
|
245
|
+
}
|
|
246
|
+
setTimeout(() => {
|
|
247
|
+
var _a2;
|
|
248
|
+
(_a2 = progressModalRef.current) == null ? void 0 : _a2.updateVisible(false);
|
|
249
|
+
}, 500);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}), /* @__PURE__ */ import_react.default.createElement(import_ProgressModal.default, { ref: progressModalRef }))));
|
|
253
|
+
};
|
|
254
|
+
var ToolBottomBar_default = ToolBottomBar;
|
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
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;
|
|
@@ -0,0 +1,39 @@
|
|
|
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;
|
|
@@ -0,0 +1,39 @@
|
|
|
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;
|
|
@@ -0,0 +1,39 @@
|
|
|
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;
|
|
@@ -0,0 +1,27 @@
|
|
|
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>;
|
|
@@ -0,0 +1,95 @@
|
|
|
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
|
+
});
|