@lingxiteam/lcdp-ueditor-react 1.0.3-alpha.8 → 1.0.4-alpha.1

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 (109) hide show
  1. package/es/LcdpUeditor.d.ts +10 -4
  2. package/es/LcdpUeditor.d.ts.map +1 -0
  3. package/es/LcdpUeditor.js +77 -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 +33 -0
  13. package/es/ToolBottomBar/index.d.ts.map +1 -0
  14. package/es/ToolBottomBar/index.js +296 -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 +21 -0
  40. package/es/type.d.ts.map +1 -0
  41. package/lib/LcdpUeditor.d.ts +10 -4
  42. package/lib/LcdpUeditor.js +62 -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 +33 -0
  50. package/lib/ToolBottomBar/index.js +235 -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 +21 -0
  65. package/package.json +8 -3
  66. package/ueditor-resource/dialogs/anchor/anchor.html +1 -1
  67. package/ueditor-resource/dialogs/attachment/attachment.html +3 -3
  68. package/ueditor-resource/dialogs/attachment/attachment.js +1 -1
  69. package/ueditor-resource/dialogs/audio/audio.js +1 -1
  70. package/ueditor-resource/dialogs/background/background.html +2 -2
  71. package/ueditor-resource/dialogs/background/background.js +1 -1
  72. package/ueditor-resource/dialogs/contentimport/contentimport.html +3 -3
  73. package/ueditor-resource/dialogs/contentimport/contentimport.js +1 -1
  74. package/ueditor-resource/dialogs/emotion/emotion.html +2 -2
  75. package/ueditor-resource/dialogs/emotion/emotion.js +1 -1
  76. package/ueditor-resource/dialogs/formula/formula.html +4 -4
  77. package/ueditor-resource/dialogs/formula/formula.js +1 -1
  78. package/ueditor-resource/dialogs/help/help.html +2 -2
  79. package/ueditor-resource/dialogs/help/help.js +1 -1
  80. package/ueditor-resource/dialogs/image/image.js +1 -1
  81. package/ueditor-resource/dialogs/insertframe/insertframe.html +1 -1
  82. package/ueditor-resource/dialogs/internal.js +1 -1
  83. package/ueditor-resource/dialogs/preview/preview.html +2 -2
  84. package/ueditor-resource/dialogs/scrawl/scrawl.html +2 -2
  85. package/ueditor-resource/dialogs/scrawl/scrawl.js +1 -1
  86. package/ueditor-resource/dialogs/searchreplace/searchreplace.html +2 -2
  87. package/ueditor-resource/dialogs/searchreplace/searchreplace.js +1 -1
  88. package/ueditor-resource/dialogs/spechars/spechars.html +2 -2
  89. package/ueditor-resource/dialogs/spechars/spechars.js +1 -1
  90. package/ueditor-resource/dialogs/table/edittable.html +2 -2
  91. package/ueditor-resource/dialogs/table/edittable.js +1 -1
  92. package/ueditor-resource/dialogs/table/edittd.html +1 -1
  93. package/ueditor-resource/dialogs/table/edittip.html +1 -1
  94. package/ueditor-resource/dialogs/template/template.html +2 -2
  95. package/ueditor-resource/dialogs/template/template.js +1 -1
  96. package/ueditor-resource/dialogs/video/video.js +1 -1
  97. package/ueditor-resource/dialogs/wordimage/wordimage.html +4 -4
  98. package/ueditor-resource/dialogs/wordimage/wordimage.js +1 -1
  99. package/ueditor-resource/plugins/browser-image-compression.js +9 -0
  100. package/ueditor-resource/plugins/demo/demo.js +3 -1
  101. package/ueditor-resource/themes/default/css/ueditor.css +1 -1
  102. package/ueditor-resource/third-party/SyntaxHighlighter/shCore.js +3 -3
  103. package/ueditor-resource/third-party/clipboard/clipboard.js +1 -1
  104. package/ueditor-resource/third-party/codemirror/codemirror.js +3 -2
  105. package/ueditor-resource/third-party/jquery-3.5.1.js +3 -3
  106. package/ueditor-resource/third-party/jquery-3.5.1_1.js +3 -3
  107. package/ueditor-resource/ueditor.all.js +22 -19
  108. package/ueditor-resource/ueditor.config.js +1 -1
  109. package/ueditor-resource/ueditor.parse.js +1 -1
@@ -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;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LcdpUeditor.d.ts","sourceRoot":"","sources":["Lcdp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S;IAcjB;;OAEG;IACG,WAAW;IA4DjB;;OAEG;IACH,eAAe;IAsCf,MAAM,IAAI,KAAK,CAAC,SAAS;CAY1B;AAED,eAAe,WAAW,CAAC"}
package/es/LcdpUeditor.js CHANGED
@@ -8,11 +8,13 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
8
8
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
9
9
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
10
10
  import React from 'react';
