@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,319 @@
|
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
|
+
import React, { useState, useEffect, useRef } from 'react';
|
|
5
|
+
import debounce from 'lodash/debounce';
|
|
6
|
+
import Icon, { SettingOutlined, CheckOutlined, FullscreenOutlined, FullscreenExitOutlined, DownOutlined } from '@ant-design/icons';
|
|
7
|
+
import { Dropdown, Menu, ConfigProvider } from 'antd';
|
|
8
|
+
import exportFile from "../icon/ExportPDF";
|
|
9
|
+
import textFileIcon from "../icon/TextFileIcon";
|
|
10
|
+
import textIcon from "../icon/TextIcon";
|
|
11
|
+
import textCopy from "../icon/TextCopy";
|
|
12
|
+
import { domloadPdf } from "../tools/exportPDF";
|
|
13
|
+
import FormatModal from "./FormatModal";
|
|
14
|
+
import { generateStylesFromSettings } from "../tools/generateStylesFromSettings";
|
|
15
|
+
import "./index.less";
|
|
16
|
+
import ProgressModal from "./ProgressModal";
|
|
17
|
+
var MENU_OPTIONS = {
|
|
18
|
+
a3: 'A3',
|
|
19
|
+
a4: 'A4',
|
|
20
|
+
a5: 'A5',
|
|
21
|
+
a0: '铺满'
|
|
22
|
+
};
|
|
23
|
+
var STYLE_ID = 'ueditor-custom-styles';
|
|
24
|
+
var ToolBottomBar = function ToolBottomBar(props) {
|
|
25
|
+
var ueditorInst = props.ueditorInst,
|
|
26
|
+
prefixCls = props.prefixCls,
|
|
27
|
+
containerRef = props.containerRef,
|
|
28
|
+
defaultSetting = props.defaultSetting,
|
|
29
|
+
onSettingChange = props.onSettingChange,
|
|
30
|
+
isReady = props.isReady,
|
|
31
|
+
bottomTypes = props.bottomTypes,
|
|
32
|
+
exportFileName = props.exportFileName;
|
|
33
|
+
var _ref = ueditorInst.ui || {},
|
|
34
|
+
uiId = _ref.id;
|
|
35
|
+
var _useState = useState(0),
|
|
36
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
37
|
+
chineseTextCount = _useState2[0],
|
|
38
|
+
setChineseTextCount = _useState2[1];
|
|
39
|
+
var _useState3 = useState(0),
|
|
40
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
41
|
+
totalTextCount = _useState4[0],
|
|
42
|
+
setTotalTextCount = _useState4[1];
|
|
43
|
+
var _useState5 = useState(false),
|
|
44
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
45
|
+
innerFullScreen = _useState6[0],
|
|
46
|
+
setInnerFullScreen = _useState6[1];
|
|
47
|
+
var _useState7 = useState(false),
|
|
48
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
49
|
+
isCopying = _useState8[0],
|
|
50
|
+
setIsCopying = _useState8[1];
|
|
51
|
+
var _useState9 = useState(undefined),
|
|
52
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
53
|
+
pageWidth = _useState10[0],
|
|
54
|
+
setPageWidth = _useState10[1];
|
|
55
|
+
var timer = useRef(undefined);
|
|
56
|
+
var progressModalRef = useRef(null);
|
|
57
|
+
var _useState11 = useState(undefined),
|
|
58
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
59
|
+
formatSetting = _useState12[0],
|
|
60
|
+
setFormatSetting = _useState12[1];
|
|
61
|
+
var debounceContentChange = debounce(function () {
|
|
62
|
+
try {
|
|
63
|
+
var _plainTxt$match;
|
|
64
|
+
var plainTxt = ueditorInst.getContentTxt() || '';
|
|
65
|
+
var _chineseTextCount = ((_plainTxt$match = plainTxt.match(/[\u4e00-\u9fa5]/g)) === null || _plainTxt$match === void 0 ? void 0 : _plainTxt$match.length) || 0;
|
|
66
|
+
var _totalTextCount = plainTxt.length;
|
|
67
|
+
setChineseTextCount(_chineseTextCount);
|
|
68
|
+
setTotalTextCount(_totalTextCount);
|
|
69
|
+
} catch (e) {
|
|
70
|
+
//
|
|
71
|
+
}
|
|
72
|
+
}, 300);
|
|
73
|
+
useEffect(function () {
|
|
74
|
+
if (isReady) {
|
|
75
|
+
ueditorInst.addListener('beforefullscreenchange', function (_, v) {
|
|
76
|
+
setInnerFullScreen(v);
|
|
77
|
+
});
|
|
78
|
+
ueditorInst.addListener('contentChange', function () {
|
|
79
|
+
debounceContentChange();
|
|
80
|
+
});
|
|
81
|
+
// 初始化调用一次
|
|
82
|
+
setTimeout(function () {
|
|
83
|
+
debounceContentChange();
|
|
84
|
+
}, 1000);
|
|
85
|
+
}
|
|
86
|
+
}, [ueditorInst, isReady]);
|
|
87
|
+
useEffect(function () {
|
|
88
|
+
return function () {
|
|
89
|
+
if (timer.current) {
|
|
90
|
+
clearTimeout(timer.current);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}, []);
|
|
94
|
+
var getStatusBarItem = function getStatusBarItem(params) {
|
|
95
|
+
var icon = params.icon,
|
|
96
|
+
content = params.content,
|
|
97
|
+
onClick = params.onClick,
|
|
98
|
+
extraNode = params.extraNode,
|
|
99
|
+
_params$className = params.className,
|
|
100
|
+
className = _params$className === void 0 ? '' : _params$className;
|
|
101
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
102
|
+
className: "ueditor-rich-status-bar-item ".concat(className),
|
|
103
|
+
onClick: onClick
|
|
104
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
105
|
+
className: "ueditor-rich-status-bar-icon"
|
|
106
|
+
}, icon), /*#__PURE__*/React.createElement("span", {
|
|
107
|
+
className: "ueditor-rich-status-bar-content"
|
|
108
|
+
}, content), extraNode && /*#__PURE__*/React.createElement("span", {
|
|
109
|
+
className: "ueditor-rich-status-bar-extra"
|
|
110
|
+
}, extraNode));
|
|
111
|
+
};
|
|
112
|
+
var copyAll = function copyAll() {
|
|
113
|
+
var txt = ueditorInst.getPlainTxt();
|
|
114
|
+
var copy = function copy(t) {
|
|
115
|
+
// 复制使用传统方式
|
|
116
|
+
var input = document.createElement('textarea');
|
|
117
|
+
input.value = t;
|
|
118
|
+
document.body.appendChild(input);
|
|
119
|
+
input.select();
|
|
120
|
+
document.execCommand('copy');
|
|
121
|
+
document.body.removeChild(input);
|
|
122
|
+
setIsCopying(true);
|
|
123
|
+
};
|
|
124
|
+
if (txt) {
|
|
125
|
+
try {
|
|
126
|
+
navigator.clipboard.writeText(txt).then(function () {
|
|
127
|
+
setIsCopying(true);
|
|
128
|
+
// 复制成功
|
|
129
|
+
}).catch(function () {
|
|
130
|
+
// 复制失败,使用传统方式
|
|
131
|
+
copy(txt);
|
|
132
|
+
});
|
|
133
|
+
} catch (e) {
|
|
134
|
+
// 浏览器不支持 clipboard API,使用传统方式
|
|
135
|
+
copy(txt);
|
|
136
|
+
}
|
|
137
|
+
timer.current = setTimeout(function () {
|
|
138
|
+
setIsCopying(false);
|
|
139
|
+
}, 1000);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* 应用格式设置
|
|
145
|
+
* @param settings 格式设置
|
|
146
|
+
*/
|
|
147
|
+
var handleApply = function handleApply(settings) {
|
|
148
|
+
var _containerRef$current, _contentDocument;
|
|
149
|
+
var isUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
150
|
+
// 生成样式
|
|
151
|
+
var cssStyles = generateStylesFromSettings(settings);
|
|
152
|
+
|
|
153
|
+
// 触发编辑器视图更新
|
|
154
|
+
var frame = ueditorInst.frame || (containerRef === null || containerRef === void 0 || (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.querySelector("#".concat(uiId, "_iframeholder > iframe")));
|
|
155
|
+
if (frame !== null && frame !== void 0 && (_contentDocument = frame.contentDocument) !== null && _contentDocument !== void 0 && _contentDocument.documentElement) {
|
|
156
|
+
var _contentDocument2;
|
|
157
|
+
// 查找或创建样式元素
|
|
158
|
+
var styleEl = frame === null || frame === void 0 || (_contentDocument2 = frame.contentDocument) === null || _contentDocument2 === void 0 ? void 0 : _contentDocument2.getElementById(STYLE_ID);
|
|
159
|
+
if (!styleEl) {
|
|
160
|
+
styleEl = document.createElement('style');
|
|
161
|
+
styleEl.id = STYLE_ID;
|
|
162
|
+
frame.contentDocument.head.appendChild(styleEl);
|
|
163
|
+
}
|
|
164
|
+
// 设置样式内容
|
|
165
|
+
styleEl.textContent = cssStyles;
|
|
166
|
+
}
|
|
167
|
+
setFormatSetting(settings);
|
|
168
|
+
if (isUpdate) {
|
|
169
|
+
onSettingChange === null || onSettingChange === void 0 || onSettingChange({
|
|
170
|
+
formatSetting: settings,
|
|
171
|
+
pageWidth: pageWidth
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
useEffect(function () {
|
|
176
|
+
if (defaultSetting !== null && defaultSetting !== void 0 && defaultSetting.formatSetting) {
|
|
177
|
+
handleApply(defaultSetting.formatSetting, false);
|
|
178
|
+
}
|
|
179
|
+
}, [defaultSetting === null || defaultSetting === void 0 ? void 0 : defaultSetting.formatSetting]);
|
|
180
|
+
var handlePageWidthChange = function handlePageWidthChange(key) {
|
|
181
|
+
var isUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
182
|
+
// 设置编辑器宽度
|
|
183
|
+
var newClass = "ueditor-rich-status-content-".concat(key);
|
|
184
|
+
var oldClass = "ueditor-rich-status-content-".concat(pageWidth);
|
|
185
|
+
if (containerRef !== null && containerRef !== void 0 && containerRef.current) {
|
|
186
|
+
var frame = containerRef.current.querySelector("#".concat(uiId, "_iframeholder"));
|
|
187
|
+
var frameContainer = ueditorInst.container || containerRef.current.querySelector("#".concat(uiId));
|
|
188
|
+
if (frame) {
|
|
189
|
+
frame.classList.remove(oldClass);
|
|
190
|
+
frame.classList.add(newClass);
|
|
191
|
+
}
|
|
192
|
+
if (frameContainer) {
|
|
193
|
+
if (key === 'a0') {
|
|
194
|
+
frameContainer.classList.remove('ueditor-rich-status-not-full');
|
|
195
|
+
} else {
|
|
196
|
+
frameContainer.classList.add('ueditor-rich-status-not-full');
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
setPageWidth(key);
|
|
201
|
+
if (isUpdate) {
|
|
202
|
+
onSettingChange === null || onSettingChange === void 0 || onSettingChange({
|
|
203
|
+
pageWidth: key,
|
|
204
|
+
formatSetting: formatSetting
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
useEffect(function () {
|
|
209
|
+
if (defaultSetting !== null && defaultSetting !== void 0 && defaultSetting.pageWidth) {
|
|
210
|
+
handlePageWidthChange(defaultSetting.pageWidth, false);
|
|
211
|
+
}
|
|
212
|
+
}, [defaultSetting === null || defaultSetting === void 0 ? void 0 : defaultSetting.pageWidth]);
|
|
213
|
+
var onProgress = function onProgress(progress, title) {
|
|
214
|
+
var _progressModalRef$cur;
|
|
215
|
+
(_progressModalRef$cur = progressModalRef.current) === null || _progressModalRef$cur === void 0 || _progressModalRef$cur.updateProgress(progress, title);
|
|
216
|
+
};
|
|
217
|
+
return /*#__PURE__*/React.createElement(ConfigProvider, {
|
|
218
|
+
prefixCls: prefixCls
|
|
219
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
220
|
+
className: "ueditor-rich-status-bar"
|
|
221
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
222
|
+
className: "ueditor-rich-status-bar-box"
|
|
223
|
+
}, (bottomTypes === null || bottomTypes === void 0 ? void 0 : bottomTypes.includes('charCount')) && getStatusBarItem({
|
|
224
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
225
|
+
component: textIcon,
|
|
226
|
+
className: "ueditor-rich-status-bar-icon-svg"
|
|
227
|
+
}),
|
|
228
|
+
content: "".concat(totalTextCount, " \u5B57\u7B26"),
|
|
229
|
+
className: 'ueditor-rich-status-bar-text'
|
|
230
|
+
}), (bottomTypes === null || bottomTypes === void 0 ? void 0 : bottomTypes.includes('chineseCount')) && getStatusBarItem({
|
|
231
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
232
|
+
component: textFileIcon,
|
|
233
|
+
className: "ueditor-rich-status-bar-icon-svg"
|
|
234
|
+
}),
|
|
235
|
+
content: "".concat(chineseTextCount, " \u4E2D\u6587"),
|
|
236
|
+
className: 'ueditor-rich-status-bar-text'
|
|
237
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
238
|
+
className: "ueditor-rich-status-bar-box"
|
|
239
|
+
}, (bottomTypes === null || bottomTypes === void 0 ? void 0 : bottomTypes.includes('pageWidth')) && /*#__PURE__*/React.createElement(Dropdown, {
|
|
240
|
+
trigger: ['click'],
|
|
241
|
+
overlay: /*#__PURE__*/React.createElement(Menu, {
|
|
242
|
+
onClick: function onClick(_ref2) {
|
|
243
|
+
var key = _ref2.key;
|
|
244
|
+
handlePageWidthChange(key);
|
|
245
|
+
}
|
|
246
|
+
}, Object.keys(MENU_OPTIONS).map(function (k) {
|
|
247
|
+
return /*#__PURE__*/React.createElement(Menu.Item, {
|
|
248
|
+
key: k
|
|
249
|
+
}, /*#__PURE__*/React.createElement("span", null, "\u9875\u9762\u5BBD\u5EA6 ", MENU_OPTIONS[k]));
|
|
250
|
+
}))
|
|
251
|
+
}, getStatusBarItem({
|
|
252
|
+
content: "\u9875\u9762\u5BBD\u5EA6".concat(pageWidth ? " ".concat(MENU_OPTIONS[pageWidth]) : ''),
|
|
253
|
+
extraNode: /*#__PURE__*/React.createElement(DownOutlined, null)
|
|
254
|
+
})), (bottomTypes === null || bottomTypes === void 0 ? void 0 : bottomTypes.includes('formatSetting')) && /*#__PURE__*/React.createElement(FormatModal, {
|
|
255
|
+
onApply: handleApply,
|
|
256
|
+
initialSettings: defaultSetting === null || defaultSetting === void 0 ? void 0 : defaultSetting.formatSetting
|
|
257
|
+
}, getStatusBarItem({
|
|
258
|
+
icon: /*#__PURE__*/React.createElement(SettingOutlined, null),
|
|
259
|
+
content: '格式设置'
|
|
260
|
+
})), (bottomTypes === null || bottomTypes === void 0 ? void 0 : bottomTypes.includes('copy')) && getStatusBarItem({
|
|
261
|
+
icon: isCopying ? /*#__PURE__*/React.createElement(CheckOutlined, null) : /*#__PURE__*/React.createElement(Icon, {
|
|
262
|
+
component: textCopy,
|
|
263
|
+
className: "ueditor-rich-status-bar-icon-svg"
|
|
264
|
+
}),
|
|
265
|
+
content: '复制全文',
|
|
266
|
+
onClick: copyAll,
|
|
267
|
+
className: isCopying ? 'isActive' : undefined
|
|
268
|
+
}), (bottomTypes === null || bottomTypes === void 0 ? void 0 : bottomTypes.includes('fullScreen')) && getStatusBarItem({
|
|
269
|
+
icon: innerFullScreen ? /*#__PURE__*/React.createElement(FullscreenExitOutlined, null) : /*#__PURE__*/React.createElement(FullscreenOutlined, null),
|
|
270
|
+
content: innerFullScreen ? '退出全屏' : '全屏预览',
|
|
271
|
+
onClick: function onClick() {
|
|
272
|
+
ueditorInst.ui.setFullScreen(!innerFullScreen);
|
|
273
|
+
}
|
|
274
|
+
}), (bottomTypes === null || bottomTypes === void 0 ? void 0 : bottomTypes.includes('exportPdf')) && getStatusBarItem({
|
|
275
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
276
|
+
component: exportFile,
|
|
277
|
+
className: "ueditor-rich-status-bar-icon-svg"
|
|
278
|
+
}),
|
|
279
|
+
content: '导出文档',
|
|
280
|
+
onClick: function () {
|
|
281
|
+
var _onClick = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
282
|
+
var _contentDocument3, frame, _contentDocument4;
|
|
283
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
284
|
+
while (1) switch (_context.prev = _context.next) {
|
|
285
|
+
case 0:
|
|
286
|
+
if (!(containerRef !== null && containerRef !== void 0 && containerRef.current)) {
|
|
287
|
+
_context.next = 7;
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
frame = ueditorInst.frame || containerRef.current.querySelector("#".concat(uiId, "_iframeholder > iframe"));
|
|
291
|
+
if (!(frame !== null && frame !== void 0 && (_contentDocument3 = frame.contentDocument) !== null && _contentDocument3 !== void 0 && _contentDocument3.body)) {
|
|
292
|
+
_context.next = 6;
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
_context.next = 5;
|
|
296
|
+
return domloadPdf(frame === null || frame === void 0 || (_contentDocument4 = frame.contentDocument) === null || _contentDocument4 === void 0 ? void 0 : _contentDocument4.body, pageWidth || 'a0', exportFileName, onProgress);
|
|
297
|
+
case 5:
|
|
298
|
+
onProgress(100, '导出完成');
|
|
299
|
+
case 6:
|
|
300
|
+
setTimeout(function () {
|
|
301
|
+
var _progressModalRef$cur2;
|
|
302
|
+
(_progressModalRef$cur2 = progressModalRef.current) === null || _progressModalRef$cur2 === void 0 || _progressModalRef$cur2.updateVisible(false);
|
|
303
|
+
}, 500);
|
|
304
|
+
case 7:
|
|
305
|
+
case "end":
|
|
306
|
+
return _context.stop();
|
|
307
|
+
}
|
|
308
|
+
}, _callee);
|
|
309
|
+
}));
|
|
310
|
+
function onClick() {
|
|
311
|
+
return _onClick.apply(this, arguments);
|
|
312
|
+
}
|
|
313
|
+
return onClick;
|
|
314
|
+
}()
|
|
315
|
+
}), /*#__PURE__*/React.createElement(ProgressModal, {
|
|
316
|
+
ref: progressModalRef
|
|
317
|
+
}))));
|
|
318
|
+
};
|
|
319
|
+
export 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 @@
|
|
|
1
|
+
{"version":3,"file":"const.d.ts","sourceRoot":"","sources":["const.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,oBAAoB,uBAAuB,CAAC;AAEzD;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;8BAMR,MAAM;CAChC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExportPDF.d.ts","sourceRoot":"","sources":["ExportPDF.tsx"],"names":[],"mappings":";AAEA,QAAA,MAAM,UAAU,mBAoBf,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
var ExportFile = function ExportFile() {
|
|
3
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
4
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5
|
+
width: "14",
|
|
6
|
+
height: "14",
|
|
7
|
+
viewBox: "0 0 24 24",
|
|
8
|
+
fill: "none",
|
|
9
|
+
stroke: "currentColor",
|
|
10
|
+
strokeWidth: "2",
|
|
11
|
+
strokeLinecap: "round",
|
|
12
|
+
strokeLinejoin: "round",
|
|
13
|
+
className: "lucide lucide-file-down"
|
|
14
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
15
|
+
d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"
|
|
16
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
17
|
+
d: "M14 2v4a2 2 0 0 0 2 2h4"
|
|
18
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
19
|
+
d: "M12 18v-6"
|
|
20
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
21
|
+
d: "m9 15 3 3 3-3"
|
|
22
|
+
}));
|
|
23
|
+
};
|
|
24
|
+
export default ExportFile;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextCopy.d.ts","sourceRoot":"","sources":["TextCopy.tsx"],"names":[],"mappings":";AAEA,QAAA,MAAM,QAAQ,mBAIb,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
var TextIcon = function TextIcon() {
|
|
3
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
4
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5
|
+
width: "14",
|
|
6
|
+
height: "14",
|
|
7
|
+
viewBox: "0 0 24 24",
|
|
8
|
+
fill: "none",
|
|
9
|
+
stroke: "currentColor",
|
|
10
|
+
strokeWidth: "2",
|
|
11
|
+
strokeLinecap: "round",
|
|
12
|
+
strokeLinejoin: "round",
|
|
13
|
+
className: "lucide lucide-copy"
|
|
14
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
15
|
+
width: "14",
|
|
16
|
+
height: "14",
|
|
17
|
+
x: "8",
|
|
18
|
+
y: "8",
|
|
19
|
+
rx: "2",
|
|
20
|
+
ry: "2"
|
|
21
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
22
|
+
d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
|
|
23
|
+
}));
|
|
24
|
+
};
|
|
25
|
+
export default TextIcon;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextFileIcon.d.ts","sourceRoot":"","sources":["TextFileIcon.tsx"],"names":[],"mappings":";AAEA,QAAA,MAAM,QAAQ,mBAIb,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
var TextIcon = function TextIcon() {
|
|
3
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
4
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5
|
+
width: "14",
|
|
6
|
+
height: "14",
|
|
7
|
+
viewBox: "0 0 24 24",
|
|
8
|
+
fill: "none",
|
|
9
|
+
stroke: "currentColor",
|
|
10
|
+
strokeWidth: "2",
|
|
11
|
+
strokeLinecap: "round",
|
|
12
|
+
strokeLinejoin: "round",
|
|
13
|
+
className: "lucide lucide-file-text"
|
|
14
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
15
|
+
d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"
|
|
16
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
17
|
+
d: "M14 2v4a2 2 0 0 0 2 2h4"
|
|
18
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
19
|
+
d: "M10 9H8"
|
|
20
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
21
|
+
d: "M16 13H8"
|
|
22
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
23
|
+
d: "M16 17H8"
|
|
24
|
+
}));
|
|
25
|
+
};
|
|
26
|
+
export default TextIcon;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextIcon.d.ts","sourceRoot":"","sources":["TextIcon.tsx"],"names":[],"mappings":";AAEA,QAAA,MAAM,QAAQ,mBAIb,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
var TextIcon = function TextIcon() {
|
|
3
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
4
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5
|
+
width: "14",
|
|
6
|
+
height: "14",
|
|
7
|
+
viewBox: "0 0 24 24",
|
|
8
|
+
fill: "none",
|
|
9
|
+
stroke: "currentColor",
|
|
10
|
+
strokeWidth: "2",
|
|
11
|
+
strokeLinecap: "round",
|
|
12
|
+
strokeLinejoin: "round",
|
|
13
|
+
className: "lucide lucide-type"
|
|
14
|
+
}, /*#__PURE__*/React.createElement("polyline", {
|
|
15
|
+
points: "4 7 4 4 20 4 20 7"
|
|
16
|
+
}), /*#__PURE__*/React.createElement("line", {
|
|
17
|
+
x1: "9",
|
|
18
|
+
x2: "15",
|
|
19
|
+
y1: "20",
|
|
20
|
+
y2: "20"
|
|
21
|
+
}), /*#__PURE__*/React.createElement("line", {
|
|
22
|
+
x1: "12",
|
|
23
|
+
x2: "12",
|
|
24
|
+
y1: "4",
|
|
25
|
+
y2: "20"
|
|
26
|
+
}));
|
|
27
|
+
};
|
|
28
|
+
export default TextIcon;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAEhD,OAAO,EACL,WAAW,EACX,iBAAiB,GAClB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UeditorResourceLoader.d.ts","sourceRoot":"","sources":["UeditorResourceLoader.ts"],"names":[],"mappings":"AAGA,cAAM,qBAAqB;IACzB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAwB;IAG/C,OAAO,CAAC,MAAM,CAAC,aAAa;IAI5B,OAAO,CAAC,YAAY,CAAkB;IAEtC,OAAO,CAAC,iBAAiB,CAAkB;IAE3C,OAAO,CAAC,OAAO,CAAkB;IAEjC,OAAO,CAAC,SAAS,CAAkB;WAEf,SAAS,CAAE,MAAM,EAAE,MAAM,EAAE;WAgCjC,WAAW;IAWzB;;;OAGG;WACW,OAAO,CAAC,QAAQ,EAAE,QAAQ;IASxC;;;OAGG;WACW,WAAW,CAAC,QAAQ,EAAE,QAAQ;CAI7C;AAED,eAAe,qBAAqB,CAAC"}
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"exportPDF.d.ts","sourceRoot":"","sources":["exportPDF.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,gBAAuB,WAAW,YAAW;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;QACtB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,KAAK,CAAC,EAAE;QACN,WAAW,CAAC,EAAE,UAAU,GAAG,WAAW,CAAC;QACvC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;QACjC,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;KACpC,CAAA;CACF,2BACsB,MAAM,SAAS,MAAM,KAAK,IAAI,+BAiDpD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,QAAe,WAAW,aAAa,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,aAAY,MAAM,2BAChF,MAAM,SAAS,MAAM,KAAK,IAAI,+BAatD,CAAC"}
|