vendor/assets/javascripts/simditor/simditor.js in simditor-2.2.3 vs vendor/assets/javascripts/simditor/simditor.js in simditor-2.2.4
- old
+ new
@@ -1,5 +1,10 @@
+/*!
+* Simditor v2.2.3
+* http://simditor.tower.im/
+* 2015-08-22
+*/
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module unless amdModuleId is set
define('simditor', ["jquery","simple-module","simple-hotkeys","simple-uploader"], function ($, SimpleModule, simpleHotkeys, simpleUploader) {
return (root['Simditor'] = factory($, SimpleModule, simpleHotkeys, simpleUploader));
@@ -3418,10 +3423,13 @@
BlockquoteButton.prototype.disableTag = 'pre, table';
BlockquoteButton.prototype.command = function() {
var $rootNodes, clearCache, nodeCache;
$rootNodes = this.editor.selection.rootNodes();
+ $rootNodes = $rootNodes.filter(function(i, node) {
+ return !$(node).parent().is('blockquote');
+ });
this.editor.selection.save();
nodeCache = [];
clearCache = (function(_this) {
return function() {
if (nodeCache.length > 0) {
@@ -3500,10 +3508,11 @@
});
};
CodeButton.prototype._status = function() {
CodeButton.__super__._status.call(this);
+ console.log('test');
if (this.active) {
return this.popover.show(this.node);
} else {
return this.popover.hide();
}
@@ -3530,41 +3539,42 @@
}
return $pre.wrapInner($code).removeAttr('data-lang');
};
CodeButton.prototype.command = function() {
- var $rootNodes, clearCache, nodeCache, pres;
+ var $rootNodes, clearCache, nodeCache, resultNodes;
$rootNodes = this.editor.selection.rootNodes();
nodeCache = [];
- pres = [];
+ resultNodes = [];
clearCache = (function(_this) {
return function() {
var $pre;
if (!(nodeCache.length > 0)) {
return;
}
$pre = $("<" + _this.htmlTag + "/>").insertBefore(nodeCache[0]).text(_this.editor.formatter.clearHtml(nodeCache));
- pres.push($pre[0]);
+ resultNodes.push($pre[0]);
return nodeCache.length = 0;
};
})(this);
$rootNodes.each((function(_this) {
return function(i, node) {
- var $node;
+ var $node, $p;
$node = $(node);
if ($node.is(_this.htmlTag)) {
clearCache();
- return $('<p/>').append($node.html().replace('\n', '<br/>')).replaceAll($node);
+ $p = $('<p/>').append($node.html().replace('\n', '<br/>')).replaceAll($node);
+ return resultNodes.push($p[0]);
} else if ($node.is(_this.disableTag) || _this.editor.util.isDecoratedNode($node) || $node.is('blockquote')) {
return clearCache();
} else {
return nodeCache.push(node);
}
};
})(this));
clearCache();
- this.editor.selection.setRangeAtEndOf($(pres).last());
+ this.editor.selection.setRangeAtEndOf($(resultNodes).last());
return this.editor.trigger('valuechanged');
};
return CodeButton;
@@ -3989,10 +3999,11 @@
$input.remove();
}
return $input = $('<input/>', {
type: 'file',
title: _this._t('uploadImage'),
+ multiple: true,
accept: 'image/*'
}).appendTo($uploadItem);
};
})(this);
createInput();
@@ -4375,9 +4386,10 @@
_this.input.remove();
}
return _this.input = $('<input/>', {
type: 'file',
title: _this._t('uploadImage'),
+ multiple: true,
accept: 'image/*'
}).appendTo($uploadBtn);
};
})(this);
createInput();