11
+ import ReactDOM from 'react-dom';
11
12
  import { DEFAULT_UEDITOR_CONFIG, DEFAULT_UEDITOR_PATH } from "./const";
12
13
  import DefaultConfig from "./defaultConfig.json";
13
14
  import UeditorResourceLoader from "./tools/UeditorResourceLoader";
14
15
  import debounce from 'lodash/debounce';
15
16
  import { filterHtmlNode } from "./tools/filterHtmlNode";
17
+ import ToolBottomBar from "./ToolBottomBar";
16
18
  var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
17
19
  _inherits(LcdpUeditor, _React$Component);
18
20
  var _super = _createSuper(LcdpUeditor);
@@ -56,25 +58,31 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
56
58
  * 上传文件函数
57
59
  */
58
60
  _defineProperty(_assertThisInitialized(_this), "uploadFunction", void 0);
59
- /**
60
- * 是否加载完成
61
- */
62
- _defineProperty(_assertThisInitialized(_this), "isReady", false);
63
61
  /**
64
62
  * 保存 compositionend 事件处理器引用
65
63
  */
66
64
  _defineProperty(_assertThisInitialized(_this), "compositionEndHandler", void 0);
65
+ /**
66
+ * 是否全屏
67
+ */
68
+ _defineProperty(_assertThisInitialized(_this), "prefixCls", 'pcfactory');
67
69
  /**
68
70
  * 初始加载失败
69
71
  */
70
72
  _defineProperty(_assertThisInitialized(_this), "state", {
71
- initError: false
73
+ initError: false,
74
+ /**
75
+ * 是否加载完成
76
+ */
77
+ isReady: false
72
78
  });
73
79
  /**
74
80
  * 编辑器配置项
75
81
  */
76
82
  _defineProperty(_assertThisInitialized(_this), "editorConfig", {});
77
- var config = props.config;
83
+ var config = props.config,
84
+ prefixCls = props.prefixCls,
85
+ onFormatChange = props.onFormatChange;
78
86
  _this.containerId = "ueditor_".concat(Date.now(), "_").concat(String(Math.random()).slice(2, 6));
79
87
  if (_this.props.ueditorPath) {
80
88
  _this.ueditorPath = _this.props.ueditorPath;
@@ -102,6 +110,7 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
102
110
  }
103
111
  return null;
104
112
  };
113
+ _this.prefixCls = prefixCls || 'pcfactory';
105
114
  _this.editorConfig = _objectSpread(_objectSpread({}, DefaultConfig), {}, {
106
115
  maximumWords: (config === null || config === void 0 ? void 0 : config.maximumWords) || 10000,
107
116
  initialFrameHeight: (config === null || config === void 0 ? void 0 : config.height) || 300,
@@ -111,7 +120,9 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
111
120
  },
112
121
  uploadFunction: _this.uploadFunction,
113
122
  initialContent: '',
114
- pasteplain: (config === null || config === void 0 ? void 0 : config.pasteplain) === true
123
+ pasteplain: (config === null || config === void 0 ? void 0 : config.pasteplain) === true,
124
+ onFormatChange: onFormatChange,
125
+ exportFileName: (config === null || config === void 0 ? void 0 : config.exportFileName) || '未命名'
115
126
  });
116
127
  _this.debounceContentChange = debounce(_this.onContentChange.bind(_assertThisInitialized(_this)), 300);
117
128
  return _this;
