@lingxiteam/lcdp-ueditor-react 1.0.0-alpha.1 → 1.0.0-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 +6 -0
- package/es/LcdpUeditor.d.ts.map +1 -0
- package/es/LcdpUeditor.js +37 -13
- package/es/const.d.ts.map +1 -0
- package/es/index.d.ts.map +1 -0
- package/es/tools/UeditorResourceLoader.d.ts.map +1 -0
- package/es/tools/loadScript.d.ts.map +1 -0
- package/es/type.d.ts +1 -1
- package/es/type.d.ts.map +1 -0
- package/lib/LcdpUeditor.d.ts +80 -0
- package/lib/LcdpUeditor.js +260 -0
- package/lib/const.d.ts +12 -0
- package/lib/const.js +39 -0
- package/lib/defaultConfig.json +77 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +41 -0
- package/lib/tools/UeditorResourceLoader.d.ts +21 -0
- package/lib/tools/UeditorResourceLoader.js +90 -0
- package/lib/tools/loadScript.d.ts +5 -0
- package/lib/tools/loadScript.js +39 -0
- package/lib/type.d.ts +142 -0
- package/lib/type.js +17 -0
- package/package.json +5 -3
- package/ueditor-resource/dialogs/image/image.js +1 -1
- package/ueditor-resource/dialogs/preview/preview.html +1 -1
- package/ueditor-resource/dialogs/video/video.js +1 -1
- package/ueditor-resource/index.html +146 -146
- package/ueditor-resource/lang/zh-tw/images/copy.png +0 -0
- package/ueditor-resource/lang/zh-tw/images/localimage.png +0 -0
- package/ueditor-resource/lang/zh-tw/images/music.png +0 -0
- package/ueditor-resource/lang/zh-tw/images/upload.png +0 -0
- package/ueditor-resource/lang/zh-tw/zh-tw.js +748 -0
- package/ueditor-resource/{ueditor.all.js → lcdp-ueditor.all.js} +2 -2
- package/ueditor-resource/themes/default/css/ueditor.css +1 -1
- package/ueditor-resource/ueditor.config.js +0 -1
- /package/ueditor-resource/{ueditor.parse.js → lcdp-ueditor.parse.js} +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
declare class UeditorResourceLoader {
|
|
2
|
+
private static instance;
|
|
3
|
+
private callbackList;
|
|
4
|
+
private errorCallbackList;
|
|
5
|
+
private isReady;
|
|
6
|
+
private loading;
|
|
7
|
+
private initError;
|
|
8
|
+
static startLoad(jsList: string[]): Promise<void>;
|
|
9
|
+
static getInstance(): UeditorResourceLoader;
|
|
10
|
+
/**
|
|
11
|
+
* 加载完成执行
|
|
12
|
+
* @param callback 回调函数
|
|
13
|
+
*/
|
|
14
|
+
static onReady(callback: Function): void;
|
|
15
|
+
/**
|
|
16
|
+
* 资源加载失败执行
|
|
17
|
+
* @param callback
|
|
18
|
+
*/
|
|
19
|
+
static onLoadError(callback: Function): void;
|
|
20
|
+
}
|
|
21
|
+
export default UeditorResourceLoader;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/tools/UeditorResourceLoader.ts
|
|
20
|
+
var UeditorResourceLoader_exports = {};
|
|
21
|
+
__export(UeditorResourceLoader_exports, {
|
|
22
|
+
default: () => UeditorResourceLoader_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(UeditorResourceLoader_exports);
|
|
25
|
+
var import_loadScript = require("./loadScript");
|
|
26
|
+
var UeditorResourceLoader = class {
|
|
27
|
+
constructor() {
|
|
28
|
+
this.callbackList = [];
|
|
29
|
+
this.errorCallbackList = [];
|
|
30
|
+
this.isReady = false;
|
|
31
|
+
this.loading = false;
|
|
32
|
+
this.initError = false;
|
|
33
|
+
}
|
|
34
|
+
static async startLoad(jsList) {
|
|
35
|
+
const inst = this.getInstance();
|
|
36
|
+
if (!inst.loading && !inst.isReady || inst.initError) {
|
|
37
|
+
inst.loading = true;
|
|
38
|
+
inst.initError = false;
|
|
39
|
+
try {
|
|
40
|
+
await (0, import_loadScript.loadScriptSync)(jsList);
|
|
41
|
+
if (window.UE) {
|
|
42
|
+
inst.isReady = true;
|
|
43
|
+
inst.loading = false;
|
|
44
|
+
while (inst.callbackList.length) {
|
|
45
|
+
const cb = inst.callbackList.pop();
|
|
46
|
+
cb && cb();
|
|
47
|
+
}
|
|
48
|
+
} else {
|
|
49
|
+
inst.loading = false;
|
|
50
|
+
inst.isReady = false;
|
|
51
|
+
inst.initError = true;
|
|
52
|
+
while (inst.errorCallbackList.length) {
|
|
53
|
+
const cb = inst.errorCallbackList.pop();
|
|
54
|
+
cb && cb();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
} catch (error) {
|
|
58
|
+
inst.loading = false;
|
|
59
|
+
inst.isReady = false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
static getInstance() {
|
|
64
|
+
if (!this.instance) {
|
|
65
|
+
this.instance = new UeditorResourceLoader();
|
|
66
|
+
}
|
|
67
|
+
return this.instance;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* 加载完成执行
|
|
71
|
+
* @param callback 回调函数
|
|
72
|
+
*/
|
|
73
|
+
static onReady(callback) {
|
|
74
|
+
const inst = this.getInstance();
|
|
75
|
+
if (inst.isReady) {
|
|
76
|
+
callback();
|
|
77
|
+
} else {
|
|
78
|
+
inst.callbackList.push(callback);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* 资源加载失败执行
|
|
83
|
+
* @param callback
|
|
84
|
+
*/
|
|
85
|
+
static onLoadError(callback) {
|
|
86
|
+
const inst = this.getInstance();
|
|
87
|
+
inst.errorCallbackList.push(callback);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
var UeditorResourceLoader_default = UeditorResourceLoader;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/tools/loadScript.ts
|
|
20
|
+
var loadScript_exports = {};
|
|
21
|
+
__export(loadScript_exports, {
|
|
22
|
+
loadScriptSync: () => loadScriptSync
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(loadScript_exports);
|
|
25
|
+
var loadScriptSync = async (strs) => {
|
|
26
|
+
for (let i = 0; i < strs.length; i += 1) {
|
|
27
|
+
const script = document.createElement("script");
|
|
28
|
+
script.src = strs[i];
|
|
29
|
+
script.async = false;
|
|
30
|
+
document.body.appendChild(script);
|
|
31
|
+
await new Promise((resolve) => {
|
|
32
|
+
script.onload = resolve;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
loadScriptSync
|
|
39
|
+
});
|
package/lib/type.d.ts
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface IUeditorStype extends React.CSSProperties {
|
|
3
|
+
toolbarColor?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ILcdpUeditorProps {
|
|
6
|
+
/**
|
|
7
|
+
* ueditor产物路径 默认 ./ueditor-resource
|
|
8
|
+
*/
|
|
9
|
+
ueditorPath?: string;
|
|
10
|
+
/**
|
|
11
|
+
* 样式类名
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* 编辑器样式
|
|
16
|
+
*/
|
|
17
|
+
style?: IUeditorStype;
|
|
18
|
+
/**
|
|
19
|
+
* 禁用
|
|
20
|
+
*/
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* 富文本配置
|
|
24
|
+
*/
|
|
25
|
+
config?: {
|
|
26
|
+
/**
|
|
27
|
+
* 编辑器高度 默认300px
|
|
28
|
+
*/
|
|
29
|
+
height?: number;
|
|
30
|
+
/**
|
|
31
|
+
* 图片类型
|
|
32
|
+
*/
|
|
33
|
+
imageType: 'file' | 'base64';
|
|
34
|
+
/**
|
|
35
|
+
* 上传大小限制,单位B,默认值:10485760
|
|
36
|
+
*/
|
|
37
|
+
imageMaxSize?: number;
|
|
38
|
+
/**
|
|
39
|
+
* 上传图片格式显示 [".png", ".jpg", ".jpeg", ".gif", ".bmp"]
|
|
40
|
+
*/
|
|
41
|
+
imageAllowFiles?: string[];
|
|
42
|
+
/**
|
|
43
|
+
* 上传大小限制,单位B,默认值:104857600
|
|
44
|
+
*/
|
|
45
|
+
fileMaxSize?: number;
|
|
46
|
+
/**
|
|
47
|
+
* 上传文件格式限制
|
|
48
|
+
*/
|
|
49
|
+
fileAllowFiles?: string[];
|
|
50
|
+
/**
|
|
51
|
+
* 上传音频大小限制,单位B,默认值:104857600
|
|
52
|
+
*/
|
|
53
|
+
audioMaxSize?: number;
|
|
54
|
+
/**
|
|
55
|
+
* 上传音频格式限制
|
|
56
|
+
*/
|
|
57
|
+
audioAllowFiles?: string[];
|
|
58
|
+
/**
|
|
59
|
+
* 上传视频大小限制,单位B,默认值:104857600
|
|
60
|
+
*/
|
|
61
|
+
videoMaxSize?: number;
|
|
62
|
+
/**
|
|
63
|
+
* 上传视频格式限制
|
|
64
|
+
*/
|
|
65
|
+
videoAllowFiles?: string[];
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* 语言 默认 zh-cn
|
|
69
|
+
* zh-cn 中文 en 英文
|
|
70
|
+
*/
|
|
71
|
+
lang?: 'zh-cn' | 'en' | 'zh-tw';
|
|
72
|
+
/**
|
|
73
|
+
* 上传方法
|
|
74
|
+
* @param file 文件
|
|
75
|
+
* @param fileType 文件类型
|
|
76
|
+
*/
|
|
77
|
+
uploadFunction(file: File): Promise<{
|
|
78
|
+
state: 'SUCCESS' | 'FAIL';
|
|
79
|
+
url?: string;
|
|
80
|
+
title?: string;
|
|
81
|
+
original?: string;
|
|
82
|
+
}>;
|
|
83
|
+
/**
|
|
84
|
+
* 编辑器挂载
|
|
85
|
+
* @param inst
|
|
86
|
+
*/
|
|
87
|
+
onMount?(inst: ILcdpUeditorInst): void;
|
|
88
|
+
/**
|
|
89
|
+
* 内容
|
|
90
|
+
*/
|
|
91
|
+
value?: string;
|
|
92
|
+
/**
|
|
93
|
+
* 内容改变事件
|
|
94
|
+
* @param val 编辑器内容
|
|
95
|
+
*/
|
|
96
|
+
onChange?(val: string): void;
|
|
97
|
+
}
|
|
98
|
+
export interface ILcdpUeditorInst {
|
|
99
|
+
/**
|
|
100
|
+
* 获取整个html内容
|
|
101
|
+
*/
|
|
102
|
+
getAllHtml(): string;
|
|
103
|
+
/**
|
|
104
|
+
* 获取内容
|
|
105
|
+
*/
|
|
106
|
+
getContent(): string;
|
|
107
|
+
/**
|
|
108
|
+
* 设置内容
|
|
109
|
+
* @param content 内容
|
|
110
|
+
* @param isAppend 是否追加
|
|
111
|
+
*/
|
|
112
|
+
setContent(content: string, isAppend?: boolean): void;
|
|
113
|
+
/**
|
|
114
|
+
* 获取纯文本内容
|
|
115
|
+
*/
|
|
116
|
+
getContentTxt(): string;
|
|
117
|
+
/**
|
|
118
|
+
* 获得带格式的纯文本
|
|
119
|
+
*/
|
|
120
|
+
getPlainTxt(): string;
|
|
121
|
+
/**
|
|
122
|
+
* 判断是否有内容
|
|
123
|
+
*/
|
|
124
|
+
hasContents(): boolean;
|
|
125
|
+
/**
|
|
126
|
+
* 使编辑器获得焦点
|
|
127
|
+
*/
|
|
128
|
+
focus(): void;
|
|
129
|
+
/**
|
|
130
|
+
* 编辑器是否获得焦点
|
|
131
|
+
*/
|
|
132
|
+
isFocus(): boolean;
|
|
133
|
+
/**
|
|
134
|
+
* 编辑器失去焦点
|
|
135
|
+
*/
|
|
136
|
+
setBlur(): void;
|
|
137
|
+
/**
|
|
138
|
+
* 获得当前选中的文本
|
|
139
|
+
*/
|
|
140
|
+
getSelectText(): string;
|
|
141
|
+
}
|
|
142
|
+
export {};
|
package/lib/type.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
|
|
15
|
+
// src/type.ts
|
|
16
|
+
var type_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(type_exports);
|
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingxiteam/lcdp-ueditor-react",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.10",
|
|
4
4
|
"module": "es/index.js",
|
|
5
|
+
"main": "lib/index.js",
|
|
5
6
|
"license": "MIT",
|
|
6
7
|
"files": [
|
|
7
8
|
"ueditor-resource",
|
|
8
|
-
"es"
|
|
9
|
+
"es",
|
|
10
|
+
"lib"
|
|
9
11
|
],
|
|
10
12
|
"publishConfig": {
|
|
11
13
|
"access": "public",
|
|
@@ -16,7 +18,7 @@
|
|
|
16
18
|
"scripts": {
|
|
17
19
|
"build": "father build",
|
|
18
20
|
"dev": "father dev",
|
|
19
|
-
"prepublishOnly": "npm run build"
|
|
21
|
+
"prepublishOnly": "npm run build && cd ../../ueditor-plus && npm run prepublish"
|
|
20
22
|
},
|
|
21
23
|
"peerDependencies": {
|
|
22
24
|
"react": "^16.12.0 || ^17.0.0"
|
|
@@ -277,7 +277,7 @@
|
|
|
277
277
|
const location = window.parent.location;
|
|
278
278
|
const host = location.protocol + '//' + location.host + location.pathname;
|
|
279
279
|
if (url) {
|
|
280
|
-
preview.innerHTML = '<img src="' + host + url + '" width="' + width + '" height="' + height + '" border="' + border + 'px solid #000" title="' + title + '" />';
|
|
280
|
+
preview.innerHTML = '<img src="' + encodeURI(host + url) + '" width="' + width + '" height="' + height + '" border="' + border + 'px solid #000" title="' + title + '" />';
|
|
281
281
|
}
|
|
282
282
|
},
|
|
283
283
|
getInsertList: function () {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
}
|
|
25
25
|
</style>
|
|
26
26
|
<script type="text/javascript" src="../internal.js?32939b8e"></script>
|
|
27
|
-
<script src="../../ueditor.parse.js?
|
|
27
|
+
<script src="../../ueditor.parse.js?{timestamp}"></script>
|
|
28
28
|
<title></title>
|
|
29
29
|
</head>
|
|
30
30
|
<body class="view">
|
|
@@ -307,7 +307,7 @@
|
|
|
307
307
|
|
|
308
308
|
$G("preview").innerHTML = '<div class="previewMsg"><span>' + lang.urlError + '</span></div>' +
|
|
309
309
|
'<iframe class="previewVideo" ' +
|
|
310
|
-
' src="' + host + conUrl + '"' +
|
|
310
|
+
' src="' + encodeURI(host + conUrl) + '"' +
|
|
311
311
|
' width="' + 420 + '"' +
|
|
312
312
|
' height="' + 280 + '"' +
|
|
313
313
|
' frameborder=0 allowfullscreen>' +
|