@lingxiteam/lcdp-ueditor-react 1.0.3-alpha.13 → 1.0.3-alpha.14

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 (49) hide show
  1. package/es/LcdpUeditor.d.ts +15 -4
  2. package/es/LcdpUeditor.js +59 -10
  3. package/es/ToolBottomBar/FormatModal/index.d.ts +9 -0
  4. package/es/ToolBottomBar/FormatModal/index.js +543 -0
  5. package/es/ToolBottomBar/FormatModal/index.less +300 -0
  6. package/es/ToolBottomBar/ProgressModal/index.d.ts +10 -0
  7. package/es/ToolBottomBar/ProgressModal/index.js +53 -0
  8. package/es/ToolBottomBar/ProgressModal/index.less +16 -0
  9. package/es/ToolBottomBar/index.d.ts +14 -0
  10. package/es/ToolBottomBar/index.js +290 -0
  11. package/es/ToolBottomBar/index.less +70 -0
  12. package/es/icon/ExportPDF.d.ts +3 -0
  13. package/es/icon/ExportPDF.js +24 -0
  14. package/es/icon/TextCopy.d.ts +3 -0
  15. package/es/icon/TextCopy.js +25 -0
  16. package/es/icon/TextFileIcon.d.ts +3 -0
  17. package/es/icon/TextFileIcon.js +26 -0
  18. package/es/icon/TextIcon.d.ts +3 -0
  19. package/es/icon/TextIcon.js +28 -0
  20. package/es/tools/exportPDF.d.ts +27 -0
  21. package/es/tools/exportPDF.js +146 -0
  22. package/es/tools/generateStylesFromSettings.d.ts +38 -0
  23. package/es/tools/generateStylesFromSettings.js +24 -0
  24. package/es/type.d.ts +17 -0
  25. package/lib/LcdpUeditor.d.ts +15 -4
  26. package/lib/LcdpUeditor.js +45 -8
  27. package/lib/ToolBottomBar/FormatModal/index.d.ts +9 -0
  28. package/lib/ToolBottomBar/FormatModal/index.js +261 -0
  29. package/lib/ToolBottomBar/FormatModal/index.less +300 -0
  30. package/lib/ToolBottomBar/ProgressModal/index.d.ts +10 -0
  31. package/lib/ToolBottomBar/ProgressModal/index.js +73 -0
  32. package/lib/ToolBottomBar/ProgressModal/index.less +16 -0
  33. package/lib/ToolBottomBar/index.d.ts +14 -0
  34. package/lib/ToolBottomBar/index.js +232 -0
  35. package/lib/ToolBottomBar/index.less +70 -0
  36. package/lib/icon/ExportPDF.d.ts +3 -0
  37. package/lib/icon/ExportPDF.js +57 -0
  38. package/lib/icon/TextCopy.d.ts +3 -0
  39. package/lib/icon/TextCopy.js +39 -0
  40. package/lib/icon/TextFileIcon.d.ts +3 -0
  41. package/lib/icon/TextFileIcon.js +39 -0
  42. package/lib/icon/TextIcon.d.ts +3 -0
  43. package/lib/icon/TextIcon.js +39 -0
  44. package/lib/tools/exportPDF.d.ts +27 -0
  45. package/lib/tools/exportPDF.js +95 -0
  46. package/lib/tools/generateStylesFromSettings.d.ts +38 -0
  47. package/lib/tools/generateStylesFromSettings.js +77 -0
  48. package/lib/type.d.ts +17 -0
  49. package/package.json +12 -3
