@lingxiteam/lcdp-ueditor-react 1.0.3-alpha.7 → 1.0.3-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.
- package/es/LcdpUeditor.js +17 -4
- package/lib/LcdpUeditor.js +16 -5
- package/package.json +1 -1
package/es/LcdpUeditor.js
CHANGED
|
@@ -312,12 +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
|
+
// 在弹窗页面中反复开关,会导致 dom 丢失
|
|
320
|
+
readyFunc = function readyFunc() {
|
|
320
321
|
_this3.initConfig();
|
|
322
|
+
var target = document.getElementById(_this3.containerId);
|
|
323
|
+
if (!window.UE || !target) {
|
|
324
|
+
timer = setInterval(function () {
|
|
325
|
+
target = document.getElementById(_this3.containerId);
|
|
326
|
+
if (target) {
|
|
327
|
+
clearInterval(timer);
|
|
328
|
+
readyFunc();
|
|
329
|
+
}
|
|
330
|
+
}, 50);
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
321
333
|
_this3.ueditorInst = window.UE.getEditor(_this3.containerId, _this3.editorConfig);
|
|
322
334
|
_this3.ueditorInst.ready(function () {
|
|
323
335
|
var nextValue = filterHtmlNode(_this3.props.value || '').str;
|
|
@@ -346,7 +358,8 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
|
|
|
346
358
|
_this3.initStyle();
|
|
347
359
|
_this3.mountRef();
|
|
348
360
|
});
|
|
349
|
-
}
|
|
361
|
+
};
|
|
362
|
+
UeditorResourceLoader.onReady(readyFunc);
|
|
350
363
|
// 默认配置 语言包 统一打包到 ueditor-all.js中
|
|
351
364
|
jsList = ["".concat(this.ueditorPath, "/").concat(DEFAULT_UEDITOR_CONFIG.UEDITOR_ALL)];
|
|
352
365
|
UeditorResourceLoader.onLoadError(function () {
|
|
@@ -355,7 +368,7 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
|
|
|
355
368
|
});
|
|
356
369
|
});
|
|
357
370
|
UeditorResourceLoader.startLoad(jsList);
|
|
358
|
-
case
|
|
371
|
+
case 5:
|
|
359
372
|
case "end":
|
|
360
373
|
return _context3.stop();
|
|
361
374
|
}
|
package/lib/LcdpUeditor.js
CHANGED
|
@@ -239,8 +239,20 @@ 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();
|
|
245
|
+
let target = document.getElementById(this.containerId);
|
|
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);
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
244
256
|
this.ueditorInst = window.UE.getEditor(this.containerId, this.editorConfig);
|
|
245
257
|
this.ueditorInst.ready(() => {
|
|
246
258
|
const nextValue = (0, import_filterHtmlNode.filterHtmlNode)(this.props.value || "").str;
|
|
@@ -266,10 +278,9 @@ var LcdpUeditor = class extends import_react.default.Component {
|
|
|
266
278
|
this.initStyle();
|
|
267
279
|
this.mountRef();
|
|
268
280
|
});
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
];
|
|
281
|
+
};
|
|
282
|
+
import_UeditorResourceLoader.default.onReady(readyFunc);
|
|
283
|
+
const jsList = [`${this.ueditorPath}/${import_const.DEFAULT_UEDITOR_CONFIG.UEDITOR_ALL}`];
|
|
273
284
|
import_UeditorResourceLoader.default.onLoadError(() => {
|
|
274
285
|
this.setState({
|
|
275
286
|
initError: true
|