@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.
Files changed (67) hide show
  1. package/es/LcdpUeditor.d.ts +10 -4
  2. package/es/LcdpUeditor.d.ts.map +1 -0
  3. package/es/LcdpUeditor.js +78 -11
  4. package/es/ToolBottomBar/FormatModal/index.d.ts +9 -0
  5. package/es/ToolBottomBar/FormatModal/index.d.ts.map +1 -0
  6. package/es/ToolBottomBar/FormatModal/index.js +543 -0
  7. package/es/ToolBottomBar/FormatModal/index.less +276 -0
  8. package/es/ToolBottomBar/ProgressModal/index.d.ts +10 -0
  9. package/es/ToolBottomBar/ProgressModal/index.d.ts.map +1 -0
  10. package/es/ToolBottomBar/ProgressModal/index.js +53 -0
  11. package/es/ToolBottomBar/ProgressModal/index.less +16 -0
  12. package/es/ToolBottomBar/index.d.ts +32 -0
  13. package/es/ToolBottomBar/index.d.ts.map +1 -0
  14. package/es/ToolBottomBar/index.js +319 -0
  15. package/es/ToolBottomBar/index.less +75 -0
  16. package/es/const.d.ts.map +1 -0
  17. package/es/icon/ExportPDF.d.ts +3 -0
  18. package/es/icon/ExportPDF.d.ts.map +1 -0
  19. package/es/icon/ExportPDF.js +24 -0
  20. package/es/icon/TextCopy.d.ts +3 -0
  21. package/es/icon/TextCopy.d.ts.map +1 -0
  22. package/es/icon/TextCopy.js +25 -0
  23. package/es/icon/TextFileIcon.d.ts +3 -0
  24. package/es/icon/TextFileIcon.d.ts.map +1 -0
  25. package/es/icon/TextFileIcon.js +26 -0
  26. package/es/icon/TextIcon.d.ts +3 -0
  27. package/es/icon/TextIcon.d.ts.map +1 -0
  28. package/es/icon/TextIcon.js +28 -0
  29. package/es/index.d.ts.map +1 -0
  30. package/es/tools/UeditorResourceLoader.d.ts.map +1 -0
  31. package/es/tools/exportPDF.d.ts +27 -0
  32. package/es/tools/exportPDF.d.ts.map +1 -0
  33. package/es/tools/exportPDF.js +146 -0
  34. package/es/tools/filterHtmlNode.d.ts.map +1 -0
  35. package/es/tools/generateStylesFromSettings.d.ts +38 -0
  36. package/es/tools/generateStylesFromSettings.d.ts.map +1 -0
  37. package/es/tools/generateStylesFromSettings.js +24 -0
  38. package/es/tools/loadScript.d.ts.map +1 -0
  39. package/es/type.d.ts +20 -0
  40. package/es/type.d.ts.map +1 -0
  41. package/lib/LcdpUeditor.d.ts +10 -4
  42. package/lib/LcdpUeditor.js +63 -8
  43. package/lib/ToolBottomBar/FormatModal/index.d.ts +9 -0
  44. package/lib/ToolBottomBar/FormatModal/index.js +261 -0
  45. package/lib/ToolBottomBar/FormatModal/index.less +276 -0
  46. package/lib/ToolBottomBar/ProgressModal/index.d.ts +10 -0
  47. package/lib/ToolBottomBar/ProgressModal/index.js +73 -0
  48. package/lib/ToolBottomBar/ProgressModal/index.less +16 -0
  49. package/lib/ToolBottomBar/index.d.ts +32 -0
  50. package/lib/ToolBottomBar/index.js +254 -0
  51. package/lib/ToolBottomBar/index.less +75 -0
  52. package/lib/icon/ExportPDF.d.ts +3 -0
  53. package/lib/icon/ExportPDF.js +57 -0
  54. package/lib/icon/TextCopy.d.ts +3 -0
  55. package/lib/icon/TextCopy.js +39 -0
  56. package/lib/icon/TextFileIcon.d.ts +3 -0
  57. package/lib/icon/TextFileIcon.js +39 -0
  58. package/lib/icon/TextIcon.d.ts +3 -0
  59. package/lib/icon/TextIcon.js +39 -0
  60. package/lib/tools/exportPDF.d.ts +27 -0
  61. package/lib/tools/exportPDF.js +95 -0
  62. package/lib/tools/generateStylesFromSettings.d.ts +38 -0
  63. package/lib/tools/generateStylesFromSettings.js +77 -0
  64. package/lib/type.d.ts +20 -0
  65. package/package.json +8 -3
  66. package/ueditor-resource/themes/default/css/ueditor.css +1 -1
  67. package/ueditor-resource/ueditor.all.js +1 -1
