@lingxiteam/lcdp-ueditor-react 1.0.1 → 1.0.3-alpha.1
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 +1 -0
- package/es/LcdpUeditor.js +17 -7
- package/es/tools/UeditorResourceLoader.d.ts +1 -1
- package/es/tools/UeditorResourceLoader.js +18 -7
- package/lib/LcdpUeditor.d.ts +1 -0
- package/lib/LcdpUeditor.js +13 -9
- package/lib/tools/UeditorResourceLoader.d.ts +1 -1
- package/lib/tools/UeditorResourceLoader.js +15 -7
- 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/demo/demo.js +1 -3
- package/ueditor-resource/themes/default/css/ueditor.css +2 -2147
- 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 +3 -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 +20 -32644
- package/ueditor-resource/ueditor.config.js +2 -655
- package/ueditor-resource/ueditor.parse.js +2 -639
package/es/LcdpUeditor.d.ts
CHANGED
package/es/LcdpUeditor.js
CHANGED
|
@@ -75,8 +75,6 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
|
|
|
75
75
|
if (_this.props.ueditorPath) {
|
|
76
76
|
_this.ueditorPath = _this.props.ueditorPath;
|
|
77
77
|
}
|
|
78
|
-
var nextValue = filterHtmlNode(_this.props.value || '').str;
|
|
79
|
-
_this.currentContent = nextValue;
|
|
80
78
|
_this.uploadFunction = function (file, type) {
|
|
81
79
|
var _this$props$config;
|
|
82
80
|
// TODO 内置上传 图片base64
|
|
@@ -108,7 +106,7 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
|
|
|
108
106
|
_this.fileSelect(cb, type);
|
|
109
107
|
},
|
|
110
108
|
uploadFunction: _this.uploadFunction,
|
|
111
|
-
initialContent:
|
|
109
|
+
initialContent: '',
|
|
112
110
|
pasteplain: (config === null || config === void 0 ? void 0 : config.pasteplain) === true
|
|
113
111
|
});
|
|
114
112
|
_this.debounceContentChange = debounce(_this.onContentChange.bind(_assertThisInitialized(_this)), 300);
|
|
@@ -167,6 +165,18 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
|
|
|
167
165
|
}
|
|
168
166
|
return str || '';
|
|
169
167
|
}
|
|
168
|
+
}, {
|
|
169
|
+
key: "initConfig",
|
|
170
|
+
value: function initConfig() {
|
|
171
|
+
if (this.props.toolbars) {
|
|
172
|
+
this.editorConfig.toolbars = this.props.toolbars;
|
|
173
|
+
}
|
|
174
|
+
var nextValue = filterHtmlNode(this.props.value || '').str;
|
|
175
|
+
this.currentContent = nextValue;
|
|
176
|
+
if (nextValue) {
|
|
177
|
+
this.editorConfig.initialContent = nextValue;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
170
180
|
|
|
171
181
|
/**
|
|
172
182
|
* 文件选择
|
|
@@ -297,9 +307,7 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
|
|
|
297
307
|
while (1) switch (_context3.prev = _context3.next) {
|
|
298
308
|
case 0:
|
|
299
309
|
UeditorResourceLoader.onReady(function () {
|
|
300
|
-
|
|
301
|
-
_this3.editorConfig.toolbars = _this3.props.toolbars;
|
|
302
|
-
}
|
|
310
|
+
_this3.initConfig();
|
|
303
311
|
_this3.ueditorInst = window.UE.getEditor(_this3.containerId, _this3.editorConfig);
|
|
304
312
|
_this3.ueditorInst.ready(function () {
|
|
305
313
|
_this3.isReady = true;
|
|
@@ -316,7 +324,9 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
|
|
|
316
324
|
});
|
|
317
325
|
_this3.mountRef();
|
|
318
326
|
});
|
|
319
|
-
|
|
327
|
+
|
|
328
|
+
// 默认配置 语言包 统一打包到 ueditor-all.js中
|
|
329
|
+
jsList = ["".concat(this.ueditorPath, "/").concat(DEFAULT_UEDITOR_CONFIG.UEDITOR_ALL)];
|
|
320
330
|
UeditorResourceLoader.onLoadError(function () {
|
|
321
331
|
_this3.setState({
|
|
322
332
|
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;
|
|
@@ -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
|
|
package/lib/LcdpUeditor.d.ts
CHANGED
package/lib/LcdpUeditor.js
CHANGED
|
@@ -84,8 +84,6 @@ var LcdpUeditor = class extends import_react.default.Component {
|
|
|
84
84
|
if (this.props.ueditorPath) {
|
|
85
85
|
this.ueditorPath = this.props.ueditorPath;
|
|
86
86
|
}
|
|
87
|
-
const nextValue = (0, import_filterHtmlNode.filterHtmlNode)(this.props.value || "").str;
|
|
88
|
-
this.currentContent = nextValue;
|
|
89
87
|
this.uploadFunction = (file, type) => {
|
|
90
88
|
var _a;
|
|
91
89
|
if (type === "image" && ((_a = this.props.config) == null ? void 0 : _a.imageType) === "base64") {
|
|
@@ -114,7 +112,7 @@ var LcdpUeditor = class extends import_react.default.Component {
|
|
|
114
112
|
this.fileSelect(cb, type);
|
|
115
113
|
},
|
|
116
114
|
uploadFunction: this.uploadFunction,
|
|
117
|
-
initialContent:
|
|
115
|
+
initialContent: "",
|
|
118
116
|
pasteplain: (config == null ? void 0 : config.pasteplain) === true
|
|
119
117
|
};
|
|
120
118
|
this.debounceContentChange = (0, import_debounce.default)(this.onContentChange.bind(this), 300);
|
|
@@ -158,6 +156,16 @@ var LcdpUeditor = class extends import_react.default.Component {
|
|
|
158
156
|
}
|
|
159
157
|
return str || "";
|
|
160
158
|
}
|
|
159
|
+
initConfig() {
|
|
160
|
+
if (this.props.toolbars) {
|
|
161
|
+
this.editorConfig.toolbars = this.props.toolbars;
|
|
162
|
+
}
|
|
163
|
+
const nextValue = (0, import_filterHtmlNode.filterHtmlNode)(this.props.value || "").str;
|
|
164
|
+
this.currentContent = nextValue;
|
|
165
|
+
if (nextValue) {
|
|
166
|
+
this.editorConfig.initialContent = nextValue;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
161
169
|
/**
|
|
162
170
|
* 文件选择
|
|
163
171
|
* @param cb 回调给编辑器
|
|
@@ -227,9 +235,7 @@ var LcdpUeditor = class extends import_react.default.Component {
|
|
|
227
235
|
*/
|
|
228
236
|
async initUeditor() {
|
|
229
237
|
import_UeditorResourceLoader.default.onReady(() => {
|
|
230
|
-
|
|
231
|
-
this.editorConfig.toolbars = this.props.toolbars;
|
|
232
|
-
}
|
|
238
|
+
this.initConfig();
|
|
233
239
|
this.ueditorInst = window.UE.getEditor(this.containerId, this.editorConfig);
|
|
234
240
|
this.ueditorInst.ready(() => {
|
|
235
241
|
this.isReady = true;
|
|
@@ -246,9 +252,7 @@ var LcdpUeditor = class extends import_react.default.Component {
|
|
|
246
252
|
this.mountRef();
|
|
247
253
|
});
|
|
248
254
|
const jsList = [
|
|
249
|
-
`${this.ueditorPath}/${import_const.DEFAULT_UEDITOR_CONFIG.
|
|
250
|
-
`${this.ueditorPath}/${import_const.DEFAULT_UEDITOR_CONFIG.UEDITOR_ALL}`,
|
|
251
|
-
`${this.ueditorPath}/${import_const.DEFAULT_UEDITOR_CONFIG.GET_UEDITOR_LANG(this.props.lang || "zh-cn")}`
|
|
255
|
+
`${this.ueditorPath}/${import_const.DEFAULT_UEDITOR_CONFIG.UEDITOR_ALL}`
|
|
252
256
|
];
|
|
253
257
|
import_UeditorResourceLoader.default.onLoadError(() => {
|
|
254
258
|
this.setState({
|
|
@@ -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
|
/**
|
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?04dbe7f0"></script>
|
|
41
41
|
<script type="text/javascript">
|
|
42
42
|
var anchorInput = $G('anchorName'),
|
|
43
43
|
node = editor.selection.getRange().getClosedNode();
|