@lingxiteam/lcdp-ueditor-react 1.0.0-alpha.7 → 1.0.0-alpha.8

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.
@@ -37,6 +37,10 @@ declare class LcdpUeditor extends React.Component<ILcdpUeditorProps, {}> {
37
37
  * 上传文件函数
38
38
  */
39
39
  private uploadFunction;
40
+ /**
41
+ * 是否加载完成
42
+ */
43
+ private isReady;
40
44
  /**
41
45
  * 初始加载失败
42
46
  */
@@ -1 +1 @@
1
- {"version":3,"file":"LcdpUeditor.d.ts","sourceRoot":"","sources":["LcdpUeditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAOhD,cAAM,WAAY,SAAQ,KAAK,CAAC,SAAS,CAAC,iBAAiB,EAAE,EAAE,CAAC;IAC9D;;OAEG;IACH,WAAW,EAAE,MAAM,CAAwB;IAE3C;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAwD;IAExE;;OAEG;IACH,OAAO,CAAC,YAAY,CAAwD;IAE5E;;OAEG;IACH,OAAO,CAAC,WAAW,CAAS;IAE5B;;OAEG;IACH,OAAO,CAAC,WAAW,CAAa;IAEhC;;OAEG;IACH,OAAO,CAAC,YAAY,CAAiB;IAErC;;OAEG;IACH,OAAO,CAAC,qBAAqB,CAAW;IAExC;;OAEG;IACH,OAAO,CAAC,cAAc,CAAc;IAEpC;;OAEG;IACH,OAAO,CAAC,cAAc,CAAM;IAE5B;;OAEG;IACH,KAAK,EAAE,QAAQ,CAAC;QAAC,SAAS,EAAE,OAAO,CAAA;KAAC,CAAC,CAEnC;IAEF;;OAEG;IACH,YAAY,EAAE,GAAG,CAAM;gBAEX,KAAK,EAAE,iBAAiB;IA0CpC,iBAAiB,IAAI,IAAI;IAIzB,yBAAyB,CAAC,SAAS,EAAE,iBAAiB;IAiBtD,oBAAoB,I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AC,eAAe;IAUvB,OAAO,CAAC,YAAY;IAOpB;;;;OAIG;YACW,UAAU;IAqCxB;;OAEG;IACH,OAAO,CAAC,QAAQ;IAMhB;;OAEG;IACH,OAAO,CAAC,SAAS;IAcjB;;OAEG;IACG,WAAW;IAiCjB,MAAM,IAAI,KAAK,CAAC,SAAS;CAY1B;AAED,eAAe,WAAW,CAAC"}
package/es/LcdpUeditor.js CHANGED
@@ -65,6 +65,10 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
65
65
  * 上传文件函数
66
66
  */
67
67
  _defineProperty(_assertThisInitialized(_this), "uploadFunction", void 0);
68
+ /**
69
+ * 是否加载完成
70
+ */
71
+ _defineProperty(_assertThisInitialized(_this), "isReady", false);
68
72
  /**
69
73
  * 初始加载失败
70
74
  */
@@ -124,18 +128,18 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
124
128
  }, {
125
129
  key: "componentWillReceiveProps",
126
130
  value: function componentWillReceiveProps(nextProps) {
127
- if ('value' in nextProps && this.currentContent !== nextProps.value) {
128
- this.isReportFlag = false;
129
- if (this.ueditorInst) {
131
+ if (this.isReady) {
132
+ if ('value' in nextProps && this.currentContent !== nextProps.value) {
133
+ this.isReportFlag = false;
130
134
  this.ueditorInst.setContent(nextProps.value);
131
135
  }
132
- }
133
- // 禁用操作需要调用指定的api进行操作
134
- if (nextProps.disabled !== this.props.disabled && this.ueditorInst) {
135
- if (nextProps.disabled) {
136
- this.ueditorInst.setDisabled();
137
- } else {
138
- this.ueditorInst.setEnabled();
136
+ // 禁用操作需要调用指定的api进行操作
137
+ if (nextProps.disabled !== this.props.disabled) {
138
+ if (nextProps.disabled) {
139
+ this.ueditorInst.setDisabled();
140
+ } else {
141
+ this.ueditorInst.setEnabled();
142
+ }
139
143
  }
140
144
  }
141
145
  }
@@ -295,6 +299,13 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
295
299
  UeditorResourceLoader.onReady(function () {
296
300
  _this3.ueditorInst = window.UE.getEditor(_this3.containerId, _this3.editorConfig);
297
301
  _this3.ueditorInst.ready(function () {
302
+ _this3.isReady = true;
303
+ // 禁用状态设置
304
+ if (_this3.props.disabled) {
305
+ _this3.ueditorInst.setDisabled();
306
+ } else {
307
+ _this3.ueditorInst.setEnabled();
308
+ }
298
309
  _this3.ueditorInst.addListener('contentChange', function () {
299
310
  _this3.debounceContentChange();
300
311
  });
@@ -37,6 +37,10 @@ declare class LcdpUeditor extends React.Component<ILcdpUeditorProps, {}> {
37
37
  * 上传文件函数
38
38
  */
39
39
  private uploadFunction;
40
+ /**
41
+ * 是否加载完成
42
+ */
43
+ private isReady;
40
44
  /**
41
45
  * 初始加载失败
42
46
  */
@@ -64,6 +64,10 @@ var LcdpUeditor = class extends import_react.default.Component {
64
64
  * 当前值
65
65
  */
66
66
  this.currentContent = "";
67
+ /**
68
+ * 是否加载完成
69
+ */
70
+ this.isReady = false;
67
71
  /**
68
72
  * 初始加载失败
69
73
  */
@@ -115,17 +119,17 @@ var LcdpUeditor = class extends import_react.default.Component {
115
119
  this.initUeditor();
116
120
  }
117
121
  componentWillReceiveProps(nextProps) {
118
- if ("value" in nextProps && this.currentContent !== nextProps.value) {
119
- this.isReportFlag = false;
120
- if (this.ueditorInst) {
122
+ if (this.isReady) {
123
+ if ("value" in nextProps && this.currentContent !== nextProps.value) {
124
+ this.isReportFlag = false;
121
125
  this.ueditorInst.setContent(nextProps.value);
122
126
  }
123
- }
124
- if (nextProps.disabled !== this.props.disabled && this.ueditorInst) {
125
- if (nextProps.disabled) {
126
- this.ueditorInst.setDisabled();
127
- } else {
128
- this.ueditorInst.setEnabled();
127
+ if (nextProps.disabled !== this.props.disabled) {
128
+ if (nextProps.disabled) {
129
+ this.ueditorInst.setDisabled();
130
+ } else {
131
+ this.ueditorInst.setEnabled();
132
+ }
129
133
  }
130
134
  }
131
135
  }
@@ -218,6 +222,12 @@ var LcdpUeditor = class extends import_react.default.Component {
218
222
  import_UeditorResourceLoader.default.onReady(() => {
219
223
  this.ueditorInst = window.UE.getEditor(this.containerId, this.editorConfig);
220
224
  this.ueditorInst.ready(() => {
225
+ this.isReady = true;
226
+ if (this.props.disabled) {
227
+ this.ueditorInst.setDisabled();
228
+ } else {
229
+ this.ueditorInst.setEnabled();
230
+ }
221
231
  this.ueditorInst.addListener("contentChange", () => {
222
232
  this.debounceContentChange();
223
233
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingxiteam/lcdp-ueditor-react",
3
- "version": "1.0.0-alpha.7",
3
+ "version": "1.0.0-alpha.8",
4
4
  "module": "es/index.js",
5
5
  "main": "lib/index.js",
6
6
  "license": "MIT",