@@ -0,0 +1,146 @@
1
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
+ /**
4
+ * 将HTML内容转换为PDF文档流
5
+ * @param htmlElement HTML元素
6
+ * @param options 配置选项
7
+ * @returns PDF文档的Blob对象
8
+ */
9
+ export var html2pdf = /*#__PURE__*/function () {
10
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(htmlElement) {
11
+ var _options$jsPDF, _options$jsPDF2, _options$jsPDF3, _options$image, _options$image2;
12
+ var options,
13
+ onProgress,
14
+ _yield$import,
15
+ JS_PDF,
16
+ pdf,
17
+ _yield$import2,
18
+ html2canvas,
19
+ canvas,
20
+ imageType,
21
+ imageQuality,
22
+ imgData,
23
+ margin,
24
+ pdfWidth,
25
+ pdfHeight,
26
+ imgWidth,
27
+ imgHeight,
28
+ heightLeft,
29
+ position,
30
+ pageHeight,
31
+ _args = arguments;
32
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
33
+ while (1) switch (_context.prev = _context.next) {
34
+ case 0:
35
+ options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
36
+ onProgress = _args.length > 2 ? _args[2] : undefined;
37
+ _context.next = 4;
38
+ return import( /* webpackChunkName: "jspdf" */'jspdf');
39
+ case 4:
40
+ _yield$import = _context.sent;
41
+ JS_PDF = _yield$import.jsPDF;
42
+ // 创建jsPDF实例
43
+ pdf = new JS_PDF({
44
+ orientation: ((_options$jsPDF = options.jsPDF) === null || _options$jsPDF === void 0 ? void 0 : _options$jsPDF.orientation) || 'portrait',
45
+ unit: ((_options$jsPDF2 = options.jsPDF) === null || _options$jsPDF2 === void 0 ? void 0 : _options$jsPDF2.unit) || 'pt',
46
+ format: ((_options$jsPDF3 = options.jsPDF) === null || _options$jsPDF3 === void 0 ? void 0 : _options$jsPDF3.format) || 'a4'
47
+ });
48
+ _context.next = 9;
49
+ return import /* webpackChunkName: "html2canvas" */('html2canvas');
50
+ case 9:
51
+ _yield$import2 = _context.sent;
52
+ html2canvas = _yield$import2.default;
53
+ onProgress === null || onProgress === void 0 || onProgress(20, '渲染页面内容...');
54
+ // 将HTML元素转换为Canvas
55
+ _context.next = 14;
56
+ return html2canvas(htmlElement, {
57
+ scale: 2,
58
+ // 提高清晰度
59
+ useCORS: true,
60
+ // 允许跨域图片
61
+ logging: false
62
+ });
63
+ case 14:
64
+ canvas = _context.sent;
65
+ // 获取Canvas数据URL
66
+ imageType = ((_options$image = options.image) === null || _options$image === void 0 ? void 0 : _options$image.type) || 'jpeg';
67
+ imageQuality = ((_options$image2 = options.image) === null || _options$image2 === void 0 ? void 0 : _options$image2.quality) || 1.0;
68
+ imgData = canvas.toDataURL("image/".concat(imageType), imageQuality); // 设置页面边距
69
+ margin = options.margin || 20;
70
+ pdfWidth = pdf.internal.pageSize.getWidth();
71
+ pdfHeight = pdf.internal.pageSize.getHeight();
72
+ imgWidth = pdfWidth - margin * 2;
73
+ imgHeight = canvas.height * imgWidth / canvas.width; // 添加图片到PDF
74
+ heightLeft = imgHeight;
75
+ position = margin;
76
+ pageHeight = pdfHeight - margin * 2; // 处理多页情况
77
+ pdf.addImage(imgData, imageType.toUpperCase(), margin, position, imgWidth, imgHeight);
78
+ heightLeft -= pageHeight;
79
+ while (heightLeft >= 0) {
80
+ position = heightLeft - imgHeight;
81
+ pdf.addPage();
82
+ pdf.addImage(imgData, imageType.toUpperCase(), margin, position, imgWidth, imgHeight);
83
+ heightLeft -= pageHeight;
84
+ }
85
+ onProgress === null || onProgress === void 0 || onProgress(50, '转换HTML内容...');
86
+ // 返回PDF文档流
87
+ return _context.abrupt("return", pdf.output('blob'));
88
+ case 31:
89
+ case "end":
90
+ return _context.stop();
91
+ }
92
+ }, _callee);
93
+ }));
94
+ return function html2pdf(_x) {
95
+ return _ref.apply(this, arguments);
96
+ };
97
+ }();
98
+
99
+ /**
100
+ * 将HTML元素转换为PDF文档流并下载
101
+ * @param dom HTML元素
102
+ * @param pageWidth 页面宽度
103
+ * @param fileName 文件名
104
+ * @returns 下载的PDF文件
105
+ */
106
+ export var domloadPdf = /*#__PURE__*/function () {
107
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(dom, pageWidth) {
108
+ var fileName,
109
+ onProgress,
110
+ _yield$import3,
111
+ saveAs,
112
+ blob,
113
+ _args2 = arguments;
114
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
115
+ while (1) switch (_context2.prev = _context2.next) {
116
+ case 0:
117
+ fileName = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : '未命名';
118
+ onProgress = _args2.length > 3 ? _args2[3] : undefined;
119
+ _context2.next = 4;
120
+ return import /* webpackChunkName: "saveAs" */('file-saver');
121
+ case 4:
122
+ _yield$import3 = _context2.sent;
123
+ saveAs = _yield$import3.saveAs;
124
+ onProgress === null || onProgress === void 0 || onProgress(5, '初始化...');
125
+ _context2.next = 9;
126
+ return html2pdf(dom, {
127
+ jsPDF: {
128
+ orientation: 'portrait',
129
+ unit: 'pt',
130
+ format: pageWidth
131
+ }
132
+ }, onProgress);
133
+ case 9:
134
+ blob = _context2.sent;
135
+ onProgress === null || onProgress === void 0 || onProgress(80, '生成PDF...');
136
+ return _context2.abrupt("return", saveAs(blob, "".concat(fileName, ".pdf")));
137
+ case 12:
138
+ case "end":
139
+ return _context2.stop();
140
+ }
141
+ }, _callee2);
142
+ }));
143
+ return function domloadPdf(_x2, _x3) {
144
+ return _ref2.apply(this, arguments);
145
+ };
146
+ }();
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filterHtmlNode.d.ts","sourceRoot":"","sources":["filterHtmlNode.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,QAAS,MAAM;;;;CA2CzC,CAAC"}
@@ -0,0 +1,38 @@
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 {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateStylesFromSettings.d.ts","sourceRoot":"","sources":["generateStylesFromSettings.ts"],"names":[],"mappings":"AAAA,UAAU,YAAa,SAAQ,SAAS;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,SAAU,SAAQ,SAAS;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB;AACD,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE;QACR,EAAE,EAAE,YAAY,CAAC;QACjB,EAAE,EAAE,YAAY,CAAC;QACjB,EAAE,EAAE,YAAY,CAAC;QACjB,EAAE,EAAE,YAAY,CAAC;QACjB,EAAE,EAAE,YAAY,CAAC;QACjB,EAAE,EAAE,YAAY,CAAC;KAClB,CAAC;IACF,SAAS,EAAE,SAAS,CAAC;IACrB,KAAK,EAAE;QACL,EAAE,EAAE,SAAS,CAAC;QACd,EAAE,EAAE,SAAS,CAAC;KACf,CAAC;CACH;AAED;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,aAAc,cAAc,KAAG,MAuDrE,CAAC"}
@@ -0,0 +1,24 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ /**
3
+ * 生成CSS样式内容
4
+ * @param settings 格式设置
5
+ * @returns CSS样式字符串
6
+ */
7
+ export var generateStylesFromSettings = function generateStylesFromSettings(settings) {
8
+ var css = '';
9
+
10
+ // 处理标题样式
11
+ Object.entries(settings.headings).forEach(function (_ref) {
12
+ var _ref2 = _slicedToArray(_ref, 2),
13
+ heading = _ref2[0],
14
+ style = _ref2[1];
15
+ css += "\n".concat(heading, " {\n font-family: ").concat(style.fontFamily, ";\n font-size: ").concat(style.fontSize, ";\n font-weight: ").concat(style.fontWeight, ";\n line-height: ").concat(style.lineHeight, ";\n color: ").concat(style.color, ";\n margin-top: ").concat(style.marginTop, ";\n margin-bottom: ").concat(style.marginBottom, ";\n}\n");
16
+ });
17
+
18
+ // 处理段落样式
19
+ css += "\np {\n font-family: ".concat(settings.paragraph.fontFamily, ";\n font-size: ").concat(settings.paragraph.fontSize, ";\n font-weight: ").concat(settings.paragraph.fontWeight, ";\n line-height: ").concat(settings.paragraph.lineHeight, ";\n color: ").concat(settings.paragraph.color, ";\n}\n");
20
+
21
+ // 处理列表样式
22
+ css += "\nul {\n font-family: ".concat(settings.lists.ul.fontFamily, ";\n font-size: ").concat(settings.lists.ul.fontSize, ";\n font-weight: ").concat(settings.lists.ul.fontWeight, ";\n line-height: ").concat(settings.lists.ul.lineHeight, ";\n color: ").concat(settings.lists.ul.color, ";\n padding-left: ").concat(settings.lists.ul.paddingLeft, ";\n margin-top: ").concat(settings.lists.ul.marginTop, ";\n margin-bottom: ").concat(settings.lists.ul.marginBottom, ";\n}\n\nol {\n font-family: ").concat(settings.lists.ol.fontFamily, ";\n font-size: ").concat(settings.lists.ol.fontSize, ";\n font-weight: ").concat(settings.lists.ol.fontWeight, ";\n line-height: ").concat(settings.lists.ol.lineHeight, ";\n color: ").concat(settings.lists.ol.color, ";\n padding-left: ").concat(settings.lists.ol.paddingLeft, ";\n margin-top: ").concat(settings.lists.ol.marginTop, ";\n margin-bottom: ").concat(settings.lists.ol.marginBottom, ";\n}\n");
23
+ return css;
24
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadScript.d.ts","sourceRoot":"","sources":["loadScript.ts"],"names":[],"mappings":"AACA;;;GAGG;AACH,eAAO,MAAM,cAAc,SAAgB,MAAM,EAAE,kBAUlD,CAAC"}
package/es/type.d.ts CHANGED
@@ -68,6 +68,10 @@ export interface ILcdpUeditorProps {
68
68
  */
69
69
  videoAllowFiles?: string[];
70
70
  maximumWords?: number;
71
+ /**
72
+ * 导出文件名
73
+ */
74
+ exportFileName?: string;
71
75
  };
72
76
  toolbars?: string[][];
73
77
  /**
@@ -100,6 +104,22 @@ export interface ILcdpUeditorProps {
100
104
  * @param val 编辑器内容
101
105
  */
102
106
  onChange?(val: string): void;
107
+ /**
108
+ * 样式前缀
109
+ */
110
+ prefixCls?: string;
111
+ /**
112
+ * 设置变化
113
+ */
114
+ onSettingChange?(val: Record<Required<ILcdpUeditorProps>['bottomTypes'][number], any>): void;
115
+ /**
116
+ * 默认设置
117
+ */
118
+ defaultSetting?: Record<Required<ILcdpUeditorProps>['bottomTypes'][number], any>;
119
+ /**
120
+ * 底部功能类型
121
+ */
122
+ bottomTypes?: Array<'chineseCount' | 'charCount' | 'pageWidth' | 'formatSetting' | 'exportPdf' | 'fullScreen' | 'copy'>;
103
123
  }
104
124
  export interface ILcdpUeditorInst {
105
125
  /**
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,UAAU,aAAc,SAAQ,KAAK,CAAC,aAAa;IAC/C,YAAY,CAAC,EAAE,MAAM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CAAC;IAEhB;;OAEG;IACH,aAAa,IAAI,MAAM,CAAC;CAC3B"}
@@ -37,19 +37,20 @@ declare class LcdpUeditor extends React.Component<ILcdpUeditorProps, {}> {
37
37
  * 上传文件函数
38
38
  */
39
39
  private uploadFunction;
40
- /**
41
- * 是否加载完成
42
- */
43
- private isReady;
44
40
  /**
45
41
  * 保存 compositionend 事件处理器引用
46
42
  */
47
43
  private compositionEndHandler?;
44
+ /**
45
+ * 是否全屏
46
+ */
47
+ private prefixCls;
48
48
  /**
49
49
  * 初始加载失败
50
50
  */
51
51
  state: Readonly<{
52
52
  initError: boolean;
53
+ isReady: boolean;
53
54
  }>;
54
55
  /**
55
56
  * 编辑器配置项
@@ -58,6 +59,7 @@ declare class LcdpUeditor extends React.Component<ILcdpUeditorProps, {}> {
58
59
  constructor(props: ILcdpUeditorProps);
59
60
  componentDidMount(): void;
60
61
  componentWillReceiveProps(nextProps: ILcdpUeditorProps): void;
62
+ componentDidUpdate(prevProps: Readonly<ILcdpUeditorProps>): void;
61
63
  componentWillUnmount(): void;
62
64
  private onContentChange;
63
65
  private getExtString;
@@ -80,6 +82,10 @@ declare class LcdpUeditor extends React.Component<ILcdpUeditorProps, {}> {
80
82
  * 初始化编辑器实例
81
83
  */
82
84
  initUeditor(): Promise<void>;
85
+ /**
86
+ * 渲染状态栏
87
+ */
88
+ renderStatusBar(): void;
83
89
  render(): React.ReactNode;
84
90
  }
85
91
  export default LcdpUeditor;
@@ -33,11 +33,14 @@ __export(LcdpUeditor_exports, {
33
33
  });
34
34
  module.exports = __toCommonJS(LcdpUeditor_exports);
35
35
  var import_react = __toESM(require("react"));
36
+ var import_react_dom = __toESM(require("react-dom"));
36
37
  var import_const = require("./const");
37
38
  var import_defaultConfig = __toESM(require("./defaultConfig.json"));
38
39
  var import_UeditorResourceLoader = __toESM(require("./tools/UeditorResourceLoader"));
39
40
  var import_debounce = __toESM(require("lodash/debounce"));
40
41
  var import_filterHtmlNode = require("./tools/filterHtmlNode");
42
+ var import_ToolBottomBar = __toESM(require("./ToolBottomBar"));
43
+ var BOTTOM_STATUS_BAR_CLASS = "ueditor-bottom-bar-with-status";
41
44
  var LcdpUeditor = class extends import_react.default.Component {
42
45
  constructor(props) {
43
46
  super(props);
@@ -66,20 +69,24 @@ var LcdpUeditor = class extends import_react.default.Component {
66
69
  */
67
70
  this.currentContent = "";
68
71
  /**
69
- * 是否加载完成
72
+ * 是否全屏
70
73
  */
71
- this.isReady = false;
74
+ this.prefixCls = "pcfactory";
72
75
  /**
73
76
  * 初始加载失败
74
77
  */
75
78
  this.state = {
76
- initError: false
79
+ initError: false,
80
+ /**
81
+ * 是否加载完成
82
+ */
83
+ isReady: false
77
84
  };
78
85
  /**
79
86
  * 编辑器配置项
80
87
  */
81
88
  this.editorConfig = {};
82
- const { config } = props;
89
+ const { config, prefixCls, onSettingChange } = props;
83
90
  this.containerId = `ueditor_${Date.now()}_${String(Math.random()).slice(2, 6)}`;
84
91
  if (this.props.ueditorPath) {
85
92
  this.ueditorPath = this.props.ueditorPath;
@@ -103,6 +110,7 @@ var LcdpUeditor = class extends import_react.default.Component {
103
110
  }
104
111
  return null;
105
112
  };
113
+ this.prefixCls = prefixCls || "pcfactory";
106
114
  this.editorConfig = {
107
115
  ...import_defaultConfig.default,
108
116
  maximumWords: (config == null ? void 0 : config.maximumWords) || 1e4,
@@ -113,7 +121,9 @@ var LcdpUeditor = class extends import_react.default.Component {
113
121
  },
114
122
  uploadFunction: this.uploadFunction,
115
123
  initialContent: "",
116
- pasteplain: (config == null ? void 0 : config.pasteplain) === true
124
+ pasteplain: (config == null ? void 0 : config.pasteplain) === true,
125
+ onSettingChange,
126
+ exportFileName: (config == null ? void 0 : config.exportFileName) || "未命名"
117
127
  };
118
128
  this.debounceContentChange = (0, import_debounce.default)(this.onContentChange.bind(this), 300);
119
129
  }
@@ -121,7 +131,7 @@ var LcdpUeditor = class extends import_react.default.Component {
121
131
  this.initUeditor();
122
132
  }
123
133
  componentWillReceiveProps(nextProps) {
124
- if (this.isReady) {
134
+ if (this.state.isReady) {
125
135
  if ("value" in nextProps && this.currentContent !== nextProps.value) {
126
136
  this.isReportFlag = false;
127
137
  this.ueditorInst.setContent((0, import_filterHtmlNode.filterHtmlNode)(nextProps.value || "").str);
@@ -135,9 +145,15 @@ var LcdpUeditor = class extends import_react.default.Component {
135
145
  }
136
146
  }
137
147
  }
148
+ componentDidUpdate(prevProps) {
149
+ var _a, _b, _c;
150
+ if (this.state.isReady && (prevProps.defaultSetting !== this.props.defaultSetting || prevProps.bottomTypes !== this.props.bottomTypes || ((_a = prevProps == null ? void 0 : prevProps.config) == null ? void 0 : _a.exportFileName) !== ((_c = (_b = this.props) == null ? void 0 : _b.config) == null ? void 0 : _c.exportFileName))) {
151
+ this.renderStatusBar();
152
+ }
153
+ }
138
154
  componentWillUnmount() {
139
155
  var _a, _b, _c;
140
- if (this.isReady) {
156
+ if (this.state.isReady) {
141
157
  const editorBody = (_a = this.ueditorInst) == null ? void 0 : _a.body;
142
158
  if (editorBody && this.compositionEndHandler) {
143
159
  editorBody.removeEventListener("compositionend", this.compositionEndHandler);
@@ -259,7 +275,9 @@ var LcdpUeditor = class extends import_react.default.Component {
259
275
  if (nextValue) {
260
276
  this.ueditorInst.setContent(nextValue);
261
277
  }
262
- this.isReady = true;
278
+ this.setState({
279
+ isReady: true
280
+ });
263
281
  if (this.props.disabled) {
264
282
  this.ueditorInst.setDisabled();
265
283
  } else {
@@ -277,6 +295,7 @@ var LcdpUeditor = class extends import_react.default.Component {
277
295
  }
278
296
  this.initStyle();
279
297
  this.mountRef();
298
+ this.renderStatusBar();
280
299
  });
281
300
  };
282
301
  import_UeditorResourceLoader.default.onReady(readyFunc);
@@ -288,6 +307,42 @@ var LcdpUeditor = class extends import_react.default.Component {
288
307
  });
289
308
  import_UeditorResourceLoader.default.startLoad(jsList);
290
309
  }
310
+ /**
311
+ * 渲染状态栏
312
+ */
313
+ renderStatusBar() {
314
+ var _a, _b, _c, _d;
315
+ const { id } = this.ueditorInst.ui || {};
316
+ const bottomBarContainer = (_a = this.containerRef.current) == null ? void 0 : _a.querySelector(`#${id}_bottombar`);
317
+ const comp = /* @__PURE__ */ import_react.default.createElement(
318
+ import_ToolBottomBar.default,
319
+ {
320
+ ueditorInst: this.ueditorInst,
321
+ prefixCls: this.prefixCls,
322
+ containerRef: this.containerRef,
323
+ defaultSetting: this.props.defaultSetting,
324
+ onSettingChange: this.editorConfig.onSettingChange,
325
+ isReady: this.state.isReady,
326
+ bottomTypes: this.props.bottomTypes,
327
+ exportFileName: (_c = (_b = this.props) == null ? void 0 : _b.config) == null ? void 0 : _c.exportFileName
328
+ }
329
+ );
330
+ if (bottomBarContainer) {
331
+ let statusContainer = bottomBarContainer.querySelector(`#${id}_bottomStatusBar`);
332
+ bottomBarContainer.classList.remove(BOTTOM_STATUS_BAR_CLASS);
333
+ if ((_d = this.props.bottomTypes) == null ? void 0 : _d.length) {
334
+ bottomBarContainer.classList.add(BOTTOM_STATUS_BAR_CLASS);
335
+ if (!statusContainer) {
336
+ statusContainer = document.createElement("div");
337
+ statusContainer.id = `${id}_bottomStatusBar`;
338
+ bottomBarContainer.appendChild(statusContainer);
339
+ }
340
+ import_react_dom.default.render(comp, statusContainer);
341
+ } else if (statusContainer) {
342
+ statusContainer.remove();
343
+ }
344
+ }
345
+ }
291
346
  render() {
292
347
  const { initError } = this.state;
293
348
  if (initError) {
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ import { FormatSettings } from '../../tools/generateStylesFromSettings';
4
+ interface FormatSettingsPanelProps {
5
+ onApply: (settings: FormatSettings) => void;
6
+ initialSettings?: Partial<FormatSettings>;
7
+ }
8
+ declare const FormatSettingsPanel: React.FC<React.PropsWithChildren<FormatSettingsPanelProps>>;
9
+ export default FormatSettingsPanel;