simditor 2.3.4 → 2.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.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/lib/simditor/version.rb +1 -1
- data/vendor/assets/javascripts/simditor/simditor.js +248 -33
- data/vendor/assets/stylesheets/simditor/editor.scss +8 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1f44c26e34b3aece6942197da6e3314d0c7c635
|
4
|
+
data.tar.gz: 951effb9402b5164749c2c8ad72b35038ccebe3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 875fb95f73906783e4982f12f1a975686bc7a5beefe85b6344493439d945437434dd4e34da3d09ad0bae09fe383f21039bf2b7e9c3f51ae075e8497d4a2a2db5
|
7
|
+
data.tar.gz: 34711d636b9dec976c9cc847a2c1b89af88088cf6139e5f9e10f0e768f11f7d5ee345c7f68ec708468bc5bb7ce08a9e60b6964c64237e3b2bd324a5fed782a92
|
data/README.md
CHANGED
data/lib/simditor/version.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/*!
|
2
|
-
* Simditor v2.3.
|
2
|
+
* Simditor v2.3.5
|
3
3
|
* http://simditor.tower.im/
|
4
|
-
* 2015-
|
4
|
+
* 2015-11-19
|
5
5
|
*/
|
6
6
|
(function (root, factory) {
|
7
7
|
if (typeof define === 'function' && define.amd) {
|
@@ -19,7 +19,7 @@
|
|
19
19
|
}
|
20
20
|
}(this, function ($, SimpleModule, simpleHotkeys, simpleUploader) {
|
21
21
|
|
22
|
-
var AlignmentButton, BlockquoteButton, BoldButton, Button, Clipboard, CodeButton, CodePopover, ColorButton, Formatter, HrButton, ImageButton, ImagePopover, IndentButton, Indentation, InputManager, ItalicButton, Keystroke, LinkButton, LinkPopover, ListButton, OrderListButton, OutdentButton, Popover, Selection, Simditor, StrikethroughButton, TableButton, TitleButton, Toolbar, UnderlineButton, UndoManager, UnorderListButton, Util,
|
22
|
+
var AlignmentButton, BlockquoteButton, BoldButton, Button, Clipboard, CodeButton, CodePopover, ColorButton, FontScaleButton, Formatter, HrButton, ImageButton, ImagePopover, IndentButton, Indentation, InputManager, ItalicButton, Keystroke, LinkButton, LinkPopover, ListButton, OrderListButton, OutdentButton, Popover, Selection, Simditor, StrikethroughButton, TableButton, TitleButton, Toolbar, UnderlineButton, UndoManager, UnorderListButton, Util,
|
23
23
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
24
24
|
hasProp = {}.hasOwnProperty,
|
25
25
|
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
|
@@ -59,7 +59,7 @@ Selection = (function(superClass) {
|
|
59
59
|
})(this));
|
60
60
|
return this.editor.on('blur', (function(_this) {
|
61
61
|
return function(e) {
|
62
|
-
return _this.
|
62
|
+
return _this.reset();
|
63
63
|
};
|
64
64
|
})(this));
|
65
65
|
};
|
@@ -480,7 +480,7 @@ Formatter = (function(superClass) {
|
|
480
480
|
code: ['class']
|
481
481
|
}, this.opts.allowedAttributes);
|
482
482
|
this._allowedStyles = $.extend({
|
483
|
-
span: ['color'],
|
483
|
+
span: ['color', 'font-size'],
|
484
484
|
b: ['color'],
|
485
485
|
i: ['color'],
|
486
486
|
strong: ['color'],
|
@@ -603,7 +603,7 @@ Formatter = (function(superClass) {
|
|
603
603
|
};
|
604
604
|
|
605
605
|
Formatter.prototype.cleanNode = function(node, recursive) {
|
606
|
-
var $childImg, $node, $p, $td, allowedAttributes, attr, contents, isDecoration, k, l, len, len1, n, ref, ref1, text, textNode;
|
606
|
+
var $blockEls, $childImg, $node, $p, $td, allowedAttributes, attr, contents, isDecoration, k, l, len, len1, n, ref, ref1, text, textNode;
|
607
607
|
$node = $(node);
|
608
608
|
if (!($node.length > 0)) {
|
609
609
|
return;
|
@@ -626,6 +626,14 @@ Formatter = (function(superClass) {
|
|
626
626
|
$node = $childImg;
|
627
627
|
contents = null;
|
628
628
|
}
|
629
|
+
if ($node.is('td') && ($blockEls = $node.find(this.editor.util.blockNodes.join(','))).length > 0) {
|
630
|
+
$blockEls.each((function(_this) {
|
631
|
+
return function(i, blockEl) {
|
632
|
+
return $(blockEl).contents().unwrap();
|
633
|
+
};
|
634
|
+
})(this));
|
635
|
+
contents = $node.contents();
|
636
|
+
}
|
629
637
|
if ($node.is('img') && $node.hasClass('uploading')) {
|
630
638
|
$node.remove();
|
631
639
|
}
|
@@ -903,9 +911,9 @@ InputManager = (function(superClass) {
|
|
903
911
|
if (_this.lastCaretPosition) {
|
904
912
|
_this.editor.undoManager.caretPosition(_this.lastCaretPosition);
|
905
913
|
} else {
|
906
|
-
$blockEl = _this.body.children.first();
|
914
|
+
$blockEl = _this.editor.body.children().first();
|
907
915
|
range = document.createRange();
|
908
|
-
_this.selection.setRangeAtStartOf($blockEl, range);
|
916
|
+
_this.editor.selection.setRangeAtStartOf($blockEl, range);
|
909
917
|
}
|
910
918
|
}
|
911
919
|
_this.lastCaretPosition = null;
|
@@ -1329,7 +1337,7 @@ UndoManager = (function(superClass) {
|
|
1329
1337
|
return function() {
|
1330
1338
|
return _this._pushUndoState();
|
1331
1339
|
};
|
1332
|
-
})(this),
|
1340
|
+
})(this), 2000);
|
1333
1341
|
this.editor.on('valuechanged', (function(_this) {
|
1334
1342
|
return function(e, src) {
|
1335
1343
|
if (src === 'undo' || src === 'redo') {
|
@@ -1340,8 +1348,14 @@ UndoManager = (function(superClass) {
|
|
1340
1348
|
})(this));
|
1341
1349
|
this.editor.on('selectionchanged', (function(_this) {
|
1342
1350
|
return function(e) {
|
1343
|
-
_this.resetCaretPosition();
|
1344
|
-
|
1351
|
+
return _this.resetCaretPosition();
|
1352
|
+
};
|
1353
|
+
})(this));
|
1354
|
+
this.editor.on('focus', (function(_this) {
|
1355
|
+
return function(e) {
|
1356
|
+
if (_this._stack.length === 0) {
|
1357
|
+
return _this._pushUndoState();
|
1358
|
+
}
|
1345
1359
|
};
|
1346
1360
|
})(this));
|
1347
1361
|
return this.editor.on('blur', (function(_this) {
|
@@ -1380,19 +1394,18 @@ UndoManager = (function(superClass) {
|
|
1380
1394
|
};
|
1381
1395
|
|
1382
1396
|
UndoManager.prototype._pushUndoState = function() {
|
1383
|
-
var
|
1397
|
+
var caret;
|
1384
1398
|
if (this.editor.triggerHandler('pushundostate') === false) {
|
1385
1399
|
return;
|
1386
1400
|
}
|
1387
|
-
|
1388
|
-
|
1389
|
-
if (currentState && currentState.html === html) {
|
1401
|
+
caret = this.caretPosition();
|
1402
|
+
if (!caret.start) {
|
1390
1403
|
return;
|
1391
1404
|
}
|
1392
1405
|
this._index += 1;
|
1393
1406
|
this._stack.length = this._index;
|
1394
1407
|
this._stack.push({
|
1395
|
-
html: html,
|
1408
|
+
html: this.editor.body.html(),
|
1396
1409
|
caret: this.caretPosition()
|
1397
1410
|
});
|
1398
1411
|
if (this._stack.length > this._capacity) {
|
@@ -1464,7 +1477,7 @@ UndoManager = (function(superClass) {
|
|
1464
1477
|
return false;
|
1465
1478
|
}
|
1466
1479
|
if (child.nodeType === Node.TEXT_NODE) {
|
1467
|
-
if (!merging) {
|
1480
|
+
if (!merging && child.nodeValue.length > 0) {
|
1468
1481
|
offset += 1;
|
1469
1482
|
merging = true;
|
1470
1483
|
}
|
@@ -1913,11 +1926,10 @@ Toolbar = (function(superClass) {
|
|
1913
1926
|
return true;
|
1914
1927
|
};
|
1915
1928
|
})(this);
|
1929
|
+
floatInitialized = null;
|
1916
1930
|
$(window).on('resize.simditor-' + this.editor.id, function(e) {
|
1917
|
-
|
1918
|
-
return floatInitialized = null;
|
1931
|
+
return floatInitialized = initToolbarFloat();
|
1919
1932
|
});
|
1920
|
-
floatInitialized = null;
|
1921
1933
|
$(window).on('scroll.simditor-' + this.editor.id, (function(_this) {
|
1922
1934
|
return function(e) {
|
1923
1935
|
var bottomEdge, scrollTop, topEdge;
|
@@ -2668,9 +2680,11 @@ Simditor.i18n = {
|
|
2668
2680
|
'outdent': '向左缩进',
|
2669
2681
|
'italic': '斜体文字',
|
2670
2682
|
'link': '插入链接',
|
2671
|
-
'text': '文本',
|
2672
2683
|
'linkText': '链接文字',
|
2673
|
-
'linkUrl': '
|
2684
|
+
'linkUrl': '链接地址',
|
2685
|
+
'linkTarget': '打开方式',
|
2686
|
+
'openLinkInCurrentWindow': '在新窗口中打开',
|
2687
|
+
'openLinkInNewWindow': '在当前窗口中打开',
|
2674
2688
|
'removeLink': '移除链接',
|
2675
2689
|
'ol': '有序列表',
|
2676
2690
|
'ul': '无序列表',
|
@@ -2690,7 +2704,13 @@ Simditor.i18n = {
|
|
2690
2704
|
'alignCenter': '居中',
|
2691
2705
|
'alignLeft': '居左',
|
2692
2706
|
'alignRight': '居右',
|
2693
|
-
'selectLanguage': '选择程序语言'
|
2707
|
+
'selectLanguage': '选择程序语言',
|
2708
|
+
'fontScale': '字体大小',
|
2709
|
+
'fontScaleXLarge': '超大字体',
|
2710
|
+
'fontScaleLarge': '大号字体',
|
2711
|
+
'fontScaleNormal': '正常大小',
|
2712
|
+
'fontScaleSmall': '小号字体',
|
2713
|
+
'fontScaleXSmall': '超小字体'
|
2694
2714
|
},
|
2695
2715
|
'en-US': {
|
2696
2716
|
'blockquote': 'Block Quote',
|
@@ -2713,9 +2733,11 @@ Simditor.i18n = {
|
|
2713
2733
|
'outdent': 'Outdent',
|
2714
2734
|
'italic': 'Italic',
|
2715
2735
|
'link': 'Insert Link',
|
2716
|
-
'
|
2717
|
-
'
|
2718
|
-
'
|
2736
|
+
'linkText': 'Text',
|
2737
|
+
'linkUrl': 'Url',
|
2738
|
+
'linkTarget': 'Target',
|
2739
|
+
'openLinkInCurrentWindow': 'Open link in current window',
|
2740
|
+
'openLinkInNewWindow': 'Open link in new window',
|
2719
2741
|
'removeLink': 'Remove Link',
|
2720
2742
|
'ol': 'Ordered List',
|
2721
2743
|
'ul': 'Unordered List',
|
@@ -2735,7 +2757,13 @@ Simditor.i18n = {
|
|
2735
2757
|
'alignCenter': 'Align Center',
|
2736
2758
|
'alignLeft': 'Align Left',
|
2737
2759
|
'alignRight': 'Align Right',
|
2738
|
-
'selectLanguage': 'Select Language'
|
2760
|
+
'selectLanguage': 'Select Language',
|
2761
|
+
'fontScale': 'Font Size',
|
2762
|
+
'fontScaleXLarge': 'X Large Size',
|
2763
|
+
'fontScaleLarge': 'Large Size',
|
2764
|
+
'fontScaleNormal': 'Normal Size',
|
2765
|
+
'fontScaleSmall': 'Small Size',
|
2766
|
+
'fontScaleXSmall': 'X Small Size'
|
2739
2767
|
}
|
2740
2768
|
};
|
2741
2769
|
|
@@ -3016,6 +3044,27 @@ Popover = (function(superClass) {
|
|
3016
3044
|
|
3017
3045
|
Popover.prototype.render = function() {};
|
3018
3046
|
|
3047
|
+
Popover.prototype._initLabelWidth = function() {
|
3048
|
+
var $fields;
|
3049
|
+
$fields = this.el.find('.settings-field');
|
3050
|
+
if (!($fields.length > 0)) {
|
3051
|
+
return;
|
3052
|
+
}
|
3053
|
+
this._labelWidth = 0;
|
3054
|
+
$fields.each((function(_this) {
|
3055
|
+
return function(i, field) {
|
3056
|
+
var $field, $label;
|
3057
|
+
$field = $(field);
|
3058
|
+
$label = $field.find('label');
|
3059
|
+
if (!($label.length > 0)) {
|
3060
|
+
return;
|
3061
|
+
}
|
3062
|
+
return _this._labelWidth = Math.max(_this._labelWidth, $label.width());
|
3063
|
+
};
|
3064
|
+
})(this));
|
3065
|
+
return $fields.find('label').width(this._labelWidth);
|
3066
|
+
};
|
3067
|
+
|
3019
3068
|
Popover.prototype.show = function($target, position) {
|
3020
3069
|
if (position == null) {
|
3021
3070
|
position = 'bottom';
|
@@ -3041,6 +3090,9 @@ Popover = (function(superClass) {
|
|
3041
3090
|
this.el.css({
|
3042
3091
|
left: -9999
|
3043
3092
|
}).show();
|
3093
|
+
if (!this._labelWidth) {
|
3094
|
+
this._initLabelWidth();
|
3095
|
+
}
|
3044
3096
|
this.editor.util.reflow();
|
3045
3097
|
this.refresh(position);
|
3046
3098
|
return this.trigger('popovershow');
|
@@ -3186,6 +3238,105 @@ TitleButton = (function(superClass) {
|
|
3186
3238
|
|
3187
3239
|
Simditor.Toolbar.addButton(TitleButton);
|
3188
3240
|
|
3241
|
+
FontScaleButton = (function(superClass) {
|
3242
|
+
extend(FontScaleButton, superClass);
|
3243
|
+
|
3244
|
+
function FontScaleButton() {
|
3245
|
+
return FontScaleButton.__super__.constructor.apply(this, arguments);
|
3246
|
+
}
|
3247
|
+
|
3248
|
+
FontScaleButton.prototype.name = 'fontScale';
|
3249
|
+
|
3250
|
+
FontScaleButton.prototype.icon = 'font';
|
3251
|
+
|
3252
|
+
FontScaleButton.prototype.disableTag = 'pre';
|
3253
|
+
|
3254
|
+
FontScaleButton.prototype.htmlTag = 'span';
|
3255
|
+
|
3256
|
+
FontScaleButton.prototype.sizeMap = {
|
3257
|
+
'x-large': '1.5em',
|
3258
|
+
'large': '1.25em',
|
3259
|
+
'small': '.75em',
|
3260
|
+
'x-small': '.5em'
|
3261
|
+
};
|
3262
|
+
|
3263
|
+
FontScaleButton.prototype._init = function() {
|
3264
|
+
this.menu = [
|
3265
|
+
{
|
3266
|
+
name: '150%',
|
3267
|
+
text: this._t('fontScaleXLarge'),
|
3268
|
+
param: '5'
|
3269
|
+
}, {
|
3270
|
+
name: '125%',
|
3271
|
+
text: this._t('fontScaleLarge'),
|
3272
|
+
param: '4'
|
3273
|
+
}, {
|
3274
|
+
name: '100%',
|
3275
|
+
text: this._t('fontScaleNormal'),
|
3276
|
+
param: '3'
|
3277
|
+
}, {
|
3278
|
+
name: '75%',
|
3279
|
+
text: this._t('fontScaleSmall'),
|
3280
|
+
param: '2'
|
3281
|
+
}, {
|
3282
|
+
name: '50%',
|
3283
|
+
text: this._t('fontScaleXSmall'),
|
3284
|
+
param: '1'
|
3285
|
+
}
|
3286
|
+
];
|
3287
|
+
return FontScaleButton.__super__._init.call(this);
|
3288
|
+
};
|
3289
|
+
|
3290
|
+
FontScaleButton.prototype._activeStatus = function() {
|
3291
|
+
var active, endNode, endNodes, range, startNode, startNodes;
|
3292
|
+
range = this.editor.selection.range();
|
3293
|
+
startNodes = this.editor.selection.startNodes();
|
3294
|
+
endNodes = this.editor.selection.endNodes();
|
3295
|
+
startNode = startNodes.filter('span[style*="font-size"]');
|
3296
|
+
endNode = endNodes.filter('span[style*="font-size"]');
|
3297
|
+
active = startNodes.length > 0 && endNodes.length > 0 && startNode.is(endNode);
|
3298
|
+
this.setActive(active);
|
3299
|
+
return this.active;
|
3300
|
+
};
|
3301
|
+
|
3302
|
+
FontScaleButton.prototype.command = function(param) {
|
3303
|
+
var $scales, containerNode, range;
|
3304
|
+
range = this.editor.selection.range();
|
3305
|
+
if (range.collapsed) {
|
3306
|
+
return;
|
3307
|
+
}
|
3308
|
+
document.execCommand('styleWithCSS', false, true);
|
3309
|
+
document.execCommand('fontSize', false, param);
|
3310
|
+
document.execCommand('styleWithCSS', false, false);
|
3311
|
+
this.editor.selection.reset();
|
3312
|
+
this.editor.selection.range();
|
3313
|
+
containerNode = this.editor.selection.containerNode();
|
3314
|
+
if (containerNode[0].nodeType === Node.TEXT_NODE) {
|
3315
|
+
$scales = containerNode.closest('span[style*="font-size"]');
|
3316
|
+
} else {
|
3317
|
+
$scales = containerNode.find('span[style*="font-size"]');
|
3318
|
+
}
|
3319
|
+
$scales.each((function(_this) {
|
3320
|
+
return function(i, n) {
|
3321
|
+
var $span, size;
|
3322
|
+
$span = $(n);
|
3323
|
+
size = n.style.fontSize;
|
3324
|
+
if (/large|x-large|small|x-small/.test(size)) {
|
3325
|
+
return $span.css('fontSize', _this.sizeMap[size]);
|
3326
|
+
} else if (size === 'medium') {
|
3327
|
+
return $span.replaceWith($span.contents());
|
3328
|
+
}
|
3329
|
+
};
|
3330
|
+
})(this));
|
3331
|
+
return this.editor.trigger('valuechanged');
|
3332
|
+
};
|
3333
|
+
|
3334
|
+
return FontScaleButton;
|
3335
|
+
|
3336
|
+
})(Button);
|
3337
|
+
|
3338
|
+
Simditor.Toolbar.addButton(FontScaleButton);
|
3339
|
+
|
3189
3340
|
BoldButton = (function(superClass) {
|
3190
3341
|
extend(BoldButton, superClass);
|
3191
3342
|
|
@@ -3640,8 +3791,24 @@ CodeButton = (function(superClass) {
|
|
3640
3791
|
});
|
3641
3792
|
};
|
3642
3793
|
|
3794
|
+
CodeButton.prototype._checkMode = function() {
|
3795
|
+
var $blockNodes, range;
|
3796
|
+
range = this.editor.selection.range();
|
3797
|
+
if (($blockNodes = $(range.cloneContents()).find(this.editor.util.blockNodes.join(','))) > 0 || (range.collapsed && this.editor.selection.startNodes().filter('code').length === 0)) {
|
3798
|
+
this.inlineMode = false;
|
3799
|
+
return this.htmlTag = 'pre';
|
3800
|
+
} else {
|
3801
|
+
this.inlineMode = true;
|
3802
|
+
return this.htmlTag = 'code';
|
3803
|
+
}
|
3804
|
+
};
|
3805
|
+
|
3643
3806
|
CodeButton.prototype._status = function() {
|
3807
|
+
this._checkMode();
|
3644
3808
|
CodeButton.__super__._status.call(this);
|
3809
|
+
if (this.inlineMode) {
|
3810
|
+
return;
|
3811
|
+
}
|
3645
3812
|
if (this.active) {
|
3646
3813
|
return this.popover.show(this.node);
|
3647
3814
|
} else {
|
@@ -3672,6 +3839,14 @@ CodeButton = (function(superClass) {
|
|
3672
3839
|
};
|
3673
3840
|
|
3674
3841
|
CodeButton.prototype.command = function() {
|
3842
|
+
if (this.inlineMode) {
|
3843
|
+
return this._inlineCommand();
|
3844
|
+
} else {
|
3845
|
+
return this._blockCommand();
|
3846
|
+
}
|
3847
|
+
};
|
3848
|
+
|
3849
|
+
CodeButton.prototype._blockCommand = function() {
|
3675
3850
|
var $rootNodes, clearCache, nodeCache, resultNodes;
|
3676
3851
|
$rootNodes = this.editor.selection.rootNodes();
|
3677
3852
|
nodeCache = [];
|
@@ -3707,6 +3882,24 @@ CodeButton = (function(superClass) {
|
|
3707
3882
|
return this.editor.trigger('valuechanged');
|
3708
3883
|
};
|
3709
3884
|
|
3885
|
+
CodeButton.prototype._inlineCommand = function() {
|
3886
|
+
var $code, $contents, range;
|
3887
|
+
range = this.editor.selection.range();
|
3888
|
+
if (this.active) {
|
3889
|
+
range.selectNodeContents(this.node[0]);
|
3890
|
+
this.editor.selection.save(range);
|
3891
|
+
this.node.contents().unwrap();
|
3892
|
+
this.editor.selection.restore();
|
3893
|
+
} else {
|
3894
|
+
$contents = $(range.extractContents());
|
3895
|
+
$code = $("<" + this.htmlTag + "/>").append($contents.contents());
|
3896
|
+
range.insertNode($code[0]);
|
3897
|
+
range.selectNodeContents($code[0]);
|
3898
|
+
this.editor.selection.range(range);
|
3899
|
+
}
|
3900
|
+
return this.editor.trigger('valuechanged');
|
3901
|
+
};
|
3902
|
+
|
3710
3903
|
return CodeButton;
|
3711
3904
|
|
3712
3905
|
})(Button);
|
@@ -3920,17 +4113,19 @@ LinkPopover = (function(superClass) {
|
|
3920
4113
|
|
3921
4114
|
LinkPopover.prototype.render = function() {
|
3922
4115
|
var tpl;
|
3923
|
-
tpl = "<div class=\"link-settings\">\n <div class=\"settings-field\">\n <label>" + (this._t('
|
4116
|
+
tpl = "<div class=\"link-settings\">\n <div class=\"settings-field\">\n <label>" + (this._t('linkText')) + "</label>\n <input class=\"link-text\" type=\"text\"/>\n <a class=\"btn-unlink\" href=\"javascript:;\" title=\"" + (this._t('removeLink')) + "\"\n tabindex=\"-1\">\n <span class=\"simditor-icon simditor-icon-unlink\"></span>\n </a>\n </div>\n <div class=\"settings-field\">\n <label>" + (this._t('linkUrl')) + "</label>\n <input class=\"link-url\" type=\"text\"/>\n </div>\n <div class=\"settings-field\">\n <label>" + (this._t('linkTarget')) + "</label>\n <select class=\"link-target\">\n <option value=\"_blank\">" + (this._t('openLinkInNewWindow')) + " (_blank)</option>\n <option value=\"_self\">" + (this._t('openLinkInCurrentWindow')) + " (_self)</option>\n </select>\n </div>\n</div>";
|
3924
4117
|
this.el.addClass('link-popover').append(tpl);
|
3925
4118
|
this.textEl = this.el.find('.link-text');
|
3926
4119
|
this.urlEl = this.el.find('.link-url');
|
3927
4120
|
this.unlinkEl = this.el.find('.btn-unlink');
|
4121
|
+
this.selectTarget = this.el.find('.link-target');
|
3928
4122
|
this.textEl.on('keyup', (function(_this) {
|
3929
4123
|
return function(e) {
|
3930
4124
|
if (e.which === 13) {
|
3931
4125
|
return;
|
3932
4126
|
}
|
3933
|
-
|
4127
|
+
_this.target.text(_this.textEl.val());
|
4128
|
+
return _this.editor.inputManager.throttledValueChanged();
|
3934
4129
|
};
|
3935
4130
|
})(this));
|
3936
4131
|
this.urlEl.on('keyup', (function(_this) {
|
@@ -3943,7 +4138,8 @@ LinkPopover = (function(superClass) {
|
|
3943
4138
|
if (!(/https?:\/\/|^\//ig.test(val) || !val)) {
|
3944
4139
|
val = 'http://' + val;
|
3945
4140
|
}
|
3946
|
-
|
4141
|
+
_this.target.attr('href', val);
|
4142
|
+
return _this.editor.inputManager.throttledValueChanged();
|
3947
4143
|
};
|
3948
4144
|
})(this));
|
3949
4145
|
$([this.urlEl[0], this.textEl[0]]).on('keydown', (function(_this) {
|
@@ -3954,11 +4150,11 @@ LinkPopover = (function(superClass) {
|
|
3954
4150
|
range = document.createRange();
|
3955
4151
|
_this.editor.selection.setRangeAfter(_this.target, range);
|
3956
4152
|
_this.hide();
|
3957
|
-
return _this.editor.
|
4153
|
+
return _this.editor.inputManager.throttledValueChanged();
|
3958
4154
|
}
|
3959
4155
|
};
|
3960
4156
|
})(this));
|
3961
|
-
|
4157
|
+
this.unlinkEl.on('click', (function(_this) {
|
3962
4158
|
return function(e) {
|
3963
4159
|
var range, txtNode;
|
3964
4160
|
txtNode = document.createTextNode(_this.target.text());
|
@@ -3966,7 +4162,13 @@ LinkPopover = (function(superClass) {
|
|
3966
4162
|
_this.hide();
|
3967
4163
|
range = document.createRange();
|
3968
4164
|
_this.editor.selection.setRangeAfter(txtNode, range);
|
3969
|
-
return _this.editor.
|
4165
|
+
return _this.editor.inputManager.throttledValueChanged();
|
4166
|
+
};
|
4167
|
+
})(this));
|
4168
|
+
return this.selectTarget.on('change', (function(_this) {
|
4169
|
+
return function(e) {
|
4170
|
+
_this.target.attr('target', _this.selectTarget.val());
|
4171
|
+
return _this.editor.inputManager.throttledValueChanged();
|
3970
4172
|
};
|
3971
4173
|
})(this));
|
3972
4174
|
};
|
@@ -4987,10 +5189,23 @@ TableButton = (function(superClass) {
|
|
4987
5189
|
};
|
4988
5190
|
|
4989
5191
|
TableButton.prototype.decorate = function($table) {
|
5192
|
+
var $headRow, $tbody, $thead;
|
4990
5193
|
if ($table.parent('.simditor-table').length > 0) {
|
4991
5194
|
this.undecorate($table);
|
4992
5195
|
}
|
4993
5196
|
$table.wrap('<div class="simditor-table"></div>');
|
5197
|
+
if ($table.find('thead').length < 1) {
|
5198
|
+
$thead = $('<thead />');
|
5199
|
+
$headRow = $table.find('tr').first();
|
5200
|
+
$thead.append($headRow);
|
5201
|
+
this._changeCellTag($headRow, 'th');
|
5202
|
+
$tbody = $table.find('tbody');
|
5203
|
+
if ($tbody.length > 0) {
|
5204
|
+
$tbody.before($thead);
|
5205
|
+
} else {
|
5206
|
+
$table.prepend($thead);
|
5207
|
+
}
|
5208
|
+
}
|
4994
5209
|
this.initResize($table);
|
4995
5210
|
return $table.parent();
|
4996
5211
|
};
|
@@ -463,23 +463,23 @@ $simditor-button-width: 46px;
|
|
463
463
|
line-height: 25px;
|
464
464
|
|
465
465
|
label {
|
466
|
-
|
467
|
-
|
466
|
+
display: inline-block;
|
467
|
+
margin: 0 5px 0 0;
|
468
468
|
}
|
469
469
|
|
470
470
|
input[type=text] {
|
471
|
-
|
471
|
+
display: inline-block;
|
472
472
|
width: 200px;
|
473
473
|
box-sizing: border-box;
|
474
474
|
font-size: 12px;
|
475
475
|
|
476
476
|
&.image-size {
|
477
|
-
width:
|
477
|
+
width: 83px;
|
478
478
|
}
|
479
479
|
}
|
480
480
|
|
481
481
|
.times {
|
482
|
-
|
482
|
+
display: inline-block;
|
483
483
|
width: 26px;
|
484
484
|
font-size: 12px;
|
485
485
|
text-align: center;
|
@@ -489,8 +489,8 @@ $simditor-button-width: 46px;
|
|
489
489
|
&.link-popover .btn-unlink,
|
490
490
|
&.image-popover .btn-upload,
|
491
491
|
&.image-popover .btn-restore {
|
492
|
-
|
493
|
-
margin: 0 0 0
|
492
|
+
display: inline-block;
|
493
|
+
margin: 0 0 0 5px;
|
494
494
|
color: #333333;
|
495
495
|
font-size: 14px;
|
496
496
|
outline: 0;
|
@@ -508,6 +508,7 @@ $simditor-button-width: 46px;
|
|
508
508
|
position: relative;
|
509
509
|
display: inline-block;
|
510
510
|
overflow: hidden;
|
511
|
+
vertical-align: middle;
|
511
512
|
|
512
513
|
input[type=file] {
|
513
514
|
position: absolute;
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simditor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wentao Liu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Rails assets wrapper for https://github.com/mycolorway/simditor
|
14
14
|
email:
|