@lingxiteam/lcdp-ueditor-react 1.0.3-alpha.3 → 1.0.3-alpha.5
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 +41 -37
- package/es/const.js +4 -4
- package/es/defaultConfig.json +76 -76
- package/es/tools/UeditorResourceLoader.js +6 -6
- package/es/tools/loadScript.js +3 -3
- package/lib/LcdpUeditor.js +5 -1
- package/lib/defaultConfig.json +76 -76
- 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
|
@@ -1,221 +1,221 @@
|
|
|
1
|
-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
|
2
|
-
"http://www.w3.org/TR/html4/loose.dtd">
|
|
3
|
-
<html>
|
|
4
|
-
<head>
|
|
5
|
-
<title></title>
|
|
6
|
-
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
|
|
7
|
-
<script type="text/javascript" src="../internal.js?04dbe7f0"></script>
|
|
8
|
-
<style type="text/css">
|
|
9
|
-
.wrapper {
|
|
10
|
-
width: 600px;
|
|
11
|
-
padding: 10px;
|
|
12
|
-
height: 352px;
|
|
13
|
-
overflow: hidden;
|
|
14
|
-
position: relative;
|
|
15
|
-
border-bottom: 1px solid #d7d7d7
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.wrapper .image-info {
|
|
19
|
-
display: flex;
|
|
20
|
-
align-items: center;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.wrapper .image-info .input {
|
|
24
|
-
flex-grow: 1;
|
|
25
|
-
display: flex;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.wrapper .image-info .input input {
|
|
29
|
-
display: block;
|
|
30
|
-
border: 1px solid #CCC;
|
|
31
|
-
height: 23px;
|
|
32
|
-
border-radius: 3px;
|
|
33
|
-
flex-grow: 1;
|
|
34
|
-
outline: none;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.wrapper .image-info .copy {
|
|
38
|
-
width: 60px;
|
|
39
|
-
cursor: pointer;
|
|
40
|
-
margin: 0 5px;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.wrapper .image-info .copy div {
|
|
44
|
-
height: 30px;
|
|
45
|
-
font-size: 12px;
|
|
46
|
-
line-height: 28px;
|
|
47
|
-
cursor: pointer;
|
|
48
|
-
border-radius: 4px;
|
|
49
|
-
text-align: center;
|
|
50
|
-
background-color: #F8F8F8;
|
|
51
|
-
border: 1px solid #EEE;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.wrapper .image-info .action {
|
|
55
|
-
width: 100px;
|
|
56
|
-
cursor: pointer;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.wrapper .image-info .action .save-from-local {
|
|
60
|
-
position: relative;
|
|
61
|
-
height: 30px;
|
|
62
|
-
font-size: 12px;
|
|
63
|
-
line-height: 28px;
|
|
64
|
-
cursor: pointer;
|
|
65
|
-
border-radius: 4px;
|
|
66
|
-
text-align: center;
|
|
67
|
-
background-color: #F8F8F8;
|
|
68
|
-
border: 1px solid #EEE;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.wrapper .image-info .action .save-from-local input {
|
|
72
|
-
position: absolute;
|
|
73
|
-
left: 0;
|
|
74
|
-
top: 0;
|
|
75
|
-
opacity: 0;
|
|
76
|
-
cursor: pointer;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.wrapper .image-manual {
|
|
80
|
-
background: #EEE;
|
|
81
|
-
padding: 10px;
|
|
82
|
-
border-radius: 5px;
|
|
83
|
-
margin-top: 10px;
|
|
84
|
-
line-height: 2;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.wrapper .image-manual .title {
|
|
88
|
-
font-weight: bold;
|
|
89
|
-
font-size: 120%;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.wrapper .image-manual .body {
|
|
93
|
-
}
|
|
94
|
-
</style>
|
|
95
|
-
</head>
|
|
96
|
-
<body>
|
|
97
|
-
<div class="wrapper">
|
|
98
|
-
<div class="image-info">
|
|
99
|
-
<div class="input">
|
|
100
|
-
<input type="text" id="fileUrl"/>
|
|
101
|
-
</div>
|
|
102
|
-
<div class="copy">
|
|
103
|
-
<div id="copyButton">复制路径</div>
|
|
104
|
-
</div>
|
|
105
|
-
<div class="action">
|
|
106
|
-
<div class="save-from-local">
|
|
107
|
-
<div>本地选择保存</div>
|
|
108
|
-
<input type="file" id="saveFile" multiple=true/>
|
|
109
|
-
</div>
|
|
110
|
-
</div>
|
|
111
|
-
</div>
|
|
112
|
-
<div class="image-tip"></div>
|
|
113
|
-
<div class="image-manual">
|
|
114
|
-
<div class="title">
|
|
115
|
-
Windows使用教程
|
|
116
|
-
</div>
|
|
117
|
-
<div class="body">
|
|
118
|
-
<p>1、点击复制地址按钮</p>
|
|
119
|
-
<p>2、点击本地选择文件,粘贴剪切板的路径到文件选择路径</p>
|
|
120
|
-
<p>3、点击确定</p>
|
|
121
|
-
</div>
|
|
122
|
-
<div class="title">
|
|
123
|
-
Mac使用教程
|
|
124
|
-
</div>
|
|
125
|
-
<div class="body">
|
|
126
|
-
<p>1、点击复制地址按钮</p>
|
|
127
|
-
<p>2、点击本地选择文件,按快捷 Command+Shift+G ,粘贴剪切板的路径到文件选择路径</p>
|
|
128
|
-
<p>3、点击确定</p>
|
|
129
|
-
</div>
|
|
130
|
-
</div>
|
|
131
|
-
</div>
|
|
132
|
-
<script src="../../third-party/jquery-3.5.1.js?9a0f9431"></script>
|
|
133
|
-
<script src="../../third-party/webuploader/webuploader.js?5e398948"></script>
|
|
134
|
-
<script type="text/javascript" src="../../third-party/clipboard/clipboard.js?bae63983"></script>
|
|
135
|
-
<script type="text/javascript" src="wordimage.js?94055851"></script>
|
|
136
|
-
<script type="text/javascript">
|
|
137
|
-
editor.setOpt({
|
|
138
|
-
wordImageFieldName: "upfile",
|
|
139
|
-
compressSide: 0,
|
|
140
|
-
maxImageSideLength: 900
|
|
141
|
-
});
|
|
142
|
-
//全局变量
|
|
143
|
-
var imageUrls = [], //用于保存从服务器返回的图片信息数组
|
|
144
|
-
selectedImageCount = 0, //当前已选择的但未上传的图片数量
|
|
145
|
-
optImageUrl = editor.getActionUrl(editor.getOpt('imageActionName')),
|
|
146
|
-
optImageFieldName = editor.getOpt('imageFieldName'),
|
|
147
|
-
optImageCompressBorder = editor.getOpt('imageCompressEnable') ? editor.getOpt('imageCompressBorder') : null,
|
|
148
|
-
maxSize = editor.getOpt('imageMaxSize') / 1024 / 1024,
|
|
149
|
-
extension = editor.getOpt('imageAllowFiles').join(';').replace(/\./g, '*.');
|
|
150
|
-
|
|
151
|
-
/* 添加额外的GET参数 */
|
|
152
|
-
var params = utils.serializeParam(editor.queryCommandValue('serverparam')) || '',
|
|
153
|
-
urlWidthParams = optImageUrl + (optImageUrl.indexOf('?') == -1 ? '?' : '&') + params;
|
|
154
|
-
|
|
155
|
-
var uploader,
|
|
156
|
-
actionUrl = editor.getActionUrl(editor.getOpt('imageActionName')),
|
|
157
|
-
acceptExtensions = (editor.getOpt('imageAllowFiles') || []).join('').replace(/\./g, ',').replace(/^[,]/, ''),
|
|
158
|
-
imageMaxSize = editor.getOpt('imageMaxSize'),
|
|
159
|
-
imageCompressBorder = editor.getOpt('imageCompressBorder');
|
|
160
|
-
uploader = WebUploader.create({
|
|
161
|
-
accept: {
|
|
162
|
-
title: 'Images',
|
|
163
|
-
extensions: acceptExtensions,
|
|
164
|
-
mimeTypes: 'image/*'
|
|
165
|
-
},
|
|
166
|
-
swf: '../../third-party/webuploader/Uploader.swf',
|
|
167
|
-
server: actionUrl,
|
|
168
|
-
fileVal: editor.getOpt('imageFieldName'),
|
|
169
|
-
duplicate: true,
|
|
170
|
-
fileSingleSizeLimit: imageMaxSize, // 默认 2 M
|
|
171
|
-
threads: 1,
|
|
172
|
-
compress: editor.getOpt('imageCompressEnable') ? {
|
|
173
|
-
width: imageCompressBorder,
|
|
174
|
-
height: imageCompressBorder,
|
|
175
|
-
// 图片质量,只有type为`image/jpeg`的时候才有效。
|
|
176
|
-
quality: 90,
|
|
177
|
-
// 是否允许放大,如果想要生成小图的时候不失真,此选项应该设置为false.
|
|
178
|
-
allowMagnify: false,
|
|
179
|
-
// 是否允许裁剪。
|
|
180
|
-
crop: false,
|
|
181
|
-
// 是否保留头部meta信息。
|
|
182
|
-
preserveHeaders: true
|
|
183
|
-
} : false
|
|
184
|
-
});
|
|
185
|
-
uploader.on('uploadSuccess', function (file, res) {
|
|
186
|
-
if ('state' in res) {
|
|
187
|
-
if (res.state === 'SUCCESS') {
|
|
188
|
-
if (res.url) {
|
|
189
|
-
imageUrls.push({
|
|
190
|
-
name: file.name,
|
|
191
|
-
url: res.url,
|
|
192
|
-
title: '',
|
|
193
|
-
});
|
|
194
|
-
$('.image-tip').html('<span style="color:#139213;">图片' + imageUrls.length + '(' + file.name + ')' + '转存成功</span>');
|
|
195
|
-
} else {
|
|
196
|
-
$('.image-tip').html('上传失败:' + JSON.stringify(res))
|
|
197
|
-
}
|
|
198
|
-
// 触发上传附件事件
|
|
199
|
-
editor.fireEvent("uploadsuccess", {
|
|
200
|
-
res: res,
|
|
201
|
-
type: 'image'
|
|
202
|
-
});
|
|
203
|
-
} else {
|
|
204
|
-
$('.image-tip').html('上传失败:' + JSON.stringify(res))
|
|
205
|
-
}
|
|
206
|
-
} else {
|
|
207
|
-
$('.image-tip').html('上传失败:' + JSON.stringify(res))
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
uploader.on('uploadFinished', function () {
|
|
211
|
-
$('.image-tip').html('<span style="color:#139213;">转存成功,请提交确认</span>');
|
|
212
|
-
});
|
|
213
|
-
utils.domReady(function () {
|
|
214
|
-
var options = {};
|
|
215
|
-
var callbacks = {};
|
|
216
|
-
wordImage.init(options, callbacks);
|
|
217
|
-
});
|
|
218
|
-
</script>
|
|
219
|
-
|
|
220
|
-
</body>
|
|
221
|
-
</html>
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
|
2
|
+
"http://www.w3.org/TR/html4/loose.dtd">
|
|
3
|
+
<html>
|
|
4
|
+
<head>
|
|
5
|
+
<title></title>
|
|
6
|
+
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
|
|
7
|
+
<script type="text/javascript" src="../internal.js?04dbe7f0"></script>
|
|
8
|
+
<style type="text/css">
|
|
9
|
+
.wrapper {
|
|
10
|
+
width: 600px;
|
|
11
|
+
padding: 10px;
|
|
12
|
+
height: 352px;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
position: relative;
|
|
15
|
+
border-bottom: 1px solid #d7d7d7
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.wrapper .image-info {
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.wrapper .image-info .input {
|
|
24
|
+
flex-grow: 1;
|
|
25
|
+
display: flex;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.wrapper .image-info .input input {
|
|
29
|
+
display: block;
|
|
30
|
+
border: 1px solid #CCC;
|
|
31
|
+
height: 23px;
|
|
32
|
+
border-radius: 3px;
|
|
33
|
+
flex-grow: 1;
|
|
34
|
+
outline: none;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.wrapper .image-info .copy {
|
|
38
|
+
width: 60px;
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
margin: 0 5px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.wrapper .image-info .copy div {
|
|
44
|
+
height: 30px;
|
|
45
|
+
font-size: 12px;
|
|
46
|
+
line-height: 28px;
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
border-radius: 4px;
|
|
49
|
+
text-align: center;
|
|
50
|
+
background-color: #F8F8F8;
|
|
51
|
+
border: 1px solid #EEE;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.wrapper .image-info .action {
|
|
55
|
+
width: 100px;
|
|
56
|
+
cursor: pointer;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.wrapper .image-info .action .save-from-local {
|
|
60
|
+
position: relative;
|
|
61
|
+
height: 30px;
|
|
62
|
+
font-size: 12px;
|
|
63
|
+
line-height: 28px;
|
|
64
|
+
cursor: pointer;
|
|
65
|
+
border-radius: 4px;
|
|
66
|
+
text-align: center;
|
|
67
|
+
background-color: #F8F8F8;
|
|
68
|
+
border: 1px solid #EEE;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.wrapper .image-info .action .save-from-local input {
|
|
72
|
+
position: absolute;
|
|
73
|
+
left: 0;
|
|
74
|
+
top: 0;
|
|
75
|
+
opacity: 0;
|
|
76
|
+
cursor: pointer;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.wrapper .image-manual {
|
|
80
|
+
background: #EEE;
|
|
81
|
+
padding: 10px;
|
|
82
|
+
border-radius: 5px;
|
|
83
|
+
margin-top: 10px;
|
|
84
|
+
line-height: 2;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.wrapper .image-manual .title {
|
|
88
|
+
font-weight: bold;
|
|
89
|
+
font-size: 120%;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.wrapper .image-manual .body {
|
|
93
|
+
}
|
|
94
|
+
</style>
|
|
95
|
+
</head>
|
|
96
|
+
<body>
|
|
97
|
+
<div class="wrapper">
|
|
98
|
+
<div class="image-info">
|
|
99
|
+
<div class="input">
|
|
100
|
+
<input type="text" id="fileUrl"/>
|
|
101
|
+
</div>
|
|
102
|
+
<div class="copy">
|
|
103
|
+
<div id="copyButton">复制路径</div>
|
|
104
|
+
</div>
|
|
105
|
+
<div class="action">
|
|
106
|
+
<div class="save-from-local">
|
|
107
|
+
<div>本地选择保存</div>
|
|
108
|
+
<input type="file" id="saveFile" multiple=true/>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
<div class="image-tip"></div>
|
|
113
|
+
<div class="image-manual">
|
|
114
|
+
<div class="title">
|
|
115
|
+
Windows使用教程
|
|
116
|
+
</div>
|
|
117
|
+
<div class="body">
|
|
118
|
+
<p>1、点击复制地址按钮</p>
|
|
119
|
+
<p>2、点击本地选择文件,粘贴剪切板的路径到文件选择路径</p>
|
|
120
|
+
<p>3、点击确定</p>
|
|
121
|
+
</div>
|
|
122
|
+
<div class="title">
|
|
123
|
+
Mac使用教程
|
|
124
|
+
</div>
|
|
125
|
+
<div class="body">
|
|
126
|
+
<p>1、点击复制地址按钮</p>
|
|
127
|
+
<p>2、点击本地选择文件,按快捷 Command+Shift+G ,粘贴剪切板的路径到文件选择路径</p>
|
|
128
|
+
<p>3、点击确定</p>
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
<script src="../../third-party/jquery-3.5.1.js?9a0f9431"></script>
|
|
133
|
+
<script src="../../third-party/webuploader/webuploader.js?5e398948"></script>
|
|
134
|
+
<script type="text/javascript" src="../../third-party/clipboard/clipboard.js?bae63983"></script>
|
|
135
|
+
<script type="text/javascript" src="wordimage.js?94055851"></script>
|
|
136
|
+
<script type="text/javascript">
|
|
137
|
+
editor.setOpt({
|
|
138
|
+
wordImageFieldName: "upfile",
|
|
139
|
+
compressSide: 0,
|
|
140
|
+
maxImageSideLength: 900
|
|
141
|
+
});
|
|
142
|
+
//全局变量
|
|
143
|
+
var imageUrls = [], //用于保存从服务器返回的图片信息数组
|
|
144
|
+
selectedImageCount = 0, //当前已选择的但未上传的图片数量
|
|
145
|
+
optImageUrl = editor.getActionUrl(editor.getOpt('imageActionName')),
|
|
146
|
+
optImageFieldName = editor.getOpt('imageFieldName'),
|
|
147
|
+
optImageCompressBorder = editor.getOpt('imageCompressEnable') ? editor.getOpt('imageCompressBorder') : null,
|
|
148
|
+
maxSize = editor.getOpt('imageMaxSize') / 1024 / 1024,
|
|
149
|
+
extension = editor.getOpt('imageAllowFiles').join(';').replace(/\./g, '*.');
|
|
150
|
+
|
|
151
|
+
/* 添加额外的GET参数 */
|
|
152
|
+
var params = utils.serializeParam(editor.queryCommandValue('serverparam')) || '',
|
|
153
|
+
urlWidthParams = optImageUrl + (optImageUrl.indexOf('?') == -1 ? '?' : '&') + params;
|
|
154
|
+
|
|
155
|
+
var uploader,
|
|
156
|
+
actionUrl = editor.getActionUrl(editor.getOpt('imageActionName')),
|
|
157
|
+
acceptExtensions = (editor.getOpt('imageAllowFiles') || []).join('').replace(/\./g, ',').replace(/^[,]/, ''),
|
|
158
|
+
imageMaxSize = editor.getOpt('imageMaxSize'),
|
|
159
|
+
imageCompressBorder = editor.getOpt('imageCompressBorder');
|
|
160
|
+
uploader = WebUploader.create({
|
|
161
|
+
accept: {
|
|
162
|
+
title: 'Images',
|
|
163
|
+
extensions: acceptExtensions,
|
|
164
|
+
mimeTypes: 'image/*'
|
|
165
|
+
},
|
|
166
|
+
swf: '../../third-party/webuploader/Uploader.swf',
|
|
167
|
+
server: actionUrl,
|
|
168
|
+
fileVal: editor.getOpt('imageFieldName'),
|
|
169
|
+
duplicate: true,
|
|
170
|
+
fileSingleSizeLimit: imageMaxSize, // 默认 2 M
|
|
171
|
+
threads: 1,
|
|
172
|
+
compress: editor.getOpt('imageCompressEnable') ? {
|
|
173
|
+
width: imageCompressBorder,
|
|
174
|
+
height: imageCompressBorder,
|
|
175
|
+
// 图片质量,只有type为`image/jpeg`的时候才有效。
|
|
176
|
+
quality: 90,
|
|
177
|
+
// 是否允许放大,如果想要生成小图的时候不失真,此选项应该设置为false.
|
|
178
|
+
allowMagnify: false,
|
|
179
|
+
// 是否允许裁剪。
|
|
180
|
+
crop: false,
|
|
181
|
+
// 是否保留头部meta信息。
|
|
182
|
+
preserveHeaders: true
|
|
183
|
+
} : false
|
|
184
|
+
});
|
|
185
|
+
uploader.on('uploadSuccess', function (file, res) {
|
|
186
|
+
if ('state' in res) {
|
|
187
|
+
if (res.state === 'SUCCESS') {
|
|
188
|
+
if (res.url) {
|
|
189
|
+
imageUrls.push({
|
|
190
|
+
name: file.name,
|
|
191
|
+
url: res.url,
|
|
192
|
+
title: '',
|
|
193
|
+
});
|
|
194
|
+
$('.image-tip').html('<span style="color:#139213;">图片' + imageUrls.length + '(' + file.name + ')' + '转存成功</span>');
|
|
195
|
+
} else {
|
|
196
|
+
$('.image-tip').html('上传失败:' + JSON.stringify(res))
|
|
197
|
+
}
|
|
198
|
+
// 触发上传附件事件
|
|
199
|
+
editor.fireEvent("uploadsuccess", {
|
|
200
|
+
res: res,
|
|
201
|
+
type: 'image'
|
|
202
|
+
});
|
|
203
|
+
} else {
|
|
204
|
+
$('.image-tip').html('上传失败:' + JSON.stringify(res))
|
|
205
|
+
}
|
|
206
|
+
} else {
|
|
207
|
+
$('.image-tip').html('上传失败:' + JSON.stringify(res))
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
uploader.on('uploadFinished', function () {
|
|
211
|
+
$('.image-tip').html('<span style="color:#139213;">转存成功,请提交确认</span>');
|
|
212
|
+
});
|
|
213
|
+
utils.domReady(function () {
|
|
214
|
+
var options = {};
|
|
215
|
+
var callbacks = {};
|
|
216
|
+
wordImage.init(options, callbacks);
|
|
217
|
+
});
|
|
218
|
+
</script>
|
|
219
|
+
|
|
220
|
+
</body>
|
|
221
|
+
</html>
|