@lingxiteam/lcdp-ueditor-react 1.0.3-alpha.1 → 1.0.3-alpha.3
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 +55 -37
- package/es/const.js +4 -4
- package/es/defaultConfig.json +76 -76
- package/es/tools/UeditorResourceLoader.js +6 -6
- package/es/tools/filterHtmlNode.js +7 -2
- package/es/tools/loadScript.js +3 -3
- package/lib/LcdpUeditor.d.ts +4 -0
- package/lib/LcdpUeditor.js +14 -2
- package/lib/defaultConfig.json +76 -76
- package/lib/tools/filterHtmlNode.js +8 -4
- package/package.json +35 -35
- package/ueditor-resource/dialogs/anchor/anchor.html +62 -62
- package/ueditor-resource/dialogs/attachment/attachment.css +2 -2
- package/ueditor-resource/dialogs/attachment/attachment.html +61 -61
- package/ueditor-resource/dialogs/audio/audio.css +2 -2
- package/ueditor-resource/dialogs/audio/audio.html +93 -93
- package/ueditor-resource/dialogs/background/background.css +2 -2
- package/ueditor-resource/dialogs/background/background.html +59 -59
- package/ueditor-resource/dialogs/contentimport/contentimport.html +176 -176
- package/ueditor-resource/dialogs/emotion/emotion.css +2 -2
- package/ueditor-resource/dialogs/emotion/emotion.html +70 -70
- package/ueditor-resource/dialogs/formula/formula.html +98 -98
- package/ueditor-resource/dialogs/help/help.css +2 -2
- package/ueditor-resource/dialogs/help/help.html +82 -82
- package/ueditor-resource/dialogs/image/image.css +2 -2
- package/ueditor-resource/dialogs/image/image.html +144 -144
- package/ueditor-resource/dialogs/insertframe/insertframe.html +135 -135
- package/ueditor-resource/dialogs/link/link.html +148 -148
- package/ueditor-resource/dialogs/preview/preview.html +45 -45
- package/ueditor-resource/dialogs/scrawl/scrawl.css +2 -2
- package/ueditor-resource/dialogs/scrawl/scrawl.html +95 -95
- package/ueditor-resource/dialogs/searchreplace/searchreplace.html +144 -144
- package/ueditor-resource/dialogs/spechars/spechars.html +42 -42
- package/ueditor-resource/dialogs/table/edittable.css +2 -2
- package/ueditor-resource/dialogs/table/edittable.html +69 -69
- package/ueditor-resource/dialogs/table/edittd.html +62 -62
- package/ueditor-resource/dialogs/table/edittip.html +33 -33
- package/ueditor-resource/dialogs/template/template.css +2 -2
- package/ueditor-resource/dialogs/template/template.html +26 -26
- package/ueditor-resource/dialogs/video/video.css +2 -2
- package/ueditor-resource/dialogs/video/video.html +114 -114
- package/ueditor-resource/dialogs/wordimage/wordimage.html +221 -221
- package/ueditor-resource/themes/default/css/ueditor.css +2 -2
- package/ueditor-resource/themes/default/dialog.css +2 -2
- package/ueditor-resource/themes/default/dialogbase.css +2 -2
- package/ueditor-resource/themes/default/exts/ai.svg +12 -12
- package/ueditor-resource/themes/default/exts/apk.svg +12 -12
- package/ueditor-resource/themes/default/exts/chm.svg +12 -12
- package/ueditor-resource/themes/default/exts/css.svg +12 -12
- package/ueditor-resource/themes/default/exts/doc.svg +22 -22
- package/ueditor-resource/themes/default/exts/docx.svg +22 -22
- package/ueditor-resource/themes/default/exts/dwg.svg +16 -16
- package/ueditor-resource/themes/default/exts/folder.svg +3 -3
- package/ueditor-resource/themes/default/exts/gif.svg +14 -14
- package/ueditor-resource/themes/default/exts/html.svg +12 -12
- package/ueditor-resource/themes/default/exts/jpeg.svg +14 -14
- package/ueditor-resource/themes/default/exts/jpg.svg +14 -14
- package/ueditor-resource/themes/default/exts/log.svg +12 -12
- package/ueditor-resource/themes/default/exts/mp3.svg +14 -14
- package/ueditor-resource/themes/default/exts/mp4.svg +12 -12
- package/ueditor-resource/themes/default/exts/pdf.svg +14 -14
- package/ueditor-resource/themes/default/exts/png.svg +14 -14
- package/ueditor-resource/themes/default/exts/ppt.svg +24 -24
- package/ueditor-resource/themes/default/exts/pptx.svg +24 -24
- package/ueditor-resource/themes/default/exts/psd.svg +12 -12
- package/ueditor-resource/themes/default/exts/rar.svg +12 -12
- package/ueditor-resource/themes/default/exts/svg.svg +12 -12
- package/ueditor-resource/themes/default/exts/torrent.svg +14 -14
- package/ueditor-resource/themes/default/exts/txt.svg +14 -14
- package/ueditor-resource/themes/default/exts/unknown.svg +12 -12
- package/ueditor-resource/themes/default/exts/xls.svg +25 -25
- package/ueditor-resource/themes/default/exts/xlsx.svg +25 -25
- package/ueditor-resource/themes/default/exts/zip.svg +12 -12
- package/ueditor-resource/themes/iframe.css +2 -2
- package/ueditor-resource/third-party/SyntaxHighlighter/shCoreDefault.css +2 -2
- package/ueditor-resource/third-party/codemirror/codemirror.css +2 -2
- package/ueditor-resource/third-party/webuploader/webuploader.css +2 -2
- package/ueditor-resource/third-party/zeroclipboard/ZeroClipboard.js +1255 -1255
- package/ueditor-resource/ueditor.all.js +3 -3
package/es/LcdpUeditor.d.ts
CHANGED
package/es/LcdpUeditor.js
CHANGED
|
@@ -20,54 +20,58 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
|
|
|
20
20
|
var _this;
|
|
21
21
|
_classCallCheck(this, LcdpUeditor);
|
|
22
22
|
_this = _super.call(this, props);
|
|
23
|
-
/**
|
|
24
|
-
* 静态资源地址
|
|
23
|
+
/**
|
|
24
|
+
* 静态资源地址
|
|
25
25
|
*/
|
|
26
26
|
_defineProperty(_assertThisInitialized(_this), "ueditorPath", DEFAULT_UEDITOR_PATH);
|
|
27
|
-
/**
|
|
28
|
-
* 文件上传inputRef
|
|
27
|
+
/**
|
|
28
|
+
* 文件上传inputRef
|
|
29
29
|
*/
|
|
30
30
|
_defineProperty(_assertThisInitialized(_this), "inputRef", /*#__PURE__*/React.createRef());
|
|
31
|
-
/**
|
|
32
|
-
* 编辑器容器ref
|
|
31
|
+
/**
|
|
32
|
+
* 编辑器容器ref
|
|
33
33
|
*/
|
|
34
34
|
_defineProperty(_assertThisInitialized(_this), "containerRef", /*#__PURE__*/React.createRef());
|
|
35
|
-
/**
|
|
36
|
-
* 编辑器容器id
|
|
35
|
+
/**
|
|
36
|
+
* 编辑器容器id
|
|
37
37
|
*/
|
|
38
38
|
_defineProperty(_assertThisInitialized(_this), "containerId", void 0);
|
|
39
|
-
/**
|
|
40
|
-
* 编辑器实例
|
|
39
|
+
/**
|
|
40
|
+
* 编辑器实例
|
|
41
41
|
*/
|
|
42
42
|
_defineProperty(_assertThisInitialized(_this), "ueditorInst", null);
|
|
43
|
-
/**
|
|
44
|
-
* 是否上报
|
|
43
|
+
/**
|
|
44
|
+
* 是否上报
|
|
45
45
|
*/
|
|
46
46
|
_defineProperty(_assertThisInitialized(_this), "isReportFlag", true);
|
|
47
|
-
/**
|
|
48
|
-
* 值变化节流函数
|
|
47
|
+
/**
|
|
48
|
+
* 值变化节流函数
|
|
49
49
|
*/
|
|
50
50
|
_defineProperty(_assertThisInitialized(_this), "debounceContentChange", void 0);
|
|
51
|
-
/**
|
|
52
|
-
* 当前值
|
|
51
|
+
/**
|
|
52
|
+
* 当前值
|
|
53
53
|
*/
|
|
54
54
|
_defineProperty(_assertThisInitialized(_this), "currentContent", '');
|
|
55
|
-
/**
|
|
56
|
-
* 上传文件函数
|
|
55
|
+
/**
|
|
56
|
+
* 上传文件函数
|
|
57
57
|
*/
|
|
58
58
|
_defineProperty(_assertThisInitialized(_this), "uploadFunction", void 0);
|
|
59
|
-
/**
|
|
60
|
-
* 是否加载完成
|
|
59
|
+
/**
|
|
60
|
+
* 是否加载完成
|
|
61
61
|
*/
|
|
62
62
|
_defineProperty(_assertThisInitialized(_this), "isReady", false);
|
|
63
|
-
/**
|
|
64
|
-
*
|
|
63
|
+
/**
|
|
64
|
+
* 保存 compositionend 事件处理器引用
|
|
65
|
+
*/
|
|
66
|
+
_defineProperty(_assertThisInitialized(_this), "compositionEndHandler", void 0);
|
|
67
|
+
/**
|
|
68
|
+
* 初始加载失败
|
|
65
69
|
*/
|
|
66
70
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
67
71
|
initError: false
|
|
68
72
|
});
|
|
69
|
-
/**
|
|
70
|
-
* 编辑器配置项
|
|
73
|
+
/**
|
|
74
|
+
* 编辑器配置项
|
|
71
75
|
*/
|
|
72
76
|
_defineProperty(_assertThisInitialized(_this), "editorConfig", {});
|
|
73
77
|
var config = props.config;
|
|
@@ -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
|
}, {
|
|
@@ -178,10 +188,10 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
|
|
|
178
188
|
}
|
|
179
189
|
}
|
|
180
190
|
|
|
181
|
-
/**
|
|
182
|
-
* 文件选择
|
|
183
|
-
* @param cb 回调给编辑器
|
|
184
|
-
* @param type 类型
|
|
191
|
+
/**
|
|
192
|
+
* 文件选择
|
|
193
|
+
* @param cb 回调给编辑器
|
|
194
|
+
* @param type 类型
|
|
185
195
|
*/
|
|
186
196
|
}, {
|
|
187
197
|
key: "fileSelect",
|
|
@@ -259,8 +269,8 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
|
|
|
259
269
|
}
|
|
260
270
|
return fileSelect;
|
|
261
271
|
}()
|
|
262
|
-
/**
|
|
263
|
-
* 对外暴露编辑器实例
|
|
272
|
+
/**
|
|
273
|
+
* 对外暴露编辑器实例
|
|
264
274
|
*/
|
|
265
275
|
)
|
|
266
276
|
}, {
|
|
@@ -271,8 +281,8 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
|
|
|
271
281
|
}
|
|
272
282
|
}
|
|
273
283
|
|
|
274
|
-
/**
|
|
275
|
-
* 初始化样式
|
|
284
|
+
/**
|
|
285
|
+
* 初始化样式
|
|
276
286
|
*/
|
|
277
287
|
}, {
|
|
278
288
|
key: "initStyle",
|
|
@@ -294,8 +304,8 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
|
|
|
294
304
|
}
|
|
295
305
|
}
|
|
296
306
|
|
|
297
|
-
/**
|
|
298
|
-
* 初始化编辑器实例
|
|
307
|
+
/**
|
|
308
|
+
* 初始化编辑器实例
|
|
299
309
|
*/
|
|
300
310
|
}, {
|
|
301
311
|
key: "initUeditor",
|
|
@@ -320,11 +330,19 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
|
|
|
320
330
|
_this3.ueditorInst.addListener('contentChange', function () {
|
|
321
331
|
_this3.debounceContentChange();
|
|
322
332
|
});
|
|
333
|
+
|
|
334
|
+
// 处理微软拼音输入法输入中文时,内容不会触发contentChange事件
|
|
335
|
+
var editorBody = _this3.ueditorInst.body;
|
|
336
|
+
if (editorBody) {
|
|
337
|
+
_this3.compositionEndHandler = function () {
|
|
338
|
+
_this3.debounceContentChange();
|
|
339
|
+
};
|
|
340
|
+
editorBody.addEventListener('compositionend', _this3.compositionEndHandler);
|
|
341
|
+
}
|
|
323
342
|
_this3.initStyle();
|
|
324
343
|
});
|
|
325
344
|
_this3.mountRef();
|
|
326
345
|
});
|
|
327
|
-
|
|
328
346
|
// 默认配置 语言包 统一打包到 ueditor-all.js中
|
|
329
347
|
jsList = ["".concat(this.ueditorPath, "/").concat(DEFAULT_UEDITOR_CONFIG.UEDITOR_ALL)];
|
|
330
348
|
UeditorResourceLoader.onLoadError(function () {
|
package/es/const.js
CHANGED
package/es/defaultConfig.json
CHANGED
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
{
|
|
2
|
-
"imageActionName": "image",
|
|
3
|
-
"imageFieldName": "file",
|
|
4
|
-
"imageMaxSize": 10485760,
|
|
5
|
-
"imageAllowFiles": [
|
|
6
|
-
".jpg",
|
|
7
|
-
".png",
|
|
8
|
-
".jpeg"
|
|
9
|
-
],
|
|
10
|
-
"imageCompressEnable": true,
|
|
11
|
-
"imageCompressBorder": 5000,
|
|
12
|
-
"imageInsertAlign": "none",
|
|
13
|
-
"imageUrlPrefix": "",
|
|
14
|
-
"scrawlActionName": "crawl",
|
|
15
|
-
"scrawlFieldName": "file",
|
|
16
|
-
"scrawlMaxSize": 10485760,
|
|
17
|
-
"scrawlUrlPrefix": "",
|
|
18
|
-
"scrawlInsertAlign": "none",
|
|
19
|
-
"snapscreenActionName": "snap",
|
|
20
|
-
"snapscreenUrlPrefix": "",
|
|
21
|
-
"snapscreenInsertAlign": "none",
|
|
22
|
-
"catcherLocalDomain": [
|
|
23
|
-
"127.0.0.1",
|
|
24
|
-
"localhost"
|
|
25
|
-
],
|
|
26
|
-
"catcherActionName": "catch",
|
|
27
|
-
"catcherFieldName": "source",
|
|
28
|
-
"catcherUrlPrefix": "",
|
|
29
|
-
"catcherMaxSize": 10485760,
|
|
30
|
-
"catcherAllowFiles": [
|
|
31
|
-
".jpg",
|
|
32
|
-
".png",
|
|
33
|
-
".jpeg"
|
|
34
|
-
],
|
|
35
|
-
"videoActionName": "video",
|
|
36
|
-
"videoFieldName": "file",
|
|
37
|
-
"videoUrlPrefix": "",
|
|
38
|
-
"videoMaxSize": 104857600,
|
|
39
|
-
"videoAllowFiles": [
|
|
40
|
-
".mp4",
|
|
41
|
-
".webm",
|
|
42
|
-
".mkv"
|
|
43
|
-
],
|
|
44
|
-
"audioActionName": "audio",
|
|
45
|
-
"audioFieldName": "file",
|
|
46
|
-
"audioUrlPrefix": "",
|
|
47
|
-
"audioMaxSize": 104857600,
|
|
48
|
-
"audioAllowFiles": [
|
|
49
|
-
".mp3"
|
|
50
|
-
],
|
|
51
|
-
"fileActionName": "file",
|
|
52
|
-
"fileFieldName": "file",
|
|
53
|
-
"fileUrlPrefix": "",
|
|
54
|
-
"fileMaxSize": 104857600,
|
|
55
|
-
"fileAllowFiles": [
|
|
56
|
-
".zip",
|
|
57
|
-
".pdf",
|
|
58
|
-
".doc"
|
|
59
|
-
],
|
|
60
|
-
"imageManagerActionName": "listImage",
|
|
61
|
-
"imageManagerListSize": 20,
|
|
62
|
-
"imageManagerUrlPrefix": "",
|
|
63
|
-
"imageManagerInsertAlign": "none",
|
|
64
|
-
"imageManagerAllowFiles": [
|
|
65
|
-
".jpg",
|
|
66
|
-
".png",
|
|
67
|
-
".jpeg"
|
|
68
|
-
],
|
|
69
|
-
"fileManagerActionName": "listFile",
|
|
70
|
-
"fileManagerUrlPrefix": "",
|
|
71
|
-
"fileManagerListSize": 20,
|
|
72
|
-
"fileManagerAllowFiles": [
|
|
73
|
-
".zip",
|
|
74
|
-
".pdf",
|
|
75
|
-
".doc"
|
|
76
|
-
]
|
|
1
|
+
{
|
|
2
|
+
"imageActionName": "image",
|
|
3
|
+
"imageFieldName": "file",
|
|
4
|
+
"imageMaxSize": 10485760,
|
|
5
|
+
"imageAllowFiles": [
|
|
6
|
+
".jpg",
|
|
7
|
+
".png",
|
|
8
|
+
".jpeg"
|
|
9
|
+
],
|
|
10
|
+
"imageCompressEnable": true,
|
|
11
|
+
"imageCompressBorder": 5000,
|
|
12
|
+
"imageInsertAlign": "none",
|
|
13
|
+
"imageUrlPrefix": "",
|
|
14
|
+
"scrawlActionName": "crawl",
|
|
15
|
+
"scrawlFieldName": "file",
|
|
16
|
+
"scrawlMaxSize": 10485760,
|
|
17
|
+
"scrawlUrlPrefix": "",
|
|
18
|
+
"scrawlInsertAlign": "none",
|
|
19
|
+
"snapscreenActionName": "snap",
|
|
20
|
+
"snapscreenUrlPrefix": "",
|
|
21
|
+
"snapscreenInsertAlign": "none",
|
|
22
|
+
"catcherLocalDomain": [
|
|
23
|
+
"127.0.0.1",
|
|
24
|
+
"localhost"
|
|
25
|
+
],
|
|
26
|
+
"catcherActionName": "catch",
|
|
27
|
+
"catcherFieldName": "source",
|
|
28
|
+
"catcherUrlPrefix": "",
|
|
29
|
+
"catcherMaxSize": 10485760,
|
|
30
|
+
"catcherAllowFiles": [
|
|
31
|
+
".jpg",
|
|
32
|
+
".png",
|
|
33
|
+
".jpeg"
|
|
34
|
+
],
|
|
35
|
+
"videoActionName": "video",
|
|
36
|
+
"videoFieldName": "file",
|
|
37
|
+
"videoUrlPrefix": "",
|
|
38
|
+
"videoMaxSize": 104857600,
|
|
39
|
+
"videoAllowFiles": [
|
|
40
|
+
".mp4",
|
|
41
|
+
".webm",
|
|
42
|
+
".mkv"
|
|
43
|
+
],
|
|
44
|
+
"audioActionName": "audio",
|
|
45
|
+
"audioFieldName": "file",
|
|
46
|
+
"audioUrlPrefix": "",
|
|
47
|
+
"audioMaxSize": 104857600,
|
|
48
|
+
"audioAllowFiles": [
|
|
49
|
+
".mp3"
|
|
50
|
+
],
|
|
51
|
+
"fileActionName": "file",
|
|
52
|
+
"fileFieldName": "file",
|
|
53
|
+
"fileUrlPrefix": "",
|
|
54
|
+
"fileMaxSize": 104857600,
|
|
55
|
+
"fileAllowFiles": [
|
|
56
|
+
".zip",
|
|
57
|
+
".pdf",
|
|
58
|
+
".doc"
|
|
59
|
+
],
|
|
60
|
+
"imageManagerActionName": "listImage",
|
|
61
|
+
"imageManagerListSize": 20,
|
|
62
|
+
"imageManagerUrlPrefix": "",
|
|
63
|
+
"imageManagerInsertAlign": "none",
|
|
64
|
+
"imageManagerAllowFiles": [
|
|
65
|
+
".jpg",
|
|
66
|
+
".png",
|
|
67
|
+
".jpeg"
|
|
68
|
+
],
|
|
69
|
+
"fileManagerActionName": "listFile",
|
|
70
|
+
"fileManagerUrlPrefix": "",
|
|
71
|
+
"fileManagerListSize": 20,
|
|
72
|
+
"fileManagerAllowFiles": [
|
|
73
|
+
".zip",
|
|
74
|
+
".pdf",
|
|
75
|
+
".doc"
|
|
76
|
+
]
|
|
77
77
|
}
|
|
@@ -88,9 +88,9 @@ var UeditorResourceLoader = /*#__PURE__*/function () {
|
|
|
88
88
|
return this.instance;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
/**
|
|
92
|
-
* 加载完成执行
|
|
93
|
-
* @param callback 回调函数
|
|
91
|
+
/**
|
|
92
|
+
* 加载完成执行
|
|
93
|
+
* @param callback 回调函数
|
|
94
94
|
*/
|
|
95
95
|
}, {
|
|
96
96
|
key: "onReady",
|
|
@@ -103,9 +103,9 @@ var UeditorResourceLoader = /*#__PURE__*/function () {
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
/**
|
|
107
|
-
* 资源加载失败执行
|
|
108
|
-
* @param callback
|
|
106
|
+
/**
|
|
107
|
+
* 资源加载失败执行
|
|
108
|
+
* @param callback
|
|
109
109
|
*/
|
|
110
110
|
}, {
|
|
111
111
|
key: "onLoadError",
|
|
@@ -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/es/tools/loadScript.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
|
-
/**
|
|
4
|
-
* 同步加载js
|
|
5
|
-
* @param strs 路径地址
|
|
3
|
+
/**
|
|
4
|
+
* 同步加载js
|
|
5
|
+
* @param strs 路径地址
|
|
6
6
|
*/
|
|
7
7
|
export var loadScriptSync = /*#__PURE__*/function () {
|
|
8
8
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(strs) {
|
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() {
|
|
@@ -247,6 +252,13 @@ var LcdpUeditor = class extends import_react.default.Component {
|
|
|
247
252
|
this.ueditorInst.addListener("contentChange", () => {
|
|
248
253
|
this.debounceContentChange();
|
|
249
254
|
});
|
|
255
|
+
const editorBody = this.ueditorInst.body;
|
|
256
|
+
if (editorBody) {
|
|
257
|
+
this.compositionEndHandler = () => {
|
|
258
|
+
this.debounceContentChange();
|
|
259
|
+
};
|
|
260
|
+
editorBody.addEventListener("compositionend", this.compositionEndHandler);
|
|
261
|
+
}
|
|
250
262
|
this.initStyle();
|
|
251
263
|
});
|
|
252
264
|
this.mountRef();
|
package/lib/defaultConfig.json
CHANGED
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
{
|
|
2
|
-
"imageActionName": "image",
|
|
3
|
-
"imageFieldName": "file",
|
|
4
|
-
"imageMaxSize": 10485760,
|
|
5
|
-
"imageAllowFiles": [
|
|
6
|
-
".jpg",
|
|
7
|
-
".png",
|
|
8
|
-
".jpeg"
|
|
9
|
-
],
|
|
10
|
-
"imageCompressEnable": true,
|
|
11
|
-
"imageCompressBorder": 5000,
|
|
12
|
-
"imageInsertAlign": "none",
|
|
13
|
-
"imageUrlPrefix": "",
|
|
14
|
-
"scrawlActionName": "crawl",
|
|
15
|
-
"scrawlFieldName": "file",
|
|
16
|
-
"scrawlMaxSize": 10485760,
|
|
17
|
-
"scrawlUrlPrefix": "",
|
|
18
|
-
"scrawlInsertAlign": "none",
|
|
19
|
-
"snapscreenActionName": "snap",
|
|
20
|
-
"snapscreenUrlPrefix": "",
|
|
21
|
-
"snapscreenInsertAlign": "none",
|
|
22
|
-
"catcherLocalDomain": [
|
|
23
|
-
"127.0.0.1",
|
|
24
|
-
"localhost"
|
|
25
|
-
],
|
|
26
|
-
"catcherActionName": "catch",
|
|
27
|
-
"catcherFieldName": "source",
|
|
28
|
-
"catcherUrlPrefix": "",
|
|
29
|
-
"catcherMaxSize": 10485760,
|
|
30
|
-
"catcherAllowFiles": [
|
|
31
|
-
".jpg",
|
|
32
|
-
".png",
|
|
33
|
-
".jpeg"
|
|
34
|
-
],
|
|
35
|
-
"videoActionName": "video",
|
|
36
|
-
"videoFieldName": "file",
|
|
37
|
-
"videoUrlPrefix": "",
|
|
38
|
-
"videoMaxSize": 104857600,
|
|
39
|
-
"videoAllowFiles": [
|
|
40
|
-
".mp4",
|
|
41
|
-
".webm",
|
|
42
|
-
".mkv"
|
|
43
|
-
],
|
|
44
|
-
"audioActionName": "audio",
|
|
45
|
-
"audioFieldName": "file",
|
|
46
|
-
"audioUrlPrefix": "",
|
|
47
|
-
"audioMaxSize": 104857600,
|
|
48
|
-
"audioAllowFiles": [
|
|
49
|
-
".mp3"
|
|
50
|
-
],
|
|
51
|
-
"fileActionName": "file",
|
|
52
|
-
"fileFieldName": "file",
|
|
53
|
-
"fileUrlPrefix": "",
|
|
54
|
-
"fileMaxSize": 104857600,
|
|
55
|
-
"fileAllowFiles": [
|
|
56
|
-
".zip",
|
|
57
|
-
".pdf",
|
|
58
|
-
".doc"
|
|
59
|
-
],
|
|
60
|
-
"imageManagerActionName": "listImage",
|
|
61
|
-
"imageManagerListSize": 20,
|
|
62
|
-
"imageManagerUrlPrefix": "",
|
|
63
|
-
"imageManagerInsertAlign": "none",
|
|
64
|
-
"imageManagerAllowFiles": [
|
|
65
|
-
".jpg",
|
|
66
|
-
".png",
|
|
67
|
-
".jpeg"
|
|
68
|
-
],
|
|
69
|
-
"fileManagerActionName": "listFile",
|
|
70
|
-
"fileManagerUrlPrefix": "",
|
|
71
|
-
"fileManagerListSize": 20,
|
|
72
|
-
"fileManagerAllowFiles": [
|
|
73
|
-
".zip",
|
|
74
|
-
".pdf",
|
|
75
|
-
".doc"
|
|
76
|
-
]
|
|
1
|
+
{
|
|
2
|
+
"imageActionName": "image",
|
|
3
|
+
"imageFieldName": "file",
|
|
4
|
+
"imageMaxSize": 10485760,
|
|
5
|
+
"imageAllowFiles": [
|
|
6
|
+
".jpg",
|
|
7
|
+
".png",
|
|
8
|
+
".jpeg"
|
|
9
|
+
],
|
|
10
|
+
"imageCompressEnable": true,
|
|
11
|
+
"imageCompressBorder": 5000,
|
|
12
|
+
"imageInsertAlign": "none",
|
|
13
|
+
"imageUrlPrefix": "",
|
|
14
|
+
"scrawlActionName": "crawl",
|
|
15
|
+
"scrawlFieldName": "file",
|
|
16
|
+
"scrawlMaxSize": 10485760,
|
|
17
|
+
"scrawlUrlPrefix": "",
|
|
18
|
+
"scrawlInsertAlign": "none",
|
|
19
|
+
"snapscreenActionName": "snap",
|
|
20
|
+
"snapscreenUrlPrefix": "",
|
|
21
|
+
"snapscreenInsertAlign": "none",
|
|
22
|
+
"catcherLocalDomain": [
|
|
23
|
+
"127.0.0.1",
|
|
24
|
+
"localhost"
|
|
25
|
+
],
|
|
26
|
+
"catcherActionName": "catch",
|
|
27
|
+
"catcherFieldName": "source",
|
|
28
|
+
"catcherUrlPrefix": "",
|
|
29
|
+
"catcherMaxSize": 10485760,
|
|
30
|
+
"catcherAllowFiles": [
|
|
31
|
+
".jpg",
|
|
32
|
+
".png",
|
|
33
|
+
".jpeg"
|
|
34
|
+
],
|
|
35
|
+
"videoActionName": "video",
|
|
36
|
+
"videoFieldName": "file",
|
|
37
|
+
"videoUrlPrefix": "",
|
|
38
|
+
"videoMaxSize": 104857600,
|
|
39
|
+
"videoAllowFiles": [
|
|
40
|
+
".mp4",
|
|
41
|
+
".webm",
|
|
42
|
+
".mkv"
|
|
43
|
+
],
|
|
44
|
+
"audioActionName": "audio",
|
|
45
|
+
"audioFieldName": "file",
|
|
46
|
+
"audioUrlPrefix": "",
|
|
47
|
+
"audioMaxSize": 104857600,
|
|
48
|
+
"audioAllowFiles": [
|
|
49
|
+
".mp3"
|
|
50
|
+
],
|
|
51
|
+
"fileActionName": "file",
|
|
52
|
+
"fileFieldName": "file",
|
|
53
|
+
"fileUrlPrefix": "",
|
|
54
|
+
"fileMaxSize": 104857600,
|
|
55
|
+
"fileAllowFiles": [
|
|
56
|
+
".zip",
|
|
57
|
+
".pdf",
|
|
58
|
+
".doc"
|
|
59
|
+
],
|
|
60
|
+
"imageManagerActionName": "listImage",
|
|
61
|
+
"imageManagerListSize": 20,
|
|
62
|
+
"imageManagerUrlPrefix": "",
|
|
63
|
+
"imageManagerInsertAlign": "none",
|
|
64
|
+
"imageManagerAllowFiles": [
|
|
65
|
+
".jpg",
|
|
66
|
+
".png",
|
|
67
|
+
".jpeg"
|
|
68
|
+
],
|
|
69
|
+
"fileManagerActionName": "listFile",
|
|
70
|
+
"fileManagerUrlPrefix": "",
|
|
71
|
+
"fileManagerListSize": 20,
|
|
72
|
+
"fileManagerAllowFiles": [
|
|
73
|
+
".zip",
|
|
74
|
+
".pdf",
|
|
75
|
+
".doc"
|
|
76
|
+
]
|
|
77
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
|
};
|