@@ -0,0 +1,300 @@
1
+ @prefixCls: pcfactory;
2
+ @suffixCls: ueditor-format;
3
+ .@{suffixCls}-settings-popover {
4
+ max-width: 720px;
5
+
6
+ input[type="color"] {
7
+ -webkit-appearance: none;
8
+ border: none;
9
+ padding: 0;
10
+ cursor: pointer;
11
+
12
+ &::-webkit-color-swatch-wrapper {
13
+ padding: 0;
14
+ border-radius: 2px;
15
+ }
16
+
17
+ &::-webkit-color-swatch {
18
+ border: none;
19
+ border-radius: 2px;
20
+ }
21
+ }
22
+
23
+ .@{prefixCls}-form-item {
24
+ margin-bottom: 0;
25
+ }
26
+
27
+ .@{prefixCls}-form-item-control-input {
28
+ min-height: 28px;
29
+ }
30
+
31
+ .@{suffixCls}-popover-content {
32
+ width: 680px;
33
+ padding: 0;
34
+ }
35
+
36
+ .@{prefixCls}-popover-inner-content {
37
+ padding: 16px 20px;
38
+ border-radius: 8px;
39
+ }
40
+
41
+ .@{prefixCls}-popover-title {
42
+ font-weight: 600;
43
+ text-align: center;
44
+ font-size: 16px;
45
+ color: #1a202c;
46
+ padding: 16px 20px 12px;
47
+ border-bottom: 1px solid #e2e8f0;
48
+ margin-bottom: 0;
49
+ }
50
+ }
51
+
52
+ .@{suffixCls}-section {
53
+ overflow-y: auto;
54
+ padding: 0;
55
+ max-height: 400px;
56
+ }
57
+
58
+ .@{suffixCls}-style-row {
59
+ margin-bottom: 8px;
60
+ padding: 12px 16px;
61
+ border-bottom: 1px solid #f0f0f0;
62
+ border-radius: 6px;
63
+ background-color: #fafbfc;
64
+ transition: all 0.2s ease;
65
+ display: flex;
66
+ align-items: center;
67
+
68
+ &:hover {
69
+ background-color: #f1f5f9;
70
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
71
+ }
72
+
73
+ &:last-child {
74
+ border-bottom: none;
75
+ margin-bottom: 0;
76
+ }
77
+
78
+ .@{suffixCls}-row-label {
79
+ font-weight: 600;
80
+ font-size: 14px;
81
+ width: 80px;
82
+ color: #374151;
83
+ flex-shrink: 0;
84
+ margin-right: 12px;
85
+ margin-bottom: 0;
86
+ }
87
+
88
+ .@{prefixCls}-row {
89
+ flex: 1;
90
+ align-items: center;
91
+ margin: 0;
92
+ .@{prefixCls}-select-selector {
93
+ width: 100%;
94
+ }
95
+ }
96
+
97
+ .@{prefixCls}-col {
98
+ margin-bottom: 0;
99
+ display: flex;
100
+ align-items: center;
101
+ }
102
+
103
+ .@{prefixCls}-select {
104
+ width: 100%;
105
+
106
+ .@{prefixCls}-select-selector {
107
+ border-radius: 4px;
108
+ border-color: #d1d5db;
109
+ transition: all 0.2s ease;
110
+ height: 28px;
111
+
112
+ .@{prefixCls}-select-selection-item {
113
+ line-height: 26px;
114
+ }
115
+
116
+ &:hover {
117
+ border-color: #6366f1;
118
+ }
119
+ }
120
+
121
+ &.@{prefixCls}-select-focused .@{prefixCls}-select-selector {
122
+ border-color: #6366f1 !important;
123
+ box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1) !important;
124
+ }
125
+ }
126
+
127
+ .@{prefixCls}-input-number {
128
+ width: 100%;
129
+ border-radius: 4px;
130
+ border-color: #d1d5db;
131
+ height: 28px;
132
+
133
+ .@{prefixCls}-input-number-input {
134
+ height: 26px;
135
+ }
136
+
137
+ &:hover {
138
+ border-color: #6366f1;
139
+ }
140
+
141
+ &:focus,
142
+ &.@{prefixCls}-input-number-focused {
143
+ border-color: #6366f1 !important;
144
+ box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1) !important;
145
+ }
146
+ }
147
+
148
+ input[type="color"] {
149
+ width: 100%;
150
+ height: 28px;
151
+ border-radius: 4px;
152
+ border: 1px solid #d1d5db;
153
+ cursor: pointer;
154
+
155
+ &:hover {
156
+ border-color: #6366f1;
157
+ }
158
+ }
159
+ }
160
+
161
+ .@{suffixCls}-footer {
162
+ display: flex;
163
+ justify-content: flex-end;
164
+ gap: 12px;
165
+ margin-top: 16px;
166
+ padding-top: 12px;
167
+ border-top: 1px solid #e2e8f0;
168
+
169
+ .@{prefixCls}-btn {
170
+ height: 32px;
171
+ padding: 0 16px;
172
+ border-radius: 4px;
173
+ font-weight: 500;
174
+ transition: all 0.2s ease;
175
+
176
+ &.@{prefixCls}-btn-default {
177
+ border-color: #d1d5db;
178
+ color: #6b7280;
179
+
180
+ &:hover {
181
+ border-color: #9ca3af;
182
+ color: #374151;
183
+ }
184
+ }
185
+
186
+ &.@{prefixCls}-btn-primary {
187
+ background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
188
+ border: none;
189
+ box-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
190
+
191
+ &:hover {
192
+ background: linear-gradient(135deg, #5b61f0 0%, #7c3aed 100%);
193
+ box-shadow: 0 4px 8px rgba(99, 102, 241, 0.3);
194
+ transform: translateY(-1px);
195
+ }
196
+ }
197
+ }
198
+ }
199
+
200
+ @media (max-width: 768px) {
201
+ .@{suffixCls}-settings-popover {
202
+ max-width: 95vw;
203
+
204
+ .@{suffixCls}-popover-content {
205
+ width: calc(95vw - 40px);
206
+ }
207
+ }
208
+
209
+ .@{suffixCls}-style-row {
210
+ flex-direction: column;
211
+ align-items: stretch;
212
+
213
+ .@{suffixCls}-row-label {
214
+ width: 100%;
215
+ margin-right: 0;
216
+ margin-bottom: 8px;
217
+ }
218
+
219
+ .@{prefixCls}-row {
220
+ width: 100%;
221
+ }
222
+
223
+ .@{prefixCls}-col {
224
+ margin-bottom: 8px;
225
+
226
+ &:last-child {
227
+ margin-bottom: 0;
228
+ }
229
+ }
230
+ }
231
+ }
232
+
233
+ .@{suffixCls}-style-section {
234
+ margin-bottom: 15px;
235
+ }
236
+
237
+ .@{suffixCls}-section-title {
238
+ font-weight: 500;
239
+ margin-bottom: 10px;
240
+ font-size: 15px;
241
+ }
242
+
243
+ .@{suffixCls}-preview {
244
+ border: 1px solid @border-color;
245
+ padding: 15px;
246
+ margin: 15px 0;
247
+ background-color: #fff;
248
+ border-radius: 4px;
249
+
250
+ h1 {
251
+ color: inherit;
252
+ font-family: inherit;
253
+ font-size: inherit;
254
+ margin-top: 10px;
255
+ margin-bottom: 10px;
256
+ }
257
+
258
+ p {
259
+ color: inherit;
260
+ font-family: inherit;
261
+ font-size: inherit;
262
+ line-height: inherit;
263
+ margin: 8px 0;
264
+ }
265
+ }
266
+
267
+ .@{suffixCls}-system-info {
268
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
269
+ color: white !important;
270
+ border-radius: 8px !important;
271
+ padding: 12px 16px !important;
272
+ margin-bottom: 16px !important;
273
+ text-align: center !important;
274
+ font-size: 13px !important;
275
+ font-weight: 500 !important;
276
+ box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2) !important;
277
+ }
278
+
279
+ .@{suffixCls}-section::-webkit-scrollbar {
280
+ width: 6px;
281
+ }
282
+
283
+ .@{suffixCls}-section::-webkit-scrollbar-track {
284
+ background: #f1f5f9;
285
+ border-radius: 3px;
286
+ }
287
+
288
+ .@{suffixCls}-section::-webkit-scrollbar-thumb {
289
+ background: #cbd5e1;
290
+ border-radius: 3px;
291
+
292
+ &:hover {
293
+ background: #94a3b8;
294
+ }
295
+ }
296
+
297
+ .@{suffixCls}-section.loading {
298
+ opacity: 0.6;
299
+ pointer-events: none;
300
+ }
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ export interface ProgressModalRef {
4
+ updateProgress: (progress: number, title?: string) => void;
5
+ updateVisible: (open: boolean) => void;
6
+ }
7
+ export interface ProgressModalProps {
8
+ }
9
+ declare const ProgressModal: React.ForwardRefExoticComponent<ProgressModalProps & React.RefAttributes<ProgressModalRef>>;
10
+ export default ProgressModal;
@@ -0,0 +1,53 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import React, { forwardRef, useImperativeHandle, useState } from 'react';
3
+ import { Modal, Progress } from 'antd';
4
+ import "./index.less";
5
+ var suffixCls = 'ueditor-progress-modal';
6
+ var ProgressModal = /*#__PURE__*/forwardRef(function (props, ref) {
7
+ var _useState = useState(false),
8
+ _useState2 = _slicedToArray(_useState, 2),
9
+ visible = _useState2[0],
10
+ setVisible = _useState2[1];
11
+ var _useState3 = useState(0),
12
+ _useState4 = _slicedToArray(_useState3, 2),
13
+ progress = _useState4[0],
14
+ setProgress = _useState4[1];
15
+ var _useState5 = useState('准备中...'),
16
+ _useState6 = _slicedToArray(_useState5, 2),
17
+ title = _useState6[0],
18
+ setTitle = _useState6[1];
19
+ useImperativeHandle(ref, function () {
20
+ return {
21
+ updateProgress: function updateProgress(newProgress, title) {
22
+ if (!visible) {
23
+ setVisible(true);
24
+ }
25
+ setProgress(newProgress);
26
+ if (title) {
27
+ setTitle(title);
28
+ }
29
+ },
30
+ updateVisible: function updateVisible(open) {
31
+ setVisible(open);
32
+ }
33
+ };
34
+ });
35
+ return /*#__PURE__*/React.createElement(Modal, {
36
+ title: null,
37
+ visible: visible,
38
+ footer: null,
39
+ closable: false,
40
+ maskClosable: false,
41
+ wrapClassName: suffixCls
42
+ }, /*#__PURE__*/React.createElement("div", {
43
+ className: "".concat(suffixCls, "-title")
44
+ }, "\u6B63\u5728\u751F\u6210PDF\u6587\u4EF6..."), /*#__PURE__*/React.createElement(Progress, {
45
+ percent: progress,
46
+ status: "active",
47
+ showInfo: false
48
+ }), title && /*#__PURE__*/React.createElement("div", {
49
+ className: "".concat(suffixCls, "-sub-title")
50
+ }, title, " ", progress, "%"));
51
+ });
52
+ ProgressModal.displayName = 'ProgressModal';
53
+ export default ProgressModal;
@@ -0,0 +1,16 @@
1
+ @suffixCls: ~'ueditor-progress-modal';
2
+
3
+ .@{suffixCls} {
4
+ &-title {
5
+ font-size: 16px;
6
+ font-weight: 500;
7
+ margin-bottom: 12px;
8
+ color: #333;
9
+ }
10
+ &-sub-title {
11
+ font-size: 14px;
12
+ color: #666;
13
+ text-align: center;
14
+ margin-top: 8px;
15
+ }
16
+ }
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { FormatSettings } from '../tools/generateStylesFromSettings';
3
+ import './index.less';
4
+ import { ILcdpUeditorProps } from '../type';
5
+ declare const ToolBottomBar: (props: {
6
+ ueditorInst: any;
7
+ prefixCls?: string | undefined;
8
+ containerRef?: React.RefObject<HTMLDivElement> | undefined;
9
+ defaultFormatSetting?: FormatSettings | undefined;
10
+ onFormatChange?: ((val: FormatSettings) => void) | undefined;
11
+ isReady?: boolean | undefined;
12
+ bottomTypes?: ILcdpUeditorProps['bottomTypes'];
13
+ }) => JSX.Element;
14
+ export default ToolBottomBar;
@@ -0,0 +1,290 @@
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
+ defaultFormatSetting = props.defaultFormatSetting,
29
+ onFormatChange = props.onFormatChange,
30
+ isReady = props.isReady,
31
+ bottomTypes = props.bottomTypes;
32
+ var _useState = useState(0),
33
+ _useState2 = _slicedToArray(_useState, 2),
34
+ chineseTextCount = _useState2[0],
35
+ setChineseTextCount = _useState2[1];
36
+ var _useState3 = useState(0),
37
+ _useState4 = _slicedToArray(_useState3, 2),
38
+ totalTextCount = _useState4[0],
39
+ setTotalTextCount = _useState4[1];
40
+ var _useState5 = useState(false),
41
+ _useState6 = _slicedToArray(_useState5, 2),
42
+ innerFullScreen = _useState6[0],
43
+ setInnerFullScreen = _useState6[1];
44
+ var _useState7 = useState(false),
45
+ _useState8 = _slicedToArray(_useState7, 2),
46
+ isCopying = _useState8[0],
47
+ setIsCopying = _useState8[1];
48
+ var _useState9 = useState(undefined),
49
+ _useState10 = _slicedToArray(_useState9, 2),
50
+ pageWidth = _useState10[0],
51
+ setPageWidth = _useState10[1];
52
+ var timer = useRef(undefined);
53
+ var progressModalRef = useRef(null);
54
+ var debounceContentChange = debounce(function () {
55
+ try {
56
+ var _plainTxt$match;
57
+ var plainTxt = ueditorInst.getContentTxt() || '';
58
+ var _chineseTextCount = ((_plainTxt$match = plainTxt.match(/[\u4e00-\u9fa5]/g)) === null || _plainTxt$match === void 0 ? void 0 : _plainTxt$match.length) || 0;
59
+ var _totalTextCount = plainTxt.length;
60
+ setChineseTextCount(_chineseTextCount);
61
+ setTotalTextCount(_totalTextCount);
62
+ } catch (e) {
63
+ //
64
+ }
65
+ }, 300);
66
+ useEffect(function () {
67
+ if (isReady) {
68
+ ueditorInst.addListener('beforefullscreenchange', function (_, v) {
69
+ setInnerFullScreen(v);
70
+ });
71
+ ueditorInst.addListener('contentChange', function () {
72
+ debounceContentChange();
73
+ });
74
+ // 初始化调用一次
75
+ setTimeout(function () {
76
+ debounceContentChange();
77
+ }, 1000);
78
+ }
79
+ }, [ueditorInst, isReady]);
80
+ useEffect(function () {
81
+ return function () {
82
+ if (timer.current) {
83
+ clearTimeout(timer.current);
84
+ }
85
+ };
86
+ }, []);
87
+ var getStatusBarItem = function getStatusBarItem(params) {
88
+ var icon = params.icon,
89
+ content = params.content,
90
+ onClick = params.onClick,
91
+ extraNode = params.extraNode,
92
+ _params$className = params.className,
93
+ className = _params$className === void 0 ? '' : _params$className;
94
+ return /*#__PURE__*/React.createElement("span", {
95
+ className: "ueditor-rich-status-bar-item ".concat(className),
96
+ onClick: onClick
97
+ }, /*#__PURE__*/React.createElement("span", {
98
+ className: "ueditor-rich-status-bar-icon"
99
+ }, icon), /*#__PURE__*/React.createElement("span", {
100
+ className: "ueditor-rich-status-bar-content"
101
+ }, content), extraNode && /*#__PURE__*/React.createElement("span", {
102
+ className: "ueditor-rich-status-bar-extra"
103
+ }, extraNode));
104
+ };
105
+ var copyAll = function copyAll() {
106
+ var txt = ueditorInst.getPlainTxt();
107
+ var copy = function copy(t) {
108
+ // 复制使用传统方式
109
+ var input = document.createElement('textarea');
110
+ input.value = t;
111
+ document.body.appendChild(input);
112
+ input.select();
113
+ document.execCommand('copy');
114
+ document.body.removeChild(input);
115
+ setIsCopying(true);
116
+ };
117
+ if (txt) {
118
+ try {
119
+ navigator.clipboard.writeText(txt).then(function () {
120
+ setIsCopying(true);
121
+ // 复制成功
122
+ }).catch(function () {
123
+ // 复制失败,使用传统方式
124
+ copy(txt);
125
+ });
126
+ } catch (e) {
127
+ // 浏览器不支持 clipboard API,使用传统方式
128
+ copy(txt);
129
+ }
130
+ timer.current = setTimeout(function () {
131
+ setIsCopying(false);
132
+ }, 1000);
133
+ }
134
+ };
135
+
136
+ /**
137
+ * 应用格式设置
138
+ * @param settings 格式设置
139
+ */
140
+ var handleApply = function handleApply(settings) {
141
+ var _containerRef$current, _contentDocument;
142
+ // 生成样式
143
+ var cssStyles = generateStylesFromSettings(settings);
144
+
145
+ // 触发编辑器视图更新
146
+ var frame = containerRef === null || containerRef === void 0 || (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.querySelector('#edui1_iframeholder > iframe');
147
+ if (frame !== null && frame !== void 0 && (_contentDocument = frame.contentDocument) !== null && _contentDocument !== void 0 && _contentDocument.documentElement) {
148
+ var _contentDocument2;
149
+ // 查找或创建样式元素
150
+ var styleEl = frame === null || frame === void 0 || (_contentDocument2 = frame.contentDocument) === null || _contentDocument2 === void 0 ? void 0 : _contentDocument2.getElementById(STYLE_ID);
151
+ if (!styleEl) {
152
+ styleEl = document.createElement('style');
153
+ styleEl.id = STYLE_ID;
154
+ frame.contentDocument.head.appendChild(styleEl);
155
+ }
156
+ // 设置样式内容
157
+ styleEl.textContent = cssStyles;
158
+ }
159
+ onFormatChange === null || onFormatChange === void 0 || onFormatChange(settings);
160
+ };
161
+ useEffect(function () {
162
+ if (defaultFormatSetting) {
163
+ handleApply(defaultFormatSetting);
164
+ }
165
+ }, [defaultFormatSetting]);
166
+ var onProgress = function onProgress(progress, title) {
167
+ var _progressModalRef$cur;
168
+ (_progressModalRef$cur = progressModalRef.current) === null || _progressModalRef$cur === void 0 || _progressModalRef$cur.updateProgress(progress, title);
169
+ };
170
+ return /*#__PURE__*/React.createElement(ConfigProvider, {
171
+ prefixCls: prefixCls
172
+ }, /*#__PURE__*/React.createElement("div", {
173
+ className: "ueditor-rich-status-bar"
174
+ }, /*#__PURE__*/React.createElement("div", {
175
+ className: "ueditor-rich-status-bar-box"
176
+ }, (bottomTypes === null || bottomTypes === void 0 ? void 0 : bottomTypes.includes('charCount')) && getStatusBarItem({
177
+ icon: /*#__PURE__*/React.createElement(Icon, {
178
+ component: textIcon,
179
+ className: "ueditor-rich-status-bar-icon-svg"
180
+ }),
181
+ content: "".concat(totalTextCount, " \u5B57\u7B26"),
182
+ className: 'ueditor-rich-status-bar-text'
183
+ }), (bottomTypes === null || bottomTypes === void 0 ? void 0 : bottomTypes.includes('chineseCount')) && getStatusBarItem({
184
+ icon: /*#__PURE__*/React.createElement(Icon, {
185
+ component: textFileIcon,
186
+ className: "ueditor-rich-status-bar-icon-svg"
187
+ }),
188
+ content: "".concat(chineseTextCount, " \u4E2D\u6587"),
189
+ className: 'ueditor-rich-status-bar-text'
190
+ })), /*#__PURE__*/React.createElement("div", {
191
+ className: "ueditor-rich-status-bar-box"
192
+ }, (bottomTypes === null || bottomTypes === void 0 ? void 0 : bottomTypes.includes('pageWidth')) && /*#__PURE__*/React.createElement(Dropdown, {
193
+ trigger: ['click'],
194
+ overlay: /*#__PURE__*/React.createElement(Menu, {
195
+ onClick: function onClick(_ref) {
196
+ var key = _ref.key;
197
+ // 设置编辑器宽度
198
+ var newClass = "ueditor-rich-status-content-".concat(key);
199
+ var oldClass = "ueditor-rich-status-content-".concat(pageWidth);
200
+ if (containerRef !== null && containerRef !== void 0 && containerRef.current) {
201
+ var frame = containerRef.current.querySelector('#edui1_iframeholder');
202
+ var frameContainer = containerRef.current.querySelector('#edui1');
203
+ if (frame) {
204
+ frame.classList.remove(oldClass);
205
+ frame.classList.add(newClass);
206
+ }
207
+ if (frameContainer) {
208
+ if (key === 'a0') {
209
+ frameContainer.classList.remove('ueditor-rich-status-not-full');
210
+ } else {
211
+ frameContainer.classList.add('ueditor-rich-status-not-full');
212
+ }
213
+ }
214
+ }
215
+ setPageWidth(key);
216
+ }
217
+ }, Object.keys(MENU_OPTIONS).map(function (k) {
218
+ return /*#__PURE__*/React.createElement(Menu.Item, {
219
+ key: k
220
+ }, /*#__PURE__*/React.createElement("span", null, "\u9875\u9762\u5BBD\u5EA6 ", MENU_OPTIONS[k]));
221
+ }))
222
+ }, getStatusBarItem({
223
+ content: "\u9875\u9762\u5BBD\u5EA6".concat(pageWidth ? " ".concat(MENU_OPTIONS[pageWidth]) : ''),
224
+ extraNode: /*#__PURE__*/React.createElement(DownOutlined, null)
225
+ })), (bottomTypes === null || bottomTypes === void 0 ? void 0 : bottomTypes.includes('formatSetting')) && /*#__PURE__*/React.createElement(FormatModal, {
226
+ onApply: handleApply,
227
+ initialSettings: defaultFormatSetting
228
+ }, getStatusBarItem({
229
+ icon: /*#__PURE__*/React.createElement(SettingOutlined, null),
230
+ content: '格式设置'
231
+ })), (bottomTypes === null || bottomTypes === void 0 ? void 0 : bottomTypes.includes('copy')) && getStatusBarItem({
232
+ icon: isCopying ? /*#__PURE__*/React.createElement(CheckOutlined, null) : /*#__PURE__*/React.createElement(Icon, {
233
+ component: textCopy,
234
+ className: "ueditor-rich-status-bar-icon-svg"
235
+ }),
236
+ content: '复制全文',
237
+ onClick: copyAll,
238
+ className: isCopying ? 'isActive' : undefined
239
+ }), (bottomTypes === null || bottomTypes === void 0 ? void 0 : bottomTypes.includes('fullScreen')) && getStatusBarItem({
240
+ icon: innerFullScreen ? /*#__PURE__*/React.createElement(FullscreenExitOutlined, null) : /*#__PURE__*/React.createElement(FullscreenOutlined, null),
241
+ content: innerFullScreen ? '退出全屏' : '全屏预览',
242
+ onClick: function onClick() {
243
+ ueditorInst.ui.setFullScreen(!innerFullScreen);
244
+ }
245
+ }), (bottomTypes === null || bottomTypes === void 0 ? void 0 : bottomTypes.includes('exportPdf')) && getStatusBarItem({
246
+ icon: /*#__PURE__*/React.createElement(Icon, {
247
+ component: exportFile,
248
+ className: "ueditor-rich-status-bar-icon-svg"
249
+ }),
250
+ content: '导出文档',
251
+ onClick: function () {
252
+ var _onClick = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
253
+ var _contentDocument3, frame, _contentDocument4;
254
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
255
+ while (1) switch (_context.prev = _context.next) {
256
+ case 0:
257
+ if (!(containerRef !== null && containerRef !== void 0 && containerRef.current)) {
258
+ _context.next = 7;
259
+ break;
260
+ }
261
+ frame = containerRef.current.querySelector('#edui1_iframeholder > iframe');
262
+ if (!(frame !== null && frame !== void 0 && (_contentDocument3 = frame.contentDocument) !== null && _contentDocument3 !== void 0 && _contentDocument3.body)) {
263
+ _context.next = 6;
264
+ break;
265
+ }
266
+ _context.next = 5;
267
+ return domloadPdf(frame === null || frame === void 0 || (_contentDocument4 = frame.contentDocument) === null || _contentDocument4 === void 0 ? void 0 : _contentDocument4.body, pageWidth || 'a0', '未命名', onProgress);
268
+ case 5:
269
+ onProgress(100, '导出完成');
270
+ case 6:
271
+ setTimeout(function () {
272
+ var _progressModalRef$cur2;
273
+ (_progressModalRef$cur2 = progressModalRef.current) === null || _progressModalRef$cur2 === void 0 || _progressModalRef$cur2.updateVisible(false);
274
+ }, 500);
275
+ case 7:
276
+ case "end":
277
+ return _context.stop();
278
+ }
279
+ }, _callee);
280
+ }));
281
+ function onClick() {
282
+ return _onClick.apply(this, arguments);
283
+ }
284
+ return onClick;
285
+ }()
286
+ }), /*#__PURE__*/React.createElement(ProgressModal, {
287
+ ref: progressModalRef
288
+ }))));
289
+ };
290
+ export default ToolBottomBar;