@lingxiteam/lcdp-ueditor-react 1.0.0-alpha.6 → 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
  */
@@ -0,0 +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,OAAO,CAAC,OAAO,CAAkB;IAEjC;;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,IAAI,IAAI;IAI5B,OAAO,CAAC,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
  */
@@ -110,7 +114,8 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
110
114
  selectCallback: function selectCallback(cb, type) {
111
115
  _this.fileSelect(cb, type);
112
116
  },
113
- uploadFunction: _this.uploadFunction
117
+ uploadFunction: _this.uploadFunction,
118
+ initialContent: _this.props.value
114
119
  });
115
120
  _this.debounceContentChange = debounce(_this.onContentChange.bind(_assertThisInitialized(_this)), 300);
116
121
  return _this;
@@ -123,18 +128,18 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
123
128
  }, {
124
129
  key: "componentWillReceiveProps",
125
130
  value: function componentWillReceiveProps(nextProps) {
126
- if ('value' in nextProps && this.currentContent !== nextProps.value) {
127
- this.isReportFlag = false;
128
- if (this.ueditorInst) {
131
+ if (this.isReady) {
132
+ if ('value' in nextProps && this.currentContent !== nextProps.value) {
133
+ this.isReportFlag = false;
129
134
  this.ueditorInst.setContent(nextProps.value);
130
135
  }
131
- }
132
- // 禁用操作需要调用指定的api进行操作
133
- if (nextProps.disabled !== this.props.disabled && this.ueditorInst) {
134
- if (nextProps.disabled) {
135
- this.ueditorInst.setDisabled();
136
- } else {
137
- 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
+ }
138
143
  }
139
144
  }
140
145
  }
@@ -294,6 +299,13 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
294
299
  UeditorResourceLoader.onReady(function () {
295
300
  _this3.ueditorInst = window.UE.getEditor(_this3.containerId, _this3.editorConfig);
296
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
+ }
297
309
  _this3.ueditorInst.addListener('contentChange', function () {
298
310
  _this3.debounceContentChange();
299
311
  });
@@ -0,0 +1 @@
1
+ {"version":3,"file":"const.d.ts","sourceRoot":"","sources":["const.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,oBAAoB,uBAAuB,CAAC;AAEzD;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;8BAMR,MAAM;CAChC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAEhD,OAAO,EACL,WAAW,EACX,iBAAiB,GAClB,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UeditorResourceLoader.d.ts","sourceRoot":"","sources":["UeditorResourceLoader.ts"],"names":[],"mappings":"AAGA,cAAM,qBAAqB;IACzB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAwB;IAE/C,OAAO,CAAC,YAAY,CAAkB;IAEtC,OAAO,CAAC,iBAAiB,CAAkB;IAE3C,OAAO,CAAC,OAAO,CAAkB;IAEjC,OAAO,CAAC,OAAO,CAAkB;IAEjC,OAAO,CAAC,SAAS,CAAkB;WAEf,SAAS,CAAE,MAAM,EAAE,MAAM,EAAE;WAgCjC,WAAW;IAOzB;;;OAGG;WACW,OAAO,CAAC,QAAQ,EAAE,QAAQ;IASxC;;;OAGG;WACW,WAAW,CAAC,QAAQ,EAAE,QAAQ;CAI7C;AAED,eAAe,qBAAqB,CAAC"}
@@ -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"}
@@ -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,CAAC;CACzB;AAGD,MAAM,WAAW,iBAAiB;IAE9B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,MAAM,CAAC,EAAE;QAEL;;WAEG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAEhB;;WAEG;QACH,SAAS,EAAE,MAAM,GAAG,QAAQ,CAAC;QAE7B;;WAEG;QACH,YAAY,CAAC,EAAE,MAAM,CAAC;QAEtB;;WAEG;QACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;QAE3B;;WAEG;QACH,WAAW,CAAC,EAAE,MAAM,CAAC;QAErB;;WAEG;QACH,cA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AAI,CAAC;IAEhB;;OAEG;IACH,aAAa,IAAI,MAAM,CAAC;CAC3B"}
@@ -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
  */
@@ -106,7 +110,8 @@ var LcdpUeditor = class extends import_react.default.Component {
106
110
  selectCallback: (cb, type) => {
107
111
  this.fileSelect(cb, type);
108
112
  },
109
- uploadFunction: this.uploadFunction
113
+ uploadFunction: this.uploadFunction,
114
+ initialContent: this.props.value
110
115
  };
111
116
  this.debounceContentChange = (0, import_lodash.debounce)(this.onContentChange.bind(this), 300);
112
117
  }
@@ -114,17 +119,17 @@ var LcdpUeditor = class extends import_react.default.Component {
114
119
  this.initUeditor();
115
120
  }
116
121
  componentWillReceiveProps(nextProps) {
117
- if ("value" in nextProps && this.currentContent !== nextProps.value) {
118
- this.isReportFlag = false;
119
- if (this.ueditorInst) {
122
+ if (this.isReady) {
123
+ if ("value" in nextProps && this.currentContent !== nextProps.value) {
124
+ this.isReportFlag = false;
120
125
  this.ueditorInst.setContent(nextProps.value);
121
126
  }
122
- }
123
- if (nextProps.disabled !== this.props.disabled && this.ueditorInst) {
124
- if (nextProps.disabled) {
125
- this.ueditorInst.setDisabled();
126
- } else {
127
- 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
+ }
128
133
  }
129
134
  }
130
135
  }
@@ -217,6 +222,12 @@ var LcdpUeditor = class extends import_react.default.Component {
217
222
  import_UeditorResourceLoader.default.onReady(() => {
218
223
  this.ueditorInst = window.UE.getEditor(this.containerId, this.editorConfig);
219
224
  this.ueditorInst.ready(() => {
225
+ this.isReady = true;
226
+ if (this.props.disabled) {
227
+ this.ueditorInst.setDisabled();
228
+ } else {
229
+ this.ueditorInst.setEnabled();
230
+ }
220
231
  this.ueditorInst.addListener("contentChange", () => {
221
232
  this.debounceContentChange();
222
233
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingxiteam/lcdp-ueditor-react",
3
- "version": "1.0.0-alpha.6",
3
+ "version": "1.0.0-alpha.8",
4
4
  "module": "es/index.js",
5
5
  "main": "lib/index.js",
6
6
  "license": "MIT",