rails_kindeditor 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/kindeditor-min.js +165 -161
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/lang/en.js +210 -210
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/lang/zh_CN.js +214 -214
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/lang/zh_TW.js +212 -212
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/anchor/anchor.js +46 -46
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/clearhtml/clearhtml.js +29 -29
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/filemanager/filemanager.js +189 -185
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/flash/flash.js +145 -145
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/image/image.js +259 -242
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/insertfile/insertfile.js +109 -109
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/link/link.js +65 -65
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/map/map.js +137 -137
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/media/media.js +153 -153
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/pagebreak/pagebreak.js +26 -26
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/table/table.js +715 -715
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/wordpaste/wordpaste.js +51 -51
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/themes/common/loading.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/themes/default/default.css +991 -980
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/themes/default/default.png +0 -0
- data/lib/rails_kindeditor/version.rb +1 -1
- metadata +29 -51
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/themes/default/default.gif +0 -0
@@ -1,145 +1,145 @@
|
|
1
|
-
/*******************************************************************************
|
2
|
-
* KindEditor - WYSIWYG HTML Editor for Internet
|
3
|
-
* Copyright (C) 2006-2011 kindsoft.net
|
4
|
-
*
|
5
|
-
* @author Roddy <luolonghao@gmail.com>
|
6
|
-
* @site http://www.kindsoft.net/
|
7
|
-
* @licence http://www.kindsoft.net/license.php
|
8
|
-
*******************************************************************************/
|
9
|
-
|
10
|
-
KindEditor.plugin('flash', function(K) {
|
11
|
-
var self = this, name = 'flash', lang = self.lang(name + '.'),
|
12
|
-
allowFlashUpload = K.undef(self.allowFlashUpload, true),
|
13
|
-
allowFileManager = K.undef(self.allowFileManager, false),
|
14
|
-
uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php');
|
15
|
-
self.plugin.flash = {
|
16
|
-
edit : function() {
|
17
|
-
var html = [
|
18
|
-
'<div style="padding:10px 20px;">',
|
19
|
-
//url
|
20
|
-
'<div class="ke-dialog-row">',
|
21
|
-
'<label for="keUrl" style="width:60px;">' + lang.url + '</label>',
|
22
|
-
'<input class="ke-input-text" type="text" id="keUrl" name="url" value="" style="width:160px;" /> ',
|
23
|
-
'<input type="button" class="ke-upload-button" value="' + lang.upload + '" /> ',
|
24
|
-
'<span class="ke-button-common ke-button-outer">',
|
25
|
-
'<input type="button" class="ke-button-common ke-button" name="viewServer" value="' + lang.viewServer + '" />',
|
26
|
-
'</span>',
|
27
|
-
'</div>',
|
28
|
-
//width
|
29
|
-
'<div class="ke-dialog-row">',
|
30
|
-
'<label for="keWidth" style="width:60px;">' + lang.width + '</label>',
|
31
|
-
'<input type="text" id="keWidth" class="ke-input-text ke-input-number" name="width" value="550" maxlength="4" /> ',
|
32
|
-
'</div>',
|
33
|
-
//height
|
34
|
-
'<div class="ke-dialog-row">',
|
35
|
-
'<label for="keHeight" style="width:60px;">' + lang.height + '</label>',
|
36
|
-
'<input type="text" id="keHeight" class="ke-input-text ke-input-number" name="height" value="400" maxlength="4" /> ',
|
37
|
-
'</div>',
|
38
|
-
'</div>'
|
39
|
-
].join('');
|
40
|
-
var dialog = self.createDialog({
|
41
|
-
name : name,
|
42
|
-
width : 450,
|
43
|
-
height : 200,
|
44
|
-
title : self.lang(name),
|
45
|
-
body : html,
|
46
|
-
yesBtn : {
|
47
|
-
name : self.lang('yes'),
|
48
|
-
click : function(e) {
|
49
|
-
var url = K.trim(urlBox.val()),
|
50
|
-
width = widthBox.val(),
|
51
|
-
height = heightBox.val();
|
52
|
-
if (url == 'http://' || K.invalidUrl(url)) {
|
53
|
-
alert(self.lang('invalidUrl'));
|
54
|
-
urlBox[0].focus();
|
55
|
-
return;
|
56
|
-
}
|
57
|
-
if (!/^\d*$/.test(width)) {
|
58
|
-
alert(self.lang('invalidWidth'));
|
59
|
-
widthBox[0].focus();
|
60
|
-
return;
|
61
|
-
}
|
62
|
-
if (!/^\d*$/.test(height)) {
|
63
|
-
alert(self.lang('invalidHeight'));
|
64
|
-
heightBox[0].focus();
|
65
|
-
return;
|
66
|
-
}
|
67
|
-
var html = K.mediaImg(self.themesPath + 'common/blank.gif', {
|
68
|
-
src : url,
|
69
|
-
type : K.mediaType('.swf'),
|
70
|
-
width : width,
|
71
|
-
height : height,
|
72
|
-
quality : 'high'
|
73
|
-
});
|
74
|
-
self.insertHtml(html).hideDialog().focus();
|
75
|
-
}
|
76
|
-
}
|
77
|
-
}),
|
78
|
-
div = dialog.div,
|
79
|
-
urlBox = K('[name="url"]', div),
|
80
|
-
viewServerBtn = K('[name="viewServer"]', div),
|
81
|
-
widthBox = K('[name="width"]', div),
|
82
|
-
heightBox = K('[name="height"]', div);
|
83
|
-
urlBox.val('http://');
|
84
|
-
|
85
|
-
if (allowFlashUpload) {
|
86
|
-
var uploadbutton = K.uploadbutton({
|
87
|
-
button : K('.ke-upload-button', div)[0],
|
88
|
-
fieldName : 'imgFile',
|
89
|
-
url : K.addParam(uploadJson, 'dir=flash'),
|
90
|
-
afterUpload : function(data) {
|
91
|
-
if (data.error === 0) {
|
92
|
-
var url = K.formatUrl(data.url, 'absolute');
|
93
|
-
urlBox.val(url);
|
94
|
-
if (self.afterUpload) {
|
95
|
-
self.afterUpload.call(self, url);
|
96
|
-
}
|
97
|
-
alert(self.lang('uploadSuccess'));
|
98
|
-
} else {
|
99
|
-
alert(data.message);
|
100
|
-
}
|
101
|
-
}
|
102
|
-
});
|
103
|
-
uploadbutton.fileBox.change(function(e) {
|
104
|
-
uploadbutton.submit();
|
105
|
-
});
|
106
|
-
} else {
|
107
|
-
K('.ke-upload-button', div).hide();
|
108
|
-
urlBox.width(250);
|
109
|
-
}
|
110
|
-
|
111
|
-
if (allowFileManager) {
|
112
|
-
viewServerBtn.click(function(e) {
|
113
|
-
self.loadPlugin('filemanager', function() {
|
114
|
-
self.plugin.filemanagerDialog({
|
115
|
-
viewType : 'LIST',
|
116
|
-
dirName : 'flash',
|
117
|
-
clickFn : function(url, title) {
|
118
|
-
if (self.dialogs.length > 1) {
|
119
|
-
K('[name="url"]', div).val(url);
|
120
|
-
self.hideDialog();
|
121
|
-
}
|
122
|
-
}
|
123
|
-
});
|
124
|
-
});
|
125
|
-
});
|
126
|
-
} else {
|
127
|
-
viewServerBtn.hide();
|
128
|
-
}
|
129
|
-
|
130
|
-
var img = self.plugin.getSelectedFlash();
|
131
|
-
if (img) {
|
132
|
-
var attrs = K.mediaAttrs(img.attr('data-ke-tag'));
|
133
|
-
urlBox.val(attrs.src);
|
134
|
-
widthBox.val(K.removeUnit(img.css('width')) || attrs.width || 0);
|
135
|
-
heightBox.val(K.removeUnit(img.css('height')) || attrs.height || 0);
|
136
|
-
}
|
137
|
-
urlBox[0].focus();
|
138
|
-
urlBox[0].select();
|
139
|
-
},
|
140
|
-
'delete' : function() {
|
141
|
-
self.plugin.getSelectedFlash().remove();
|
142
|
-
}
|
143
|
-
};
|
144
|
-
self.clickToolbar(name, self.plugin.flash.edit);
|
145
|
-
});
|
1
|
+
/*******************************************************************************
|
2
|
+
* KindEditor - WYSIWYG HTML Editor for Internet
|
3
|
+
* Copyright (C) 2006-2011 kindsoft.net
|
4
|
+
*
|
5
|
+
* @author Roddy <luolonghao@gmail.com>
|
6
|
+
* @site http://www.kindsoft.net/
|
7
|
+
* @licence http://www.kindsoft.net/license.php
|
8
|
+
*******************************************************************************/
|
9
|
+
|
10
|
+
KindEditor.plugin('flash', function(K) {
|
11
|
+
var self = this, name = 'flash', lang = self.lang(name + '.'),
|
12
|
+
allowFlashUpload = K.undef(self.allowFlashUpload, true),
|
13
|
+
allowFileManager = K.undef(self.allowFileManager, false),
|
14
|
+
uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php');
|
15
|
+
self.plugin.flash = {
|
16
|
+
edit : function() {
|
17
|
+
var html = [
|
18
|
+
'<div style="padding:10px 20px;">',
|
19
|
+
//url
|
20
|
+
'<div class="ke-dialog-row">',
|
21
|
+
'<label for="keUrl" style="width:60px;">' + lang.url + '</label>',
|
22
|
+
'<input class="ke-input-text" type="text" id="keUrl" name="url" value="" style="width:160px;" /> ',
|
23
|
+
'<input type="button" class="ke-upload-button" value="' + lang.upload + '" /> ',
|
24
|
+
'<span class="ke-button-common ke-button-outer">',
|
25
|
+
'<input type="button" class="ke-button-common ke-button" name="viewServer" value="' + lang.viewServer + '" />',
|
26
|
+
'</span>',
|
27
|
+
'</div>',
|
28
|
+
//width
|
29
|
+
'<div class="ke-dialog-row">',
|
30
|
+
'<label for="keWidth" style="width:60px;">' + lang.width + '</label>',
|
31
|
+
'<input type="text" id="keWidth" class="ke-input-text ke-input-number" name="width" value="550" maxlength="4" /> ',
|
32
|
+
'</div>',
|
33
|
+
//height
|
34
|
+
'<div class="ke-dialog-row">',
|
35
|
+
'<label for="keHeight" style="width:60px;">' + lang.height + '</label>',
|
36
|
+
'<input type="text" id="keHeight" class="ke-input-text ke-input-number" name="height" value="400" maxlength="4" /> ',
|
37
|
+
'</div>',
|
38
|
+
'</div>'
|
39
|
+
].join('');
|
40
|
+
var dialog = self.createDialog({
|
41
|
+
name : name,
|
42
|
+
width : 450,
|
43
|
+
height : 200,
|
44
|
+
title : self.lang(name),
|
45
|
+
body : html,
|
46
|
+
yesBtn : {
|
47
|
+
name : self.lang('yes'),
|
48
|
+
click : function(e) {
|
49
|
+
var url = K.trim(urlBox.val()),
|
50
|
+
width = widthBox.val(),
|
51
|
+
height = heightBox.val();
|
52
|
+
if (url == 'http://' || K.invalidUrl(url)) {
|
53
|
+
alert(self.lang('invalidUrl'));
|
54
|
+
urlBox[0].focus();
|
55
|
+
return;
|
56
|
+
}
|
57
|
+
if (!/^\d*$/.test(width)) {
|
58
|
+
alert(self.lang('invalidWidth'));
|
59
|
+
widthBox[0].focus();
|
60
|
+
return;
|
61
|
+
}
|
62
|
+
if (!/^\d*$/.test(height)) {
|
63
|
+
alert(self.lang('invalidHeight'));
|
64
|
+
heightBox[0].focus();
|
65
|
+
return;
|
66
|
+
}
|
67
|
+
var html = K.mediaImg(self.themesPath + 'common/blank.gif', {
|
68
|
+
src : url,
|
69
|
+
type : K.mediaType('.swf'),
|
70
|
+
width : width,
|
71
|
+
height : height,
|
72
|
+
quality : 'high'
|
73
|
+
});
|
74
|
+
self.insertHtml(html).hideDialog().focus();
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}),
|
78
|
+
div = dialog.div,
|
79
|
+
urlBox = K('[name="url"]', div),
|
80
|
+
viewServerBtn = K('[name="viewServer"]', div),
|
81
|
+
widthBox = K('[name="width"]', div),
|
82
|
+
heightBox = K('[name="height"]', div);
|
83
|
+
urlBox.val('http://');
|
84
|
+
|
85
|
+
if (allowFlashUpload) {
|
86
|
+
var uploadbutton = K.uploadbutton({
|
87
|
+
button : K('.ke-upload-button', div)[0],
|
88
|
+
fieldName : 'imgFile',
|
89
|
+
url : K.addParam(uploadJson, 'dir=flash'),
|
90
|
+
afterUpload : function(data) {
|
91
|
+
if (data.error === 0) {
|
92
|
+
var url = K.formatUrl(data.url, 'absolute');
|
93
|
+
urlBox.val(url);
|
94
|
+
if (self.afterUpload) {
|
95
|
+
self.afterUpload.call(self, url);
|
96
|
+
}
|
97
|
+
alert(self.lang('uploadSuccess'));
|
98
|
+
} else {
|
99
|
+
alert(data.message);
|
100
|
+
}
|
101
|
+
}
|
102
|
+
});
|
103
|
+
uploadbutton.fileBox.change(function(e) {
|
104
|
+
uploadbutton.submit();
|
105
|
+
});
|
106
|
+
} else {
|
107
|
+
K('.ke-upload-button', div).hide();
|
108
|
+
urlBox.width(250);
|
109
|
+
}
|
110
|
+
|
111
|
+
if (allowFileManager) {
|
112
|
+
viewServerBtn.click(function(e) {
|
113
|
+
self.loadPlugin('filemanager', function() {
|
114
|
+
self.plugin.filemanagerDialog({
|
115
|
+
viewType : 'LIST',
|
116
|
+
dirName : 'flash',
|
117
|
+
clickFn : function(url, title) {
|
118
|
+
if (self.dialogs.length > 1) {
|
119
|
+
K('[name="url"]', div).val(url);
|
120
|
+
self.hideDialog();
|
121
|
+
}
|
122
|
+
}
|
123
|
+
});
|
124
|
+
});
|
125
|
+
});
|
126
|
+
} else {
|
127
|
+
viewServerBtn.hide();
|
128
|
+
}
|
129
|
+
|
130
|
+
var img = self.plugin.getSelectedFlash();
|
131
|
+
if (img) {
|
132
|
+
var attrs = K.mediaAttrs(img.attr('data-ke-tag'));
|
133
|
+
urlBox.val(attrs.src);
|
134
|
+
widthBox.val(K.removeUnit(img.css('width')) || attrs.width || 0);
|
135
|
+
heightBox.val(K.removeUnit(img.css('height')) || attrs.height || 0);
|
136
|
+
}
|
137
|
+
urlBox[0].focus();
|
138
|
+
urlBox[0].select();
|
139
|
+
},
|
140
|
+
'delete' : function() {
|
141
|
+
self.plugin.getSelectedFlash().remove();
|
142
|
+
}
|
143
|
+
};
|
144
|
+
self.clickToolbar(name, self.plugin.flash.edit);
|
145
|
+
});
|
@@ -1,242 +1,259 @@
|
|
1
|
-
/*******************************************************************************
|
2
|
-
* KindEditor - WYSIWYG HTML Editor for Internet
|
3
|
-
* Copyright (C) 2006-2011 kindsoft.net
|
4
|
-
*
|
5
|
-
* @author Roddy <luolonghao@gmail.com>
|
6
|
-
* @site http://www.kindsoft.net/
|
7
|
-
* @licence http://www.kindsoft.net/license.php
|
8
|
-
*******************************************************************************/
|
9
|
-
|
10
|
-
KindEditor.plugin('image', function(K) {
|
11
|
-
var self = this, name = 'image',
|
12
|
-
allowImageUpload = K.undef(self.allowImageUpload, true),
|
13
|
-
allowFileManager = K.undef(self.allowFileManager, false),
|
14
|
-
uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php'),
|
15
|
-
imgPath = self.basePath + 'plugins/image/images/',
|
16
|
-
lang = self.lang(name + '.');
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
return;
|
92
|
-
}
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
}
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
}
|
167
|
-
}
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
}
|
221
|
-
|
222
|
-
|
223
|
-
if (
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
1
|
+
/*******************************************************************************
|
2
|
+
* KindEditor - WYSIWYG HTML Editor for Internet
|
3
|
+
* Copyright (C) 2006-2011 kindsoft.net
|
4
|
+
*
|
5
|
+
* @author Roddy <luolonghao@gmail.com>
|
6
|
+
* @site http://www.kindsoft.net/
|
7
|
+
* @licence http://www.kindsoft.net/license.php
|
8
|
+
*******************************************************************************/
|
9
|
+
|
10
|
+
KindEditor.plugin('image', function(K) {
|
11
|
+
var self = this, name = 'image',
|
12
|
+
allowImageUpload = K.undef(self.allowImageUpload, true),
|
13
|
+
allowFileManager = K.undef(self.allowFileManager, false),
|
14
|
+
uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php'),
|
15
|
+
imgPath = self.basePath + 'plugins/image/images/',
|
16
|
+
lang = self.lang(name + '.');
|
17
|
+
|
18
|
+
self.plugin.imageDialog = function(options) {
|
19
|
+
var imageUrl = K.undef(options.imageUrl, 'http://'),
|
20
|
+
imageWidth = K.undef(options.imageWidth, ''),
|
21
|
+
imageHeight = K.undef(options.imageHeight, ''),
|
22
|
+
imageTitle = K.undef(options.imageTitle, ''),
|
23
|
+
imageAlign = K.undef(options.imageAlign, ''),
|
24
|
+
clickFn = options.clickFn;
|
25
|
+
var html = [
|
26
|
+
'<div style="padding:10px 20px;">',
|
27
|
+
//tabs
|
28
|
+
'<div class="tabs"></div>',
|
29
|
+
//url or file
|
30
|
+
'<div class="ke-dialog-row">',
|
31
|
+
'<div class="tab1" style="display:none;">',
|
32
|
+
'<label for="keUrl" style="width:60px;">' + lang.remoteUrl + '</label>',
|
33
|
+
'<input type="text" id="keUrl" class="ke-input-text" name="url" value="" style="width:200px;" /> ',
|
34
|
+
'<span class="ke-button-common ke-button-outer">',
|
35
|
+
'<input type="button" class="ke-button-common ke-button" name="viewServer" value="' + lang.viewServer + '" />',
|
36
|
+
'</span>',
|
37
|
+
'</div>',
|
38
|
+
'<div class="tab2" style="display:none;">',
|
39
|
+
'<label style="width:60px;">' + lang.localUrl + '</label>',
|
40
|
+
'<input type="text" name="localUrl" class="ke-input-text" tabindex="-1" style="width:200px;" readonly="true" /> ',
|
41
|
+
'<input type="button" class="ke-upload-button" value="' + lang.viewServer + '" />',
|
42
|
+
'</div>',
|
43
|
+
'</div>',
|
44
|
+
//size
|
45
|
+
'<div class="ke-dialog-row">',
|
46
|
+
'<label for="keWidth" style="width:60px;">' + lang.size + '</label>',
|
47
|
+
lang.width + ' <input type="text" id="keWidth" class="ke-input-text ke-input-number" name="width" value="" maxlength="4" /> ',
|
48
|
+
lang.height + ' <input type="text" class="ke-input-text ke-input-number" name="height" value="" maxlength="4" /> ',
|
49
|
+
'<img class="ke-refresh-btn" src="' + imgPath + 'refresh.gif" width="16" height="16" alt="" style="cursor:pointer;" />',
|
50
|
+
'</div>',
|
51
|
+
//align
|
52
|
+
'<div class="ke-dialog-row">',
|
53
|
+
'<label style="width:60px;">' + lang.align + '</label>',
|
54
|
+
'<input type="radio" name="align" class="ke-inline-block" value="" checked="checked" /> <img name="defaultImg" src="' + imgPath + 'align_top.gif" width="23" height="25" alt="" />',
|
55
|
+
' <input type="radio" name="align" class="ke-inline-block" value="left" /> <img name="leftImg" src="' + imgPath + 'align_left.gif" width="23" height="25" alt="" />',
|
56
|
+
' <input type="radio" name="align" class="ke-inline-block" value="right" /> <img name="rightImg" src="' + imgPath + 'align_right.gif" width="23" height="25" alt="" />',
|
57
|
+
'</div>',
|
58
|
+
//title
|
59
|
+
'<div class="ke-dialog-row">',
|
60
|
+
'<label for="keTitle" style="width:60px;">' + lang.imgTitle + '</label>',
|
61
|
+
'<input type="text" id="keTitle" class="ke-input-text" name="title" value="" style="width:200px;" /></div>',
|
62
|
+
'</div>',
|
63
|
+
'</div>'
|
64
|
+
].join('');
|
65
|
+
var dialogWidth = allowImageUpload ? 450 : 400;
|
66
|
+
dialogHeight = allowImageUpload ? 300 : 250;
|
67
|
+
var dialog = self.createDialog({
|
68
|
+
name : name,
|
69
|
+
width : dialogWidth,
|
70
|
+
height : dialogHeight,
|
71
|
+
title : self.lang(name),
|
72
|
+
body : html,
|
73
|
+
yesBtn : {
|
74
|
+
name : self.lang('yes'),
|
75
|
+
click : function(e) {
|
76
|
+
// insert local image
|
77
|
+
if (tabs && tabs.selectedIndex === 1) {
|
78
|
+
uploadbutton.submit();
|
79
|
+
localUrlBox.val('');
|
80
|
+
return;
|
81
|
+
}
|
82
|
+
// insert remote image
|
83
|
+
var url = K.trim(urlBox.val()),
|
84
|
+
width = widthBox.val(),
|
85
|
+
height = heightBox.val(),
|
86
|
+
title = titleBox.val(),
|
87
|
+
align = '';
|
88
|
+
alignBox.each(function() {
|
89
|
+
if (this.checked) {
|
90
|
+
align = this.value;
|
91
|
+
return false;
|
92
|
+
}
|
93
|
+
});
|
94
|
+
if (url == 'http://' || K.invalidUrl(url)) {
|
95
|
+
alert(self.lang('invalidUrl'));
|
96
|
+
urlBox[0].focus();
|
97
|
+
return;
|
98
|
+
}
|
99
|
+
if (!/^\d*$/.test(width)) {
|
100
|
+
alert(self.lang('invalidWidth'));
|
101
|
+
widthBox[0].focus();
|
102
|
+
return;
|
103
|
+
}
|
104
|
+
if (!/^\d*$/.test(height)) {
|
105
|
+
alert(self.lang('invalidHeight'));
|
106
|
+
heightBox[0].focus();
|
107
|
+
return;
|
108
|
+
}
|
109
|
+
clickFn.call(self, url, title, width, height, 0, align);
|
110
|
+
}
|
111
|
+
},
|
112
|
+
beforeRemove : function() {
|
113
|
+
viewServerBtn.remove();
|
114
|
+
widthBox.remove();
|
115
|
+
heightBox.remove();
|
116
|
+
refreshBtn.remove();
|
117
|
+
uploadbutton.remove();
|
118
|
+
}
|
119
|
+
}),
|
120
|
+
div = dialog.div;
|
121
|
+
|
122
|
+
var tabs;
|
123
|
+
if (allowImageUpload) {
|
124
|
+
tabs = K.tabs({
|
125
|
+
src : K('.tabs', div),
|
126
|
+
afterSelect : function(i) {
|
127
|
+
|
128
|
+
}
|
129
|
+
});
|
130
|
+
tabs.add({
|
131
|
+
title : lang.remoteImage,
|
132
|
+
panel : K('.tab1', div)
|
133
|
+
});
|
134
|
+
tabs.add({
|
135
|
+
title : lang.localImage,
|
136
|
+
panel : K('.tab2', div)
|
137
|
+
});
|
138
|
+
tabs.select(0);
|
139
|
+
} else {
|
140
|
+
K('.tab1', div).show();
|
141
|
+
}
|
142
|
+
|
143
|
+
var urlBox = K('[name="url"]', div),
|
144
|
+
localUrlBox = K('[name="localUrl"]', div),
|
145
|
+
viewServerBtn = K('[name="viewServer"]', div),
|
146
|
+
widthBox = K('[name="width"]', div),
|
147
|
+
heightBox = K('[name="height"]', div),
|
148
|
+
refreshBtn = K('.ke-refresh-btn', div),
|
149
|
+
titleBox = K('[name="title"]', div),
|
150
|
+
alignBox = K('[name="align"]');
|
151
|
+
|
152
|
+
var uploadbutton = K.uploadbutton({
|
153
|
+
button : K('.ke-upload-button', div)[0],
|
154
|
+
fieldName : 'imgFile',
|
155
|
+
url : K.addParam(uploadJson, 'dir=image'),
|
156
|
+
afterUpload : function(data) {
|
157
|
+
if (data.error === 0) {
|
158
|
+
var width = widthBox.val(),
|
159
|
+
height = heightBox.val(),
|
160
|
+
title = titleBox.val(),
|
161
|
+
align = '';
|
162
|
+
alignBox.each(function() {
|
163
|
+
if (this.checked) {
|
164
|
+
align = this.value;
|
165
|
+
return false;
|
166
|
+
}
|
167
|
+
});
|
168
|
+
var url = K.formatUrl(data.url, 'absolute');
|
169
|
+
clickFn.call(self, url, title, width, height, 0, align);
|
170
|
+
if (self.afterUpload) {
|
171
|
+
self.afterUpload.call(self, url);
|
172
|
+
}
|
173
|
+
} else {
|
174
|
+
alert(data.message);
|
175
|
+
}
|
176
|
+
}
|
177
|
+
});
|
178
|
+
uploadbutton.fileBox.change(function(e) {
|
179
|
+
localUrlBox.val(uploadbutton.fileBox.val());
|
180
|
+
});
|
181
|
+
if (allowFileManager) {
|
182
|
+
viewServerBtn.click(function(e) {
|
183
|
+
self.loadPlugin('filemanager', function() {
|
184
|
+
self.plugin.filemanagerDialog({
|
185
|
+
viewType : 'VIEW',
|
186
|
+
dirName : 'image',
|
187
|
+
clickFn : function(url, title) {
|
188
|
+
if (self.dialogs.length > 1) {
|
189
|
+
K('[name="url"]', div).val(url);
|
190
|
+
self.hideDialog();
|
191
|
+
}
|
192
|
+
}
|
193
|
+
});
|
194
|
+
});
|
195
|
+
});
|
196
|
+
} else {
|
197
|
+
viewServerBtn.hide();
|
198
|
+
}
|
199
|
+
var originalWidth = 0, originalHeight = 0;
|
200
|
+
function setSize(width, height) {
|
201
|
+
widthBox.val(width);
|
202
|
+
heightBox.val(height);
|
203
|
+
originalWidth = width;
|
204
|
+
originalHeight = height;
|
205
|
+
}
|
206
|
+
refreshBtn.click(function(e) {
|
207
|
+
var tempImg = K('<img src="' + urlBox.val() + '" />', self.edit.doc).css({
|
208
|
+
position : 'absolute',
|
209
|
+
visibility : 'hidden',
|
210
|
+
top : 0,
|
211
|
+
left : '1000px'
|
212
|
+
});
|
213
|
+
K(self.edit.doc.body).append(tempImg);
|
214
|
+
setSize(tempImg.width(), tempImg.height());
|
215
|
+
tempImg.remove();
|
216
|
+
});
|
217
|
+
widthBox.change(function(e) {
|
218
|
+
if (originalWidth > 0) {
|
219
|
+
heightBox.val(Math.round(originalHeight / originalWidth * parseInt(this.value, 10)));
|
220
|
+
}
|
221
|
+
});
|
222
|
+
heightBox.change(function(e) {
|
223
|
+
if (originalHeight > 0) {
|
224
|
+
widthBox.val(Math.round(originalWidth / originalHeight * parseInt(this.value, 10)));
|
225
|
+
}
|
226
|
+
});
|
227
|
+
urlBox.val(options.imageUrl);
|
228
|
+
setSize(options.imageWidth, options.imageHeight);
|
229
|
+
titleBox.val(options.imageTitle);
|
230
|
+
alignBox.each(function() {
|
231
|
+
if (this.value === options.imageAlign) {
|
232
|
+
this.checked = true;
|
233
|
+
return false;
|
234
|
+
}
|
235
|
+
});
|
236
|
+
urlBox[0].focus();
|
237
|
+
urlBox[0].select();
|
238
|
+
return dialog;
|
239
|
+
};
|
240
|
+
self.plugin.image = {
|
241
|
+
edit : function() {
|
242
|
+
var img = self.plugin.getSelectedImage();
|
243
|
+
self.plugin.imageDialog({
|
244
|
+
imageUrl : img ? img.attr('data-ke-src') : 'http://',
|
245
|
+
imageWidth : img ? img.width() : '',
|
246
|
+
imageHeight : img ? img.height() : '',
|
247
|
+
imageTitle : img ? img.attr('title') : '',
|
248
|
+
imageAlign : img ? img.attr('align') : '',
|
249
|
+
clickFn : function(url, title, width, height, border, align) {
|
250
|
+
self.exec('insertimage', url, title, width, height, border, align).hideDialog().focus();
|
251
|
+
}
|
252
|
+
});
|
253
|
+
},
|
254
|
+
'delete' : function() {
|
255
|
+
self.plugin.getSelectedImage().remove();
|
256
|
+
}
|
257
|
+
};
|
258
|
+
self.clickToolbar(name, self.plugin.image.edit);
|
259
|
+
});
|