@lingxiteam/lcdp-ueditor-react 1.0.0-alpha.17 → 1.0.0-alpha.19

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.js CHANGED
@@ -80,9 +80,7 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
80
80
  * 编辑器配置项
81
81
  */
82
82
  _defineProperty(_assertThisInitialized(_this), "editorConfig", {});
83
- var config = props.config,
84
- _props$toolbars = props.toolbars,
85
- toolbars = _props$toolbars === void 0 ? [] : _props$toolbars;
83
+ var config = props.config;
86
84
  _this.containerId = "ueditor_".concat(Date.now(), "_").concat(String(Math.random()).slice(2, 6));
87
85
  if (_this.props.ueditorPath) {
88
86
  _this.ueditorPath = _this.props.ueditorPath;
@@ -113,14 +111,14 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
113
111
  return null;
114
112
  };
115
113
  _this.editorConfig = _objectSpread(_objectSpread({}, DefaultConfig), {}, {
114
+ maximumWords: (config === null || config === void 0 ? void 0 : config.maximumWords) || 10000,
116
115
  initialFrameHeight: (config === null || config === void 0 ? void 0 : config.height) || 300,
117
116
  autoHeightEnabled: false,
118
117
  selectCallback: function selectCallback(cb, type) {
119
118
  _this.fileSelect(cb, type);
120
119
  },
121
120
  uploadFunction: _this.uploadFunction,
122
- initialContent: nextValue || '',
123
- toolbars: toolbars
121
+ initialContent: nextValue || ''
124
122
  });
125
123
  _this.debounceContentChange = debounce(_this.onContentChange.bind(_assertThisInitialized(_this)), 300);
126
124
  return _this;
@@ -308,6 +306,9 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
308
306
  while (1) switch (_context3.prev = _context3.next) {
309
307
  case 0:
310
308
  UeditorResourceLoader.onReady(function () {
309
+ if (_this3.props.toolbars) {
310
+ _this3.editorConfig.toolbars = _this3.props.toolbars;
311
+ }
311
312
  _this3.ueditorInst = window.UE.getEditor(_this3.containerId, _this3.editorConfig);
312
313
  _this3.ueditorInst.ready(function () {
313
314
  _this3.isReady = true;
package/es/type.d.ts CHANGED
@@ -63,8 +63,9 @@ export interface ILcdpUeditorProps {
63
63
  * 上传视频格式限制
64
64
  */
65
65
  videoAllowFiles?: string[];
66
+ maximumWords?: number;
66
67
  };
67
- toolbars: string[][];
68
+ toolbars?: string[][];
68
69
  /**
69
70
  * 语言 默认 zh-cn
70
71
  * zh-cn 中文 en 英文
@@ -79,7 +79,7 @@ var LcdpUeditor = class extends import_react.default.Component {
79
79
  * 编辑器配置项
80
80
  */
81
81
  this.editorConfig = {};
82
- const { config, toolbars = [] } = props;
82
+ const { config } = props;
83
83
  this.containerId = `ueditor_${Date.now()}_${String(Math.random()).slice(2, 6)}`;
84
84
  if (this.props.ueditorPath) {
85
85
  this.ueditorPath = this.props.ueditorPath;
@@ -107,14 +107,14 @@ var LcdpUeditor = class extends import_react.default.Component {
107
107
  };
108
108
  this.editorConfig = {
109
109
  ...import_defaultConfig.default,
110
+ maximumWords: (config == null ? void 0 : config.maximumWords) || 1e4,
110
111
  initialFrameHeight: (config == null ? void 0 : config.height) || 300,
111
112
  autoHeightEnabled: false,
112
113
  selectCallback: (cb, type) => {
113
114
  this.fileSelect(cb, type);
114
115
  },
115
116
  uploadFunction: this.uploadFunction,
116
- initialContent: nextValue || "",
117
- toolbars
117
+ initialContent: nextValue || ""
118
118
  };
119
119
  this.debounceContentChange = (0, import_lodash.debounce)(this.onContentChange.bind(this), 300);
120
120
  }
@@ -226,6 +226,9 @@ var LcdpUeditor = class extends import_react.default.Component {
226
226
  */
227
227
  async initUeditor() {
228
228
  import_UeditorResourceLoader.default.onReady(() => {
229
+ if (this.props.toolbars) {
230
+ this.editorConfig.toolbars = this.props.toolbars;
231
+ }
229
232
  this.ueditorInst = window.UE.getEditor(this.containerId, this.editorConfig);
230
233
  this.ueditorInst.ready(() => {
231
234
  this.isReady = true;
package/lib/type.d.ts CHANGED
@@ -63,8 +63,9 @@ export interface ILcdpUeditorProps {
63
63
  * 上传视频格式限制
64
64
  */
65
65
  videoAllowFiles?: string[];
66
+ maximumWords?: number;
66
67
  };
67
- toolbars: string[][];
68
+ toolbars?: string[][];
68
69
  /**
69
70
  * 语言 默认 zh-cn
70
71
  * zh-cn 中文 en 英文
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingxiteam/lcdp-ueditor-react",
3
- "version": "1.0.0-alpha.17",
3
+ "version": "1.0.0-alpha.19",
4
4
  "module": "es/index.js",
5
5
  "main": "lib/index.js",
6
6
  "license": "MIT",