@lingxiteam/lcdp-ueditor-react 1.0.2 → 1.0.3-alpha.10
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.d.ts +4 -0
- package/es/LcdpUeditor.js +45 -8
- package/es/tools/UeditorResourceLoader.d.ts +1 -1
- package/es/tools/UeditorResourceLoader.js +18 -7
- package/es/tools/filterHtmlNode.js +7 -2
- package/lib/LcdpUeditor.d.ts +4 -0
- package/lib/LcdpUeditor.js +35 -10
- package/lib/tools/UeditorResourceLoader.d.ts +1 -1
- package/lib/tools/UeditorResourceLoader.js +15 -7
- package/lib/tools/filterHtmlNode.js +8 -4
- package/package.json +1 -1
- package/ueditor-resource/dialogs/anchor/anchor.html +1 -1
- package/ueditor-resource/dialogs/attachment/attachment.css +2 -715
- package/ueditor-resource/dialogs/attachment/attachment.html +6 -6
- package/ueditor-resource/dialogs/attachment/attachment.js +2 -803
- package/ueditor-resource/dialogs/audio/audio.css +2 -878
- package/ueditor-resource/dialogs/audio/audio.js +2 -815
- package/ueditor-resource/dialogs/background/background.css +2 -192
- package/ueditor-resource/dialogs/background/background.html +3 -3
- package/ueditor-resource/dialogs/background/background.js +2 -370
- package/ueditor-resource/dialogs/contentimport/contentimport.html +3 -3
- package/ueditor-resource/dialogs/contentimport/contentimport.js +2 -91
- package/ueditor-resource/dialogs/emotion/emotion.css +2 -128
- package/ueditor-resource/dialogs/emotion/emotion.html +3 -3
- package/ueditor-resource/dialogs/emotion/emotion.js +2 -186
- package/ueditor-resource/dialogs/formula/formula.html +4 -4
- package/ueditor-resource/dialogs/formula/formula.js +2 -147
- package/ueditor-resource/dialogs/help/help.css +2 -36
- package/ueditor-resource/dialogs/help/help.html +3 -3
- package/ueditor-resource/dialogs/help/help.js +2 -57
- package/ueditor-resource/dialogs/image/image.css +2 -767
- package/ueditor-resource/dialogs/image/image.js +2 -1060
- package/ueditor-resource/dialogs/insertframe/insertframe.html +2 -2
- package/ueditor-resource/dialogs/internal.js +2 -81
- package/ueditor-resource/dialogs/preview/preview.html +2 -2
- package/ueditor-resource/dialogs/scrawl/scrawl.css +2 -323
- package/ueditor-resource/dialogs/scrawl/scrawl.html +3 -3
- package/ueditor-resource/dialogs/scrawl/scrawl.js +2 -682
- package/ueditor-resource/dialogs/searchreplace/searchreplace.html +2 -2
- package/ueditor-resource/dialogs/searchreplace/searchreplace.js +2 -174
- package/ueditor-resource/dialogs/spechars/spechars.html +2 -2
- package/ueditor-resource/dialogs/spechars/spechars.js +2 -86
- package/ueditor-resource/dialogs/table/edittable.css +2 -84
- package/ueditor-resource/dialogs/table/edittable.html +3 -3
- package/ueditor-resource/dialogs/table/edittable.js +2 -241
- package/ueditor-resource/dialogs/table/edittd.html +1 -1
- package/ueditor-resource/dialogs/table/edittip.html +1 -1
- package/ueditor-resource/dialogs/template/config.js +2 -42
- package/ueditor-resource/dialogs/template/template.css +2 -98
- package/ueditor-resource/dialogs/template/template.html +4 -4
- package/ueditor-resource/dialogs/template/template.js +2 -53
- package/ueditor-resource/dialogs/video/video.css +2 -908
- package/ueditor-resource/dialogs/video/video.js +2 -867
- package/ueditor-resource/dialogs/wordimage/wordimage.html +5 -5
- package/ueditor-resource/dialogs/wordimage/wordimage.js +2 -93
- package/ueditor-resource/lang/en/en.js +2 -686
- package/ueditor-resource/lang/zh-cn/zh-cn.js +2 -748
- package/ueditor-resource/lang/zh-tw/zh-tw.js +2 -748
- package/ueditor-resource/plugins/browser-image-compression.js +9 -0
- package/ueditor-resource/themes/default/css/ueditor.css +2 -2148
- package/ueditor-resource/themes/default/dialog.css +2 -16
- package/ueditor-resource/themes/default/dialogbase.css +2 -131
- package/ueditor-resource/themes/iframe.css +2 -62
- package/ueditor-resource/third-party/SyntaxHighlighter/shCore.js +4 -3655
- package/ueditor-resource/third-party/SyntaxHighlighter/shCoreDefault.css +3 -1
- package/ueditor-resource/third-party/clipboard/clipboard.js +2 -753
- package/ueditor-resource/third-party/codemirror/codemirror.css +2 -105
- package/ueditor-resource/third-party/codemirror/codemirror.js +4 -3581
- package/ueditor-resource/third-party/jquery-3.5.1.js +4 -2
- package/ueditor-resource/third-party/jquery-3.5.1_1.js +4 -4314
- package/ueditor-resource/third-party/webuploader/webuploader.css +2 -87
- package/ueditor-resource/third-party/webuploader/webuploader.js +5 -4
- package/ueditor-resource/ueditor.all.js +23 -32644
- package/ueditor-resource/ueditor.config.js +2 -655
- package/ueditor-resource/ueditor.parse.js +2 -639
- package/es/LcdpUeditor.d.ts.map +0 -1
- package/es/const.d.ts.map +0 -1
- package/es/index.d.ts.map +0 -1
- package/es/tools/UeditorResourceLoader.d.ts.map +0 -1
- package/es/tools/filterHtmlNode.d.ts.map +0 -1
- package/es/tools/loadScript.d.ts.map +0 -1
- package/es/type.d.ts.map +0 -1
package/es/LcdpUeditor.d.ts
CHANGED
package/es/LcdpUeditor.js
CHANGED
|
@@ -60,6 +60,10 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
|
|
|
60
60
|
* 是否加载完成
|
|
61
61
|
*/
|
|
62
62
|
_defineProperty(_assertThisInitialized(_this), "isReady", false);
|
|
63
|
+
/**
|
|
64
|
+
* 保存 compositionend 事件处理器引用
|
|
65
|
+
*/
|
|
66
|
+
_defineProperty(_assertThisInitialized(_this), "compositionEndHandler", void 0);
|
|
63
67
|
/**
|
|
64
68
|
* 初始加载失败
|
|
65
69
|
*/
|
|
@@ -139,8 +143,14 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
|
|
|
139
143
|
key: "componentWillUnmount",
|
|
140
144
|
value: function componentWillUnmount() {
|
|
141
145
|
if (this.isReady) {
|
|
142
|
-
var _this$ueditorInst, _this$
|
|
143
|
-
(_this$ueditorInst = this.ueditorInst) === null || _this$ueditorInst === void 0
|
|
146
|
+
var _this$ueditorInst, _this$ueditorInst2, _this$ueditorInst2$de;
|
|
147
|
+
var editorBody = (_this$ueditorInst = this.ueditorInst) === null || _this$ueditorInst === void 0 ? void 0 : _this$ueditorInst.body;
|
|
148
|
+
if (editorBody && this.compositionEndHandler) {
|
|
149
|
+
// 销毁时移除监听
|
|
150
|
+
editorBody.removeEventListener('compositionend', this.compositionEndHandler);
|
|
151
|
+
this.compositionEndHandler = undefined;
|
|
152
|
+
}
|
|
153
|
+
(_this$ueditorInst2 = this.ueditorInst) === null || _this$ueditorInst2 === void 0 || (_this$ueditorInst2$de = _this$ueditorInst2.destroy) === null || _this$ueditorInst2$de === void 0 || _this$ueditorInst2$de.call(_this$ueditorInst2);
|
|
144
154
|
}
|
|
145
155
|
}
|
|
146
156
|
}, {
|
|
@@ -302,14 +312,30 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
|
|
|
302
312
|
value: (function () {
|
|
303
313
|
var _initUeditor = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
304
314
|
var _this3 = this;
|
|
305
|
-
var jsList;
|
|
315
|
+
var timer, readyFunc, jsList;
|
|
306
316
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
307
317
|
while (1) switch (_context3.prev = _context3.next) {
|
|
308
318
|
case 0:
|
|
309
|
-
|
|
319
|
+
// 在弹窗页面中反复开关,会导致 dom 丢失
|
|
320
|
+
readyFunc = function readyFunc() {
|
|
310
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
|
+
}
|
|
311
333
|
_this3.ueditorInst = window.UE.getEditor(_this3.containerId, _this3.editorConfig);
|
|
312
334
|
_this3.ueditorInst.ready(function () {
|
|
335
|
+
var nextValue = filterHtmlNode(_this3.props.value || '').str;
|
|
336
|
+
if (nextValue) {
|
|
337
|
+
_this3.ueditorInst.setContent(nextValue);
|
|
338
|
+
}
|
|
313
339
|
_this3.isReady = true;
|
|
314
340
|
// 禁用状态设置
|
|
315
341
|
if (_this3.props.disabled) {
|
|
@@ -320,18 +346,29 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
|
|
|
320
346
|
_this3.ueditorInst.addListener('contentChange', function () {
|
|
321
347
|
_this3.debounceContentChange();
|
|
322
348
|
});
|
|
349
|
+
|
|
350
|
+
// 处理微软拼音输入法输入中文时,内容不会触发contentChange事件
|
|
351
|
+
var editorBody = _this3.ueditorInst.body;
|
|
352
|
+
if (editorBody) {
|
|
353
|
+
_this3.compositionEndHandler = function () {
|
|
354
|
+
_this3.debounceContentChange();
|
|
355
|
+
};
|
|
356
|
+
editorBody.addEventListener('compositionend', _this3.compositionEndHandler);
|
|
357
|
+
}
|
|
323
358
|
_this3.initStyle();
|
|
359
|
+
_this3.mountRef();
|
|
324
360
|
});
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
361
|
+
};
|
|
362
|
+
UeditorResourceLoader.onReady(readyFunc);
|
|
363
|
+
// 默认配置 语言包 统一打包到 ueditor-all.js中
|
|
364
|
+
jsList = ["".concat(this.ueditorPath, "/").concat(DEFAULT_UEDITOR_CONFIG.UEDITOR_ALL)];
|
|
328
365
|
UeditorResourceLoader.onLoadError(function () {
|
|
329
366
|
_this3.setState({
|
|
330
367
|
initError: true
|
|
331
368
|
});
|
|
332
369
|
});
|
|
333
370
|
UeditorResourceLoader.startLoad(jsList);
|
|
334
|
-
case
|
|
371
|
+
case 5:
|
|
335
372
|
case "end":
|
|
336
373
|
return _context3.stop();
|
|
337
374
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
declare class UeditorResourceLoader {
|
|
2
2
|
private static instance;
|
|
3
|
+
private static ueditorIsLoad;
|
|
3
4
|
private callbackList;
|
|
4
5
|
private errorCallbackList;
|
|
5
6
|
private isReady;
|
|
6
|
-
private loading;
|
|
7
7
|
private initError;
|
|
8
8
|
static startLoad(jsList: string[]): Promise<void>;
|
|
9
9
|
static getInstance(): UeditorResourceLoader;
|
|
@@ -10,10 +10,17 @@ var UeditorResourceLoader = /*#__PURE__*/function () {
|
|
|
10
10
|
_defineProperty(this, "callbackList", []);
|
|
11
11
|
_defineProperty(this, "errorCallbackList", []);
|
|
12
12
|
_defineProperty(this, "isReady", false);
|
|
13
|
-
_defineProperty(this, "loading", false);
|
|
14
13
|
_defineProperty(this, "initError", false);
|
|
15
14
|
}
|
|
16
15
|
_createClass(UeditorResourceLoader, null, [{
|
|
16
|
+
key: "ueditorIsLoad",
|
|
17
|
+
value:
|
|
18
|
+
// 编辑器已经加载
|
|
19
|
+
function ueditorIsLoad() {
|
|
20
|
+
var _window;
|
|
21
|
+
return !!((_window = window) !== null && _window !== void 0 && (_window = _window.UE) !== null && _window !== void 0 && _window.getEditor);
|
|
22
|
+
}
|
|
23
|
+
}, {
|
|
17
24
|
key: "startLoad",
|
|
18
25
|
value: function () {
|
|
19
26
|
var _startLoad = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(jsList) {
|
|
@@ -22,19 +29,19 @@ var UeditorResourceLoader = /*#__PURE__*/function () {
|
|
|
22
29
|
while (1) switch (_context.prev = _context.next) {
|
|
23
30
|
case 0:
|
|
24
31
|
inst = this.getInstance();
|
|
25
|
-
if (!(!
|
|
32
|
+
if (!(!window.loadingUE && !inst.isReady || inst.initError)) {
|
|
26
33
|
_context.next = 14;
|
|
27
34
|
break;
|
|
28
35
|
}
|
|
29
|
-
|
|
36
|
+
window.loadingUE = true;
|
|
30
37
|
inst.initError = false;
|
|
31
38
|
_context.prev = 4;
|
|
32
39
|
_context.next = 7;
|
|
33
40
|
return loadScriptSync(jsList);
|
|
34
41
|
case 7:
|
|
35
|
-
if (
|
|
42
|
+
if (UeditorResourceLoader.ueditorIsLoad()) {
|
|
36
43
|
inst.isReady = true;
|
|
37
|
-
|
|
44
|
+
window.loadingUE = false;
|
|
38
45
|
|
|
39
46
|
// 执行callback中的回调函数
|
|
40
47
|
while (inst.callbackList.length) {
|
|
@@ -42,7 +49,7 @@ var UeditorResourceLoader = /*#__PURE__*/function () {
|
|
|
42
49
|
cb && cb();
|
|
43
50
|
}
|
|
44
51
|
} else {
|
|
45
|
-
|
|
52
|
+
window.loadingUE = false;
|
|
46
53
|
inst.isReady = false;
|
|
47
54
|
inst.initError = true;
|
|
48
55
|
while (inst.errorCallbackList.length) {
|
|
@@ -55,7 +62,7 @@ var UeditorResourceLoader = /*#__PURE__*/function () {
|
|
|
55
62
|
case 10:
|
|
56
63
|
_context.prev = 10;
|
|
57
64
|
_context.t0 = _context["catch"](4);
|
|
58
|
-
|
|
65
|
+
window.loadingUE = false;
|
|
59
66
|
inst.isReady = false;
|
|
60
67
|
case 14:
|
|
61
68
|
case "end":
|
|
@@ -74,6 +81,10 @@ var UeditorResourceLoader = /*#__PURE__*/function () {
|
|
|
74
81
|
if (!this.instance) {
|
|
75
82
|
this.instance = new UeditorResourceLoader();
|
|
76
83
|
}
|
|
84
|
+
if (UeditorResourceLoader.ueditorIsLoad()) {
|
|
85
|
+
this.instance.isReady = true;
|
|
86
|
+
window.loadingUE = false;
|
|
87
|
+
}
|
|
77
88
|
return this.instance;
|
|
78
89
|
}
|
|
79
90
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export var filterHtmlNode = function filterHtmlNode(str) {
|
|
2
|
+
var _doc$body;
|
|
2
3
|
var flag = false;
|
|
3
4
|
if (typeof str !== 'string') return str || '';
|
|
4
5
|
var blacklist = ['script', 'style', 'iframe'];
|
|
@@ -11,6 +12,9 @@ export var filterHtmlNode = function filterHtmlNode(str) {
|
|
|
11
12
|
|
|
12
13
|
// 遍历 DOM 树并删除恶意节点
|
|
13
14
|
function cleanNode(node) {
|
|
15
|
+
if (!node) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
14
18
|
if (node.nodeType === 1) {
|
|
15
19
|
// 元素节点
|
|
16
20
|
if (blacklist.indexOf(node.nodeName.toLowerCase()) !== -1) {
|
|
@@ -28,13 +32,14 @@ export var filterHtmlNode = function filterHtmlNode(str) {
|
|
|
28
32
|
}
|
|
29
33
|
}
|
|
30
34
|
}
|
|
31
|
-
for (var _i = 0; _i < node.childNodes.length; _i += 1) {
|
|
35
|
+
for (var _i = 0; _i < (node === null || node === void 0 || (_node$childNodes = node.childNodes) === null || _node$childNodes === void 0 ? void 0 : _node$childNodes.length); _i += 1) {
|
|
36
|
+
var _node$childNodes;
|
|
32
37
|
cleanNode(node.childNodes[_i]);
|
|
33
38
|
}
|
|
34
39
|
}
|
|
35
40
|
cleanNode(doc.body);
|
|
36
41
|
return {
|
|
37
|
-
str: doc.body.innerHTML,
|
|
42
|
+
str: ((_doc$body = doc.body) === null || _doc$body === void 0 ? void 0 : _doc$body.innerHTML) || '',
|
|
38
43
|
flag: flag,
|
|
39
44
|
source: str
|
|
40
45
|
};
|
package/lib/LcdpUeditor.d.ts
CHANGED
package/lib/LcdpUeditor.js
CHANGED
|
@@ -136,9 +136,14 @@ var LcdpUeditor = class extends import_react.default.Component {
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
componentWillUnmount() {
|
|
139
|
-
var _a, _b;
|
|
139
|
+
var _a, _b, _c;
|
|
140
140
|
if (this.isReady) {
|
|
141
|
-
|
|
141
|
+
const editorBody = (_a = this.ueditorInst) == null ? void 0 : _a.body;
|
|
142
|
+
if (editorBody && this.compositionEndHandler) {
|
|
143
|
+
editorBody.removeEventListener("compositionend", this.compositionEndHandler);
|
|
144
|
+
this.compositionEndHandler = void 0;
|
|
145
|
+
}
|
|
146
|
+
(_c = (_b = this.ueditorInst) == null ? void 0 : _b.destroy) == null ? void 0 : _c.call(_b);
|
|
142
147
|
}
|
|
143
148
|
}
|
|
144
149
|
onContentChange() {
|
|
@@ -234,10 +239,26 @@ var LcdpUeditor = class extends import_react.default.Component {
|
|
|
234
239
|
* 初始化编辑器实例
|
|
235
240
|
*/
|
|
236
241
|
async initUeditor() {
|
|
237
|
-
|
|
242
|
+
let timer;
|
|
243
|
+
const readyFunc = () => {
|
|
238
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
|
+
}
|
|
239
256
|
this.ueditorInst = window.UE.getEditor(this.containerId, this.editorConfig);
|
|
240
257
|
this.ueditorInst.ready(() => {
|
|
258
|
+
const nextValue = (0, import_filterHtmlNode.filterHtmlNode)(this.props.value || "").str;
|
|
259
|
+
if (nextValue) {
|
|
260
|
+
this.ueditorInst.setContent(nextValue);
|
|
261
|
+
}
|
|
241
262
|
this.isReady = true;
|
|
242
263
|
if (this.props.disabled) {
|
|
243
264
|
this.ueditorInst.setDisabled();
|
|
@@ -247,15 +268,19 @@ var LcdpUeditor = class extends import_react.default.Component {
|
|
|
247
268
|
this.ueditorInst.addListener("contentChange", () => {
|
|
248
269
|
this.debounceContentChange();
|
|
249
270
|
});
|
|
271
|
+
const editorBody = this.ueditorInst.body;
|
|
272
|
+
if (editorBody) {
|
|
273
|
+
this.compositionEndHandler = () => {
|
|
274
|
+
this.debounceContentChange();
|
|
275
|
+
};
|
|
276
|
+
editorBody.addEventListener("compositionend", this.compositionEndHandler);
|
|
277
|
+
}
|
|
250
278
|
this.initStyle();
|
|
279
|
+
this.mountRef();
|
|
251
280
|
});
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
const jsList = [
|
|
255
|
-
`${this.ueditorPath}/${import_const.DEFAULT_UEDITOR_CONFIG.UEDITOR_CONFIG}`,
|
|
256
|
-
`${this.ueditorPath}/${import_const.DEFAULT_UEDITOR_CONFIG.UEDITOR_ALL}`,
|
|
257
|
-
`${this.ueditorPath}/${import_const.DEFAULT_UEDITOR_CONFIG.GET_UEDITOR_LANG(this.props.lang || "zh-cn")}`
|
|
258
|
-
];
|
|
281
|
+
};
|
|
282
|
+
import_UeditorResourceLoader.default.onReady(readyFunc);
|
|
283
|
+
const jsList = [`${this.ueditorPath}/${import_const.DEFAULT_UEDITOR_CONFIG.UEDITOR_ALL}`];
|
|
259
284
|
import_UeditorResourceLoader.default.onLoadError(() => {
|
|
260
285
|
this.setState({
|
|
261
286
|
initError: true
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
declare class UeditorResourceLoader {
|
|
2
2
|
private static instance;
|
|
3
|
+
private static ueditorIsLoad;
|
|
3
4
|
private callbackList;
|
|
4
5
|
private errorCallbackList;
|
|
5
6
|
private isReady;
|
|
6
|
-
private loading;
|
|
7
7
|
private initError;
|
|
8
8
|
static startLoad(jsList: string[]): Promise<void>;
|
|
9
9
|
static getInstance(): UeditorResourceLoader;
|
|
@@ -28,25 +28,29 @@ var UeditorResourceLoader = class {
|
|
|
28
28
|
this.callbackList = [];
|
|
29
29
|
this.errorCallbackList = [];
|
|
30
30
|
this.isReady = false;
|
|
31
|
-
this.loading = false;
|
|
32
31
|
this.initError = false;
|
|
33
32
|
}
|
|
33
|
+
// 编辑器已经加载
|
|
34
|
+
static ueditorIsLoad() {
|
|
35
|
+
var _a;
|
|
36
|
+
return !!((_a = window == null ? void 0 : window.UE) == null ? void 0 : _a.getEditor);
|
|
37
|
+
}
|
|
34
38
|
static async startLoad(jsList) {
|
|
35
39
|
const inst = this.getInstance();
|
|
36
|
-
if (!
|
|
37
|
-
|
|
40
|
+
if (!window.loadingUE && !inst.isReady || inst.initError) {
|
|
41
|
+
window.loadingUE = true;
|
|
38
42
|
inst.initError = false;
|
|
39
43
|
try {
|
|
40
44
|
await (0, import_loadScript.loadScriptSync)(jsList);
|
|
41
|
-
if (
|
|
45
|
+
if (UeditorResourceLoader.ueditorIsLoad()) {
|
|
42
46
|
inst.isReady = true;
|
|
43
|
-
|
|
47
|
+
window.loadingUE = false;
|
|
44
48
|
while (inst.callbackList.length) {
|
|
45
49
|
const cb = inst.callbackList.pop();
|
|
46
50
|
cb && cb();
|
|
47
51
|
}
|
|
48
52
|
} else {
|
|
49
|
-
|
|
53
|
+
window.loadingUE = false;
|
|
50
54
|
inst.isReady = false;
|
|
51
55
|
inst.initError = true;
|
|
52
56
|
while (inst.errorCallbackList.length) {
|
|
@@ -55,7 +59,7 @@ var UeditorResourceLoader = class {
|
|
|
55
59
|
}
|
|
56
60
|
}
|
|
57
61
|
} catch (error) {
|
|
58
|
-
|
|
62
|
+
window.loadingUE = false;
|
|
59
63
|
inst.isReady = false;
|
|
60
64
|
}
|
|
61
65
|
}
|
|
@@ -64,6 +68,10 @@ var UeditorResourceLoader = class {
|
|
|
64
68
|
if (!this.instance) {
|
|
65
69
|
this.instance = new UeditorResourceLoader();
|
|
66
70
|
}
|
|
71
|
+
if (UeditorResourceLoader.ueditorIsLoad()) {
|
|
72
|
+
this.instance.isReady = true;
|
|
73
|
+
window.loadingUE = false;
|
|
74
|
+
}
|
|
67
75
|
return this.instance;
|
|
68
76
|
}
|
|
69
77
|
/**
|
|
@@ -23,6 +23,7 @@ __export(filterHtmlNode_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(filterHtmlNode_exports);
|
|
25
25
|
var filterHtmlNode = (str) => {
|
|
26
|
+
var _a;
|
|
26
27
|
let flag = false;
|
|
27
28
|
if (typeof str !== "string")
|
|
28
29
|
return str || "";
|
|
@@ -30,10 +31,13 @@ var filterHtmlNode = (str) => {
|
|
|
30
31
|
const parser = new DOMParser();
|
|
31
32
|
const doc = parser.parseFromString(str, "text/html");
|
|
32
33
|
function cleanNode(node) {
|
|
33
|
-
var
|
|
34
|
+
var _a2, _b;
|
|
35
|
+
if (!node) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
34
38
|
if (node.nodeType === 1) {
|
|
35
39
|
if (blacklist.indexOf(node.nodeName.toLowerCase()) !== -1) {
|
|
36
|
-
(
|
|
40
|
+
(_a2 = node.parentNode) == null ? void 0 : _a2.removeChild(node);
|
|
37
41
|
return;
|
|
38
42
|
}
|
|
39
43
|
for (let i = node.attributes.length - 1; i >= 0; i -= 1) {
|
|
@@ -44,13 +48,13 @@ var filterHtmlNode = (str) => {
|
|
|
44
48
|
}
|
|
45
49
|
}
|
|
46
50
|
}
|
|
47
|
-
for (let i = 0; i < node.childNodes.length; i += 1) {
|
|
51
|
+
for (let i = 0; i < ((_b = node == null ? void 0 : node.childNodes) == null ? void 0 : _b.length); i += 1) {
|
|
48
52
|
cleanNode(node.childNodes[i]);
|
|
49
53
|
}
|
|
50
54
|
}
|
|
51
55
|
cleanNode(doc.body);
|
|
52
56
|
return {
|
|
53
|
-
str: doc.body.innerHTML,
|
|
57
|
+
str: ((_a = doc.body) == null ? void 0 : _a.innerHTML) || "",
|
|
54
58
|
flag,
|
|
55
59
|
source: str
|
|
56
60
|
};
|
package/package.json
CHANGED
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
<div class="content">
|
|
38
38
|
<span><var id="lang_input_anchorName"></var></span><input id="anchorName" value=""/>
|
|
39
39
|
</div>
|
|
40
|
-
<script type="text/javascript" src="../internal.js?
|
|
40
|
+
<script type="text/javascript" src="../internal.js?b983a808"></script>
|
|
41
41
|
<script type="text/javascript">
|
|
42
42
|
var anchorInput = $G('anchorName'),
|
|
43
43
|
node = editor.selection.getRange().getClosedNode();
|