@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 +13 -5
- package/lib/LcdpUeditor.js +14 -7
- package/package.json +1 -1
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
|
-
|
|
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(
|
|
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
|
|
366
|
+
case 5:
|
|
359
367
|
case "end":
|
|
360
368
|
return _context3.stop();
|
|
361
369
|
}
|
package/lib/LcdpUeditor.js
CHANGED
|
@@ -239,13 +239,21 @@ var LcdpUeditor = class extends import_react.default.Component {
|
|
|
239
239
|
* 初始化编辑器实例
|
|
240
240
|
*/
|
|
241
241
|
async initUeditor() {
|
|
242
|
-
|
|
242
|
+
let timer;
|
|
243
|
+
const readyFunc = () => {
|
|
243
244
|
this.initConfig();
|
|
244
|
-
|
|
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(
|
|
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
|
-
|
|
271
|
-
|
|
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
|