rails_kindeditor 0.3.4 → 0.3.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.
- data/lib/rails_kindeditor/version.rb +1 -1
- data/vendor/assets/javascripts/kindeditor/kindeditor.js +96 -56
- data/vendor/assets/javascripts/kindeditor/plugins/flash/flash.js +6 -2
- data/vendor/assets/javascripts/kindeditor/plugins/image/image.js +25 -8
- data/vendor/assets/javascripts/kindeditor/plugins/insertfile/insertfile.js +6 -2
- data/vendor/assets/javascripts/kindeditor/plugins/media/media.js +6 -2
- data/vendor/assets/javascripts/kindeditor/plugins/multiimage/multiimage.js +21 -13
- data/vendor/assets/javascripts/kindeditor/plugins/table/table.js +24 -5
- metadata +2 -2
@@ -5,7 +5,7 @@
|
|
5
5
|
* @author Roddy <luolonghao@gmail.com>
|
6
6
|
* @website http://www.kindsoft.net/
|
7
7
|
* @licence http://www.kindsoft.net/license.php
|
8
|
-
* @version 4.1.
|
8
|
+
* @version 4.1.2 (2012-07-21)
|
9
9
|
*******************************************************************************/
|
10
10
|
(function (window, undefined) {
|
11
11
|
if (window.KindEditor) {
|
@@ -17,7 +17,7 @@ if (!window.console) {
|
|
17
17
|
if (!console.log) {
|
18
18
|
console.log = function () {};
|
19
19
|
}
|
20
|
-
var _VERSION = '4.1.
|
20
|
+
var _VERSION = '4.1.2 (2012-07-21)',
|
21
21
|
_ua = navigator.userAgent.toLowerCase(),
|
22
22
|
_IE = _ua.indexOf('msie') > -1 && _ua.indexOf('opera') == -1,
|
23
23
|
_GECKO = _ua.indexOf('gecko') > -1 && _ua.indexOf('khtml') == -1,
|
@@ -243,7 +243,7 @@ K.options = {
|
|
243
243
|
pasteType : 2,
|
244
244
|
dialogAlignType : 'page',
|
245
245
|
useContextmenu : true,
|
246
|
-
fullscreenShortcut :
|
246
|
+
fullscreenShortcut : false,
|
247
247
|
bodyClass : 'ke-content',
|
248
248
|
indentChar : '\t',
|
249
249
|
cssPath : '',
|
@@ -636,7 +636,9 @@ function _formatCss(css) {
|
|
636
636
|
}
|
637
637
|
function _formatUrl(url, mode, host, pathname) {
|
638
638
|
mode = _undef(mode, '').toLowerCase();
|
639
|
-
|
639
|
+
if (url.substr(0, 5) != 'data:') {
|
640
|
+
url = url.replace(/([^:])\/\//g, '$1/');
|
641
|
+
}
|
640
642
|
if (_inArray(mode, ['absolute', 'relative', 'domain']) < 0) {
|
641
643
|
return url;
|
642
644
|
}
|
@@ -712,6 +714,7 @@ function _formatHtml(html, htmlTags, urlType, wellFormatted, indentChar) {
|
|
712
714
|
html = html.replace(/<(?:br|br\s[^>]*)\s*\/?>\s*<\/p>/ig, '</p>');
|
713
715
|
html = html.replace(/(<(?:p|p\s[^>]*)>)\s*(<\/p>)/ig, '$1<br />$2');
|
714
716
|
html = html.replace(/\u200B/g, '');
|
717
|
+
html = html.replace(/\u00A9/g, '©');
|
715
718
|
var htmlTagMap = {};
|
716
719
|
if (htmlTags) {
|
717
720
|
_each(htmlTags, function(key, val) {
|
@@ -1279,7 +1282,6 @@ _extend(KNode, {
|
|
1279
1282
|
self.name = _getNodeName(self[0]);
|
1280
1283
|
self.type = self.length > 0 ? self[0].nodeType : null;
|
1281
1284
|
self.win = _getWin(self[0]);
|
1282
|
-
self._data = {};
|
1283
1285
|
},
|
1284
1286
|
each : function(fn) {
|
1285
1287
|
var self = this;
|
@@ -1473,10 +1475,16 @@ _extend(KNode, {
|
|
1473
1475
|
},
|
1474
1476
|
data : function(key, val) {
|
1475
1477
|
var self = this;
|
1478
|
+
key = 'kindeditor_data_' + key;
|
1476
1479
|
if (val === undefined) {
|
1477
|
-
|
1480
|
+
if (self.length < 1) {
|
1481
|
+
return null;
|
1482
|
+
}
|
1483
|
+
return self[0][key];
|
1478
1484
|
}
|
1479
|
-
|
1485
|
+
this.each(function() {
|
1486
|
+
this[key] = val;
|
1487
|
+
});
|
1480
1488
|
return self;
|
1481
1489
|
},
|
1482
1490
|
pos : function() {
|
@@ -1577,14 +1585,25 @@ _extend(KNode, {
|
|
1577
1585
|
delete self[i];
|
1578
1586
|
});
|
1579
1587
|
self.length = 0;
|
1580
|
-
self._data = {};
|
1581
1588
|
return self;
|
1582
1589
|
},
|
1583
1590
|
show : function(val) {
|
1584
|
-
|
1591
|
+
var self = this;
|
1592
|
+
if (val === undefined) {
|
1593
|
+
val = self._originDisplay || '';
|
1594
|
+
}
|
1595
|
+
if (self.css('display') != 'none') {
|
1596
|
+
return self;
|
1597
|
+
}
|
1598
|
+
return self.css('display', val);
|
1585
1599
|
},
|
1586
1600
|
hide : function() {
|
1587
|
-
|
1601
|
+
var self = this;
|
1602
|
+
if (self.length < 1) {
|
1603
|
+
return self;
|
1604
|
+
}
|
1605
|
+
self._originDisplay = self[0].style.display;
|
1606
|
+
return self.css('display', 'none');
|
1588
1607
|
},
|
1589
1608
|
outer : function() {
|
1590
1609
|
var self = this;
|
@@ -1737,6 +1756,9 @@ K = function(expr, root) {
|
|
1737
1756
|
if (expr && expr.constructor === KNode) {
|
1738
1757
|
return expr;
|
1739
1758
|
}
|
1759
|
+
if (expr.toArray) {
|
1760
|
+
expr = expr.toArray();
|
1761
|
+
}
|
1740
1762
|
if (_isArray(expr)) {
|
1741
1763
|
return newNode(expr);
|
1742
1764
|
}
|
@@ -1745,6 +1767,7 @@ K = function(expr, root) {
|
|
1745
1767
|
_each(_K, function(key, val) {
|
1746
1768
|
K[key] = val;
|
1747
1769
|
});
|
1770
|
+
K.NodeClass = KNode;
|
1748
1771
|
window.KindEditor = K;
|
1749
1772
|
var _START_TO_START = 0,
|
1750
1773
|
_START_TO_END = 1,
|
@@ -2451,6 +2474,7 @@ function _range(mixed) {
|
|
2451
2474
|
}
|
2452
2475
|
return new KRange(mixed);
|
2453
2476
|
}
|
2477
|
+
K.RangeClass = KRange;
|
2454
2478
|
K.range = _range;
|
2455
2479
|
K.START_TO_START = _START_TO_START;
|
2456
2480
|
K.START_TO_END = _START_TO_END;
|
@@ -3094,9 +3118,6 @@ _extend(KCmd, {
|
|
3094
3118
|
if (val === '') {
|
3095
3119
|
return self;
|
3096
3120
|
}
|
3097
|
-
if (_inPreElement(K(range.startContainer))) {
|
3098
|
-
return self;
|
3099
|
-
}
|
3100
3121
|
function pasteHtml(range, val) {
|
3101
3122
|
val = '<img id="__kindeditor_temp_tag__" width="0" height="0" style="display:none;" />' + val;
|
3102
3123
|
var rng = range.get();
|
@@ -3248,6 +3269,7 @@ function _cmd(mixed) {
|
|
3248
3269
|
}
|
3249
3270
|
return new KCmd(mixed);
|
3250
3271
|
}
|
3272
|
+
K.CmdClass = KCmd;
|
3251
3273
|
K.cmd = _cmd;
|
3252
3274
|
function _drag(options) {
|
3253
3275
|
var moveEl = options.moveEl,
|
@@ -3255,9 +3277,7 @@ function _drag(options) {
|
|
3255
3277
|
clickEl = options.clickEl || moveEl,
|
3256
3278
|
beforeDrag = options.beforeDrag,
|
3257
3279
|
iframeFix = options.iframeFix === undefined ? true : options.iframeFix;
|
3258
|
-
var docs = [document]
|
3259
|
-
poss = [{ x : 0, y : 0}],
|
3260
|
-
listeners = [];
|
3280
|
+
var docs = [document];
|
3261
3281
|
if (iframeFix) {
|
3262
3282
|
K('iframe').each(function() {
|
3263
3283
|
var doc;
|
@@ -3268,57 +3288,47 @@ function _drag(options) {
|
|
3268
3288
|
doc = null;
|
3269
3289
|
}
|
3270
3290
|
if (doc) {
|
3291
|
+
var pos = K(this).pos();
|
3292
|
+
K(doc).data('pos-x', pos.x);
|
3293
|
+
K(doc).data('pos-y', pos.y);
|
3271
3294
|
docs.push(doc);
|
3272
|
-
poss.push(K(this).pos());
|
3273
3295
|
}
|
3274
3296
|
});
|
3275
3297
|
}
|
3276
3298
|
clickEl.mousedown(function(e) {
|
3299
|
+
e.stopPropagation();
|
3277
3300
|
var self = clickEl.get(),
|
3278
3301
|
x = _removeUnit(moveEl.css('left')),
|
3279
3302
|
y = _removeUnit(moveEl.css('top')),
|
3280
3303
|
width = moveEl.width(),
|
3281
3304
|
height = moveEl.height(),
|
3282
3305
|
pageX = e.pageX,
|
3283
|
-
pageY = e.pageY
|
3284
|
-
dragging = true;
|
3306
|
+
pageY = e.pageY;
|
3285
3307
|
if (beforeDrag) {
|
3286
3308
|
beforeDrag();
|
3287
3309
|
}
|
3288
|
-
|
3289
|
-
|
3290
|
-
|
3291
|
-
|
3292
|
-
|
3293
|
-
|
3294
|
-
|
3295
|
-
|
3296
|
-
|
3297
|
-
|
3298
|
-
|
3299
|
-
|
3300
|
-
|
3301
|
-
|
3302
|
-
|
3303
|
-
|
3304
|
-
|
3305
|
-
_each(listeners, function() {
|
3306
|
-
K(this.doc).unbind('mousemove', this.move)
|
3307
|
-
.unbind('mouseup', this.up)
|
3308
|
-
.unbind('selectstart', this.select);
|
3309
|
-
});
|
3310
|
-
e.stop();
|
3310
|
+
function moveListener(e) {
|
3311
|
+
e.preventDefault();
|
3312
|
+
var kdoc = K(_getDoc(e.target));
|
3313
|
+
var diffX = _round((kdoc.data('pos-x') || 0) + e.pageX - pageX);
|
3314
|
+
var diffY = _round((kdoc.data('pos-y') || 0) + e.pageY - pageY);
|
3315
|
+
moveFn.call(clickEl, x, y, width, height, diffX, diffY);
|
3316
|
+
}
|
3317
|
+
function selectListener(e) {
|
3318
|
+
e.preventDefault();
|
3319
|
+
}
|
3320
|
+
function upListener(e) {
|
3321
|
+
e.preventDefault();
|
3322
|
+
K(docs).unbind('mousemove', moveListener)
|
3323
|
+
.unbind('mouseup', upListener)
|
3324
|
+
.unbind('selectstart', selectListener);
|
3325
|
+
if (self.releaseCapture) {
|
3326
|
+
self.releaseCapture();
|
3311
3327
|
}
|
3312
|
-
|
3313
|
-
|
3314
|
-
|
3315
|
-
|
3316
|
-
doc : doc,
|
3317
|
-
move : moveListener,
|
3318
|
-
up : upListener,
|
3319
|
-
select : selectListener
|
3320
|
-
});
|
3321
|
-
});
|
3328
|
+
}
|
3329
|
+
K(docs).mousemove(moveListener)
|
3330
|
+
.mouseup(upListener)
|
3331
|
+
.bind('selectstart', selectListener);
|
3322
3332
|
if (self.setCapture) {
|
3323
3333
|
self.setCapture();
|
3324
3334
|
}
|
@@ -3433,7 +3443,7 @@ _extend(KWidget, {
|
|
3433
3443
|
},
|
3434
3444
|
remove : function() {
|
3435
3445
|
var self = this;
|
3436
|
-
if (_IE && _V < 7) {
|
3446
|
+
if (_IE && _V < 7 || _QUIRKS) {
|
3437
3447
|
K(self.win).unbind('scroll');
|
3438
3448
|
}
|
3439
3449
|
self.div.remove();
|
@@ -3772,6 +3782,7 @@ _extend(KEdit, KWidget, {
|
|
3772
3782
|
function _edit(options) {
|
3773
3783
|
return new KEdit(options);
|
3774
3784
|
}
|
3785
|
+
K.EditClass = KEdit;
|
3775
3786
|
K.edit = _edit;
|
3776
3787
|
K.iframeDoc = _iframeDoc;
|
3777
3788
|
function _selectToolbar(name, fn) {
|
@@ -3900,6 +3911,7 @@ _extend(KToolbar, KWidget, {
|
|
3900
3911
|
function _toolbar(options) {
|
3901
3912
|
return new KToolbar(options);
|
3902
3913
|
}
|
3914
|
+
K.ToolbarClass = KToolbar;
|
3903
3915
|
K.toolbar = _toolbar;
|
3904
3916
|
function KMenu(options) {
|
3905
3917
|
this.init(options);
|
@@ -3980,6 +3992,7 @@ _extend(KMenu, KWidget, {
|
|
3980
3992
|
function _menu(options) {
|
3981
3993
|
return new KMenu(options);
|
3982
3994
|
}
|
3995
|
+
K.MenuClass = KMenu;
|
3983
3996
|
K.menu = _menu;
|
3984
3997
|
function KColorPicker(options) {
|
3985
3998
|
this.init(options);
|
@@ -4054,6 +4067,7 @@ _extend(KColorPicker, KWidget, {
|
|
4054
4067
|
function _colorpicker(options) {
|
4055
4068
|
return new KColorPicker(options);
|
4056
4069
|
}
|
4070
|
+
K.ColorPickerClass = KColorPicker;
|
4057
4071
|
K.colorpicker = _colorpicker;
|
4058
4072
|
function KUploadButton(options) {
|
4059
4073
|
this.init(options);
|
@@ -4142,6 +4156,7 @@ _extend(KUploadButton, {
|
|
4142
4156
|
function _uploadbutton(options) {
|
4143
4157
|
return new KUploadButton(options);
|
4144
4158
|
}
|
4159
|
+
K.UploadButtonClass = KUploadButton;
|
4145
4160
|
K.uploadbutton = _uploadbutton;
|
4146
4161
|
function _createButton(arg) {
|
4147
4162
|
arg = arg || {};
|
@@ -4275,6 +4290,7 @@ _extend(KDialog, KWidget, {
|
|
4275
4290
|
function _dialog(options) {
|
4276
4291
|
return new KDialog(options);
|
4277
4292
|
}
|
4293
|
+
K.DialogClass = KDialog;
|
4278
4294
|
K.dialog = _dialog;
|
4279
4295
|
function _tabs(options) {
|
4280
4296
|
var self = _widget(options),
|
@@ -4568,6 +4584,9 @@ function _bindNewlineEvent() {
|
|
4568
4584
|
if (newlineTag == 'br') {
|
4569
4585
|
return;
|
4570
4586
|
}
|
4587
|
+
if (_GECKO) {
|
4588
|
+
return;
|
4589
|
+
}
|
4571
4590
|
self.cmd.selection();
|
4572
4591
|
var tagName = getAncestorTagName(self.cmd.range);
|
4573
4592
|
if (tagName == 'marquee' || tagName == 'select') {
|
@@ -5117,12 +5136,12 @@ KEditor.prototype = {
|
|
5117
5136
|
}
|
5118
5137
|
return self;
|
5119
5138
|
},
|
5120
|
-
insertHtml : function(val) {
|
5139
|
+
insertHtml : function(val, quickMode) {
|
5121
5140
|
if (!this.isCreated) {
|
5122
5141
|
return this;
|
5123
5142
|
}
|
5124
5143
|
val = this.beforeSetHtml(val);
|
5125
|
-
this.exec('inserthtml', val);
|
5144
|
+
this.exec('inserthtml', val, quickMode);
|
5126
5145
|
return this;
|
5127
5146
|
},
|
5128
5147
|
appendHtml : function(val) {
|
@@ -5314,7 +5333,7 @@ function _create(expr, options) {
|
|
5314
5333
|
return editor.create();
|
5315
5334
|
}
|
5316
5335
|
var knode = K(expr);
|
5317
|
-
if (!knode) {
|
5336
|
+
if (!knode || knode.length === 0) {
|
5318
5337
|
return;
|
5319
5338
|
}
|
5320
5339
|
if (knode.length > 1) {
|
@@ -5334,6 +5353,27 @@ function _create(expr, options) {
|
|
5334
5353
|
});
|
5335
5354
|
return editor;
|
5336
5355
|
}
|
5356
|
+
function _eachEditor(expr, fn) {
|
5357
|
+
K(expr).each(function(i, el) {
|
5358
|
+
K.each(_instances, function(j, editor) {
|
5359
|
+
if (editor && editor.srcElement[0] == el) {
|
5360
|
+
fn.call(editor, j, editor);
|
5361
|
+
return false;
|
5362
|
+
}
|
5363
|
+
});
|
5364
|
+
});
|
5365
|
+
}
|
5366
|
+
K.remove = function(expr) {
|
5367
|
+
_eachEditor(expr, function(i) {
|
5368
|
+
this.remove();
|
5369
|
+
_instances.splice(i, 1);
|
5370
|
+
});
|
5371
|
+
};
|
5372
|
+
K.sync = function(expr) {
|
5373
|
+
_eachEditor(expr, function() {
|
5374
|
+
this.sync();
|
5375
|
+
});
|
5376
|
+
};
|
5337
5377
|
if (_IE && _V < 7) {
|
5338
5378
|
_nativeCommand(document, 'BackgroundImageCache', true);
|
5339
5379
|
}
|
@@ -13,6 +13,7 @@ KindEditor.plugin('flash', function(K) {
|
|
13
13
|
allowFileManager = K.undef(self.allowFileManager, false),
|
14
14
|
formatUploadUrl = K.undef(self.formatUploadUrl, true),
|
15
15
|
extraParams = K.undef(self.extraFileUploadParams, {}),
|
16
|
+
filePostName = K.undef(self.filePostName, 'imgFile'),
|
16
17
|
uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php');
|
17
18
|
self.plugin.flash = {
|
18
19
|
edit : function() {
|
@@ -86,7 +87,7 @@ KindEditor.plugin('flash', function(K) {
|
|
86
87
|
if (allowFlashUpload) {
|
87
88
|
var uploadbutton = K.uploadbutton({
|
88
89
|
button : K('.ke-upload-button', div)[0],
|
89
|
-
fieldName :
|
90
|
+
fieldName : filePostName,
|
90
91
|
extraParams : extraParams,
|
91
92
|
url : K.addParam(uploadJson, 'dir=flash'),
|
92
93
|
afterUpload : function(data) {
|
@@ -98,7 +99,7 @@ KindEditor.plugin('flash', function(K) {
|
|
98
99
|
}
|
99
100
|
urlBox.val(url);
|
100
101
|
if (self.afterUpload) {
|
101
|
-
self.afterUpload.call(self, url);
|
102
|
+
self.afterUpload.call(self, url, data, name);
|
102
103
|
}
|
103
104
|
alert(self.lang('uploadSuccess'));
|
104
105
|
} else {
|
@@ -127,6 +128,9 @@ KindEditor.plugin('flash', function(K) {
|
|
127
128
|
clickFn : function(url, title) {
|
128
129
|
if (self.dialogs.length > 1) {
|
129
130
|
K('[name="url"]', div).val(url);
|
131
|
+
if (self.afterSelectFile) {
|
132
|
+
self.afterSelectFile.call(self, url);
|
133
|
+
}
|
130
134
|
self.hideDialog();
|
131
135
|
}
|
132
136
|
}
|
@@ -16,6 +16,8 @@ KindEditor.plugin('image', function(K) {
|
|
16
16
|
imageTabIndex = K.undef(self.imageTabIndex, 0),
|
17
17
|
imgPath = self.pluginsPath + 'image/images/',
|
18
18
|
extraParams = K.undef(self.extraFileUploadParams, {}),
|
19
|
+
filePostName = K.undef(self.filePostName, 'imgFile'),
|
20
|
+
fillDescAfterUploadImage = K.undef(self.fillDescAfterUploadImage, false),
|
19
21
|
lang = self.lang(name + '.');
|
20
22
|
|
21
23
|
self.plugin.imageDialog = function(options) {
|
@@ -24,6 +26,8 @@ KindEditor.plugin('image', function(K) {
|
|
24
26
|
imageHeight = K.undef(options.imageHeight, ''),
|
25
27
|
imageTitle = K.undef(options.imageTitle, ''),
|
26
28
|
imageAlign = K.undef(options.imageAlign, ''),
|
29
|
+
showRemote = K.undef(options.showRemote, true),
|
30
|
+
showLocal = K.undef(options.showLocal, true),
|
27
31
|
tabIndex = K.undef(options.tabIndex, 0),
|
28
32
|
clickFn = options.clickFn;
|
29
33
|
var target = 'kindeditor_upload_iframe_' + new Date().getTime();
|
@@ -82,8 +86,8 @@ KindEditor.plugin('image', function(K) {
|
|
82
86
|
//local upload - end
|
83
87
|
'</div>'
|
84
88
|
].join('');
|
85
|
-
var dialogWidth =
|
86
|
-
dialogHeight =
|
89
|
+
var dialogWidth = showLocal || allowFileManager ? 450 : 400,
|
90
|
+
dialogHeight = showLocal && showRemote ? 300 : 250;
|
87
91
|
var dialog = self.createDialog({
|
88
92
|
name : name,
|
89
93
|
width : dialogWidth,
|
@@ -98,7 +102,7 @@ KindEditor.plugin('image', function(K) {
|
|
98
102
|
return;
|
99
103
|
}
|
100
104
|
// insert local image
|
101
|
-
if (tabs && tabs.selectedIndex === 1) {
|
105
|
+
if (showLocal && showRemote && tabs && tabs.selectedIndex === 1 || !showRemote) {
|
102
106
|
if (uploadbutton.fileBox.val() == '') {
|
103
107
|
alert(self.lang('pleaseSelectFile'));
|
104
108
|
return;
|
@@ -157,7 +161,7 @@ KindEditor.plugin('image', function(K) {
|
|
157
161
|
alignBox = K('.tab1 [name="align"]', div);
|
158
162
|
|
159
163
|
var tabs;
|
160
|
-
if (
|
164
|
+
if (showRemote && showLocal) {
|
161
165
|
tabs = K.tabs({
|
162
166
|
src : K('.tabs', div),
|
163
167
|
afterSelect : function(i) {}
|
@@ -171,13 +175,15 @@ KindEditor.plugin('image', function(K) {
|
|
171
175
|
panel : K('.tab2', div)
|
172
176
|
});
|
173
177
|
tabs.select(tabIndex);
|
174
|
-
} else {
|
178
|
+
} else if (showRemote) {
|
175
179
|
K('.tab1', div).show();
|
180
|
+
} else if (showLocal) {
|
181
|
+
K('.tab2', div).show();
|
176
182
|
}
|
177
183
|
|
178
184
|
var uploadbutton = K.uploadbutton({
|
179
185
|
button : K('.ke-upload-button', div)[0],
|
180
|
-
fieldName :
|
186
|
+
fieldName : filePostName,
|
181
187
|
url : K.addParam(uploadJson, 'dir=image'),
|
182
188
|
form : K('.ke-form', div),
|
183
189
|
target : target,
|
@@ -189,9 +195,15 @@ KindEditor.plugin('image', function(K) {
|
|
189
195
|
if (formatUploadUrl) {
|
190
196
|
url = K.formatUrl(url, 'absolute');
|
191
197
|
}
|
192
|
-
clickFn.call(self, url, '', '', '', 0, '');
|
193
198
|
if (self.afterUpload) {
|
194
|
-
self.afterUpload.call(self, url);
|
199
|
+
self.afterUpload.call(self, url, data, name);
|
200
|
+
}
|
201
|
+
if (!fillDescAfterUploadImage) {
|
202
|
+
clickFn.call(self, url, data.title, data.width, data.height, data.border, data.align);
|
203
|
+
} else {
|
204
|
+
K(".ke-dialog-row #remoteUrl", div).val(url);
|
205
|
+
K(".ke-tabs-li", div)[0].click();
|
206
|
+
K(".ke-refresh-btn", div).click();
|
195
207
|
}
|
196
208
|
} else {
|
197
209
|
alert(data.message);
|
@@ -214,6 +226,9 @@ KindEditor.plugin('image', function(K) {
|
|
214
226
|
clickFn : function(url, title) {
|
215
227
|
if (self.dialogs.length > 1) {
|
216
228
|
K('[name="url"]', div).val(url);
|
229
|
+
if (self.afterSelectFile) {
|
230
|
+
self.afterSelectFile.call(self, url);
|
231
|
+
}
|
217
232
|
self.hideDialog();
|
218
233
|
}
|
219
234
|
}
|
@@ -277,6 +292,8 @@ KindEditor.plugin('image', function(K) {
|
|
277
292
|
imageHeight : img ? img.height() : '',
|
278
293
|
imageTitle : img ? img.attr('title') : '',
|
279
294
|
imageAlign : img ? img.attr('align') : '',
|
295
|
+
showRemote : true,
|
296
|
+
showLocal : allowImageUpload,
|
280
297
|
tabIndex: img ? 0 : imageTabIndex,
|
281
298
|
clickFn : function(url, title, width, height, border, align) {
|
282
299
|
self.exec('insertimage', url, title, width, height, border, align);
|
@@ -14,6 +14,7 @@ KindEditor.plugin('insertfile', function(K) {
|
|
14
14
|
formatUploadUrl = K.undef(self.formatUploadUrl, true),
|
15
15
|
uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php'),
|
16
16
|
extraParams = K.undef(self.extraFileUploadParams, {}),
|
17
|
+
filePostName = K.undef(self.filePostName, 'imgFile'),
|
17
18
|
lang = self.lang(name + '.');
|
18
19
|
self.plugin.fileDialog = function(options) {
|
19
20
|
var fileUrl = K.undef(options.fileUrl, 'http://'),
|
@@ -69,7 +70,7 @@ KindEditor.plugin('insertfile', function(K) {
|
|
69
70
|
if (allowFileUpload) {
|
70
71
|
var uploadbutton = K.uploadbutton({
|
71
72
|
button : K('.ke-upload-button', div)[0],
|
72
|
-
fieldName :
|
73
|
+
fieldName : filePostName,
|
73
74
|
url : K.addParam(uploadJson, 'dir=file'),
|
74
75
|
extraParams : extraParams,
|
75
76
|
afterUpload : function(data) {
|
@@ -81,7 +82,7 @@ KindEditor.plugin('insertfile', function(K) {
|
|
81
82
|
}
|
82
83
|
urlBox.val(url);
|
83
84
|
if (self.afterUpload) {
|
84
|
-
self.afterUpload.call(self, url);
|
85
|
+
self.afterUpload.call(self, url, data, name);
|
85
86
|
}
|
86
87
|
alert(self.lang('uploadSuccess'));
|
87
88
|
} else {
|
@@ -109,6 +110,9 @@ KindEditor.plugin('insertfile', function(K) {
|
|
109
110
|
clickFn : function(url, title) {
|
110
111
|
if (self.dialogs.length > 1) {
|
111
112
|
K('[name="url"]', div).val(url);
|
113
|
+
if (self.afterSelectFile) {
|
114
|
+
self.afterSelectFile.call(self, url);
|
115
|
+
}
|
112
116
|
self.hideDialog();
|
113
117
|
}
|
114
118
|
}
|
@@ -13,6 +13,7 @@ KindEditor.plugin('media', function(K) {
|
|
13
13
|
allowFileManager = K.undef(self.allowFileManager, false),
|
14
14
|
formatUploadUrl = K.undef(self.formatUploadUrl, true),
|
15
15
|
extraParams = K.undef(self.extraFileUploadParams, {}),
|
16
|
+
filePostName = K.undef(self.filePostName, 'imgFile'),
|
16
17
|
uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php');
|
17
18
|
self.plugin.media = {
|
18
19
|
edit : function() {
|
@@ -94,7 +95,7 @@ KindEditor.plugin('media', function(K) {
|
|
94
95
|
if (allowMediaUpload) {
|
95
96
|
var uploadbutton = K.uploadbutton({
|
96
97
|
button : K('.ke-upload-button', div)[0],
|
97
|
-
fieldName :
|
98
|
+
fieldName : filePostName,
|
98
99
|
extraParams : extraParams,
|
99
100
|
url : K.addParam(uploadJson, 'dir=media'),
|
100
101
|
afterUpload : function(data) {
|
@@ -106,7 +107,7 @@ KindEditor.plugin('media', function(K) {
|
|
106
107
|
}
|
107
108
|
urlBox.val(url);
|
108
109
|
if (self.afterUpload) {
|
109
|
-
self.afterUpload.call(self, url);
|
110
|
+
self.afterUpload.call(self, url, data, name);
|
110
111
|
}
|
111
112
|
alert(self.lang('uploadSuccess'));
|
112
113
|
} else {
|
@@ -135,6 +136,9 @@ KindEditor.plugin('media', function(K) {
|
|
135
136
|
clickFn : function(url, title) {
|
136
137
|
if (self.dialogs.length > 1) {
|
137
138
|
K('[name="url"]', div).val(url);
|
139
|
+
if (self.afterSelectFile) {
|
140
|
+
self.afterSelectFile.call(self, url);
|
141
|
+
}
|
138
142
|
self.hideDialog();
|
139
143
|
}
|
140
144
|
}
|
@@ -57,6 +57,7 @@ K.extend(KSWFUpload, {
|
|
57
57
|
file_types_description : options.fileTypesDesc,
|
58
58
|
file_upload_limit : options.fileUploadLimit,
|
59
59
|
file_size_limit : options.fileSizeLimit,
|
60
|
+
post_params : options.postParams,
|
60
61
|
file_queued_handler : function(file) {
|
61
62
|
file.url = self.options.fileIconUrl;
|
62
63
|
self.appendFile(file);
|
@@ -113,7 +114,7 @@ K.extend(KSWFUpload, {
|
|
113
114
|
return;
|
114
115
|
}
|
115
116
|
file.url = data.url;
|
116
|
-
K('.ke-img', itemDiv).attr('src', file.url).attr('data-status', file.filestatus);
|
117
|
+
K('.ke-img', itemDiv).attr('src', file.url).attr('data-status', file.filestatus).data('data', data);
|
117
118
|
K('.ke-status > div', itemDiv).hide();
|
118
119
|
}
|
119
120
|
};
|
@@ -127,10 +128,9 @@ K.extend(KSWFUpload, {
|
|
127
128
|
var list = [];
|
128
129
|
K('.ke-img', self.bodyDiv).each(function() {
|
129
130
|
var img = K(this);
|
130
|
-
var url = img.attr('src');
|
131
131
|
var status = img.attr('data-status');
|
132
132
|
if (status == SWFUpload.FILE_STATUS.COMPLETE) {
|
133
|
-
list.push(
|
133
|
+
list.push(img.data('data'));
|
134
134
|
}
|
135
135
|
});
|
136
136
|
return list;
|
@@ -203,6 +203,7 @@ KindEditor.plugin('multiimage', function(K) {
|
|
203
203
|
imageSizeLimit = K.undef(self.imageSizeLimit, '1MB'),
|
204
204
|
imageFileTypes = K.undef(self.imageFileTypes, '*.jpg;*.gif;*.png'),
|
205
205
|
imageUploadLimit = K.undef(self.imageUploadLimit, 20),
|
206
|
+
filePostName = K.undef(self.filePostName, 'imgFile'),
|
206
207
|
lang = self.lang(name + '.');
|
207
208
|
|
208
209
|
self.plugin.multiImageDialog = function(options) {
|
@@ -248,11 +249,12 @@ KindEditor.plugin('multiimage', function(K) {
|
|
248
249
|
startButtonValue : lang.startUpload,
|
249
250
|
uploadUrl : K.addParam(uploadJson, 'dir=image'),
|
250
251
|
flashUrl : imgPath + 'swfupload.swf',
|
251
|
-
filePostName :
|
252
|
+
filePostName : filePostName,
|
252
253
|
fileTypes : '*.jpg;*.jpeg;*.gif;*.png;*.bmp',
|
253
254
|
fileTypesDesc : 'Image Files',
|
254
255
|
fileUploadLimit : imageUploadLimit,
|
255
256
|
fileSizeLimit : imageSizeLimit,
|
257
|
+
postParams : K.undef(self.extraFileUploadParams, {}),
|
256
258
|
queueLimitExceeded : lang.queueLimitExceeded,
|
257
259
|
fileExceedsSizeLimit : lang.fileExceedsSizeLimit,
|
258
260
|
zeroByteFile : lang.zeroByteFile,
|
@@ -273,11 +275,12 @@ KindEditor.plugin('multiimage', function(K) {
|
|
273
275
|
if (urlList.length === 0) {
|
274
276
|
return;
|
275
277
|
}
|
276
|
-
|
277
|
-
|
278
|
-
|
278
|
+
K.each(urlList, function(i, data) {
|
279
|
+
if (self.afterUpload) {
|
280
|
+
self.afterUpload.call(self, data.url, data, 'multiimage');
|
281
|
+
}
|
282
|
+
self.exec('insertimage', data.url, data.title, data.width, data.height, data.border, data.align);
|
279
283
|
});
|
280
|
-
self.insertHtml(html);
|
281
284
|
// Bugfix: [Firefox] 上传图片后,总是出现正在加载的样式,需要延迟执行hideDialog
|
282
285
|
setTimeout(function() {
|
283
286
|
self.hideDialog().focus();
|
@@ -305,14 +308,17 @@ KindEditor.plugin('multiimage', function(K) {
|
|
305
308
|
/* ******************* */
|
306
309
|
/* Constructor & Init */
|
307
310
|
/* ******************* */
|
308
|
-
var SWFUpload;
|
309
311
|
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
312
|
+
(function() {
|
313
|
+
|
314
|
+
if (window.SWFUpload) {
|
315
|
+
return;
|
314
316
|
}
|
315
317
|
|
318
|
+
window.SWFUpload = function (settings) {
|
319
|
+
this.initSWFUpload(settings);
|
320
|
+
};
|
321
|
+
|
316
322
|
SWFUpload.prototype.initSWFUpload = function (settings) {
|
317
323
|
try {
|
318
324
|
this.customSettings = {}; // A container where developers can place their own settings associated with this instance.
|
@@ -1366,3 +1372,5 @@ if (typeof(SWFUpload) === "function") {
|
|
1366
1372
|
}
|
1367
1373
|
};
|
1368
1374
|
}
|
1375
|
+
|
1376
|
+
})();
|
@@ -494,6 +494,9 @@ KindEditor.plugin('table', function(K) {
|
|
494
494
|
row = self.plugin.getSelectedRow()[0],
|
495
495
|
cell = self.plugin.getSelectedCell()[0],
|
496
496
|
index = cell.cellIndex + offset;
|
497
|
+
// 取得第一行的index
|
498
|
+
index += table.rows[0].cells.length - row.cells.length;
|
499
|
+
|
497
500
|
for (var i = 0, len = table.rows.length; i < len; i++) {
|
498
501
|
var newRow = table.rows[i],
|
499
502
|
newCell = newRow.insertCell(index);
|
@@ -514,14 +517,18 @@ KindEditor.plugin('table', function(K) {
|
|
514
517
|
rowinsert : function(offset) {
|
515
518
|
var table = self.plugin.getSelectedTable()[0],
|
516
519
|
row = self.plugin.getSelectedRow()[0],
|
517
|
-
cell = self.plugin.getSelectedCell()[0]
|
518
|
-
|
520
|
+
cell = self.plugin.getSelectedCell()[0];
|
521
|
+
var rowIndex = row.rowIndex;
|
519
522
|
if (offset === 1) {
|
520
|
-
|
521
|
-
} else {
|
522
|
-
newRow = table.insertRow(row.rowIndex);
|
523
|
+
rowIndex = row.rowIndex + (cell.rowSpan - 1) + offset;
|
523
524
|
}
|
525
|
+
var newRow = table.insertRow(rowIndex);
|
526
|
+
|
524
527
|
for (var i = 0, len = row.cells.length; i < len; i++) {
|
528
|
+
// 调整cell个数
|
529
|
+
if (row.cells[i].rowSpan > 1) {
|
530
|
+
len -= row.cells[i].rowSpan - 1;
|
531
|
+
}
|
525
532
|
var newCell = newRow.insertCell(i);
|
526
533
|
// copy colspan
|
527
534
|
if (offset === 1 && row.cells[i].colSpan > 1) {
|
@@ -529,6 +536,18 @@ KindEditor.plugin('table', function(K) {
|
|
529
536
|
}
|
530
537
|
newCell.innerHTML = K.IE ? '' : '<br />';
|
531
538
|
}
|
539
|
+
// 调整rowspan
|
540
|
+
for (var j = rowIndex; j >= 0; j--) {
|
541
|
+
var cells = table.rows[j].cells;
|
542
|
+
if (cells.length > i) {
|
543
|
+
for (var k = cell.cellIndex; k >= 0; k--) {
|
544
|
+
if (cells[k].rowSpan > 1) {
|
545
|
+
cells[k].rowSpan += 1;
|
546
|
+
}
|
547
|
+
}
|
548
|
+
break;
|
549
|
+
}
|
550
|
+
}
|
532
551
|
self.cmd.range.selectNodeContents(cell).collapse(true);
|
533
552
|
self.cmd.select();
|
534
553
|
self.addBookmark();
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_kindeditor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: carrierwave
|