@@ -124,7 +135,7 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
124
135
  }, {
125
136
  key: "componentWillReceiveProps",
126
137
  value: function componentWillReceiveProps(nextProps) {
127
- if (this.isReady) {
138
+ if (this.state.isReady) {
128
139
  if ('value' in nextProps && this.currentContent !== nextProps.value) {
129
140
  this.isReportFlag = false;
130
141
  this.ueditorInst.setContent(filterHtmlNode(nextProps.value || '').str);
@@ -139,10 +150,18 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
139
150
  }
140
151
  }
141
152
  }
153
+ }, {
154
+ key: "componentDidUpdate",
155
+ value: function componentDidUpdate(prevProps) {
156
+ var _prevProps$config, _this$props;
157
+ if (this.state.isReady && (prevProps.defaultFormatSetting !== this.props.defaultFormatSetting || prevProps.bottomTypes !== this.props.bottomTypes || (prevProps === null || prevProps === void 0 || (_prevProps$config = prevProps.config) === null || _prevProps$config === void 0 ? void 0 : _prevProps$config.exportFileName) !== ((_this$props = this.props) === null || _this$props === void 0 || (_this$props = _this$props.config) === null || _this$props === void 0 ? void 0 : _this$props.exportFileName))) {
158
+ this.renderStatusBar();
159
+ }
160
+ }
142
161
  }, {
143
162
  key: "componentWillUnmount",
144
163
  value: function componentWillUnmount() {
145
- if (this.isReady) {
164
+ if (this.state.isReady) {
146
165
  var _this$ueditorInst, _this$ueditorInst2, _this$ueditorInst2$de;
147
166
  var editorBody = (_this$ueditorInst = this.ueditorInst) === null || _this$ueditorInst === void 0 ? void 0 : _this$ueditorInst.body;
148
167
  if (editorBody && this.compositionEndHandler) {
@@ -336,7 +355,9 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
336
355
  if (nextValue) {
337
356
  _this3.ueditorInst.setContent(nextValue);
338
357
  }
339
- _this3.isReady = true;
358
+ _this3.setState({
359
+ isReady: true
360
+ });
340
361
  // 禁用状态设置
341
362
  if (_this3.props.disabled) {
342
363
  _this3.ueditorInst.setDisabled();
@@ -357,6 +378,7 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
357
378
  }
358
379
  _this3.initStyle();
359
380
  _this3.mountRef();
381
+ _this3.renderStatusBar();
360
382
  });
361
383
  };
362
384
  UeditorResourceLoader.onReady(readyFunc);
@@ -378,7 +400,51 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
378
400
  return _initUeditor.apply(this, arguments);
379
401
  }
380
402
  return initUeditor;
381
- }())
403
+ }()
404
+ /**
405
+ * 渲染状态栏
406
+ */
407
+ )
408
+ }, {
409
+ key: "renderStatusBar",
410
+ value: function renderStatusBar() {
411
+ var _this$containerRef$cu, _this$props2;
412
+ var _ref4 = this.ueditorInst.ui || {},
413
+ id = _ref4.id;
414
+ var bottomBarContainer = (_this$containerRef$cu = this.containerRef.current) === null || _this$containerRef$cu === void 0 ? void 0 : _this$containerRef$cu.querySelector("#".concat(id, "_bottombar"));
415
+ var comp = /*#__PURE__*/React.createElement(ToolBottomBar, {
416
+ ueditorInst: this.ueditorInst,
417
+ prefixCls: this.prefixCls,
418
+ containerRef: this.containerRef,
419
+ defaultFormatSetting: this.props.defaultFormatSetting,
420
+ onFormatChange: this.editorConfig.onFormatChange,
421
+ isReady: this.state.isReady,
422
+ bottomTypes: this.props.bottomTypes,
423
+ exportFileName: (_this$props2 = this.props) === null || _this$props2 === void 0 || (_this$props2 = _this$props2.config) === null || _this$props2 === void 0 ? void 0 : _this$props2.exportFileName
424
+ });
425
+ if (bottomBarContainer) {
426
+ var _this$props$bottomTyp;
427
+ // 获取底部状态组件
428
+ var statusContainer = bottomBarContainer.querySelector("#".concat(id, "_bottomStatusBar"));
429
+ // 移除底部状态栏的样式
430
+ bottomBarContainer.classList.remove('ueditor-bottom-bar-with-status');
431
+ // 如果底部状态栏有类型,则添加样式
432
+ if ((_this$props$bottomTyp = this.props.bottomTypes) !== null && _this$props$bottomTyp !== void 0 && _this$props$bottomTyp.length) {
433
+ bottomBarContainer.classList.add('ueditor-bottom-bar-with-status');
434
+ // 如果底部状态栏没有组件,则创建组件
435
+ if (!statusContainer) {
436
+ statusContainer = document.createElement('div');
437
+ statusContainer.id = "".concat(id, "_bottomStatusBar");
438
+ bottomBarContainer.appendChild(statusContainer);
439
+ }
440
+ // 渲染组件
441
+ ReactDOM.render(comp, statusContainer);
442
+ } else if (statusContainer) {
443
+ // 如果底部状态栏有类型,但是类型为空,则移除组件
444
+ statusContainer.remove();
445
+ }
446
+ }
447
+ }
382
448
  }, {
383
449
  key: "render",
384
450
  value: function render() {
@@ -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;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,cAAc,EAAa,MAAM,wCAAwC,CAAC;AAEnF,UAAU,wBAAwB;IAChC,OAAO,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,CAAC;IAC5C,eAAe,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;CAC3C;AA6LD,QAAA,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,wBAAwB,CAAC,CA8JpF,CAAC;AAEF,eAAe,mBAAmB,CAAC"}