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