@lingxiteam/lcdp-ueditor-react 1.0.3-alpha.5 → 1.0.3-alpha.6

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
@@ -312,17 +312,24 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
312
312
  value: (function () {
313
313
  var _initUeditor = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
314
314
  var _this3 = this;
315
- var jsList;
315
+ var timer, readyFunc, jsList;
316
316
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
317
317
  while (1) switch (_context3.prev = _context3.next) {
318
318
  case 0:
319
- UeditorResourceLoader.onReady(function () {
319
+ readyFunc = function readyFunc() {
320
320
  _this3.initConfig();
321
321
  var target = document.getElementById(_this3.containerId);
322
322
  if (!window.UE || !target) {
323
+ timer = setInterval(function () {
324
+ target = document.getElementById(_this3.containerId);
325
+ if (target) {
326
+ clearInterval(timer);
327
+ readyFunc();
328
+ }
329
+ }, 50);
323
330
  return;
324
331
  }
325
- _this3.ueditorInst = window.UE.getEditor(target, _this3.editorConfig);
332
+ _this3.ueditorInst = window.UE.getEditor(_this3.containerId, _this3.editorConfig);
326
333
  _this3.ueditorInst.ready(function () {
327
334
  _this3.isReady = true;
328
335
  // 禁用状态设置
@@ -346,7 +353,8 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
346
353
  _this3.initStyle();
347
354
  });
348
355
  _this3.mountRef();
349
- });
356
+ };
357
+ UeditorResourceLoader.onReady(readyFunc);
350
358
  // 默认配置 语言包 统一打包到 ueditor-all.js中
351
359
  jsList = ["".concat(this.ueditorPath, "/").concat(DEFAULT_UEDITOR_CONFIG.UEDITOR_ALL)];
352
360
  UeditorResourceLoader.onLoadError(function () {
@@ -355,7 +363,7 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
355
363
  });
356
364
  });
357
365
  UeditorResourceLoader.startLoad(jsList);
358
- case 4:
366
+ case 5:
359
367
  case "end":
360
368
  return _context3.stop();
361
369
  }
@@ -239,13 +239,21 @@ var LcdpUeditor = class extends import_react.default.Component {
239
239
  * 初始化编辑器实例
240
240
  */
241
241
  async initUeditor() {
242
- import_UeditorResourceLoader.default.onReady(() => {
242
+ let timer;
243
+ const readyFunc = () => {
243
244
  this.initConfig();
244
- const target = document.getElementById(this.containerId);
245
+ let target = document.getElementById(this.containerId);
245
246
  if (!window.UE || !target) {
247
+ timer = setInterval(() => {
248
+ target = document.getElementById(this.containerId);
249
+ if (target) {
250
+ clearInterval(timer);
251
+ readyFunc();
252
+ }
253
+ }, 50);
246
254
  return;
247
255
  }
248
- this.ueditorInst = window.UE.getEditor(target, this.editorConfig);
256
+ this.ueditorInst = window.UE.getEditor(this.containerId, this.editorConfig);
249
257
  this.ueditorInst.ready(() => {
250
258
  this.isReady = true;
251
259
  if (this.props.disabled) {
@@ -266,10 +274,9 @@ var LcdpUeditor = class extends import_react.default.Component {
266
274
  this.initStyle();
267
275
  });
268
276
  this.mountRef();
269
- });
270
- const jsList = [
271
- `${this.ueditorPath}/${import_const.DEFAULT_UEDITOR_CONFIG.UEDITOR_ALL}`
272
- ];
277
+ };
278
+ import_UeditorResourceLoader.default.onReady(readyFunc);
279
+ const jsList = [`${this.ueditorPath}/${import_const.DEFAULT_UEDITOR_CONFIG.UEDITOR_ALL}`];
273
280
  import_UeditorResourceLoader.default.onLoadError(() => {
274
281
  this.setState({
275
282
  initError: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingxiteam/lcdp-ueditor-react",
3
- "version": "1.0.3-alpha.5",
3
+ "version": "1.0.3-alpha.6",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",