b31400186ef39bfb1b1057a2c5c7b2R2904">2904
+
+ Button.prototype.setIcon = function(icon) {
+ return this.el.find('span').removeClass().addClass(this.iconClassOf(icon)).text(this.text);
+ };
+
+ Button.prototype.render = function() {
+ this.wrapper = $(this._tpl.item).appendTo(this.editor.toolbar.list);
+ this.el = this.wrapper.find('a.toolbar-item');
+ this.el.attr('title', this.title).addClass("toolbar-item-" + this.name).data('button', this);
+ this.setIcon(this.icon);
+ if (!this.menu) {
+ return;
+ }
+ this.menuWrapper = $(this._tpl.menuWrapper).appendTo(this.wrapper);
+ this.menuWrapper.addClass("toolbar-menu-" + this.name);
+ return this.renderMenu();
+ };
+
+ Button.prototype.renderMenu = function() {
+ var $menuBtnEl, $menuItemEl, k, len, menuItem, ref, ref1, results;
+ if (!$.isArray(this.menu)) {
+ return;
+ }
+ this.menuEl = $('<ul/>').appendTo(this.menuWrapper);
+ ref = this.menu;
+ results = [];
+ for (k = 0, len = ref.length; k < len; k++) {
+ menuItem = ref[k];
+ if (menuItem === '|') {
+ $(this._tpl.separator).appendTo(this.menuEl);
+ continue;
+ }
+ $menuItemEl = $(this._tpl.menuItem).appendTo(this.menuEl);
+ $menuBtnEl = $menuItemEl.find('a.menu-item').attr({
+ 'title': (ref1 = menuItem.title) != null ? ref1 : menuItem.text,
+ 'data-param': menuItem.param
+ }).addClass('menu-item-' + menuItem.name);
+ if (menuItem.icon) {
+ results.push($menuBtnEl.find('span').addClass(this.iconClassOf(menuItem.icon)));
+ } else {
+ results.push($menuBtnEl.find('span').text(menuItem.text));
+ }
+ }
+ return results;
+ };
+
+ Button.prototype.setActive = function(active) {
+ if (active === this.active) {
+ return;
+ }
+ this.active = active;
+ return this.el.toggleClass('active', this.active);
+ };
+
+ Button.prototype.setDisabled = function(disabled) {
+ if (disabled === this.disabled) {
+ return;
+ }
+ this.disabled = disabled;
+ return this.el.toggleClass('disabled', this.disabled);
+ };
+
+ Button.prototype._disableStatus = function() {
+ var disabled, endNodes, startNodes;
+ startNodes = this.editor.selection.startNodes();
+ endNodes = this.editor.selection.endNodes();
+ disabled = startNodes.filter(this.disableTag).length > 0 || endNodes.filter(this.disableTag).length > 0;
+ this.setDisabled(disabled);
+ if (this.disabled) {
+ this.setActive(false);
+ }
+ return this.disabled;
+ };
+
+ Button.prototype._activeStatus = function() {
+ var active, endNode, endNodes, startNode, startNodes;
+ startNodes = this.editor.selection.startNodes();
+ endNodes = this.editor.selection.endNodes();
+ startNode = startNodes.filter(this.htmlTag);
+ endNode = endNodes.filter(this.htmlTag);
+ active = startNode.length > 0 && endNode.length > 0 && startNode.is(endNode);
+ this.node = active ? startNode : null;
+ this.setActive(active);
+ return this.active;
+ };
+
+ Button.prototype._status = function() {
+ this._disableStatus();
+ if (this.disabled) {
+ return;
+ }
+ return this._activeStatus();
+ };
+
+ Button.prototype.command = function(param) {};
+
+ Button.prototype._t = function() {
+ var args, ref, result;
+ args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
+ result = Button.__super__._t.apply(this, args);
+ if (!result) {
+ result = (ref = this.editor)._t.apply(ref, args);
+ }
+ return result;
+ };
+
+ return Button;
+
+})(SimpleModule);
+
+Simditor.Button = Button;
+
+Popover = (function(superClass) {
+ extend(Popover, superClass);
+
+ Popover.prototype.offset = {
+ top: 4,
+ left: 0
+ };
+
+ Popover.prototype.target = null;
+
+ Popover.prototype.active = false;
+
+ function Popover(opts) {
+ this.button = opts.button;
+ this.editor = opts.button.editor;
+ Popover.__super__.constructor.call(this, opts);
+ }
+
+ Popover.prototype._init = function() {
+ this.el = $('<div class="simditor-popover"></div>').appendTo(this.editor.el).data('popover', this);
+ this.render();
+ this.el.on('mouseenter', (function(_this) {
+ return function(e) {
+ return _this.el.addClass('hover');
+ };
+ })(this));
+ return this.el.on('mouseleave', (function(_this) {
+ return function(e) {
+ return _this.el.removeClass('hover');
+ };
+ })(this));
+ };
+
+ Popover.prototype.render = function() {};
+
+ Popover.prototype._initLabelWidth = function() {
+ var $fields;
+ $fields = this.el.find('.settings-field');
+ if (!($fields.length > 0)) {
+ return;
+ }
+ this._labelWidth = 0;
+ $fields.each((function(_this) {
+ return function(i, field) {
+ var $field, $label;
+ $field = $(field);
+ $label = $field.find('label');
+ if (!($label.length > 0)) {
+ return;
+ }
+ return _this._labelWidth = Math.max(_this._labelWidth, $label.width());
+ };
+ })(this));
+ return $fields.find('label').width(this._labelWidth);
+ };
+
+ Popover.prototype.show = function($target, position) {
+ if (position == null) {
+ position = 'bottom';
+ }
+ if ($target == null) {
+ return;
+ }
+ this.el.siblings('.simditor-popover').each(function(i, popover) {
+ popover = $(popover).data('popover');
+ if (popover.active) {
+ return popover.hide();
+ }
+ });
+ if (this.active && this.target) {
+ this.target.removeClass('selected');
+ }
+ this.target = $target.addClass('selected');
+ if (this.active) {
+ this.refresh(position);
+ return this.trigger('popovershow');
+ } else {
+ this.active = true;
+ this.el.css({
+ left: -9999
+ }).show();
+ if (!this._labelWidth) {
+ this._initLabelWidth();
+ }
+ this.editor.util.reflow();
+ this.refresh(position);
+ return this.trigger('popovershow');
+ }
+ };
+
+ Popover.prototype.hide = function() {
+ if (!this.active) {
+ return;
+ }
+ if (this.target) {
+ this.target.removeClass('selected');
+ }
+ this.target = null;
+ this.active = false;
+ this.el.hide();
+ return this.trigger('popoverhide');
+ };
+
+ Popover.prototype.refresh = function(position) {
+ var editorOffset, left, maxLeft, targetH, targetOffset, top;
+ if (position == null) {
+ position = 'bottom';
+ }
+ if (!this.active) {
+ return;
+ }
+ editorOffset = this.editor.el.offset();
+ targetOffset = this.target.offset();
+ targetH = this.target.outerHeight();
+ if (position === 'bottom') {
+ top = targetOffset.top - editorOffset.top + targetH;
+ } else if (position === 'top') {
+ top = targetOffset.top - editorOffset.top - this.el.height();
+ }
+ maxLeft = this.editor.wrapper.width() - this.el.outerWidth() - 10;
+ left = Math.min(targetOffset.left - editorOffset.left, maxLeft);
+ return this.el.css({
+ top: top + this.offset.top,
+ left: left + this.offset.left
+ });
+ };
+
+ Popover.prototype.destroy = function() {
+ this.target = null;
+ this.active = false;
+ this.editor.off('.linkpopover');
+ return this.el.remove();
+ };
+
+ Popover.prototype._t = function() {
+ var args, ref, result;
+ args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
+ result = Popover.__super__._t.apply(this, args);
+ if (!result) {
+ result = (ref = this.button)._t.apply(ref, args);
+ }
+ return result;
+ };
+
+ return Popover;
+
+})(SimpleModule);
+
+Simditor.Popover = Popover;
+
+TitleButton = (function(superClass) {
+ extend(TitleButton, superClass);
+
+ function TitleButton() {
+ return TitleButton.__super__.constructor.apply(this, arguments);
+ }
+
+ TitleButton.prototype.name = 'title';
+
+ TitleButton.prototype.htmlTag = 'h1, h2, h3, h4, h5';
+
+ TitleButton.prototype.disableTag = 'pre, table';
+
+ TitleButton.prototype._init = function() {
+ this.menu = [
+ {
+ name: 'normal',
+ text: this._t('normalText'),
+ param: 'p'
+ }, '|', {
+ name: 'h1',
+ text: this._t('title') + ' 1',
+ param: 'h1'
+ }, {
+ name: 'h2',
+ text: this._t('title') + ' 2',
+ param: 'h2'
+ }, {
+ name: 'h3',
+ text: this._t('title') + ' 3',
+ param: 'h3'
+ }, {
+ name: 'h4',
+ text: this._t('title') + ' 4',
+ param: 'h4'
+ }, {
+ name: 'h5',
+ text: this._t('title') + ' 5',
+ param: 'h5'
+ }
+ ];
+ return TitleButton.__super__._init.call(this);
+ };
+
+ TitleButton.prototype.setActive = function(active, param) {
+ TitleButton.__super__.setActive.call(this, active);
+ if (active) {
+ param || (param = this.node[0].tagName.toLowerCase());
+ }
+ this.el.removeClass('active-p active-h1 active-h2 active-h3 active-h4 active-h5');
+ if (active) {
+ return this.el.addClass('active active-' + param);
+ }
+ };
+
+ TitleButton.prototype.command = function(param) {
+ var $rootNodes;
+ $rootNodes = this.editor.selection.rootNodes();
+ this.editor.selection.save();
+ $rootNodes.each((function(_this) {
+ return function(i, node) {
+ var $node;
+ $node = $(node);
+ if ($node.is('blockquote') || $node.is(param) || $node.is(_this.disableTag) || _this.editor.util.isDecoratedNode($node)) {
+ return;
+ }
+ return $('<' + param + '/>').append($node.contents()).replaceAll($node);
+ };
+ })(this));
+ this.editor.selection.restore();
+ return this.editor.trigger('valuechanged');
+ };
+
+ return TitleButton;
+
+})(Button);
+
+Simditor.Toolbar.addButton(TitleButton);
+
+FontScaleButton = (function(superClass) {
+ extend(FontScaleButton, superClass);
+
+ function FontScaleButton() {
+ return FontScaleButton.__super__.constructor.apply(this, arguments);
+ }
+
+ FontScaleButton.prototype.name = 'fontScale';
+
+ FontScaleButton.prototype.icon = 'font';
+
+ FontScaleButton.prototype.disableTag = 'pre';
+
+ FontScaleButton.prototype.htmlTag = 'span';
+
+ FontScaleButton.prototype.sizeMap = {
+ 'x-large': '1.5em',
+ 'large': '1.25em',
+ 'small': '.75em',
+ 'x-small': '.5em'
+ };
+
+ FontScaleButton.prototype._init = function() {
+ this.menu = [
+ {
+ name: '150%',
+ text: this._t('fontScaleXLarge'),
+ param: '5'
+ }, {
+ name: '125%',
+ text: this._t('fontScaleLarge'),
+ param: '4'
+ }, {
+ name: '100%',
+ text: this._t('fontScaleNormal'),
+ param: '3'
+ }, {
+ name: '75%',
+ text: this._t('fontScaleSmall'),
+ param: '2'
+ }, {
+ name: '50%',
+ text: this._t('fontScaleXSmall'),
+ param: '1'
+ }
+ ];
+ return FontScaleButton.__super__._init.call(this);
+ };
+
+ FontScaleButton.prototype._activeStatus = function() {
+ var active, endNode, endNodes, range, startNode, startNodes;
+ range = this.editor.selection.range();
+ startNodes = this.editor.selection.startNodes();
+ endNodes = this.editor.selection.endNodes();
+ startNode = startNodes.filter('span[style*="font-size"]');
+ endNode = endNodes.filter('span[style*="font-size"]');
+ active = startNodes.length > 0 && endNodes.length > 0 && startNode.is(endNode);
+ this.setActive(active);
+ return this.active;
+ };
+
+ FontScaleButton.prototype.command = function(param) {
+ var $scales, containerNode, range;
+ range = this.editor.selection.range();
+ if (range.collapsed) {
+ return;
+ }
+ document.execCommand('styleWithCSS', false, true);
+ document.execCommand('fontSize', false, param);
+ document.execCommand('styleWithCSS', false, false);
+ this.editor.selection.reset();
+ this.editor.selection.range();
+ containerNode = this.editor.selection.containerNode();
+ if (containerNode[0].nodeType === Node.TEXT_NODE) {
+ $scales = containerNode.closest('span[style*="font-size"]');
+ } else {
+ $scales = containerNode.find('span[style*="font-size"]');
+ }
+ $scales.each((function(_this) {
+ return function(i, n) {
+ var $span, size;
+ $span = $(n);
+ size = n.style.fontSize;
+ if (/large|x-large|small|x-small/.test(size)) {
+ return $span.css('fontSize', _this.sizeMap[size]);
+ } else if (size === 'medium') {
+ return $span.replaceWith($span.contents());
+ }
+ };
+ })(this));
+ return this.editor.trigger('valuechanged');
+ };
+
+ return FontScaleButton;
+
+})(Button);
+
+Simditor.Toolbar.addButton(FontScaleButton);
+
+BoldButton = (function(superClass) {
+ extend(BoldButton, superClass);
+
+ function BoldButton() {
+ return BoldButton.__super__.constructor.apply(this, arguments);
+ }
+
+ BoldButton.prototype.name = 'bold';
+
+ BoldButton.prototype.icon = 'bold';
+
+ BoldButton.prototype.htmlTag = 'b, strong';
+
+ BoldButton.prototype.disableTag = 'pre';
+
+ BoldButton.prototype.shortcut = 'cmd+b';
+
+ BoldButton.prototype._init = function() {
+ if (this.editor.util.os.mac) {
+ this.title = this.title + ' ( Cmd + b )';
+ } else {
+ this.title = this.title + ' ( Ctrl + b )';
+ this.shortcut = 'ctrl+b';
+ }
+ return BoldButton.__super__._init.call(this);
+ };
+
+ BoldButton.prototype._activeStatus = function() {
+ var active;
+ active = document.queryCommandState('bold') === true;
+ this.setActive(active);
+ return this.active;
+ };
+
+ BoldButton.prototype.command = function() {
+ document.execCommand('bold');
+ if (!this.editor.util.support.oninput) {
+ this.editor.trigger('valuechanged');
+ }
+ return $(document).trigger('selectionchange');
+ };
+
+ return BoldButton;
+
+})(Button);
+
+Simditor.Toolbar.addButton(BoldButton);
+
+ItalicButton = (function(superClass) {
+ extend(ItalicButton, superClass);
+
+ function ItalicButton() {
+ return ItalicButton.__super__.constructor.apply(this, arguments);
+ }
+
+ ItalicButton.prototype.name = 'italic';
+
+ ItalicButton.prototype.icon = 'italic';
+
+ ItalicButton.prototype.htmlTag = 'i';
+
+ ItalicButton.prototype.disableTag = 'pre';
+
+ ItalicButton.prototype.shortcut = 'cmd+i';
+
+ ItalicButton.prototype._init = function() {
+ if (this.editor.util.os.mac) {
+ this.title = this.title + " ( Cmd + i )";
+ } else {
+ this.title = this.title + " ( Ctrl + i )";
+ this.shortcut = 'ctrl+i';
+ }
+ return ItalicButton.__super__._init.call(this);
+ };
+
+ ItalicButton.prototype._activeStatus = function() {
+ var active;
+ active = document.queryCommandState('italic') === true;
+ this.setActive(active);
+ return this.active;
+ };
+
+ ItalicButton.prototype.command = function() {
+ document.execCommand('italic');
+ if (!this.editor.util.support.oninput) {
+ this.editor.trigger('valuechanged');
+ }
+ return $(document).trigger('selectionchange');
+ };
+
+ return ItalicButton;
+
+})(Button);
+
+Simditor.Toolbar.addButton(ItalicButton);
+
+UnderlineButton = (function(superClass) {
+ extend(UnderlineButton, superClass);
+
+ function UnderlineButton() {
+ return UnderlineButton.__super__.constructor.apply(this, arguments);
+ }
+
+ UnderlineButton.prototype.name = 'underline';
+
+ UnderlineButton.prototype.icon = 'underline';
+
+ UnderlineButton.prototype.htmlTag = 'u';
+
+ UnderlineButton.prototype.disableTag = 'pre';
+
+ UnderlineButton.prototype.shortcut = 'cmd+u';
+
+ UnderlineButton.prototype.render = function() {
+ if (this.editor.util.os.mac) {
+ this.title = this.title + ' ( Cmd + u )';
+ } else {
+ this.title = this.title + ' ( Ctrl + u )';
+ this.shortcut = 'ctrl+u';
+ }
+ return UnderlineButton.__super__.render.call(this);
+ };
+
+ UnderlineButton.prototype._activeStatus = function() {
+ var active;
+ active = document.queryCommandState('underline') === true;
+ this.setActive(active);
+ return this.active;
+ };
+
+ UnderlineButton.prototype.command = function() {
+ document.execCommand('underline');
+ if (!this.editor.util.support.oninput) {
+ this.editor.trigger('valuechanged');
+ }
+ return $(document).trigger('selectionchange');
+ };
+
+ return UnderlineButton;
+
+})(Button);
+
+Simditor.Toolbar.addButton(UnderlineButton);
+
+ColorButton = (function(superClass) {
+ extend(ColorButton, superClass);
+
+ function ColorButton() {
+ return ColorButton.__super__.constructor.apply(this, arguments);
+ }
+
+ ColorButton.prototype.name = 'color';
+
+ ColorButton.prototype.icon = 'tint';
+
+ ColorButton.prototype.disableTag = 'pre';
+
+ ColorButton.prototype.menu = true;
+
+ ColorButton.prototype.render = function() {
+ var args;
+ args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
+ return ColorButton.__super__.render.apply(this, args);
+ };
+
+ ColorButton.prototype.renderMenu = function() {
+ $('<ul class="color-list">\n <li><a href="javascript:;" class="font-color font-color-1"></a></li>\n <li><a href="javascript:;" class="font-color font-color-2"></a></li>\n <li><a href="javascript:;" class="font-color font-color-3"></a></li>\n <li><a href="javascript:;" class="font-color font-color-4"></a></li>\n <li><a href="javascript:;" class="font-color font-color-5"></a></li>\n <li><a href="javascript:;" class="font-color font-color-6"></a></li>\n <li><a href="javascript:;" class="font-color font-color-7"></a></li>\n <li><a href="javascript:;" class="font-color font-color-default"></a></li>\n</ul>').appendTo(this.menuWrapper);
+ this.menuWrapper.on('mousedown', '.color-list', function(e) {
+ return false;
+ });
+ return this.menuWrapper.on('click', '.font-color', (function(_this) {
+ return function(e) {
+ var $link, $p, hex, range, rgb, textNode;
+ _this.wrapper.removeClass('menu-on');
+ $link = $(e.currentTarget);
+ if ($link.hasClass('font-color-default')) {
+ $p = _this.editor.body.find('p, li');
+ if (!($p.length > 0)) {
+ return;
+ }
+ rgb = window.getComputedStyle($p[0], null).getPropertyValue('color');
+ hex = _this._convertRgbToHex(rgb);
+ } else {
+ rgb = window.getComputedStyle($link[0], null).getPropertyValue('background-color');
+ hex = _this._convertRgbToHex(rgb);
+ }
+ if (!hex) {
+ return;
+ }
+ range = _this.editor.selection.range();
+ if (!$link.hasClass('font-color-default') && range.collapsed) {
+ textNode = document.createTextNode(_this._t('coloredText'));
+ range.insertNode(textNode);
+ range.selectNodeContents(textNode);
+ _this.editor.selection.range(range);
+ }
+ document.execCommand('styleWithCSS', false, true);
+ document.execCommand('foreColor', false, hex);
+ document.execCommand('styleWithCSS', false, false);
+ if (!_this.editor.util.support.oninput) {
+ return _this.editor.trigger('valuechanged');
+ }
+ };
+ })(this));
+ };
+
+ ColorButton.prototype._convertRgbToHex = function(rgb) {
+ var match, re, rgbToHex;
+ re = /rgb\((\d+),\s?(\d+),\s?(\d+)\)/g;
+ match = re.exec(rgb);
+ if (!match) {
+ return '';
+ }
+ rgbToHex = function(r, g, b) {
+ var componentToHex;
+ componentToHex = function(c) {
+ var hex;
+ hex = c.toString(16);
+ if (hex.length === 1) {
+ return '0' + hex;
+ } else {
+ return hex;
+ }
+ };
+ return "#" + componentToHex(r) + componentToHex(g) + componentToHex(b);
+ };
+ return rgbToHex(match[1] * 1, match[2] * 1, match[3] * 1);
+ };
+
+ return ColorButton;
+
+})(Button);
+
+Simditor.Toolbar.addButton(ColorButton);
+
+ListButton = (function(superClass) {
+ extend(ListButton, superClass);
+
+ function ListButton() {
+ return ListButton.__super__.constructor.apply(this, arguments);
+ }
+
+ ListButton.prototype.type = '';
+
+ ListButton.prototype.disableTag = 'pre, table';
+
+ ListButton.prototype.command = function(param) {
+ var $list, $rootNodes, anotherType;
+ $rootNodes = this.editor.selection.blockNodes();
+ anotherType = this.type === 'ul' ? 'ol' : 'ul';
+ this.editor.selection.save();
+ $list = null;
+ $rootNodes.each((function(_this) {
+ return function(i, node) {
+ var $node;
+ $node = $(node);
+ if ($node.is('blockquote, li') || $node.is(_this.disableTag) || _this.editor.util.isDecoratedNode($node) || !$.contains(document, node)) {
+ return;
+ }
+ if ($node.is(_this.type)) {
+ $node.children('li').each(function(i, li) {
+ var $childList, $li;
+ $li = $(li);
+ $childList = $li.children('ul, ol').insertAfter($node);
+ return $('<p/>').append($(li).html() || _this.editor.util.phBr).insertBefore($node);
+ });
+ return $node.remove();
+ } else if ($node.is(anotherType)) {
+ return $('<' + _this.type + '/>').append($node.contents()).replaceAll($node);
+ } else if ($list && $node.prev().is($list)) {
+ $('<li/>').append($node.html() || _this.editor.util.phBr).appendTo($list);
+ return $node.remove();
+ } else {
+ $list = $("<" + _this.type + "><li></li></" + _this.type + ">");
+ $list.find('li').append($node.html() || _this.editor.util.phBr);
+ return $list.replaceAll($node);
+ }
+ };
+ })(this));
+ this.editor.selection.restore();
+ return this.editor.trigger('valuechanged');
+ };
+
+ return ListButton;
+
+})(Button);
+
+OrderListButton = (function(superClass) {
+ extend(OrderListButton, superClass);
+
+ function OrderListButton() {
+ return OrderListButton.__super__.constructor.apply(this, arguments);
+ }
+
+ OrderListButton.prototype.type = 'ol';
+
+ OrderListButton.prototype.name = 'ol';
+
+ OrderListButton.prototype.icon = 'list-ol';
+
+ OrderListButton.prototype.htmlTag = 'ol';
+
+ OrderListButton.prototype.shortcut = 'cmd+/';
+
+ OrderListButton.prototype._init = function() {
+ if (this.editor.util.os.mac) {
+ this.title = this.title + ' ( Cmd + / )';
+ } else {
+ this.title = this.title + ' ( ctrl + / )';
+ this.shortcut = 'ctrl+/';
+ }
+ return OrderListButton.__super__._init.call(this);
+ };
+
+ return OrderListButton;
+
+})(ListButton);
+
+UnorderListButton = (function(superClass) {
+ extend(UnorderListButton, superClass);
+
+ function UnorderListButton() {
+ return UnorderListButton.__super__.constructor.apply(this, arguments);
+ }
+
+ UnorderListButton.prototype.type = 'ul';
+
+ UnorderListButton.prototype.name = 'ul';
+
+ UnorderListButton.prototype.icon = 'list-ul';
+
+ UnorderListButton.prototype.htmlTag = 'ul';
+
+ UnorderListButton.prototype.shortcut = 'cmd+.';
+
+ UnorderListButton.prototype._init = function() {
+ if (this.editor.util.os.mac) {
+ this.title = this.title + ' ( Cmd + . )';
+ } else {
+ this.title = this.title + ' ( Ctrl + . )';
+ this.shortcut = 'ctrl+.';
+ }
+ return UnorderListButton.__super__._init.call(this);
+ };
+
+ return UnorderListButton;
+
+})(ListButton);
+
+Simditor.Toolbar.addButton(OrderListButton);
+
+Simditor.Toolbar.addButton(UnorderListButton);
+
+BlockquoteButton = (function(superClass) {
+ extend(BlockquoteButton, superClass);
+
+ function BlockquoteButton() {
+ return BlockquoteButton.__super__.constructor.apply(this, arguments);
+ }
+
+ BlockquoteButton.prototype.name = 'blockquote';
+
+ BlockquoteButton.prototype.icon = 'quote-left';
+
+ BlockquoteButton.prototype.htmlTag = 'blockquote';
+
+ 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) {
+ $("<" + _this.htmlTag + "/>").insertBefore(nodeCache[0]).append(nodeCache);
+ return nodeCache.length = 0;
+ }
+ };
+ })(this);
+ $rootNodes.each((function(_this) {
+ return function(i, node) {
+ var $node;
+ $node = $(node);
+ if (!$node.parent().is(_this.editor.body)) {
+ return;
+ }
+ if ($node.is(_this.htmlTag)) {
+ clearCache();
+ return $node.children().unwrap();
+ } else if ($node.is(_this.disableTag) || _this.editor.util.isDecoratedNode($node)) {
+ return clearCache();
+ } else {
+ return nodeCache.push(node);
+ }
+ };
+ })(this));
+ clearCache();
+ this.editor.selection.restore();
+ return this.editor.trigger('valuechanged');
+ };
+
+ return BlockquoteButton;
+
+})(Button);
+
+Simditor.Toolbar.addButton(BlockquoteButton);
+
+CodeButton = (function(superClass) {
+ extend(CodeButton, superClass);
+
+ function CodeButton() {
+ return CodeButton.__super__.constructor.apply(this, arguments);
+ }
+
+ CodeButton.prototype.name = 'code';
+
+ CodeButton.prototype.icon = 'code';
+
+ CodeButton.prototype.htmlTag = 'pre';
+
+ CodeButton.prototype.disableTag = 'ul, ol, table';
+
+ CodeButton.prototype._init = function() {
+ CodeButton.__super__._init.call(this);
+ this.editor.on('decorate', (function(_this) {
+ return function(e, $el) {
+ return $el.find('pre').each(function(i, pre) {
+ return _this.decorate($(pre));
+ });
+ };
+ })(this));
+ return this.editor.on('undecorate', (function(_this) {
+ return function(e, $el) {
+ return $el.find('pre').each(function(i, pre) {
+ return _this.undecorate($(pre));
+ });
+ };
+ })(this));
+ };
+
+ CodeButton.prototype.render = function() {
+ var args;
+ args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
+ CodeButton.__super__.render.apply(this, args);
+ return this.popover = new CodePopover({
+ button: this
+ });
+ };
+
+ CodeButton.prototype._checkMode = function() {
+ var $blockNodes, range;
+ range = this.editor.selection.range();
+ if (($blockNodes = $(range.cloneContents()).find(this.editor.util.blockNodes.join(','))) > 0 || (range.collapsed && this.editor.selection.startNodes().filter('code').length === 0)) {
+ this.inlineMode = false;
+ return this.htmlTag = 'pre';
+ } else {
+ this.inlineMode = true;
+ return this.htmlTag = 'code';
+ }
+ };
+
+ CodeButton.prototype._status = function() {
+ this._checkMode();
+ CodeButton.__super__._status.call(this);
+ if (this.inlineMode) {
+ return;
+ }
+ if (this.active) {
+ return this.popover.show(this.node);
+ } else {
+ return this.popover.hide();
+ }
+ };
+
+ CodeButton.prototype.decorate = function($pre) {
+ var $code, lang, ref, ref1;
+ $code = $pre.find('> code');
+ if ($code.length > 0) {
+ lang = (ref = $code.attr('class')) != null ? (ref1 = ref.match(/lang-(\S+)/)) != null ? ref1[1] : void 0 : void 0;
+ $code.contents().unwrap();
+ if (lang) {
+ return $pre.attr('data-lang', lang);
+ }
+ }
+ };
+
+ CodeButton.prototype.undecorate = function($pre) {
+ var $code, lang;
+ lang = $pre.attr('data-lang');
+ $code = $('<code/>');
+ if (lang && lang !== -1) {
+ $code.addClass('lang-' + lang);
+ }
+ return $pre.wrapInner($code).removeAttr('data-lang');
+ };
+
+ CodeButton.prototype.command = function() {
+ if (this.inlineMode) {
+ return this._inlineCommand();
+ } else {
+ return this._blockCommand();
+ }
+ };
+
+ CodeButton.prototype._blockCommand = function() {
+ var $rootNodes, clearCache, nodeCache, resultNodes;
+ $rootNodes = this.editor.selection.rootNodes();
+ nodeCache = [];
+ 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));
+ resultNodes.push($pre[0]);
+ return nodeCache.length = 0;
+ };
+ })(this);
+ $rootNodes.each((function(_this) {
+ return function(i, node) {
+ var $node, $p;
+ $node = $(node);
+ if ($node.is(_this.htmlTag)) {
+ clearCache();
+ $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($(resultNodes).last());
+ return this.editor.trigger('valuechanged');
+ };
+
+ CodeButton.prototype._inlineCommand = function() {
+ var $code, $contents, range;
+ range = this.editor.selection.range();
+ if (this.active) {
+ range.selectNodeContents(this.node[0]);
+ this.editor.selection.save(range);
+ this.node.contents().unwrap();
+ this.editor.selection.restore();
+ } else {
+ $contents = $(range.extractContents());
+ $code = $("<" + this.htmlTag + "/>").append($contents.contents());
+ range.insertNode($code[0]);
+ range.selectNodeContents($code[0]);
+ this.editor.selection.range(range);
+ }
+ return this.editor.trigger('valuechanged');
+ };
+
+ return CodeButton;
+
+})(Button);
+
+CodePopover = (function(superClass) {
+ extend(CodePopover, superClass);
+
+ function CodePopover() {
+ return CodePopover.__super__.constructor.apply(this, arguments);
+ }
+
+ CodePopover.prototype.render = function() {
+ var $option, k, lang, len, ref;
+ this._tpl = "<div class=\"code-settings\">\n <div class=\"settings-field\">\n <select class=\"select-lang\">\n <option value=\"-1\">" + (this._t('selectLanguage')) + "</option>\n </select>\n </div>\n</div>";
+ this.langs = this.editor.opts.codeLanguages || [
+ {
+ name: 'Bash',
+ value: 'bash'
+ }, {
+ name: 'C++',
+ value: 'c++'
+ }, {
+ name: 'C#',
+ value: 'cs'
+ }, {
+ name: 'CSS',
+ value: 'css'
+ }, {
+ name: 'Erlang',
+ value: 'erlang'
+ }, {
+ name: 'Less',
+ value: 'less'
+ }, {
+ name: 'Sass',
+ value: 'sass'
+ }, {
+ name: 'Diff',
+ value: 'diff'
+ }, {
+ name: 'CoffeeScript',
+ value: 'coffeescript'
+ }, {
+ name: 'HTML,XML',
+ value: 'html'
+ }, {
+ name: 'JSON',
+ value: 'json'
+ }, {
+ name: 'Java',
+ value: 'java'
+ }, {
+ name: 'JavaScript',
+ value: 'js'
+ }, {
+ name: 'Markdown',
+ value: 'markdown'
+ }, {
+ name: 'Objective C',
+ value: 'oc'
+ }, {
+ name: 'PHP',
+ value: 'php'
+ }, {
+ name: 'Perl',
+ value: 'parl'
+ }, {
+ name: 'Python',
+ value: 'python'
+ }, {
+ name: 'Ruby',
+ value: 'ruby'
+ }, {
+ name: 'SQL',
+ value: 'sql'
+ }
+ ];
+ this.el.addClass('code-popover').append(this._tpl);
+ this.selectEl = this.el.find('.select-lang');
+ ref = this.langs;
+ for (k = 0, len = ref.length; k < len; k++) {
+ lang = ref[k];
+ $option = $('<option/>', {
+ text: lang.name,
+ value: lang.value
+ }).appendTo(this.selectEl);
+ }
+ this.selectEl.on('change', (function(_this) {
+ return function(e) {
+ var selected;
+ _this.lang = _this.selectEl.val();
+ selected = _this.target.hasClass('selected');
+ _this.target.removeClass().removeAttr('data-lang');
+ if (_this.lang !== -1) {
+ _this.target.attr('data-lang', _this.lang);
+ }
+ if (selected) {
+ _this.target.addClass('selected');
+ }
+ return _this.editor.trigger('valuechanged');
+ };
+ })(this));
+ return this.editor.on('valuechanged', (function(_this) {
+ return function(e) {
+ if (_this.active) {
+ return _this.refresh();
+ }
+ };
+ })(this));
+ };
+
+ CodePopover.prototype.show = function() {
+ var args;
+ args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
+ CodePopover.__super__.show.apply(this, args);
+ this.lang = this.target.attr('data-lang');
+ if (this.lang != null) {
+ return this.selectEl.val(this.lang);
+ } else {
+ return this.selectEl.val(-1);
+ }
+ };
+
+ return CodePopover;
+
+})(Popover);
+
+Simditor.Toolbar.addButton(CodeButton);
+
+LinkButton = (function(superClass) {
+ extend(LinkButton, superClass);
+
+ function LinkButton() {
+ return LinkButton.__super__.constructor.apply(this, arguments);
+ }
+
+ LinkButton.prototype.name = 'link';
+
+ LinkButton.prototype.icon = 'link';
+
+ LinkButton.prototype.htmlTag = 'a';
+
+ LinkButton.prototype.disableTag = 'pre';
+
+ LinkButton.prototype.render = function() {
+ var args;
+ args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
+ LinkButton.__super__.render.apply(this, args);
+ return this.popover = new LinkPopover({
+ button: this
+ });
+ };
+
+ LinkButton.prototype._status = function() {
+ LinkButton.__super__._status.call(this);
+ if (this.active && !this.editor.selection.rangeAtEndOf(this.node)) {
+ return this.popover.show(this.node);
+ } else {
+ return this.popover.hide();
+ }
+ };
+
+ LinkButton.prototype.command = function() {
+ var $contents, $link, $newBlock, linkText, range, txtNode;
+ range = this.editor.selection.range();
+ if (this.active) {
+ txtNode = document.createTextNode(this.node.text());
+ this.node.replaceWith(txtNode);
+ range.selectNode(txtNode);
+ } else {
+ $contents = $(range.extractContents());
+ linkText = this.editor.formatter.clearHtml($contents.contents(), false);
+ $link = $('<a/>', {
+ href: 'http://www.example.com',
+ target: '_blank',
+ text: linkText || this._t('linkText')
+ });
+ if (this.editor.selection.blockNodes().length > 0) {
+ range.insertNode($link[0]);
+ } else {
+ $newBlock = $('<p/>').append($link);
+ range.insertNode($newBlock[0]);
+ }
+ range.selectNodeContents($link[0]);
+ this.popover.one('popovershow', (function(_this) {
+ return function() {
+ if (linkText) {
+ _this.popover.urlEl.focus();
+ return _this.popover.urlEl[0].select();
+ } else {
+ _this.popover.textEl.focus();
+ return _this.popover.textEl[0].select();
+ }
+ };
+ })(this));
+ }
+ this.editor.selection.range(range);
+ return this.editor.trigger('valuechanged');
+ };
+
+ return LinkButton;
+
+})(Button);
+
+LinkPopover = (function(superClass) {
+ extend(LinkPopover, superClass);
+
+ function LinkPopover() {
+ return LinkPopover.__super__.constructor.apply(this, arguments);
+ }
+
+ LinkPopover.prototype.render = function() {
+ var tpl;
+ 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>";
+ this.el.addClass('link-popover').append(tpl);
+ this.textEl = this.el.find('.link-text');
+ this.urlEl = this.el.find('.link-url');
+ this.unlinkEl = this.el.find('.btn-unlink');
+ this.selectTarget = this.el.find('.link-target');
+ this.textEl.on('keyup', (function(_this) {
+ return function(e) {
+ if (e.which === 13) {
+ return;
+ }
+ _this.target.text(_this.textEl.val());
+ return _this.editor.inputManager.throttledValueChanged();
+ };
+ })(this));
+ this.urlEl.on('keyup', (function(_this) {
+ return function(e) {
+ var val;
+ if (e.which === 13) {
+ return;
+ }
+ val = _this.urlEl.val();
+ if (!(/https?:\/\/|^\//ig.test(val) || !val)) {
+ val = 'http://' + val;
+ }
+ _this.target.attr('href', val);
+ return _this.editor.inputManager.throttledValueChanged();
+ };
+ })(this));
+ $([this.urlEl[0], this.textEl[0]]).on('keydown', (function(_this) {
+ return function(e) {
+ var range;
+ if (e.which === 13 || e.which === 27 || (!e.shiftKey && e.which === 9 && $(e.target).hasClass('link-url'))) {
+ e.preventDefault();
+ range = document.createRange();
+ _this.editor.selection.setRangeAfter(_this.target, range);
+ _this.hide();
+ return _this.editor.inputManager.throttledValueChanged();
+ }
+ };
+ })(this));
+ this.unlinkEl.on('click', (function(_this) {
+ return function(e) {
+ var range, txtNode;
+ txtNode = document.createTextNode(_this.target.text());
+ _this.target.replaceWith(txtNode);
+ _this.hide();
+ range = document.createRange();
+ _this.editor.selection.setRangeAfter(txtNode, range);
+ return _this.editor.inputManager.throttledValueChanged();
+ };
+ })(this));
+ return this.selectTarget.on('change', (function(_this) {
+ return function(e) {
+ _this.target.attr('target', _this.selectTarget.val());
+ return _this.editor.inputManager.throttledValueChanged();
+ };
+ })(this));
+ };
+
+ LinkPopover.prototype.show = function() {
+ var args;
+ args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
+ LinkPopover.__super__.show.apply(this, args);
+ this.textEl.val(this.target.text());
+ return this.urlEl.val(this.target.attr('href'));
+ };
+
+ return LinkPopover;
+
+})(Popover);
+
+Simditor.Toolbar.addButton(LinkButton);
+
+ImageButton = (function(superClass) {
+ extend(ImageButton, superClass);
+
+ function ImageButton() {
+ return ImageButton.__super__.constructor.apply(this, arguments);
+ }
+
+ ImageButton.prototype.name = 'image';
+
+ ImageButton.prototype.icon = 'picture-o';
+
+ ImageButton.prototype.htmlTag = 'img';
+
+ ImageButton.prototype.disableTag = 'pre, table';
+
+ ImageButton.prototype.defaultImage = '';
+
+ ImageButton.prototype.needFocus = false;
+
+ ImageButton.prototype._init = function() {
+ var item, k, len, ref;
+ if (this.editor.opts.imageButton) {
+ if (Array.isArray(this.editor.opts.imageButton)) {
+ this.menu = [];
+ ref = this.editor.opts.imageButton;
+ for (k = 0, len = ref.length; k < len; k++) {
+ item = ref[k];
+ this.menu.push({
+ name: item + '-image',
+ text: this._t(item + 'Image')
+ });
+ }
+ } else {
+ this.menu = false;
+ }
+ } else {
+ if (this.editor.uploader != null) {
+ this.menu = [
+ {
+ name: 'upload-image',
+ text: this._t('uploadImage')
+ }, {
+ name: 'external-image',
+ text: this._t('externalImage')
+ }
+ ];
+ } else {
+ this.menu = false;
+ }
+ }
+ this.defaultImage = this.editor.opts.defaultImage;
+ this.editor.body.on('click', 'img:not([data-non-image])', (function(_this) {
+ return function(e) {
+ var $img, range;
+ $img = $(e.currentTarget);
+ range = document.createRange();
+ range.selectNode($img[0]);
+ _this.editor.selection.range(range);
+ if (!_this.editor.util.support.onselectionchange) {
+ _this.editor.trigger('selectionchanged');
+ }
+ return false;
+ };
+ })(this));
+ this.editor.body.on('mouseup', 'img:not([data-non-image])', function(e) {
+ return false;
+ });
+ this.editor.on('selectionchanged.image', (function(_this) {
+ return function() {
+ var $contents, $img, range;
+ range = _this.editor.selection.range();
+ if (range == null) {
+ return;
+ }
+ $contents = $(range.cloneContents()).contents();
+ if ($contents.length === 1 && $contents.is('img:not([data-non-image])')) {
+ $img = $(range.startContainer).contents().eq(range.startOffset);
+ return _this.popover.show($img);
+ } else {
+ return _this.popover.hide();
+ }
+ };
+ })(this));
+ this.editor.on('valuechanged.image', (function(_this) {
+ return function() {
+ var $masks;
+ $masks = _this.editor.wrapper.find('.simditor-image-loading');
+ if (!($masks.length > 0)) {
+ return;
+ }
+ return $masks.each(function(i, mask) {
+ var $img, $mask, file;
+ $mask = $(mask);
+ $img = $mask.data('img');
+ if (!($img && $img.parent().length > 0)) {
+ $mask.remove();
+ if ($img) {
+ file = $img.data('file');
+ if (file) {
+ _this.editor.uploader.cancel(file);
+ if (_this.editor.body.find('img.uploading').length < 1) {
+ return _this.editor.uploader.trigger('uploadready', [file]);
+ }
+ }
+ }
+ }
+ });
+ };
+ })(this));
+ return ImageButton.__super__._init.call(this);
+ };
+
+ ImageButton.prototype.render = function() {
+ var args;
+ args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
+ ImageButton.__super__.render.apply(this, args);
+ this.popover = new ImagePopover({
+ button: this
+ });
+ if (this.editor.opts.imageButton === 'upload') {
+ return this._initUploader(this.el);
+ }
+ };
+
+ ImageButton.prototype.renderMenu = function() {
+ ImageButton.__super__.renderMenu.call(this);
+ return this._initUploader();
+ };
+
+ ImageButton.prototype._initUploader = function($uploadItem) {
+ var $input, createInput, uploadProgress;
+ if ($uploadItem == null) {
+ $uploadItem = this.menuEl.find('.menu-item-upload-image');
+ }
+ if (this.editor.uploader == null) {
+ this.el.find('.btn-upload').remove();
+ return;
+ }
+ $input = null;
+ createInput = (function(_this) {
+ return function() {
+ if ($input) {
+ $input.remove();
+ }
+ return $input = $('<input/>', {
+ type: 'file',
+ title: _this._t('uploadImage'),
+ multiple: true,
+ accept: 'image/*'
+ }).appendTo($uploadItem);
+ };
+ })(this);
+ createInput();
+ $uploadItem.on('click mousedown', 'input[type=file]', function(e) {
+ return e.stopPropagation();
+ });
+ $uploadItem.on('change', 'input[type=file]', (function(_this) {
+ return function(e) {
+ if (_this.editor.inputManager.focused) {
+ _this.editor.uploader.upload($input, {
+ inline: true
+ });
+ createInput();
+ } else {
+ _this.editor.one('focus', function(e) {
+ _this.editor.uploader.upload($input, {
+ inline: true
+ });
+ return createInput();
+ });
+ _this.editor.focus();
+ }
+ return _this.wrapper.removeClass('menu-on');
+ };
+ })(this));
+ this.editor.uploader.on('beforeupload', (function(_this) {
+ return function(e, file) {
+ var $img;
+ if (!file.inline) {
+ return;
+ }
+ if (file.img) {
+ $img = $(file.img);
+ } else {
+ $img = _this.createImage(file.name);
+ file.img = $img;
+ }
+ $img.addClass('uploading');
+ $img.data('file', file);
+ return _this.editor.uploader.readImageFile(file.obj, function(img) {
+ var src;
+ if (!$img.hasClass('uploading')) {
+ return;
+ }
+ src = img ? img.src : _this.defaultImage;
+ return _this.loadImage($img, src, function() {
+ if (_this.popover.active) {
+ _this.popover.refresh();
+ return _this.popover.srcEl.val(_this._t('uploading')).prop('disabled', true);
+ }
+ });
+ });
+ };
+ })(this));
+ uploadProgress = $.proxy(this.editor.util.throttle(function(e, file, loaded, total) {
+ var $img, $mask, percent;
+ if (!file.inline) {
+ return;
+ }
+ $mask = file.img.data('mask');
+ if (!$mask) {
+ return;
+ }
+ $img = $mask.data('img');
+ if (!($img.hasClass('uploading') && $img.parent().length > 0)) {
+ $mask.remove();
+ return;
+ }
+ percent = loaded / total;
+ percent = (percent * 100).toFixed(0);
+ if (percent > 99) {
+ percent = 99;
+ }
+ return $mask.find('.progress').height((100 - percent) + "%");
+ }, 500), this);
+ this.editor.uploader.on('uploadprogress', uploadProgress);
+ this.editor.uploader.on('uploadsuccess', (function(_this) {
+ return function(e, file, result) {
+ var $img, img_path, msg;
+ if (!file.inline) {
+ return;
+ }
+ $img = file.img;
+ if (!($img.hasClass('uploading') && $img.parent().length > 0)) {
+ return;
+ }
+ if (typeof result !== 'object') {
+ try {
+ result = $.parseJSON(result);
+ } catch (_error) {
+ e = _error;
+ result = {
+ success: false
+ };
+ }
+ }
+ if (result.success === false) {
+ msg = result.msg || _this._t('uploadFailed');
+ alert(msg);
+ img_path = _this.defaultImage;
+ } else {
+ img_path = result.file_path;
+ }
+ _this.loadImage($img, img_path, function() {
+ var $mask;
+ $img.removeData('file');
+ $img.removeClass('uploading').removeClass('loading');
+ $mask = $img.data('mask');
+ if ($mask) {
+ $mask.remove();
+ }
+ $img.removeData('mask');
+ _this.editor.trigger('valuechanged');
+ if (_this.editor.body.find('img.uploading').length < 1) {
+ return _this.editor.uploader.trigger('uploadready', [file, result]);
+ }
+ });
+ if (_this.popover.active) {
+ _this.popover.srcEl.prop('disabled', false);
+ return _this.popover.srcEl.val(result.file_path);
+ }
+ };
+ })(this));
+ return this.editor.uploader.on('uploaderror', (function(_this) {
+ return function(e, file, xhr) {
+ var $img, msg, result;
+ if (!file.inline) {
+ return;
+ }
+ if (xhr.statusText === 'abort') {
+ return;
+ }
+ if (xhr.responseText) {
+ try {
+ result = $.parseJSON(xhr.responseText);
+ msg = result.msg;
+ } catch (_error) {
+ e = _error;
+ msg = _this._t('uploadError');
+ }
+ alert(msg);
+ }
+ $img = file.img;
+ if (!($img.hasClass('uploading') && $img.parent().length > 0)) {
+ return;
+ }
+ _this.loadImage($img, _this.defaultImage, function() {
+ var $mask;
+ $img.removeData('file');
+ $img.removeClass('uploading').removeClass('loading');
+ $mask = $img.data('mask');
+ if ($mask) {
+ $mask.remove();
+ }
+ return $img.removeData('mask');
+ });
+ if (_this.popover.active) {
+ _this.popover.srcEl.prop('disabled', false);
+ _this.popover.srcEl.val(_this.defaultImage);
+ }
+ _this.editor.trigger('valuechanged');
+ if (_this.editor.body.find('img.uploading').length < 1) {
+ return _this.editor.uploader.trigger('uploadready', [file, result]);
+ }
+ };
+ })(this));
+ };
+
+ ImageButton.prototype._status = function() {
+ return this._disableStatus();
+ };
+
+ ImageButton.prototype.loadImage = function($img, src, callback) {
+ var $mask, img, positionMask;
+ positionMask = (function(_this) {
+ return function() {
+ var imgOffset, wrapperOffset;
+ imgOffset = $img.offset();
+ wrapperOffset = _this.editor.wrapper.offset();
+ return $mask.css({
+ top: imgOffset.top - wrapperOffset.top,
+ left: imgOffset.left - wrapperOffset.left,
+ width: $img.width(),
+ height: $img.height()
+ }).show();
+ };
+ })(this);
+ $img.addClass('loading');
+ $mask = $img.data('mask');
+ if (!$mask) {
+ $mask = $('<div class="simditor-image-loading">\n <div class="progress"></div>\n</div>').hide().appendTo(this.editor.wrapper);
+ positionMask();
+ $img.data('mask', $mask);
+ $mask.data('img', $img);
+ }
+ img = new Image();
+ img.onload = (function(_this) {
+ return function() {
+ var height, width;
+ if (!$img.hasClass('loading') && !$img.hasClass('uploading')) {
+ return;
+ }
+ width = img.width;
+ height = img.height;
+ $img.attr({
+ src: src,
+ width: width,
+ height: height,
+ 'data-image-size': width + ',' + height
+ }).removeClass('loading');
+ if ($img.hasClass('uploading')) {
+ _this.editor.util.reflow(_this.editor.body);
+ positionMask();
+ } else {
+ $mask.remove();
+ $img.removeData('mask');
+ }
+ if ($.isFunction(callback)) {
+ return callback(img);
+ }
+ };
+ })(this);
+ img.onerror = function() {
+ if ($.isFunction(callback)) {
+ callback(false);
+ }
+ $mask.remove();
+ return $img.removeData('mask').removeClass('loading');
+ };
+ return img.src = src;
+ };
+
+ ImageButton.prototype.createImage = function(name) {
+ var $img, range;
+ if (name == null) {
+ name = 'Image';
+ }
+ if (!this.editor.inputManager.focused) {
+ this.editor.focus();
+ }
+ range = this.editor.selection.range();
+ range.deleteContents();
+ this.editor.selection.range(range);
+ $img = $('<img/>').attr('alt', name);
+ range.insertNode($img[0]);
+ this.editor.selection.setRangeAfter($img, range);
+ this.editor.trigger('valuechanged');
+ return $img;
+ };
+
+ ImageButton.prototype.command = function(src) {
+ var $img;
+ $img = this.createImage();
+ return this.loadImage($img, src || this.defaultImage, (function(_this) {
+ return function() {
+ _this.editor.trigger('valuechanged');
+ _this.editor.util.reflow($img);
+ $img.click();
+ return _this.popover.one('popovershow', function() {
+ _this.popover.srcEl.focus();
+ return _this.popover.srcEl[0].select();
+ });
+ };
+ })(this));
+ };
+
+ return ImageButton;
+
+})(Button);
+
+ImagePopover = (function(superClass) {
+ extend(ImagePopover, superClass);
+
+ function ImagePopover() {
+ return ImagePopover.__super__.constructor.apply(this, arguments);
+ }
+
+ ImagePopover.prototype.offset = {
+ top: 6,
+ left: -4
+ };
+
+ ImagePopover.prototype.render = function() {
+ var tpl;
+ tpl = "<div class=\"link-settings\">\n <div class=\"settings-field\">\n <label>" + (this._t('imageUrl')) + "</label>\n <input class=\"image-src\" type=\"text\" tabindex=\"1\" />\n <a class=\"btn-upload\" href=\"javascript:;\"\n title=\"" + (this._t('uploadImage')) + "\" tabindex=\"-1\">\n <span class=\"simditor-icon simditor-icon-upload\"></span>\n </a>\n </div>\n <div class='settings-field'>\n <label>" + (this._t('imageAlt')) + "</label>\n <input class=\"image-alt\" id=\"image-alt\" type=\"text\" tabindex=\"1\" />\n </div>\n <div class=\"settings-field\">\n <label>" + (this._t('imageSize')) + "</label>\n <input class=\"image-size\" id=\"image-width\" type=\"text\" tabindex=\"2\" />\n <span class=\"times\">×</span>\n <input class=\"image-size\" id=\"image-height\" type=\"text\" tabindex=\"3\" />\n <a class=\"btn-restore\" href=\"javascript:;\"\n title=\"" + (this._t('restoreImageSize')) + "\" tabindex=\"-1\">\n <span class=\"simditor-icon simditor-icon-undo\"></span>\n </a>\n </div>\n</div>";
+ this.el.addClass('image-popover').append(tpl);
+ this.srcEl = this.el.find('.image-src');
+ this.widthEl = this.el.find('#image-width');
+ this.heightEl = this.el.find('#image-height');
+ this.altEl = this.el.find('#image-alt');
+ this.srcEl.on('keydown', (function(_this) {
+ return function(e) {
+ var range;
+ if (!(e.which === 13 && !_this.target.hasClass('uploading'))) {
+ return;
+ }
+ e.preventDefault();
+ range = document.createRange();
+ _this.button.editor.selection.setRangeAfter(_this.target, range);
+ return _this.hide();
+ };
+ })(this));
+ this.srcEl.on('blur', (function(_this) {
+ return function(e) {
+ return _this._loadImage(_this.srcEl.val());
+ };
+ })(this));
+ this.el.find('.image-size').on('blur', (function(_this) {
+ return function(e) {
+ _this._resizeImg($(e.currentTarget));
+ return _this.el.data('popover').refresh();
+ };
+ })(this));
+ this.el.find('.image-size').on('keyup', (function(_this) {
+ return function(e) {
+ var inputEl;
+ inputEl = $(e.currentTarget);
+ if (!(e.which === 13 || e.which === 27 || e.which === 9)) {
+ return _this._resizeImg(inputEl, true);
+ }
+ };
+ })(this));
+ this.el.find('.image-size').on('keydown', (function(_this) {
+ return function(e) {
+ var $img, inputEl, range;
+ inputEl = $(e.currentTarget);
+ if (e.which === 13 || e.which === 27) {
+ e.preventDefault();
+ if (e.which === 13) {
+ _this._resizeImg(inputEl);
+ } else {
+ _this._restoreImg();
+ }
+ $img = _this.target;
+ _this.hide();
+ range = document.createRange();
+ return _this.button.editor.selection.setRangeAfter($img, range);
+ } else if (e.which === 9) {
+ return _this.el.data('popover').refresh();
+ }
+ };
+ })(this));
+ this.altEl.on('keydown', (function(_this) {
+ return function(e) {
+ var range;
+ if (e.which === 13) {
+ e.preventDefault();
+ range = document.createRange();
+ _this.button.editor.selection.setRangeAfter(_this.target, range);
+ return _this.hide();
+ }
+ };
+ })(this));
+ this.altEl.on('keyup', (function(_this) {
+ return function(e) {
+ if (e.which === 13 || e.which === 27 || e.which === 9) {
+ return;
+ }
+ _this.alt = _this.altEl.val();
+ return _this.target.attr('alt', _this.alt);
+ };
+ })(this));
+ this.el.find('.btn-restore').on('click', (function(_this) {
+ return function(e) {
+ _this._restoreImg();
+ return _this.el.data('popover').refresh();
+ };
+ })(this));
+ this.editor.on('valuechanged', (function(_this) {
+ return function(e) {
+ if (_this.active) {
+ return _this.refresh();
+ }
+ };
+ })(this));
+ return this._initUploader();
+ };
+
+ ImagePopover.prototype._initUploader = function() {
+ var $uploadBtn, createInput;
+ $uploadBtn = this.el.find('.btn-upload');
+ if (this.editor.uploader == null) {
+ $uploadBtn.remove();
+ return;
+ }
+ createInput = (function(_this) {
+ return function() {
+ if (_this.input) {
+ _this.input.remove();
+ }
+ return _this.input = $('<input/>', {
+ type: 'file',
+ title: _this._t('uploadImage'),
+ multiple: true,
+ accept: 'image/*'
+ }).appendTo($uploadBtn);
+ };
+ })(this);
+ createInput();
+ this.el.on('click mousedown', 'input[type=file]', function(e) {
+ return e.stopPropagation();
+ });
+ return this.el.on('change', 'input[type=file]', (function(_this) {
+ return function(e) {
+ _this.editor.uploader.upload(_this.input, {
+ inline: true,
+ img: _this.target
+ });
+ return createInput();
+ };
+ })(this));
+ };
+
+ ImagePopover.prototype._resizeImg = function(inputEl, onlySetVal) {
+ var height, value, width;
+ if (onlySetVal == null) {
+ onlySetVal = false;
+ }
+ value = inputEl.val() * 1;
+ if (!(this.target && ($.isNumeric(value) || value < 0))) {
+ return;
+ }
+ if (inputEl.is(this.widthEl)) {
+ width = value;
+ height = this.height * value / this.width;
+ this.heightEl.val(height);
+ } else {
+ height = value;
+ width = this.width * value / this.height;
+ this.widthEl.val(width);
+ }
+ if (!onlySetVal) {
+ this.target.attr({
+ width: width,
+ height: height
+ });
+ return this.editor.trigger('valuechanged');
+ }
+ };
+
+ ImagePopover.prototype._restoreImg = function() {
+ var ref, size;
+ size = ((ref = this.target.data('image-size')) != null ? ref.split(",") : void 0) || [this.width, this.height];
+ this.target.attr({
+ width: size[0] * 1,
+ height: size[1] * 1
+ });
+ this.widthEl.val(size[0]);
+ this.heightEl.val(size[1]);
+ return this.editor.trigger('valuechanged');
+ };
+
+ ImagePopover.prototype._loadImage = function(src, callback) {
+ if (/^data:image/.test(src) && !this.editor.uploader) {
+ if (callback) {
+ callback(false);
+ }
+ return;
+ }
+ if (this.target.attr('src') === src) {
+ return;
+ }
+ return this.button.loadImage(this.target, src, (function(_this) {
+ return function(img) {
+ var blob;
+ if (!img) {
+ return;
+ }
+ if (_this.active) {
+ _this.width = img.width;
+ _this.height = img.height;
+ _this.widthEl.val(_this.width);
+ _this.heightEl.val(_this.height);
+ }
+ if (/^data:image/.test(src)) {
+ blob = _this.editor.util.dataURLtoBlob(src);
+ blob.name = "Base64 Image.png";
+ _this.editor.uploader.upload(blob, {
+ inline: true,
+ img: _this.target
+ });
+ } else {
+ _this.editor.trigger('valuechanged');
+ }
+ if (callback) {
+ return callback(img);
+ }
+ };
+ })(this));
+ };
+
+ ImagePopover.prototype.show = function() {
+ var $img, args;
+ args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
+ ImagePopover.__super__.show.apply(this, args);
+ $img = this.target;
+ this.width = $img.width();
+ this.height = $img.height();
+ this.alt = $img.attr('alt');
+ if ($img.hasClass('uploading')) {
+ return this.srcEl.val(this._t('uploading')).prop('disabled', true);
+ } else {
+ this.srcEl.val($img.attr('src')).prop('disabled', false);
+ this.widthEl.val(this.width);
+ this.heightEl.val(this.height);
+ return this.altEl.val(this.alt);
+ }
+ };
+
+ return ImagePopover;
+
+})(Popover);
+
+Simditor.Toolbar.addButton(ImageButton);
+
+IndentButton = (function(superClass) {
+ extend(IndentButton, superClass);
+
+ function IndentButton() {
+ return IndentButton.__super__.constructor.apply(this, arguments);
+ }
+
+ IndentButton.prototype.name = 'indent';
+
+ IndentButton.prototype.icon = 'indent';
+
+ IndentButton.prototype._init = function() {
+ this.title = this._t(this.name) + ' (Tab)';
+ return IndentButton.__super__._init.call(this);
+ };
+
+ IndentButton.prototype._status = function() {};
+
+ IndentButton.prototype.command = function() {
+ return this.editor.indentation.indent();
+ };
+
+ return IndentButton;
+
+})(Button);
+
+Simditor.Toolbar.addButton(IndentButton);
+
+OutdentButton = (function(superClass) {
+ extend(OutdentButton, superClass);
+
+ function OutdentButton() {
+ return OutdentButton.__super__.constructor.apply(this, arguments);
+ }
+
+ OutdentButton.prototype.name = 'outdent';
+
+ OutdentButton.prototype.icon = 'outdent';
+
+ OutdentButton.prototype._init = function() {
+ this.title = this._t(this.name) + ' (Shift + Tab)';
+ return OutdentButton.__super__._init.call(this);
+ };
+
+ OutdentButton.prototype._status = function() {};
+
+ OutdentButton.prototype.command = function() {
+ return this.editor.indentation.indent(true);
+ };
+
+ return OutdentButton;
+
+})(Button);
+
+Simditor.Toolbar.addButton(OutdentButton);
+
+HrButton = (function(superClass) {
+ extend(HrButton, superClass);
+
+ function HrButton() {
+ return HrButton.__super__.constructor.apply(this, arguments);
+ }
+
+ HrButton.prototype.name = 'hr';
+
+ HrButton.prototype.icon = 'minus';
+
+ HrButton.prototype.htmlTag = 'hr';
+
+ HrButton.prototype._status = function() {};
+
+ HrButton.prototype.command = function() {
+ var $hr, $newBlock, $nextBlock, $rootBlock;
+ $rootBlock = this.editor.selection.rootNodes().first();
+ $nextBlock = $rootBlock.next();
+ if ($nextBlock.length > 0) {
+ this.editor.selection.save();
+ } else {
+ $newBlock = $('<p/>').append(this.editor.util.phBr);
+ }
+ $hr = $('<hr/>').insertAfter($rootBlock);
+ if ($newBlock) {
+ $newBlock.insertAfter($hr);
+ this.editor.selection.setRangeAtStartOf($newBlock);
+ } else {
+ this.editor.selection.restore();
+ }
+ return this.editor.trigger('valuechanged');
+ };
+
+ return HrButton;
+
+})(Button);
+
+Simditor.Toolbar.addButton(HrButton);
+
+TableButton = (function(superClass) {
+ extend(TableButton, superClass);
+
+ function TableButton() {
+ return TableButton.__super__.constructor.apply(this, arguments);
+ }
+
+ TableButton.prototype.name = 'table';
+
+ TableButton.prototype.icon = 'table';
+
+ TableButton.prototype.htmlTag = 'table';
+
+ TableButton.prototype.disableTag = 'pre, li, blockquote';
+
+ TableButton.prototype.menu = true;
+
+ TableButton.prototype._init = function() {
+ TableButton.__super__._init.call(this);
+ $.merge(this.editor.formatter._allowedTags, ['thead', 'th', 'tbody', 'tr', 'td', 'colgroup', 'col']);
+ $.extend(this.editor.formatter._allowedAttributes, {
+ td: ['rowspan', 'colspan'],
+ col: ['width']
+ });
+ $.extend(this.editor.formatter._allowedStyles, {
+ td: ['text-align'],
+ th: ['text-align']
+ });
+ this._initShortcuts();
+ this.editor.on('decorate', (function(_this) {
+ return function(e, $el) {
+ return $el.find('table').each(function(i, table) {
+ return _this.decorate($(table));
+ });
+ };
+ })(this));
+ this.editor.on('undecorate', (function(_this) {
+ return function(e, $el) {
+ return $el.find('table').each(function(i, table) {
+ return _this.undecorate($(table));
+ });
+ };
+ })(this));
+ this.editor.on('selectionchanged.table', (function(_this) {
+ return function(e) {
+ var $container, range;
+ _this.editor.body.find('.simditor-table td, .simditor-table th').removeClass('active');
+ range = _this.editor.selection.range();
+ if (!range) {
+ return;
+ }
+ $container = _this.editor.selection.containerNode();
+ if (range.collapsed && $container.is('.simditor-table')) {
+ if (_this.editor.selection.rangeAtStartOf($container)) {
+ $container = $container.find('th:first');
+ } else {
+ $container = $container.find('td:last');
+ }
+ _this.editor.selection.setRangeAtEndOf($container);
+ }
+ return $container.closest('td, th', _this.editor.body).addClass('active');
+ };
+ })(this));
+ this.editor.on('blur.table', (function(_this) {
+ return function(e) {
+ return _this.editor.body.find('.simditor-table td, .simditor-table th').removeClass('active');
+ };
+ })(this));
+ this.editor.keystroke.add('up', 'td', (function(_this) {
+ return function(e, $node) {
+ _this._tdNav($node, 'up');
+ return true;
+ };
+ })(this));
+ this.editor.keystroke.add('up', 'th', (function(_this) {
+ return function(e, $node) {
+ _this._tdNav($node, 'up');
+ return true;
+ };
+ })(this));
+ this.editor.keystroke.add('down', 'td', (function(_this) {
+ return function(e, $node) {
+ _this._tdNav($node, 'down');
+ return true;
+ };
+ })(this));
+ return this.editor.keystroke.add('down', 'th', (function(_this) {
+ return function(e, $node) {
+ _this._tdNav($node, 'down');
+ return true;
+ };
+ })(this));
+ };
+
+ TableButton.prototype._tdNav = function($td, direction) {
+ var $anotherTr, $tr, action, anotherTag, index, parentTag, ref;
+ if (direction == null) {
+ direction = 'up';
+ }
+ action = direction === 'up' ? 'prev' : 'next';
+ ref = direction === 'up' ? ['tbody', 'thead'] : ['thead', 'tbody'], parentTag = ref[0], anotherTag = ref[1];
+ $tr = $td.parent('tr');
+ $anotherTr = this["_" + action + "Row"]($tr);
+ if (!($anotherTr.length > 0)) {
+ return true;
+ }
+ index = $tr.find('td, th').index($td);
+ return this.editor.selection.setRangeAtEndOf($anotherTr.find('td, th').eq(index));
+ };
+
+ TableButton.prototype._nextRow = function($tr) {
+ var $nextTr;
+ $nextTr = $tr.next('tr');
+ if ($nextTr.length < 1 && $tr.parent('thead').length > 0) {
+ $nextTr = $tr.parent('thead').next('tbody').find('tr:first');
+ }
+ return $nextTr;
+ };
+
+ TableButton.prototype._prevRow = function($tr) {
+ var $prevTr;
+ $prevTr = $tr.prev('tr');
+ if ($prevTr.length < 1 && $tr.parent('tbody').length > 0) {
+ $prevTr = $tr.parent('tbody').prev('thead').find('tr');
+ }
+ return $prevTr;
+ };
+
+ TableButton.prototype.initResize = function($table) {
+ var $colgroup, $resizeHandle, $wrapper;
+ $wrapper = $table.parent('.simditor-table');
+ $colgroup = $table.find('colgroup');
+ if ($colgroup.length < 1) {
+ $colgroup = $('<colgroup/>').prependTo($table);
+ $table.find('thead tr th').each(function(i, td) {
+ var $col;
+ return $col = $('<col/>').appendTo($colgroup);
+ });
+ this.refreshTableWidth($table);
+ }
+ $resizeHandle = $('<div />', {
+ "class": 'simditor-resize-handle',
+ contenteditable: 'false'
+ }).appendTo($wrapper);
+ $wrapper.on('mousemove', 'td, th', function(e) {
+ var $col, $td, index, ref, ref1, x;
+ if ($wrapper.hasClass('resizing')) {
+ return;
+ }
+ $td = $(e.currentTarget);
+ x = e.pageX - $(e.currentTarget).offset().left;
+ if (x < 5 && $td.prev().length > 0) {
+ $td = $td.prev();
+ }
+ if ($td.next('td, th').length < 1) {
+ $resizeHandle.hide();
+ return;
+ }
+ if ((ref = $resizeHandle.data('td')) != null ? ref.is($td) : void 0) {
+ $resizeHandle.show();
+ return;
+ }
+ index = $td.parent().find('td, th').index($td);
+ $col = $colgroup.find('col').eq(index);
+ if ((ref1 = $resizeHandle.data('col')) != null ? ref1.is($col) : void 0) {
+ $resizeHandle.show();
+ return;
+ }
+ return $resizeHandle.css('left', $td.position().left + $td.outerWidth() - 5).data('td', $td).data('col', $col).show();
+ });
+ $wrapper.on('mouseleave', function(e) {
+ return $resizeHandle.hide();
+ });
+ return $wrapper.on('mousedown', '.simditor-resize-handle', function(e) {
+ var $handle, $leftCol, $leftTd, $rightCol, $rightTd, minWidth, startHandleLeft, startLeftWidth, startRightWidth, startX, tableWidth;
+ $handle = $(e.currentTarget);
+ $leftTd = $handle.data('td');
+ $leftCol = $handle.data('col');
+ $rightTd = $leftTd.next('td, th');
+ $rightCol = $leftCol.next('col');
+ startX = e.pageX;
+ startLeftWidth = $leftTd.outerWidth() * 1;
+ startRightWidth = $rightTd.outerWidth() * 1;
+ startHandleLeft = parseFloat($handle.css('left'));
+ tableWidth = $leftTd.closest('table').width();
+ minWidth = 50;
+ $(document).on('mousemove.simditor-resize-table', function(e) {
+ var deltaX, leftWidth, rightWidth;
+ deltaX = e.pageX - startX;
+ leftWidth = startLeftWidth + deltaX;
+ rightWidth = startRightWidth - deltaX;
+ if (leftWidth < minWidth) {
+ leftWidth = minWidth;
+ deltaX = minWidth - startLeftWidth;
+ rightWidth = startRightWidth - deltaX;
+ } else if (rightWidth < minWidth) {
+ rightWidth = minWidth;
+ deltaX = startRightWidth - minWidth;
+ leftWidth = startLeftWidth + deltaX;
+ }
+ $leftCol.attr('width', (leftWidth / tableWidth * 100) + '%');
+ $rightCol.attr('width', (rightWidth / tableWidth * 100) + '%');
+ return $handle.css('left', startHandleLeft + deltaX);
+ });
+ $(document).one('mouseup.simditor-resize-table', function(e) {
+ $(document).off('.simditor-resize-table');
+ return $wrapper.removeClass('resizing');
+ });
+ $wrapper.addClass('resizing');
+ return false;
+ });
+ };
+
+ TableButton.prototype._initShortcuts = function() {
+ this.editor.hotkeys.add('ctrl+alt+up', (function(_this) {
+ return function(e) {
+ _this.editMenu.find('.menu-item[data-param=insertRowAbove]').click();
+ return false;
+ };
+ })(this));
+ this.editor.hotkeys.add('ctrl+alt+down', (function(_this) {
+ return function(e) {
+ _this.editMenu.find('.menu-item[data-param=insertRowBelow]').click();
+ return false;
+ };
+ })(this));
+ this.editor.hotkeys.add('ctrl+alt+left', (function(_this) {
+ return function(e) {
+ _this.editMenu.find('.menu-item[data-param=insertColLeft]').click();
+ return false;
+ };
+ })(this));
+ return this.editor.hotkeys.add('ctrl+alt+right', (function(_this) {
+ return function(e) {
+ _this.editMenu.find('.menu-item[data-param=insertColRight]').click();
+ return false;
+ };
+ })(this));
+ };
+
+ TableButton.prototype.decorate = function($table) {
+ var $headRow, $tbody, $thead;
+ if ($table.parent('.simditor-table').length > 0) {
+ this.undecorate($table);
+ }
+ $table.wrap('<div class="simditor-table"></div>');
+ if ($table.find('thead').length < 1) {
+ $thead = $('<thead />');
+ $headRow = $table.find('tr').first();
+ $thead.append($headRow);
+ this._changeCellTag($headRow, 'th');
+ $tbody = $table.find('tbody');
+ if ($tbody.length > 0) {
+ $tbody.before($thead);
+ } else {
+ $table.prepend($thead);
+ }
+ }
+ this.initResize($table);
+ return $table.parent();
+ };
+
+ TableButton.prototype.undecorate = function($table) {
+ if (!($table.parent('.simditor-table').length > 0)) {
+ return;
+ }
+ return $table.parent().replaceWith($table);
+ };
+
+ TableButton.prototype.renderMenu = function() {
+ var $table;
+ $("<div class=\"menu-create-table\">\n</div>\n<div class=\"menu-edit-table\">\n <ul>\n <li>\n <a tabindex=\"-1\" unselectable=\"on\" class=\"menu-item\"\n href=\"javascript:;\" data-param=\"deleteRow\">\n <span>" + (this._t('deleteRow')) + "</span>\n </a>\n </li>\n <li>\n <a tabindex=\"-1\" unselectable=\"on\" class=\"menu-item\"\n href=\"javascript:;\" data-param=\"insertRowAbove\">\n <span>" + (this._t('insertRowAbove')) + " ( Ctrl + Alt + ↑ )</span>\n </a>\n </li>\n <li>\n <a tabindex=\"-1\" unselectable=\"on\" class=\"menu-item\"\n href=\"javascript:;\" data-param=\"insertRowBelow\">\n <span>" + (this._t('insertRowBelow')) + " ( Ctrl + Alt + ↓ )</span>\n </a>\n </li>\n <li><span class=\"separator\"></span></li>\n <li>\n <a tabindex=\"-1\" unselectable=\"on\" class=\"menu-item\"\n href=\"javascript:;\" data-param=\"deleteCol\">\n <span>" + (this._t('deleteColumn')) + "</span>\n </a>\n </li>\n <li>\n <a tabindex=\"-1\" unselectable=\"on\" class=\"menu-item\"\n href=\"javascript:;\" data-param=\"insertColLeft\">\n <span>" + (this._t('insertColumnLeft')) + " ( Ctrl + Alt + ← )</span>\n </a>\n </li>\n <li>\n <a tabindex=\"-1\" unselectable=\"on\" class=\"menu-item\"\n href=\"javascript:;\" data-param=\"insertColRight\">\n <span>" + (this._t('insertColumnRight')) + " ( Ctrl + Alt + → )</span>\n </a>\n </li>\n <li><span class=\"separator\"></span></li>\n <li>\n <a tabindex=\"-1\" unselectable=\"on\" class=\"menu-item\"\n href=\"javascript:;\" data-param=\"deleteTable\">\n <span>" + (this._t('deleteTable')) + "</span>\n </a>\n </li>\n </ul>\n</div>").appendTo(this.menuWrapper);
+ this.createMenu = this.menuWrapper.find('.menu-create-table');
+ this.editMenu = this.menuWrapper.find('.menu-edit-table');
+ $table = this.createTable(6, 6).appendTo(this.createMenu);
+ this.createMenu.on('mouseenter', 'td, th', (function(_this) {
+ return function(e) {
+ var $td, $tr, $trs, num;
+ _this.createMenu.find('td, th').removeClass('selected');
+ $td = $(e.currentTarget);
+ $tr = $td.parent();
+ num = $tr.find('td, th').index($td) + 1;
+ $trs = $tr.prevAll('tr').addBack();
+ if ($tr.parent().is('tbody')) {
+ $trs = $trs.add($table.find('thead tr'));
+ }
+ return $trs.find("td:lt(" + num + "), th:lt(" + num + ")").addClass('selected');
+ };
+ })(this));
+ this.createMenu.on('mouseleave', function(e) {
+ return $(e.currentTarget).find('td, th').removeClass('selected');
+ });
+ return this.createMenu.on('mousedown', 'td, th', (function(_this) {
+ return function(e) {
+ var $closestBlock, $td, $tr, colNum, rowNum;
+ _this.wrapper.removeClass('menu-on');
+ if (!_this.editor.inputManager.focused) {
+ return;
+ }
+ $td = $(e.currentTarget);
+ $tr = $td.parent();
+ colNum = $tr.find('td').index($td) + 1;
+ rowNum = $tr.prevAll('tr').length + 1;
+ if ($tr.parent().is('tbody')) {
+ rowNum += 1;
+ }
+ $table = _this.createTable(rowNum, colNum, true);
+ $closestBlock = _this.editor.selection.blockNodes().last();
+ if (_this.editor.util.isEmptyNode($closestBlock)) {
+ $closestBlock.replaceWith($table);
+ } else {
+ $closestBlock.after($table);
+ }
+ _this.decorate($table);
+ _this.editor.selection.setRangeAtStartOf($table.find('th:first'));
+ _this.editor.trigger('valuechanged');
+ return false;
+ };
+ })(this));
+ };
+
+ TableButton.prototype.createTable = function(row, col, phBr) {
+ var $table, $tbody, $td, $thead, $tr, c, k, l, r, ref, ref1;
+ $table = $('<table/>');
+ $thead = $('<thead/>').appendTo($table);
+ $tbody = $('<tbody/>').appendTo($table);
+ for (r = k = 0, ref = row; 0 <= ref ? k < ref : k > ref; r = 0 <= ref ? ++k : --k) {
+ $tr = $('<tr/>');
+ $tr.appendTo(r === 0 ? $thead : $tbody);
+ for (c = l = 0, ref1 = col; 0 <= ref1 ? l < ref1 : l > ref1; c = 0 <= ref1 ? ++l : --l) {
+ $td = $(r === 0 ? '<th/>' : '<td/>').appendTo($tr);
+ if (phBr) {
+ $td.append(this.editor.util.phBr);
+ }
+ }
+ }
+ return $table;
+ };
+
+ TableButton.prototype.refreshTableWidth = function($table) {
+ var cols, tableWidth;
+ tableWidth = $table.width();
+ cols = $table.find('col');
+ return $table.find('thead tr th').each(function(i, td) {
+ var $col;
+ $col = cols.eq(i);
+ return $col.attr('width', ($(td).outerWidth() / tableWidth * 100) + '%');
+ });
+ };
+
+ TableButton.prototype.setActive = function(active) {
+ TableButton.__super__.setActive.call(this, active);
+ if (active) {
+ this.createMenu.hide();
+ return this.editMenu.show();
+ } else {
+ this.createMenu.show();
+ return this.editMenu.hide();
+ }
+ };
+
+ TableButton.prototype._changeCellTag = function($tr, tagName) {
+ return $tr.find('td, th').each(function(i, cell) {
+ var $cell;
+ $cell = $(cell);
+ return $cell.replaceWith("<" + tagName + ">" + ($cell.html()) + "</" + tagName + ">");
+ });
+ };
+
+ TableButton.prototype.deleteRow = function($td) {
+ var $newTr, $tr, index;
+ $tr = $td.parent('tr');
+ if ($tr.closest('table').find('tr').length < 1) {
+ return this.deleteTable($td);
+ } else {
+ $newTr = this._nextRow($tr);
+ if (!($newTr.length > 0)) {
+ $newTr = this._prevRow($tr);
+ }
+ index = $tr.find('td, th').index($td);
+ if ($tr.parent().is('thead')) {
+ $newTr.appendTo($tr.parent());
+ this._changeCellTag($newTr, 'th');
+ }
+ $tr.remove();
+ return this.editor.selection.setRangeAtEndOf($newTr.find('td, th').eq(index));
+ }
+ };
+
+ TableButton.prototype.insertRow = function($td, direction) {
+ var $newTr, $table, $tr, cellTag, colNum, i, index, k, ref;
+ if (direction == null) {
+ direction = 'after';
+ }
+ $tr = $td.parent('tr');
+ $table = $tr.closest('table');
+ colNum = 0;
+ $table.find('tr').each(function(i, tr) {
+ return colNum = Math.max(colNum, $(tr).find('td').length);
+ });
+ index = $tr.find('td, th').index($td);
+ $newTr = $('<tr/>');
+ cellTag = 'td';
+ if (direction === 'after' && $tr.parent().is('thead')) {
+ $tr.parent().next('tbody').prepend($newTr);
+ } else if (direction === 'before' && $tr.parent().is('thead')) {
+ $tr.before($newTr);
+ $tr.parent().next('tbody').prepend($tr);
+ this._changeCellTag($tr, 'td');
+ cellTag = 'th';
+ } else {
+ $tr[direction]($newTr);
+ }
+ for (i = k = 1, ref = colNum; 1 <= ref ? k <= ref : k >= ref; i = 1 <= ref ? ++k : --k) {
+ $("<" + cellTag + "/>").append(this.editor.util.phBr).appendTo($newTr);
+ }
+ return this.editor.selection.setRangeAtStartOf($newTr.find('td, th').eq(index));
+ };
+
+ TableButton.prototype.deleteCol = function($td) {
+ var $newTd, $table, $tr, index, noOtherCol, noOtherRow;
+ $tr = $td.parent('tr');
+ noOtherRow = $tr.closest('table').find('tr').length < 2;
+ noOtherCol = $td.siblings('td, th').length < 1;
+ if (noOtherRow && noOtherCol) {
+ return this.deleteTable($td);
+ } else {
+ index = $tr.find('td, th').index($td);
+ $newTd = $td.next('td, th');
+ if (!($newTd.length > 0)) {
+ $newTd = $tr.prev('td, th');
+ }
+ $table = $tr.closest('table');
+ $table.find('col').eq(index).remove();
+ $table.find('tr').each(function(i, tr) {
+ return $(tr).find('td, th').eq(index).remove();
+ });
+ this.refreshTableWidth($table);
+ return this.editor.selection.setRangeAtEndOf($newTd);
+ }
+ };
+
+ TableButton.prototype.insertCol = function($td, direction) {
+ var $col, $newCol, $newTd, $table, $tr, index, tableWidth, width;
+ if (direction == null) {
+ direction = 'after';
+ }
+ $tr = $td.parent('tr');
+ index = $tr.find('td, th').index($td);
+ $table = $td.closest('table');
+ $col = $table.find('col').eq(index);
+ $table.find('tr').each((function(_this) {
+ return function(i, tr) {
+ var $newTd, cellTag;
+ cellTag = $(tr).parent().is('thead') ? 'th' : 'td';
+ $newTd = $("<" + cellTag + "/>").append(_this.editor.util.phBr);
+ return $(tr).find('td, th').eq(index)[direction]($newTd);
+ };
+ })(this));
+ $newCol = $('<col/>');
+ $col[direction]($newCol);
+ tableWidth = $table.width();
+ width = Math.max(parseFloat($col.attr('width')) / 2, 50 / tableWidth * 100);
+ $col.attr('width', width + '%');
+ $newCol.attr('width', width + '%');
+ this.refreshTableWidth($table);
+ $newTd = direction === 'after' ? $td.next('td, th') : $td.prev('td, th');
+ return this.editor.selection.setRangeAtStartOf($newTd);
+ };
+
+ TableButton.prototype.deleteTable = function($td) {
+ var $block, $table;
+ $table = $td.closest('.simditor-table');
+ $block = $table.next('p');
+ $table.remove();
+ if ($block.length > 0) {
+ return this.editor.selection.setRangeAtStartOf($block);
+ }
+ };
+
+ TableButton.prototype.command = function(param) {
+ var $td;
+ $td = this.editor.selection.containerNode().closest('td, th');
+ if (!($td.length > 0)) {
+ return;
+ }
+ if (param === 'deleteRow') {
+ this.deleteRow($td);
+ } else if (param === 'insertRowAbove') {
+ this.insertRow($td, 'before');
+ } else if (param === 'insertRowBelow') {
+ this.insertRow($td);
+ } else if (param === 'deleteCol') {
+ this.deleteCol($td);
+ } else if (param === 'insertColLeft') {
+ this.insertCol($td, 'before');
+ } else if (param === 'insertColRight') {
+ this.insertCol($td);
+ } else if (param === 'deleteTable') {
+ this.deleteTable($td);
+ } else {
+ return;
+ }
+ return this.editor.trigger('valuechanged');
+ };
+
+ return TableButton;
+
+})(Button);
+
+Simditor.Toolbar.addButton(TableButton);
+
+StrikethroughButton = (function(superClass) {
+ extend(StrikethroughButton, superClass);
+
+ function StrikethroughButton() {
+ return StrikethroughButton.__super__.constructor.apply(this, arguments);
+ }
+
+ StrikethroughButton.prototype.name = 'strikethrough';
+
+ StrikethroughButton.prototype.icon = 'strikethrough';
+
+ StrikethroughButton.prototype.htmlTag = 'strike';
+
+ StrikethroughButton.prototype.disableTag = 'pre';
+
+ StrikethroughButton.prototype._activeStatus = function() {
+ var active;
+ active = document.queryCommandState('strikethrough') === true;
+ this.setActive(active);
+ return this.active;
+ };
+
+ StrikethroughButton.prototype.command = function() {
+ document.execCommand('strikethrough');
+ if (!this.editor.util.support.oninput) {
+ this.editor.trigger('valuechanged');
+ }
+ return $(document).trigger('selectionchange');
+ };
+
+ return StrikethroughButton;
+
+})(Button);
+
+Simditor.Toolbar.addButton(StrikethroughButton);
+
+AlignmentButton = (function(superClass) {
+ extend(AlignmentButton, superClass);
+
+ function AlignmentButton() {
+ return AlignmentButton.__super__.constructor.apply(this, arguments);
+ }
+
+ AlignmentButton.prototype.name = "alignment";
+
+ AlignmentButton.prototype.icon = 'align-left';
+
+ AlignmentButton.prototype.htmlTag = 'p, h1, h2, h3, h4, td, th';
+
+ AlignmentButton.prototype._init = function() {
+ this.menu = [
+ {
+ name: 'left',
+ text: this._t('alignLeft'),
+ icon: 'align-left',
+ param: 'left'
+ }, {
+ name: 'center',
+ text: this._t('alignCenter'),
+ icon: 'align-center',
+ param: 'center'
+ }, {
+ name: 'right',
+ text: this._t('alignRight'),
+ icon: 'align-right',
+ param: 'right'
+ }
+ ];
+ return AlignmentButton.__super__._init.call(this);
+ };
+
+ AlignmentButton.prototype.setActive = function(active, align) {
+ if (align == null) {
+ align = 'left';
+ }
+ if (align !== 'left' && align !== 'center' && align !== 'right') {
+ align = 'left';
+ }
+ if (align === 'left') {
+ AlignmentButton.__super__.setActive.call(this, false);
+ } else {
+ AlignmentButton.__super__.setActive.call(this, active);
+ }
+ this.el.removeClass('align-left align-center align-right');
+ if (active) {
+ this.el.addClass('align-' + align);
+ }
+ this.setIcon('align-' + align);
+ return this.menuEl.find('.menu-item').show().end().find('.menu-item-' + align).hide();
+ };
+
+ AlignmentButton.prototype._status = function() {
+ this.nodes = this.editor.selection.nodes().filter(this.htmlTag);
+ if (this.nodes.length < 1) {
+ this.setDisabled(true);
+ return this.setActive(false);
+ } else {
+ this.setDisabled(false);
+ return this.setActive(true, this.nodes.first().css('text-align'));
+ }
+ };
+
+ AlignmentButton.prototype.command = function(align) {
+ if (align !== 'left' && align !== 'center' && align !== 'right') {
+ throw new Error("simditor alignment button: invalid align " + align);
+ }
+ this.nodes.css({
+ 'text-align': align === 'left' ? '' : align
+ });
+ this.editor.trigger('valuechanged');
+ return this.editor.inputManager.throttledSelectionChanged();
+ };
+
+ return AlignmentButton;
+
+})(Button);
+
+Simditor.Toolbar.addButton(AlignmentButton);
+
+return Simditor;
+
+}));
@@ -0,0 +1,25 @@ |
||
1 |
+!function(a,b){"function"==typeof define&&define.amd? |
|
2 |
+// AMD. Register as an anonymous module unless amdModuleId is set |
|
3 |
+define("simple-module",["jquery"],function(c){return a.Module=b(c)}):"object"==typeof exports?module.exports=b(require("jquery")):a.SimpleModule=b(jQuery)}(this,function(a){var b,c=[].slice;return b=function(){function b(b){var c,d,e,f,g,h,i;if(this.opts=a.extend({},this.opts,b),(c=this.constructor)._connectedClasses||(c._connectedClasses=[]),g=function(){var a,b,c,e;for(c=this.constructor._connectedClasses,e=[],a=0,b=c.length;b>a;a++)d=c[a],i=d.pluginName.charAt(0).toLowerCase()+d.pluginName.slice(1),d.prototype._connected&&(d.prototype._module=this),e.push(this[i]=new d);return e}.call(this),this._connected)this.opts=a.extend({},this.opts,this._module.opts);else for(this._init(),e=0,h=g.length;h>e;e++)f=g[e],"function"==typeof f._init&&f._init();this.trigger("initialized")}return b.extend=function(a){var b,c,d;if(null!=a&&"object"==typeof a){for(b in a)d=a[b],"included"!==b&&"extended"!==b&&(this[b]=d);return null!=(c=a.extended)?c.call(this):void 0}},b.include=function(a){var b,c,d;if(null!=a&&"object"==typeof a){for(b in a)d=a[b],"included"!==b&&"extended"!==b&&(this.prototype[b]=d);return null!=(c=a.included)?c.call(this):void 0}},b.connect=function(a){if("function"==typeof a){if(!a.pluginName)throw new Error("Module.connect: cannot connect plugin without pluginName");return a.prototype._connected=!0,this._connectedClasses||(this._connectedClasses=[]),this._connectedClasses.push(a),a.pluginName?this[a.pluginName]=a:void 0}},b.prototype.opts={},b.prototype._init=function(){},b.prototype.on=function(){var b,d;return b=1<=arguments.length?c.call(arguments,0):[],(d=a(this)).on.apply(d,b),this},b.prototype.one=function(){var b,d;return b=1<=arguments.length?c.call(arguments,0):[],(d=a(this)).one.apply(d,b),this},b.prototype.off=function(){var b,d;return b=1<=arguments.length?c.call(arguments,0):[],(d=a(this)).off.apply(d,b),this},b.prototype.trigger=function(){var b,d;return b=1<=arguments.length?c.call(arguments,0):[],(d=a(this)).trigger.apply(d,b),this},b.prototype.triggerHandler=function(){var b,d;return b=1<=arguments.length?c.call(arguments,0):[],(d=a(this)).triggerHandler.apply(d,b)},b.prototype._t=function(){var a,b;return a=1<=arguments.length?c.call(arguments,0):[],(b=this.constructor)._t.apply(b,a)},b._t=function(){var a,b,d,e;return b=arguments[0],a=2<=arguments.length?c.call(arguments,1):[],e=(null!=(d=this.i18n[this.locale])?d[b]:void 0)||"",a.length>0?(e=e.replace(/([^%]|^)%(?:(\d+)\$)?s/g,function(b,c,d){return d?c+a[parseInt(d)-1]:c+a.shift()}),e.replace(/%%s/g,"%s")):e},b.i18n={"zh-CN":{}},b.locale="zh-CN",b}()});!function(a,b){"function"==typeof define&&define.amd? |
|
4 |
+// AMD. Register as an anonymous module unless amdModuleId is set |
|
5 |
+define("simple-hotkeys",["jquery","simple-module"],function(c,d){return a.hotkeys=b(c,d)}):"object"==typeof exports? |
|
6 |
+// Node. Does not work with strict CommonJS, but |
|
7 |
+// only CommonJS-like environments that support module.exports, |
|
8 |
+// like Node. |
|
9 |
+module.exports=b(require("jquery"),require("simple-module")):(a.simple=a.simple||{},a.simple.hotkeys=b(jQuery,SimpleModule))}(this,function(a,b){var c,d,e=function(a,b){function c(){this.constructor=a}for(var d in b)f.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},f={}.hasOwnProperty;return c=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return e(c,b),c.count=0,c.keyNameMap={8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Spacebar",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",45:"Insert",46:"Del",91:"Meta",93:"Meta",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"Multiply",107:"Add",109:"Subtract",110:"Decimal",111:"Divide",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",124:"F13",125:"F14",126:"F15",127:"F16",128:"F17",129:"F18",130:"F19",131:"F20",132:"F21",133:"F22",134:"F23",135:"F24",59:";",61:"=",186:";",187:"=",188:",",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},c.aliases={escape:"esc","delete":"del","return":"enter",ctrl:"control",space:"spacebar",ins:"insert",cmd:"meta",command:"meta",wins:"meta",windows:"meta"},c.normalize=function(a){var b,c,d,e,f,g;for(f=a.toLowerCase().replace(/\s+/gi,"").split("+"),b=c=0,g=f.length;g>c;b=++c)d=f[b],f[b]=this.aliases[d]||d;return e=f.pop(),f.sort().push(e),f.join("_")},c.prototype.opts={el:document},c.prototype._init=function(){return this.id=++this.constructor.count,this._map={},this._delegate="string"==typeof this.opts.el?document:this.opts.el,a(this._delegate).on("keydown.simple-hotkeys-"+this.id,this.opts.el,function(a){return function(b){var c;return null!=(c=a._getHander(b))?c.call(a,b):void 0}}(this))},c.prototype._getHander=function(a){var b,c;if(b=this.constructor.keyNameMap[a.which])return c="",a.altKey&&(c+="alt_"),a.ctrlKey&&(c+="control_"),a.metaKey&&(c+="meta_"),a.shiftKey&&(c+="shift_"),c+=b.toLowerCase(),this._map[c]},c.prototype.respondTo=function(a){return"string"==typeof a?null!=this._map[this.constructor.normalize(a)]:null!=this._getHander(a)},c.prototype.add=function(a,b){return this._map[this.constructor.normalize(a)]=b,this},c.prototype.remove=function(a){return delete this._map[this.constructor.normalize(a)],this},c.prototype.destroy=function(){return a(this._delegate).off(".simple-hotkeys-"+this.id),this._map={},this},c}(b),d=function(a){return new c(a)}});!function(a,b){"function"==typeof define&&define.amd? |
|
10 |
+// AMD. Register as an anonymous module unless amdModuleId is set |
|
11 |
+define("simple-uploader",["jquery","simple-module"],function(c,d){return a.uploader=b(c,d)}):"object"==typeof exports? |
|
12 |
+// Node. Does not work with strict CommonJS, but |
|
13 |
+// only CommonJS-like environments that support module.exports, |
|
14 |
+// like Node. |
|
15 |
+module.exports=b(require("jquery"),require("simple-module")):(a.simple=a.simple||{},a.simple.uploader=b(jQuery,SimpleModule))}(this,function(a,b){var c,d,e=function(a,b){function c(){this.constructor=a}for(var d in b)f.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},f={}.hasOwnProperty;return c=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return e(c,b),c.count=0,c.prototype.opts={url:"",params:null,fileKey:"upload_file",connectionCount:3},c.prototype._init=function(){return this.files=[],this.queue=[],this.id=++c.count,this.on("uploadcomplete",function(b){return function(c,d){return b.files.splice(a.inArray(d,b.files),1),b.queue.length>0&&b.files.length<b.opts.connectionCount?b.upload(b.queue.shift()):b.uploading=!1}}(this)),a(window).on("beforeunload.uploader-"+this.id,function(a){return function(b){return a.uploading?(b.originalEvent.returnValue=a._t("leaveConfirm"),a._t("leaveConfirm")):void 0}}(this))},c.prototype.generateId=function(){var a;return a=0,function(){return a+=1}}(),c.prototype.upload=function(b,c){var d,e,f,g;if(null==c&&(c={}),null!=b){if(a.isArray(b)||b instanceof FileList)for(e=0,g=b.length;g>e;e++)d=b[e],this.upload(d,c);else a(b).is("input:file")?(f=a(b).attr("name"),f&&(c.fileKey=f),this.upload(a.makeArray(a(b)[0].files),c)):b.id&&b.obj||(b=this.getFile(b));if(b&&b.obj){if(a.extend(b,c),this.files.length>=this.opts.connectionCount)return void this.queue.push(b);if(this.triggerHandler("beforeupload",[b])!==!1)return this.files.push(b),this._xhrUpload(b),this.uploading=!0}}},c.prototype.getFile=function(a){var b,c,d;return a instanceof window.File||a instanceof window.Blob?(b=null!=(c=a.fileName)?c:a.name,{id:this.generateId(),url:this.opts.url,params:this.opts.params,fileKey:this.opts.fileKey,name:b,size:null!=(d=a.fileSize)?d:a.size,ext:b?b.split(".").pop().toLowerCase():"",obj:a}):null},c.prototype._xhrUpload=function(b){var c,d,e,f;if(c=new FormData,c.append(b.fileKey,b.obj),c.append("original_filename",b.name),b.params){e=b.params;for(d in e)f=e[d],c.append(d,f)}return b.xhr=a.ajax({url:b.url,data:c,processData:!1,contentType:!1,type:"POST",headers:{"X-File-Name":encodeURIComponent(b.name)},xhr:function(){var b;return b=a.ajaxSettings.xhr(),b&&(b.upload.onprogress=function(a){return function(b){return a.progress(b)}}(this)),b},progress:function(a){return function(c){return c.lengthComputable?a.trigger("uploadprogress",[b,c.loaded,c.total]):void 0}}(this),error:function(a){return function(c,d,e){return a.trigger("uploaderror",[b,c,d])}}(this),success:function(c){return function(d){return c.trigger("uploadprogress",[b,b.size,b.size]),c.trigger("uploadsuccess",[b,d]),a(document).trigger("uploadsuccess",[b,d,c])}}(this),complete:function(a){return function(c,d){return a.trigger("uploadcomplete",[b,c.responseText])}}(this)})},c.prototype.cancel=function(a){var b,c,d,e;if(!a.id)for(e=this.files,c=0,d=e.length;d>c;c++)if(b=e[c],b.id===1*a){a=b;break}return this.trigger("uploadcancel",[a]),a.xhr&&a.xhr.abort(),a.xhr=null},c.prototype.readImageFile=function(b,c){var d,e;if(a.isFunction(c))return e=new Image,e.onload=function(){return c(e)},e.onerror=function(){return c()},window.FileReader&&FileReader.prototype.readAsDataURL&&/^image/.test(b.type)?(d=new FileReader,d.onload=function(a){return e.src=a.target.result},d.readAsDataURL(b)):c()},c.prototype.destroy=function(){var b,c,d,e;for(this.queue.length=0,e=this.files,c=0,d=e.length;d>c;c++)b=e[c],this.cancel(b);return a(window).off(".uploader-"+this.id),a(document).off(".uploader-"+this.id)},c.i18n={"zh-CN":{leaveConfirm:"正在上传文件,如果离开上传会自动取消"}},c.locale="zh-CN",c}(b),d=function(a){return new c(a)}});/*! |
|
16 |
+* Simditor v2.3.6 |
|
17 |
+* http://simditor.tower.im/ |
|
18 |
+* 2015-12-21 |
|
19 |
+*/ |
|
20 |
+!function(a,b){"function"==typeof define&&define.amd? |
|
21 |
+// AMD. Register as an anonymous module unless amdModuleId is set |
|
22 |
+define("simditor",["jquery","simple-module","simple-hotkeys","simple-uploader"],function(c,d,e,f){return a.Simditor=b(c,d,e,f)}):"object"==typeof exports?module.exports=b(require("jquery"),require("simple-module"),require("simple-hotkeys"),require("simple-uploader")):a.Simditor=b(jQuery,SimpleModule,simple.hotkeys,simple.uploader)}(this,function(a,b,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M=function(a,b){function c(){this.constructor=a}for(var d in b)N.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},N={}.hasOwnProperty,O=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1},P=[].slice;return C=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return M(c,b),c.pluginName="Selection",c.prototype._range=null,c.prototype._startNodes=null,c.prototype._endNodes=null,c.prototype._containerNode=null,c.prototype._nodes=null,c.prototype._blockNodes=null,c.prototype._rootNodes=null,c.prototype._init=function(){return this.editor=this._module,this._selection=document.getSelection(),this.editor.on("selectionchanged",function(a){return function(b){return a.reset(),a._range=a._selection.getRangeAt(0)}}(this)),this.editor.on("blur",function(a){return function(b){return a.reset()}}(this))},c.prototype.reset=function(){return this._range=null,this._startNodes=null,this._endNodes=null,this._containerNode=null,this._nodes=null,this._blockNodes=null,this._rootNodes=null},c.prototype.clear=function(){var a;try{this._selection.removeAllRanges()}catch(b){a=b}return this.reset()},c.prototype.range=function(a){var b;return a?(this.clear(),this._selection.addRange(a),this._range=a,b=this.editor.util.browser.firefox||this.editor.util.browser.msie,!this.editor.inputManager.focused&&b&&this.editor.body.focus()):!this._range&&this.editor.inputManager.focused&&this._selection.rangeCount&&(this._range=this._selection.getRangeAt(0)),this._range},c.prototype.startNodes=function(){return this._range&&(this._startNodes||(this._startNodes=function(b){return function(){var c;return c=a(b._range.startContainer).parentsUntil(b.editor.body).get(),c.unshift(b._range.startContainer),a(c)}}(this)())),this._startNodes},c.prototype.endNodes=function(){var b;return this._range&&(this._endNodes||(this._endNodes=this._range.collapsed?this.startNodes():(b=a(this._range.endContainer).parentsUntil(this.editor.body).get(),b.unshift(this._range.endContainer),a(b)))),this._endNodes},c.prototype.containerNode=function(){return this._range&&(this._containerNode||(this._containerNode=a(this._range.commonAncestorContainer))),this._containerNode},c.prototype.nodes=function(){return this._range&&(this._nodes||(this._nodes=function(b){return function(){var c;return c=[],b.startNodes().first().is(b.endNodes().first())?c=b.startNodes().get():(b.startNodes().each(function(d,e){var f,g,h,i,j,k,l;return g=a(e),b.endNodes().index(g)>-1?c.push(e):g.parent().is(b.editor.body)||(k=b.endNodes().index(g.parent()))>-1?(f=k&&k>-1?b.endNodes().eq(k-1):b.endNodes().last(),h=g.parent().contents(),l=h.index(g),i=h.index(f),a.merge(c,h.slice(l,i).get())):(h=g.parent().contents(),j=h.index(g),a.merge(c,h.slice(j).get()))}),b.endNodes().each(function(d,e){var f,g,h;return f=a(e),f.parent().is(b.editor.body)||b.startNodes().index(f.parent())>-1?(c.push(e),!1):(g=f.parent().contents(),h=g.index(f),a.merge(c,g.slice(0,h+1)))})),a(a.unique(c))}}(this)())),this._nodes},c.prototype.blockNodes=function(){return this._range?(this._blockNodes||(this._blockNodes=function(a){return function(){return a.nodes().filter(function(b,c){return a.editor.util.isBlockNode(c)})}}(this)()),this._blockNodes):void 0},c.prototype.rootNodes=function(){return this._range?(this._rootNodes||(this._rootNodes=function(b){return function(){return b.nodes().filter(function(c,d){var e;return e=a(d).parent(),e.is(b.editor.body)||e.is("blockquote")})}}(this)()),this._rootNodes):void 0},c.prototype.rangeAtEndOf=function(b,c){var d,e,f,g,h,i;return null==c&&(c=this.range()),c&&c.collapsed?(b=a(b)[0],f=c.endContainer,g=this.editor.util.getNodeLength(f),e=c.endOffset===g-1,h=a(f).contents().last().is("br"),d=c.endOffset===g,e&&h||d?b===f?!0:a.contains(b,f)?(i=!0,a(f).parentsUntil(b).addBack().each(function(b,c){var d,e,f,g;return g=a(c).parent().contents().filter(function(){return!(this!==c&&3===this.nodeType&&!this.nodeValue)}),d=g.last(),f=d.get(0)===c,e=d.is("br")&&d.prev().get(0)===c,f||e?void 0:(i=!1,!1)}),i):!1:!1):void 0},c.prototype.rangeAtStartOf=function(b,c){var d,e;return null==c&&(c=this.range()),c&&c.collapsed?(b=a(b)[0],e=c.startContainer,0!==c.startOffset?!1:b===e?!0:a.contains(b,e)?(d=!0,a(e).parentsUntil(b).addBack().each(function(b,c){var e;return e=a(c).parent().contents().filter(function(){return!(this!==c&&3===this.nodeType&&!this.nodeValue)}),e.first().get(0)!==c?d=!1:void 0}),d):!1):void 0},c.prototype.insertNode=function(b,c){return null==c&&(c=this.range()),c?(b=a(b)[0],c.insertNode(b),this.setRangeAfter(b,c)):void 0},c.prototype.setRangeAfter=function(b,c){return null==c&&(c=this.range()),null!=c?(b=a(b)[0],c.setEndAfter(b),c.collapse(!1),this.range(c)):void 0},c.prototype.setRangeBefore=function(b,c){return null==c&&(c=this.range()),null!=c?(b=a(b)[0],c.setEndBefore(b),c.collapse(!1),this.range(c)):void 0},c.prototype.setRangeAtStartOf=function(b,c){return null==c&&(c=this.range()),b=a(b).get(0),c.setEnd(b,0),c.collapse(!1),this.range(c)},c.prototype.setRangeAtEndOf=function(b,c){var d,e,f,g,h,i,j;return null==c&&(c=this.range()),e=a(b),b=e[0],e.is("pre")?(f=e.contents(),f.length>0?(g=f.last(),i=g.text(),h=this.editor.util.getNodeLength(g[0]),"\n"===i.charAt(i.length-1)?c.setEnd(g[0],h-1):c.setEnd(g[0],h)):c.setEnd(b,0)):(j=this.editor.util.getNodeLength(b),3!==b.nodeType&&j>0&&(d=a(b).contents().last(),d.is("br")?j-=1:3!==d[0].nodeType&&this.editor.util.isEmptyNode(d)&&(d.append(this.editor.util.phBr),b=d[0],j=0)),c.setEnd(b,j)),c.collapse(!1),this.range(c)},c.prototype.deleteRangeContents=function(a){var b,c,d,e;return null==a&&(a=this.range()),e=a.cloneRange(),d=a.cloneRange(),e.collapse(!0),d.collapse(!1),c=this.rangeAtStartOf(this.editor.body,e),b=this.rangeAtEndOf(this.editor.body,d),!a.collapsed&&c&&b?(this.editor.body.empty(),a.setStart(this.editor.body[0],0),a.collapse(!0),this.range(a)):a.deleteContents(),a},c.prototype.breakBlockEl=function(b,c){var d;return null==c&&(c=this.range()),d=a(b),c.collapsed?(c.setStartBefore(d.get(0)),c.collapsed?d:d.before(c.extractContents())):d},c.prototype.save=function(b){var c,d,e;return null==b&&(b=this.range()),this._selectionSaved?void 0:(d=b.cloneRange(),d.collapse(!1),e=a("<span/>").addClass("simditor-caret-start"),c=a("<span/>").addClass("simditor-caret-end"),d.insertNode(c[0]),b.insertNode(e[0]),this.clear(),this._selectionSaved=!0)},c.prototype.restore=function(){var a,b,c,d,e,f,g;return this._selectionSaved?(e=this.editor.body.find(".simditor-caret-start"),a=this.editor.body.find(".simditor-caret-end"),e.length&&a.length?(f=e.parent(),g=f.contents().index(e),b=a.parent(),c=b.contents().index(a),f[0]===b[0]&&(c-=1),d=document.createRange(),d.setStart(f.get(0),g),d.setEnd(b.get(0),c),e.remove(),a.remove(),this.range(d)):(e.remove(),a.remove()),this._selectionSaved=!1,d):!1},c}(b),n=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return M(c,b),c.pluginName="Formatter",c.prototype.opts={allowedTags:[],allowedAttributes:{},allowedStyles:{}},c.prototype._init=function(){return this.editor=this._module,this._allowedTags=a.merge(["br","span","a","img","b","strong","i","strike","u","font","p","ul","ol","li","blockquote","pre","code","h1","h2","h3","h4","hr"],this.opts.allowedTags),this._allowedAttributes=a.extend({img:["src","alt","width","height","data-non-image"],a:["href","target"],font:["color"],code:["class"]},this.opts.allowedAttributes),this._allowedStyles=a.extend({span:["color","font-size"],b:["color"],i:["color"],strong:["color"],strike:["color"],u:["color"],p:["margin-left","text-align"],h1:["margin-left","text-align"],h2:["margin-left","text-align"],h3:["margin-left","text-align"],h4:["margin-left","text-align"]},this.opts.allowedStyles),this.editor.body.on("click","a",function(a){return!1})},c.prototype.decorate=function(a){return null==a&&(a=this.editor.body),this.editor.trigger("decorate",[a]),a},c.prototype.undecorate=function(a){return null==a&&(a=this.editor.body.clone()),this.editor.trigger("undecorate",[a]),a},c.prototype.autolink=function(b){var c,d,e,f,g,h,i,j,k,l,m,n,o;for(null==b&&(b=this.editor.body),i=[],e=function(c){return c.contents().each(function(c,d){var f,g;return f=a(d),f.is("a")||f.closest("a, pre",b).length?void 0:!f.is("iframe")&&f.contents().length?e(f):(g=f.text())&&/https?:\/\/|www\./gi.test(g)?i.push(f):void 0})},e(b),k=/(https?:\/\/|www\.)[\w\-\.\?&=\/#%:,@\!\+]+/gi,f=0,h=i.length;h>f;f++){for(d=i[f],n=d.text(),l=[],j=null,g=0;null!==(j=k.exec(n));)m=n.substring(g,j.index),l.push(document.createTextNode(m)),g=k.lastIndex,o=/^(http(s)?:\/\/|\/)/.test(j[0])?j[0]:"http://"+j[0],c=a('<a href="'+o+'" rel="nofollow"></a>').text(j[0]),l.push(c[0]);l.push(document.createTextNode(n.substring(g))),d.replaceWith(a(l))}return b},c.prototype.format=function(b){var c,d,e,f,g,h,i,j,k,l;if(null==b&&(b=this.editor.body),b.is(":empty"))return b.append("<p>"+this.editor.util.phBr+"</p>"),b;for(k=b.contents(),e=0,g=k.length;g>e;e++)i=k[e],this.cleanNode(i,!0);for(l=b.contents(),f=0,h=l.length;h>f;f++)j=l[f],c=a(j),c.is("br")?("undefined"!=typeof d&&null!==d&&(d=null),c.remove()):this.editor.util.isBlockNode(j)?c.is("li")?d&&d.is("ul, ol")?d.append(j):(d=a("<ul/>").insertBefore(j),d.append(j)):d=null:((!d||d.is("ul, ol"))&&(d=a("<p/>").insertBefore(j)),d.append(j),this.editor.util.isEmptyNode(d)&&d.append(this.editor.util.phBr));return b},c.prototype.cleanNode=function(b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;if(f=a(b),f.length>0){if(3===f[0].nodeType)return t=f.text().replace(/(\r\n|\n|\r)/gm,""),void(t?(u=document.createTextNode(t),f.replaceWith(u)):f.remove());if(k=f.is("iframe")?null:f.contents(),l=this.editor.util.isDecoratedNode(f),f.is(this._allowedTags.join(","))||l){if(f.is("a")&&(e=f.find("img")).length>0&&(f.replaceWith(e),f=e,k=null),f.is("td")&&(d=f.find(this.editor.util.blockNodes.join(","))).length>0&&(d.each(function(b){return function(b,c){return a(c).contents().unwrap()}}(this)),k=f.contents()),f.is("img")&&f.hasClass("uploading")&&f.remove(),!l){for(i=this._allowedAttributes[f[0].tagName.toLowerCase()],r=a.makeArray(f[0].attributes),m=0,o=r.length;o>m;m++)j=r[m],"style"!==j.name&&(null!=i&&(s=j.name,O.call(i,s)>=0)||f.removeAttr(j.name));this._cleanNodeStyles(f),f.is("span")&&0===f[0].attributes.length&&f.contents().first().unwrap()}}else 1!==f[0].nodeType||f.is(":empty")?(f.remove(),k=null):f.is("div, article, dl, header, footer, tr")?(f.append("<br/>"),k.first().unwrap()):f.is("table")?(g=a("<p/>"),f.find("tr").each(function(b,c){return g.append(a(c).text()+"<br/>")}),f.replaceWith(g),k=null):f.is("thead, tfoot")?(f.remove(),k=null):f.is("th")?(h=a("<td/>").append(f.contents()),f.replaceWith(h)):k.first().unwrap();if(c&&null!=k&&!f.is("pre"))for(n=0,p=k.length;p>n;n++)q=k[n],this.cleanNode(q,!0);return null}},c.prototype._cleanNodeStyles=function(b){var c,d,e,f,g,h,i,j,k;if(j=b.attr("style")){if(b.removeAttr("style"),c=this._allowedStyles[b[0].tagName.toLowerCase()],!(c&&c.length>0))return b;for(k={},g=j.split(";"),d=0,e=g.length;e>d;d++)i=g[d],i=a.trim(i),f=i.split(":"),(f.length=2)&&(h=f[0],O.call(c,h)>=0&&(k[a.trim(f[0])]=a.trim(f[1])));return Object.keys(k).length>0&&b.css(k),b}},c.prototype.clearHtml=function(b,c){var d,e,f;return null==c&&(c=!0),d=a("<div/>").append(b),e=d.contents(),f="",e.each(function(b){return function(d,g){var h,i;return 3===g.nodeType?f+=g.nodeValue:1===g.nodeType&&(h=a(g),i=h.is("iframe")?null:h.contents(),i&&i.length>0&&(f+=b.clearHtml(i)),c&&d<e.length-1&&h.is("br, p, div, li,tr, pre, address, artticle, aside, dl, figcaption, footer, h1, h2,h3, h4, header"))?f+="\n":void 0}}(this)),f},c.prototype.beautify=function(b){var c;return c=function(a){return!!(a.is("p")&&!a.text()&&a.children(":not(br)").length<1)},b.each(function(b,d){var e,f;return e=a(d),f=e.is(':not(img, br, col, td, hr, [class^="simditor-"]):empty'),(f||c(e))&&e.remove(),e.find(':not(img, br, col, td, hr, [class^="simditor-"]):empty').remove()})},c}(b),t=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return M(c,b),c.pluginName="InputManager",c.prototype._modifierKeys=[16,17,18,91,93,224],c.prototype._arrowKeys=[37,38,39,40],c.prototype._init=function(){var b,c;return this.editor=this._module,this.throttledValueChanged=this.editor.util.throttle(function(a){return function(b){return setTimeout(function(){return a.editor.trigger("valuechanged",b)},10)}}(this),300),this.throttledSelectionChanged=this.editor.util.throttle(function(a){return function(){return a.editor.trigger("selectionchanged")}}(this),50),a(document).on("selectionchange.simditor"+this.editor.id,function(a){return function(b){var c;if(a.focused&&!a.editor.clipboard.pasting)return(c=function(){return a._selectionTimer&&(clearTimeout(a._selectionTimer),a._selectionTimer=null),a.editor.selection._selection.rangeCount>0?a.throttledSelectionChanged():a._selectionTimer=setTimeout(function(){return a._selectionTimer=null,a.focused?c():void 0},10)})()}}(this)),this.editor.on("valuechanged",function(b){return function(){var c;return b.lastCaretPosition=null,c=b.editor.body.children().filter(function(a,c){return b.editor.util.isBlockNode(c)}),b.focused&&0===c.length&&(b.editor.selection.save(),b.editor.formatter.format(),b.editor.selection.restore()),b.editor.body.find("hr, pre, .simditor-table").each(function(c,d){var e,f;return e=a(d),(e.parent().is("blockquote")||e.parent()[0]===b.editor.body[0])&&(f=!1,0===e.next().length&&(a("<p/>").append(b.editor.util.phBr).insertAfter(e),f=!0),0===e.prev().length&&(a("<p/>").append(b.editor.util.phBr).insertBefore(e),f=!0),f)?b.throttledValueChanged():void 0}),b.editor.body.find("pre:empty").append(b.editor.util.phBr),!b.editor.util.support.onselectionchange&&b.focused?b.throttledSelectionChanged():void 0}}(this)),this.editor.body.on("keydown",a.proxy(this._onKeyDown,this)).on("keypress",a.proxy(this._onKeyPress,this)).on("keyup",a.proxy(this._onKeyUp,this)).on("mouseup",a.proxy(this._onMouseUp,this)).on("focus",a.proxy(this._onFocus,this)).on("blur",a.proxy(this._onBlur,this)).on("drop",a.proxy(this._onDrop,this)).on("input",a.proxy(this._onInput,this)),this.editor.util.browser.firefox&&(this.editor.hotkeys.add("cmd+left",function(a){return function(b){return b.preventDefault(),a.editor.selection._selection.modify("move","backward","lineboundary"),!1}}(this)),this.editor.hotkeys.add("cmd+right",function(a){return function(b){return b.preventDefault(),a.editor.selection._selection.modify("move","forward","lineboundary"),!1}}(this)),b=this.editor.util.os.mac?"cmd+a":"ctrl+a",this.editor.hotkeys.add(b,function(a){return function(b){var c,d,e,f;return c=a.editor.body.children(),c.length>0?(d=c.first().get(0),e=c.last().get(0),f=document.createRange(),f.setStart(d,0),f.setEnd(e,a.editor.util.getNodeLength(e)),a.editor.selection.range(f),!1):void 0}}(this))),c=this.editor.util.os.mac?"cmd+enter":"ctrl+enter",this.editor.hotkeys.add(c,function(a){return function(b){return a.editor.el.closest("form").find("button:submit").click(),!1}}(this))},c.prototype._onFocus=function(a){return this.editor.clipboard.pasting?void 0:(this.editor.el.addClass("focus").removeClass("error"),this.focused=!0,setTimeout(function(a){return function(){var b,c;return c=a.editor.selection._selection.getRangeAt(0),c.startContainer===a.editor.body[0]&&(a.lastCaretPosition?a.editor.undoManager.caretPosition(a.lastCaretPosition):(b=a.editor.body.children().first(),c=document.createRange(),a.editor.selection.setRangeAtStartOf(b,c))),a.lastCaretPosition=null,a.editor.triggerHandler("focus"),a.editor.util.support.onselectionchange?void 0:a.throttledSelectionChanged()}}(this),0))},c.prototype._onBlur=function(a){var b;if(!this.editor.clipboard.pasting)return this.editor.el.removeClass("focus"),this.editor.sync(),this.focused=!1,this.lastCaretPosition=null!=(b=this.editor.undoManager.currentState())?b.caret:void 0,this.editor.triggerHandler("blur")},c.prototype._onMouseUp=function(a){return this.editor.util.support.onselectionchange?void 0:this.throttledSelectionChanged()},c.prototype._onKeyDown=function(a){var b,c;if(this.editor.triggerHandler(a)===!1)return!1;if(!this.editor.hotkeys.respondTo(a)){if(this.editor.keystroke.respondTo(a))return this.throttledValueChanged(),!1;if(b=a.which,!(O.call(this._modifierKeys,b)>=0||(c=a.which,O.call(this._arrowKeys,c)>=0)||this.editor.util.metaKey(a)&&86===a.which))return this.editor.util.support.oninput||this.throttledValueChanged(["typing"]),null}},c.prototype._onKeyPress=function(a){return this.editor.triggerHandler(a)===!1?!1:void 0},c.prototype._onKeyUp=function(b){var c,d;return this.editor.triggerHandler(b)===!1?!1:!this.editor.util.support.onselectionchange&&(d=b.which,O.call(this._arrowKeys,d)>=0)?void this.throttledValueChanged():void(8!==b.which&&46!==b.which||!this.editor.util.isEmptyNode(this.editor.body)||(this.editor.body.empty(),c=a("<p/>").append(this.editor.util.phBr).appendTo(this.editor.body),this.editor.selection.setRangeAtStartOf(c)))},c.prototype._onDrop=function(a){return this.editor.triggerHandler(a)===!1?!1:this.throttledValueChanged()},c.prototype._onInput=function(a){return this.throttledValueChanged(["oninput"])},c}(b),v=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return M(c,b),c.pluginName="Keystroke",c.prototype._init=function(){return this.editor=this._module,this._keystrokeHandlers={},this._initKeystrokeHandlers()},c.prototype.add=function(a,b,c){return a=a.toLowerCase(),a=this.editor.hotkeys.constructor.aliases[a]||a,this._keystrokeHandlers[a]||(this._keystrokeHandlers[a]={}),this._keystrokeHandlers[a][b]=c},c.prototype.respondTo=function(b){var c,d,e,f;return(d=null!=(e=this.editor.hotkeys.constructor.keyNameMap[b.which])?e.toLowerCase():void 0)&&d in this._keystrokeHandlers&&(f="function"==typeof(c=this._keystrokeHandlers[d])["*"]?c["*"](b):void 0,f||this.editor.selection.startNodes().each(function(c){return function(e,g){var h,i;if(g.nodeType===Node.ELEMENT_NODE)return h=null!=(i=c._keystrokeHandlers[d])?i[g.tagName.toLowerCase()]:void 0,f="function"==typeof h?h(b,a(g)):void 0,f===!0||f===!1?!1:void 0}}(this)),f)?!0:void 0},c.prototype._initKeystrokeHandlers=function(){var b;return this.editor.util.browser.safari&&this.add("enter","*",function(b){return function(c){var d,e;if(c.shiftKey&&(d=b.editor.selection.blockNodes().last(),!d.is("pre")))return e=a("<br/>"),b.editor.selection.rangeAtEndOf(d)?(b.editor.selection.insertNode(e),b.editor.selection.insertNode(a("<br/>")),b.editor.selection.setRangeBefore(e)):b.editor.selection.insertNode(e),!0}}(this)),(this.editor.util.browser.webkit||this.editor.util.browser.msie)&&(b=function(b){return function(c,d){var e;if(b.editor.selection.rangeAtEndOf(d))return e=a("<p/>").append(b.editor.util.phBr).insertAfter(d),b.editor.selection.setRangeAtStartOf(e),!0}}(this),this.add("enter","h1",b),this.add("enter","h2",b),this.add("enter","h3",b),this.add("enter","h4",b),this.add("enter","h5",b),this.add("enter","h6",b)),this.add("backspace","*",function(a){return function(b){var c,d,e,f;return e=a.editor.selection.rootNodes().first(),d=e.prev(),d.is("hr")&&a.editor.selection.rangeAtStartOf(e)?(a.editor.selection.save(),d.remove(),a.editor.selection.restore(),!0):(c=a.editor.selection.blockNodes().last(),f=a.editor.util.browser.webkit,f&&a.editor.selection.rangeAtStartOf(c)?(a.editor.selection.save(),a.editor.formatter.cleanNode(c,!0),a.editor.selection.restore(),null):void 0)}}(this)),this.add("enter","li",function(b){return function(c,d){var e,f,g,h;if(e=d.clone(),e.find("ul, ol").remove(),b.editor.util.isEmptyNode(e)&&d.is(b.editor.selection.blockNodes().last())){if(f=d.parent(),d.next("li").length>0){if(!b.editor.util.isEmptyNode(d))return;f.parent("li").length>0?(g=a("<li/>").append(b.editor.util.phBr).insertAfter(f.parent("li")),h=a("<"+f[0].tagName+"/>").append(d.nextAll("li")),g.append(h)):(g=a("<p/>").append(b.editor.util.phBr).insertAfter(f),h=a("<"+f[0].tagName+"/>").append(d.nextAll("li")),g.after(h))}else f.parent("li").length>0?(g=a("<li/>").insertAfter(f.parent("li")),d.contents().length>0?g.append(d.contents()):g.append(b.editor.util.phBr)):(g=a("<p/>").append(b.editor.util.phBr).insertAfter(f),d.children("ul, ol").length>0&&g.after(d.children("ul, ol")));return d.prev("li").length?d.remove():f.remove(),b.editor.selection.setRangeAtStartOf(g),!0}}}(this)),this.add("enter","pre",function(b){return function(c,d){var e,f,g;return c.preventDefault(),c.shiftKey?(e=a("<p/>").append(b.editor.util.phBr).insertAfter(d),b.editor.selection.setRangeAtStartOf(e),!0):(g=b.editor.selection.range(),f=null,g.deleteContents(),!b.editor.util.browser.msie&&b.editor.selection.rangeAtEndOf(d)?(f=document.createTextNode("\n\n"),g.insertNode(f),g.setEnd(f,1)):(f=document.createTextNode("\n"),g.insertNode(f),g.setStartAfter(f)),g.collapse(!1),b.editor.selection.range(g),!0)}}(this)),this.add("enter","blockquote",function(a){return function(b,c){var d,e;return d=a.editor.selection.blockNodes().last(),d.is("p")&&!d.next().length&&a.editor.util.isEmptyNode(d)?(c.after(d),e=document.createRange(),a.editor.selection.setRangeAtStartOf(d,e),!0):void 0}}(this)),this.add("backspace","li",function(b){return function(c,d){var e,f,g,h,i,j,k,l,m;return f=d.children("ul, ol"),i=d.prev("li"),f.length>0&&i.length>0?(m="",j=null,d.contents().each(function(b,c){if(1===c.nodeType&&/UL|OL/.test(c.nodeName))return!1;if(1!==c.nodeType||!/BR/.test(c.nodeName))return 3===c.nodeType&&c.nodeValue?m+=c.nodeValue:1===c.nodeType&&(m+=a(c).text()),j=a(c)}),k=b.editor.util.browser.firefox&&!j.next("br").length,j&&1===m.length&&k?(e=a(b.editor.util.phBr).insertAfter(j),j.remove(),b.editor.selection.setRangeBefore(e),!0):m.length>0?!1:(l=document.createRange(),h=i.children("ul, ol"),h.length>0?(g=a("<li/>").append(b.editor.util.phBr).appendTo(h),h.append(f.children("li")),d.remove(),b.editor.selection.setRangeAtEndOf(g,l)):(b.editor.selection.setRangeAtEndOf(i,l),i.append(f),d.remove(),b.editor.selection.range(l)),!0)):!1}}(this)),this.add("backspace","pre",function(b){return function(c,d){var e,f,g;if(b.editor.selection.rangeAtStartOf(d))return f=d.html().replace("\n","<br/>")||b.editor.util.phBr,e=a("<p/>").append(f).insertAfter(d),d.remove(),g=document.createRange(),b.editor.selection.setRangeAtStartOf(e,g),!0}}(this)),this.add("backspace","blockquote",function(a){return function(b,c){var d,e;if(a.editor.selection.rangeAtStartOf(c))return d=c.children().first().unwrap(),e=document.createRange(),a.editor.selection.setRangeAtStartOf(d,e),!0}}(this))},c}(b),J=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return M(c,b),c.pluginName="UndoManager",c.prototype._index=-1,c.prototype._capacity=20,c.prototype._startPosition=null,c.prototype._endPosition=null,c.prototype._init=function(){var a,b;return this.editor=this._module,this._stack=[],this.editor.util.os.mac?(b="cmd+z",a="shift+cmd+z"):this.editor.util.os.win?(b="ctrl+z",a="ctrl+y"):(b="ctrl+z",a="shift+ctrl+z"),this.editor.hotkeys.add(b,function(a){return function(b){return b.preventDefault(),a.undo(),!1}}(this)),this.editor.hotkeys.add(a,function(a){return function(b){return b.preventDefault(),a.redo(),!1}}(this)),this.throttledPushState=this.editor.util.throttle(function(a){return function(){return a._pushUndoState()}}(this),2e3),this.editor.on("valuechanged",function(a){return function(b,c){return"undo"!==c&&"redo"!==c?a.throttledPushState():void 0}}(this)),this.editor.on("selectionchanged",function(a){return function(b){return a.resetCaretPosition(),a.update()}}(this)),this.editor.on("focus",function(a){return function(b){return 0===a._stack.length?a._pushUndoState():void 0}}(this)),this.editor.on("blur",function(a){return function(b){return a.resetCaretPosition()}}(this))},c.prototype.resetCaretPosition=function(){return this._startPosition=null,this._endPosition=null},c.prototype.startPosition=function(){return this.editor.selection._range&&(this._startPosition||(this._startPosition=this._getPosition("start"))),this._startPosition},c.prototype.endPosition=function(){return this.editor.selection._range&&(this._endPosition||(this._endPosition=function(a){return function(){var b;return b=a.editor.selection.range(),b.collapsed?a._startPosition:a._getPosition("end")}}(this)())),this._endPosition},c.prototype._pushUndoState=function(){var a;if(this.editor.triggerHandler("pushundostate")!==!1&&(a=this.caretPosition(),a.start))return this._index+=1,this._stack.length=this._index,this._stack.push({html:this.editor.body.html(),caret:this.caretPosition()}),this._stack.length>this._capacity?(this._stack.shift(),this._index-=1):void 0},c.prototype.currentState=function(){return this._stack.length&&this._index>-1?this._stack[this._index]:null},c.prototype.undo=function(){var a;if(!(this._index<1||this._stack.length<2))return this.editor.hidePopover(),this._index-=1,a=this._stack[this._index],this.editor.body.get(0).innerHTML=a.html,this.caretPosition(a.caret),this.editor.body.find(".selected").removeClass("selected"),this.editor.sync(),this.editor.trigger("valuechanged",["undo"])},c.prototype.redo=function(){var a;if(!(this._index<0||this._stack.length<this._index+2))return this.editor.hidePopover(),this._index+=1,a=this._stack[this._index],this.editor.body.get(0).innerHTML=a.html,this.caretPosition(a.caret),this.editor.body.find(".selected").removeClass("selected"),this.editor.sync(),this.editor.trigger("valuechanged",["redo"])},c.prototype.update=function(){var a;return(a=this.currentState())?(a.html=this.editor.body.html(),a.caret=this.caretPosition()):void 0},c.prototype._getNodeOffset=function(b,c){var d,e,f;return d=a.isNumeric(c)?a(b):a(b).parent(),f=0,e=!1,d.contents().each(function(a,d){return b===d||c===a&&0===a?!1:(d.nodeType===Node.TEXT_NODE?!e&&d.nodeValue.length>0&&(f+=1,e=!0):(f+=1,e=!1),c-1===a?!1:null)}),f},c.prototype._getPosition=function(b){var c,d,e,f,g,h,i;if(null==b&&(b="start"),i=this.editor.selection.range(),f=i[b+"Offset"],c=this.editor.selection[b+"Nodes"](),d=c.first()[0],d.nodeType===Node.TEXT_NODE){for(h=d.previousSibling;h&&h.nodeType===Node.TEXT_NODE;)d=h,f+=this.editor.util.getNodeLength(h),h=h.previousSibling;e=c.get(),e[0]=d,c=a(e)}else f=this._getNodeOffset(d,f);return g=[f],c.each(function(a){return function(b,c){return g.unshift(a._getNodeOffset(c))}}(this)),g},c.prototype._getNodeByPosition=function(b){var c,d,e,f,g,h,i,j;for(h=this.editor.body[0],j=b.slice(0,b.length-1),e=f=0,g=j.length;g>f;e=++f){if(i=j[e],d=h.childNodes,i>d.length-1){if(e!==b.length-2||!a(h).is("pre:empty")){h=null;break}c=document.createTextNode(""),h.appendChild(c),d=h.childNodes}h=d[i]}return h},c.prototype.caretPosition=function(a){var b,c,d,e,f;if(a){if(!a.start)return;return e=this._getNodeByPosition(a.start),f=a.start[a.start.length-1],a.collapsed?(b=e,c=f):(b=this._getNodeByPosition(a.end),c=a.start[a.start.length-1]),e&&b?(d=document.createRange(),d.setStart(e,f),d.setEnd(b,c),this.editor.selection.range(d)):void("undefined"!=typeof console&&null!==console&&"function"==typeof console.warn&&console.warn("simditor: invalid caret state"))}return d=this.editor.selection.range(),a=this.editor.inputManager.focused&&null!=d?{start:this.startPosition(),end:this.endPosition(),collapsed:d.collapsed}:{}},c}(b),L=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return M(c,b),c.pluginName="Util",c.prototype._init=function(){return this.editor=this._module,this.browser.msie&&this.browser.version<11?this.phBr="":void 0},c.prototype.phBr="<br/>",c.prototype.os=function(){var a;return a={},/Mac/.test(navigator.appVersion)?a.mac=!0:/Linux/.test(navigator.appVersion)?a.linux=!0:/Win/.test(navigator.appVersion)?a.win=!0:/X11/.test(navigator.appVersion)&&(a.unix=!0),/Mobi/.test(navigator.appVersion)&&(a.mobile=!0),a}(),c.prototype.browser=function(){var a,b,c,d,e,f,g,h,i,j,k;return k=navigator.userAgent,d=/(msie|trident)/i.test(k),a=/chrome|crios/i.test(k),j=/safari/i.test(k)&&!a,c=/firefox/i.test(k),b=/edge/i.test(k),d?{msie:!0,version:1*(null!=(e=k.match(/(msie |rv:)(\d+(\.\d+)?)/i))?e[2]:void 0)}:b?{edge:!0,webkit:!0,version:1*(null!=(f=k.match(/edge\/(\d+(\.\d+)?)/i))?f[1]:void 0)}:a?{webkit:!0,chrome:!0,version:1*(null!=(g=k.match(/(?:chrome|crios)\/(\d+(\.\d+)?)/i))?g[1]:void 0)}:j?{webkit:!0,safari:!0,version:1*(null!=(h=k.match(/version\/(\d+(\.\d+)?)/i))?h[1]:void 0)}:c?{mozilla:!0,firefox:!0,version:1*(null!=(i=k.match(/firefox\/(\d+(\.\d+)?)/i))?i[1]:void 0)}:{}}(),c.prototype.support=function(){return{onselectionchange:function(){var a,b;if(b=document.onselectionchange,void 0!==b)try{return document.onselectionchange=0,null===document.onselectionchange}catch(c){a=c}finally{document.onselectionchange=b}return!1}(),oninput:function(){return!/(msie|trident)/i.test(navigator.userAgent)}()}}(),c.prototype.reflow=function(b){return null==b&&(b=document),a(b)[0].offsetHeight},c.prototype.metaKey=function(a){var b;return b=/Mac/.test(navigator.userAgent),b?a.metaKey:a.ctrlKey},c.prototype.isEmptyNode=function(b){var c;return c=a(b),c.is(":empty")||!c.text()&&!c.find(":not(br, span, div)").length},c.prototype.isDecoratedNode=function(b){return a(b).is('[class^="simditor-"]')},c.prototype.blockNodes=["div","p","ul","ol","li","blockquote","hr","pre","h1","h2","h3","h4","h5","table"],c.prototype.isBlockNode=function(b){return b=a(b)[0],b&&3!==b.nodeType?new RegExp("^("+this.blockNodes.join("|")+")$").test(b.nodeName.toLowerCase()):!1},c.prototype.getNodeLength=function(b){switch(b=a(b)[0],b.nodeType){case 7:case 10:return 0;case 3:case 8:return b.length;default:return b.childNodes.length}},c.prototype.dataURLtoBlob=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n;if(h=window.Blob&&function(){var a;try{return Boolean(new Blob)}catch(b){return a=b,!1}}(),g=h&&window.Uint8Array&&function(){var a;try{return 100===new Blob([new Uint8Array(100)]).size}catch(b){return a=b,!1}}(),b=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,n=h||b,!(n&&window.atob&&window.ArrayBuffer&&window.Uint8Array))return!1;for(f=a.split(",")[0].indexOf("base64")>=0?atob(a.split(",")[1]):decodeURIComponent(a.split(",")[1]),c=new ArrayBuffer(f.length),j=new Uint8Array(c),i=k=0,m=f.length;m>=0?m>=k:k>=m;i=m>=0?++k:--k)j[i]=f.charCodeAt(i);return l=a.split(",")[0].split(":")[1].split(";")[0],h?(e=g?j:c,new Blob([e],{type:l})):(d=new b,d.append(c),d.getBlob(l))},c.prototype.throttle=function(a,b){var c,d,e,f,g,h,i;return f=0,i=0,e=c=g=null,d=function(){return i=0,f=+new Date,g=a.apply(e,c),e=null,c=null},h=function(){var a;return e=this,c=arguments,a=new Date-f,i||(a>=b?d():i=setTimeout(d,b-a)),g},h.clear=function(){return i?(clearTimeout(i),d()):void 0},h},c.prototype.formatHTML=function(b){var c,d,e,f,g,h,i,j,k;for(h=/<(\/?)(.+?)(\/?)>/g,j="",f=0,e=null,d=" ",i=function(a,b){return new Array(b+1).join(a)};null!==(g=h.exec(b));)g.isBlockNode=a.inArray(g[2],this.blockNodes)>-1,g.isStartTag="/"!==g[1]&&"/"!==g[3],g.isEndTag="/"===g[1]||"/"===g[3],c=e?e.index+e[0].length:0,(k=b.substring(c,g.index)).length>0&&a.trim(k)&&(j+=k),g.isBlockNode&&g.isEndTag&&!g.isStartTag&&(f-=1),g.isBlockNode&&g.isStartTag&&(e&&e.isBlockNode&&e.isEndTag||(j+="\n"),j+=i(d,f)),j+=g[0],g.isBlockNode&&g.isEndTag&&(j+="\n"),g.isBlockNode&&g.isStartTag&&(f+=1),e=g;return a.trim(j)},c}(b),H=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return M(c,b),c.pluginName="Toolbar",c.prototype.opts={toolbar:!0,toolbarFloat:!0, |
|
23 |
+toolbarHidden:!1,toolbarFloatOffset:0},c.prototype._tpl={wrapper:'<div class="simditor-toolbar"><ul></ul></div>',separator:'<li><span class="separator"></span></li>'},c.prototype._init=function(){var b,c,d;return this.editor=this._module,this.opts.toolbar?(a.isArray(this.opts.toolbar)||(this.opts.toolbar=["bold","italic","underline","strikethrough","|","ol","ul","blockquote","code","|","link","image","|","indent","outdent"]),this._render(),this.list.on("click",function(a){return!1}),this.wrapper.on("mousedown",function(a){return function(b){return a.list.find(".menu-on").removeClass(".menu-on")}}(this)),a(document).on("mousedown.simditor"+this.editor.id,function(a){return function(b){return a.list.find(".menu-on").removeClass(".menu-on")}}(this)),!this.opts.toolbarHidden&&this.opts.toolbarFloat&&(this.wrapper.css("top",this.opts.toolbarFloatOffset),d=0,c=function(a){return function(){return a.wrapper.css("position","static"),a.wrapper.width("auto"),a.editor.util.reflow(a.wrapper),a.wrapper.width(a.wrapper.outerWidth()),a.wrapper.css("left",a.editor.util.os.mobile?a.wrapper.position().left:a.wrapper.offset().left),a.wrapper.css("position",""),d=a.wrapper.outerHeight(),a.editor.placeholderEl.css("top",d),!0}}(this),b=null,a(window).on("resize.simditor-"+this.editor.id,function(a){return b=c()}),a(window).on("scroll.simditor-"+this.editor.id,function(e){return function(f){var g,h,i;if(e.wrapper.is(":visible"))if(i=e.editor.wrapper.offset().top,g=i+e.editor.wrapper.outerHeight()-80,h=a(document).scrollTop()+e.opts.toolbarFloatOffset,i>=h||h>=g){if(e.editor.wrapper.removeClass("toolbar-floating").css("padding-top",""),e.editor.util.os.mobile)return e.wrapper.css("top",e.opts.toolbarFloatOffset)}else if(b||(b=c()),e.editor.wrapper.addClass("toolbar-floating").css("padding-top",d),e.editor.util.os.mobile)return e.wrapper.css("top",h-i+e.opts.toolbarFloatOffset)}}(this))),this.editor.on("destroy",function(a){return function(){return a.buttons.length=0}}(this)),a(document).on("mousedown.simditor-"+this.editor.id,function(a){return function(b){return a.list.find("li.menu-on").removeClass("menu-on")}}(this))):void 0},c.prototype._render=function(){var b,c,d,e;for(this.buttons=[],this.wrapper=a(this._tpl.wrapper).prependTo(this.editor.wrapper),this.list=this.wrapper.find("ul"),e=this.opts.toolbar,b=0,c=e.length;c>b;b++)if(d=e[b],"|"!==d){if(!this.constructor.buttons[d])throw new Error("simditor: invalid toolbar button "+d);this.buttons.push(new this.constructor.buttons[d]({editor:this.editor}))}else a(this._tpl.separator).appendTo(this.list);return this.opts.toolbarHidden?this.wrapper.hide():void 0},c.prototype.findButton=function(a){var b;return b=this.list.find(".toolbar-item-"+a).data("button"),null!=b?b:null},c.addButton=function(a){return this.buttons[a.prototype.name]=a},c.buttons={},c}(b),s=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return M(c,b),c.pluginName="Indentation",c.prototype.opts={tabIndent:!0},c.prototype._init=function(){return this.editor=this._module,this.editor.keystroke.add("tab","*",function(a){return function(b){var c;return c=a.editor.toolbar.findButton("code"),a.opts.tabIndent||c&&c.active?a.indent(b.shiftKey):void 0}}(this))},c.prototype.indent=function(b){var c,d,e,f,g;return e=this.editor.selection.startNodes(),d=this.editor.selection.endNodes(),c=this.editor.selection.blockNodes(),f=[],c=c.each(function(b,c){var d,e,g,h,i;for(d=!0,e=g=0,h=f.length;h>g;e=++g){if(i=f[e],a.contains(c,i)){d=!1;break}if(a.contains(i,c)){f.splice(e,1,c),d=!1;break}}return d?f.push(c):void 0}),c=a(f),g=!1,c.each(function(a){return function(c,d){var e;return e=b?a.outdentBlock(d):a.indentBlock(d),e?g=e:void 0}}(this)),g},c.prototype.indentBlock=function(b){var c,d,e,f,g,h,i,j,k,l;if(c=a(b),c.length){if(c.is("pre")){if(h=this.editor.selection.containerNode(),!h.is(c)&&!h.closest("pre").is(c))return;this.indentText(this.editor.selection.range())}else if(c.is("li")){if(g=c.prev("li"),g.length<1)return;this.editor.selection.save(),l=c.parent()[0].tagName,d=g.children("ul, ol"),d.length>0?d.append(c):a("<"+l+"/>").append(c).appendTo(g),this.editor.selection.restore()}else if(c.is("p, h1, h2, h3, h4"))k=parseInt(c.css("margin-left"))||0,k=(Math.round(k/this.opts.indentWidth)+1)*this.opts.indentWidth,c.css("margin-left",k);else{if(!c.is("table")&&!c.is(".simditor-table"))return!1;if(i=this.editor.selection.containerNode().closest("td, th"),e=i.next("td, th"),e.length>0||(j=i.parent("tr"),f=j.next("tr"),f.length<1&&j.parent().is("thead")&&(f=j.parent("thead").next("tbody").find("tr:first")),e=f.find("td:first, th:first")),!(i.length>0&&e.length>0))return;this.editor.selection.setRangeAtEndOf(e)}return!0}},c.prototype.indentText=function(a){var b,c;return b=a.toString().replace(/^(?=.+)/gm," "),c=document.createTextNode(b||" "),a.deleteContents(),a.insertNode(c),b?(a.selectNode(c),this.editor.selection.range(a)):this.editor.selection.setRangeAfter(c)},c.prototype.outdentBlock=function(b){var c,d,e,f,g,h,i,j,k,l;if(c=a(b),c&&c.length>0){if(c.is("pre")){if(f=this.editor.selection.containerNode(),!f.is(c)&&!f.closest("pre").is(c))return;this.outdentText(l)}else if(c.is("li"))d=c.parent(),e=d.parent("li"),this.editor.selection.save(),e.length<1?(l=document.createRange(),l.setStartBefore(d[0]),l.setEndBefore(c[0]),d.before(l.extractContents()),a("<p/>").insertBefore(d).after(c.children("ul, ol")).append(c.contents()),c.remove()):(c.next("li").length>0&&a("<"+d[0].tagName+"/>").append(c.nextAll("li")).appendTo(c),c.insertAfter(e),d.children("li").length<1&&d.remove()),this.editor.selection.restore();else if(c.is("p, h1, h2, h3, h4"))k=parseInt(c.css("margin-left"))||0,k=Math.max(Math.round(k/this.opts.indentWidth)-1,0)*this.opts.indentWidth,c.css("margin-left",0===k?"":k);else{if(!c.is("table")&&!c.is(".simditor-table"))return!1;if(i=this.editor.selection.containerNode().closest("td, th"),g=i.prev("td, th"),g.length>0||(j=i.parent("tr"),h=j.prev("tr"),h.length<1&&j.parent().is("tbody")&&(h=j.parent("tbody").prev("thead").find("tr:first")),g=h.find("td:last, th:last")),!(i.length>0&&g.length>0))return;this.editor.selection.setRangeAtEndOf(g)}return!0}},c.prototype.outdentText=function(a){},c}(b),i=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return M(c,b),c.pluginName="Clipboard",c.prototype.opts={pasteImage:!1,cleanPaste:!1},c.prototype._init=function(){return this.editor=this._module,this.opts.pasteImage&&"string"!=typeof this.opts.pasteImage&&(this.opts.pasteImage="inline"),this.editor.body.on("paste",function(a){return function(b){var c;if(!a.pasting&&!a._pasteBin)return a.editor.triggerHandler(b)===!1?!1:(c=a.editor.selection.deleteRangeContents(),a.editor.body.html()?c.collapsed||c.collapse(!0):(a.editor.formatter.format(),a.editor.selection.setRangeAtStartOf(a.editor.body.find("p:first"))),a._processPasteByClipboardApi(b)?!1:(a.editor.inputManager.throttledValueChanged.clear(),a.editor.inputManager.throttledSelectionChanged.clear(),a.editor.undoManager.throttledPushState.clear(),a.editor.selection.reset(),a.editor.undoManager.resetCaretPosition(),a.pasting=!0,a._getPasteContent(function(b){return a._processPasteContent(b),a._pasteInBlockEl=null,a._pastePlainText=null,a.pasting=!1})))}}(this))},c.prototype._processPasteByClipboardApi=function(a){var b,c,d,e;if(!this.editor.util.browser.edge&&a.originalEvent.clipboardData&&a.originalEvent.clipboardData.items&&a.originalEvent.clipboardData.items.length>0&&(c=a.originalEvent.clipboardData.items[0],/^image\//.test(c.type))){if(b=c.getAsFile(),null==b||!this.opts.pasteImage)return;if(b.name||(b.name="Clipboard Image.png"),this.editor.triggerHandler("pasting",[b])===!1)return;return e={},e[this.opts.pasteImage]=!0,null!=(d=this.editor.uploader)&&d.upload(b,e),!0}},c.prototype._getPasteContent=function(b){var c;return this._pasteBin=a('<div contenteditable="true" />').addClass("simditor-paste-bin").attr("tabIndex","-1").appendTo(this.editor.el),c={html:this.editor.body.html(),caret:this.editor.undoManager.caretPosition()},this._pasteBin.focus(),setTimeout(function(d){return function(){var e;return d.editor.hidePopover(),d.editor.body.get(0).innerHTML=c.html,d.editor.undoManager.caretPosition(c.caret),d.editor.body.focus(),d.editor.selection.reset(),d.editor.selection.range(),d._pasteInBlockEl=d.editor.selection.blockNodes().last(),d._pastePlainText=d.opts.cleanPaste||d._pasteInBlockEl.is("pre, table"),d._pastePlainText?e=d.editor.formatter.clearHtml(d._pasteBin.html(),!0):(e=a("<div/>").append(d._pasteBin.contents()),e.find("table colgroup").remove(),d.editor.formatter.format(e),d.editor.formatter.decorate(e),d.editor.formatter.beautify(e.children()),e=e.contents()),d._pasteBin.remove(),d._pasteBin=null,b(e)}}(this),0)},c.prototype._processPasteContent=function(b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y;if(this.editor.triggerHandler("pasting",[b])!==!1&&(c=this._pasteInBlockEl,b)){if(this._pastePlainText)if(c.is("table")){for(q=b.split("\n"),j=q.pop(),h=0,k=q.length;k>h;h++)p=q[h],this.editor.selection.insertNode(document.createTextNode(p)),this.editor.selection.insertNode(a("<br/>"));this.editor.selection.insertNode(document.createTextNode(j))}else for(b=a("<div/>").text(b),v=b.contents(),i=0,l=v.length;l>i;i++)s=v[i],this.editor.selection.insertNode(a(s)[0]);else if(c.is(this.editor.body))for(r=0,m=b.length;m>r;r++)s=b[r],this.editor.selection.insertNode(s);else{if(b.length<1)return;if(1===b.length)if(b.is("p")){if(f=b.contents(),1===f.length&&f.is("img")){if(d=f,/^data:image/.test(d.attr("src"))){if(!this.opts.pasteImage)return;return e=this.editor.util.dataURLtoBlob(d.attr("src")),e.name="Clipboard Image.png",y={},y[this.opts.pasteImage]=!0,void(null!=(w=this.editor.uploader)&&w.upload(e,y))}if(d.is('img[src^="webkit-fake-url://"]'))return}for(t=0,n=f.length;n>t;t++)s=f[t],this.editor.selection.insertNode(s)}else if(c.is("p")&&this.editor.util.isEmptyNode(c))c.replaceWith(b),this.editor.selection.setRangeAtEndOf(b);else if(b.is("ul, ol"))if(1===b.find("li").length)for(b=a("<div/>").text(b.text()),x=b.contents(),u=0,o=x.length;o>u;u++)s=x[u],this.editor.selection.insertNode(a(s)[0]);else c.is("li")?(c.parent().after(b),this.editor.selection.setRangeAtEndOf(b)):(c.after(b),this.editor.selection.setRangeAtEndOf(b));else c.after(b),this.editor.selection.setRangeAtEndOf(b);else c.is("li")&&(c=c.parent()),this.editor.selection.rangeAtStartOf(c)?g="before":this.editor.selection.rangeAtEndOf(c)?g="after":(this.editor.selection.breakBlockEl(c),g="before"),c[g](b),this.editor.selection.setRangeAtEndOf(b.last())}return this.editor.inputManager.throttledValueChanged()}},c}(b),D=function(b){function e(){return e.__super__.constructor.apply(this,arguments)}return M(e,b),e.connect(L),e.connect(t),e.connect(C),e.connect(J),e.connect(v),e.connect(n),e.connect(H),e.connect(s),e.connect(i),e.count=0,e.prototype.opts={textarea:null,placeholder:"",defaultImage:"images/image.png",params:{},upload:!1,indentWidth:40},e.prototype._init=function(){var b,f,g,h;if(this.textarea=a(this.opts.textarea),this.opts.placeholder=this.opts.placeholder||this.textarea.attr("placeholder"),!this.textarea.length)throw new Error("simditor: param textarea is required.");if(f=this.textarea.data("simditor"),null!=f&&f.destroy(),this.id=++e.count,this._render(),!c)throw new Error("simditor: simple-hotkeys is required.");if(this.hotkeys=c({el:this.body}),this.opts.upload&&d&&(h="object"==typeof this.opts.upload?this.opts.upload:{},this.uploader=d(h)),g=this.textarea.closest("form"),g.length&&(g.on("submit.simditor-"+this.id,function(a){return function(){return a.sync()}}(this)),g.on("reset.simditor-"+this.id,function(a){return function(){return a.setValue("")}}(this))),this.on("initialized",function(a){return function(){return a.opts.placeholder&&a.on("valuechanged",function(){return a._placeholder()}),a.setValue(a.textarea.val().trim()||""),a.textarea.attr("autofocus")?a.focus():void 0}}(this)),this.util.browser.mozilla){this.util.reflow();try{return document.execCommand("enableObjectResizing",!1,!1),document.execCommand("enableInlineTableEditing",!1,!1)}catch(i){b=i}}},e.prototype._tpl='<div class="simditor">\n <div class="simditor-wrapper">\n <div class="simditor-placeholder"></div>\n <div class="simditor-body" contenteditable="true">\n </div>\n </div>\n</div>',e.prototype._render=function(){var b,c,d,e;if(this.el=a(this._tpl).insertBefore(this.textarea),this.wrapper=this.el.find(".simditor-wrapper"),this.body=this.wrapper.find(".simditor-body"),this.placeholderEl=this.wrapper.find(".simditor-placeholder").append(this.opts.placeholder),this.el.data("simditor",this),this.wrapper.append(this.textarea),this.textarea.data("simditor",this).blur(),this.body.attr("tabindex",this.textarea.attr("tabindex")),this.util.os.mac?this.el.addClass("simditor-mac"):this.util.os.linux&&this.el.addClass("simditor-linux"),this.util.os.mobile&&this.el.addClass("simditor-mobile"),this.opts.params){c=this.opts.params,d=[];for(b in c)e=c[b],d.push(a("<input/>",{type:"hidden",name:b,value:e}).insertAfter(this.textarea));return d}},e.prototype._placeholder=function(){var a;return a=this.body.children(),0===a.length||1===a.length&&this.util.isEmptyNode(a)&&parseInt(a.css("margin-left")||0)<this.opts.indentWidth?this.placeholderEl.show():this.placeholderEl.hide()},e.prototype.setValue=function(a){return this.hidePopover(),this.textarea.val(a),this.body.get(0).innerHTML=a,this.formatter.format(),this.formatter.decorate(),this.util.reflow(this.body),this.inputManager.lastCaretPosition=null,this.trigger("valuechanged")},e.prototype.getValue=function(){return this.sync()},e.prototype.sync=function(){var b,c,d,e,f,g;for(c=this.body.clone(),this.formatter.undecorate(c),this.formatter.format(c),this.formatter.autolink(c),b=c.children(),f=b.last("p"),e=b.first("p");f.is("p")&&this.util.isEmptyNode(f);)d=f,f=f.prev("p"),d.remove();for(;e.is("p")&&this.util.isEmptyNode(e);)d=e,e=f.next("p"),d.remove();return c.find("img.uploading").remove(),g=a.trim(c.html()),this.textarea.val(g),g},e.prototype.focus=function(){var b,c;return this.body.is(":visible")&&this.body.is("[contenteditable]")?this.inputManager.lastCaretPosition?(this.undoManager.caretPosition(this.inputManager.lastCaretPosition),this.inputManager.lastCaretPosition=null):(b=this.body.children().last(),b.is("p")||(b=a("<p/>").append(this.util.phBr).appendTo(this.body)),c=document.createRange(),this.selection.setRangeAtEndOf(b,c)):void this.el.find("textarea:visible").focus()},e.prototype.blur=function(){return this.body.is(":visible")&&this.body.is("[contenteditable]")?this.body.blur():this.body.find("textarea:visible").blur()},e.prototype.hidePopover=function(){return this.el.find(".simditor-popover").each(function(b,c){return c=a(c).data("popover"),c.active?c.hide():void 0})},e.prototype.destroy=function(){return this.triggerHandler("destroy"),this.textarea.closest("form").off(".simditor .simditor-"+this.id),this.selection.clear(),this.inputManager.focused=!1,this.textarea.insertBefore(this.el).hide().val("").removeData("simditor"),this.el.remove(),a(document).off(".simditor-"+this.id),a(window).off(".simditor-"+this.id),this.off()},e}(b),D.i18n={"zh-CN":{blockquote:"引用",bold:"加粗文字",code:"插入代码",color:"文字颜色",coloredText:"彩色文字",hr:"分隔线",image:"插入图片",externalImage:"外链图片",uploadImage:"上传图片",uploadFailed:"上传失败了",uploadError:"上传出错了",imageUrl:"图片地址",imageSize:"图片尺寸",imageAlt:"图片描述",restoreImageSize:"还原图片尺寸",uploading:"正在上传",indent:"向右缩进",outdent:"向左缩进",italic:"斜体文字",link:"插入链接",linkText:"链接文字",linkUrl:"链接地址",linkTarget:"打开方式",openLinkInCurrentWindow:"在新窗口中打开",openLinkInNewWindow:"在当前窗口中打开",removeLink:"移除链接",ol:"有序列表",ul:"无序列表",strikethrough:"删除线文字",table:"表格",deleteRow:"删除行",insertRowAbove:"在上面插入行",insertRowBelow:"在下面插入行",deleteColumn:"删除列",insertColumnLeft:"在左边插入列",insertColumnRight:"在右边插入列",deleteTable:"删除表格",title:"标题",normalText:"普通文本",underline:"下划线文字",alignment:"水平对齐",alignCenter:"居中",alignLeft:"居左",alignRight:"居右",selectLanguage:"选择程序语言",fontScale:"字体大小",fontScaleXLarge:"超大字体",fontScaleLarge:"大号字体",fontScaleNormal:"正常大小",fontScaleSmall:"小号字体",fontScaleXSmall:"超小字体"},"en-US":{blockquote:"Block Quote",bold:"Bold",code:"Code",color:"Text Color",coloredText:"Colored Text",hr:"Horizontal Line",image:"Insert Image",externalImage:"External Image",uploadImage:"Upload Image",uploadFailed:"Upload failed",uploadError:"Error occurs during upload",imageUrl:"Url",imageSize:"Size",imageAlt:"Alt",restoreImageSize:"Restore Origin Size",uploading:"Uploading",indent:"Indent",outdent:"Outdent",italic:"Italic",link:"Insert Link",linkText:"Text",linkUrl:"Url",linkTarget:"Target",openLinkInCurrentWindow:"Open link in current window",openLinkInNewWindow:"Open link in new window",removeLink:"Remove Link",ol:"Ordered List",ul:"Unordered List",strikethrough:"Strikethrough",table:"Table",deleteRow:"Delete Row",insertRowAbove:"Insert Row Above",insertRowBelow:"Insert Row Below",deleteColumn:"Delete Column",insertColumnLeft:"Insert Column Left",insertColumnRight:"Insert Column Right",deleteTable:"Delete Table",title:"Title",normalText:"Text",underline:"Underline",alignment:"Alignment",alignCenter:"Align Center",alignLeft:"Align Left",alignRight:"Align Right",selectLanguage:"Select Language",fontScale:"Font Size",fontScaleXLarge:"X Large Size",fontScaleLarge:"Large Size",fontScaleNormal:"Normal Size",fontScaleSmall:"Small Size",fontScaleXSmall:"X Small Size"}},h=function(b){function c(a){this.editor=a.editor,this.title=this._t(this.name),c.__super__.constructor.call(this,a)}return M(c,b),c.prototype._tpl={item:'<li><a tabindex="-1" unselectable="on" class="toolbar-item" href="javascript:;"><span></span></a></li>',menuWrapper:'<div class="toolbar-menu"></div>',menuItem:'<li><a tabindex="-1" unselectable="on" class="menu-item" href="javascript:;"><span></span></a></li>',separator:'<li><span class="separator"></span></li>'},c.prototype.name="",c.prototype.icon="",c.prototype.title="",c.prototype.text="",c.prototype.htmlTag="",c.prototype.disableTag="",c.prototype.menu=!1,c.prototype.active=!1,c.prototype.disabled=!1,c.prototype.needFocus=!0,c.prototype.shortcut=null,c.prototype._init=function(){var b,c,d,e;for(this.render(),this.el.on("mousedown",function(a){return function(b){var c,d,e;return b.preventDefault(),d=a.needFocus&&!a.editor.inputManager.focused,a.el.hasClass("disabled")||d?!1:a.menu?(a.wrapper.toggleClass("menu-on").siblings("li").removeClass("menu-on"),a.wrapper.is(".menu-on")&&(c=a.menuWrapper.offset().left+a.menuWrapper.outerWidth()+5-a.editor.wrapper.offset().left-a.editor.wrapper.outerWidth(),c>0&&a.menuWrapper.css({left:"auto",right:0}),a.trigger("menuexpand")),!1):(e=a.el.data("param"),a.command(e),!1)}}(this)),this.wrapper.on("click","a.menu-item",function(b){return function(c){var d,e,f;return c.preventDefault(),d=a(c.currentTarget),b.wrapper.removeClass("menu-on"),e=b.needFocus&&!b.editor.inputManager.focused,d.hasClass("disabled")||e?!1:(b.editor.toolbar.wrapper.removeClass("menu-on"),f=d.data("param"),b.command(f),!1)}}(this)),this.wrapper.on("mousedown","a.menu-item",function(a){return!1}),this.editor.on("blur",function(a){return function(){var b;return b=a.editor.body.is(":visible")&&a.editor.body.is("[contenteditable]"),b&&!a.editor.clipboard.pasting?(a.setActive(!1),a.setDisabled(!1)):void 0}}(this)),null!=this.shortcut&&this.editor.hotkeys.add(this.shortcut,function(a){return function(b){return a.el.mousedown(),!1}}(this)),d=this.htmlTag.split(","),b=0,c=d.length;c>b;b++)e=d[b],e=a.trim(e),e&&a.inArray(e,this.editor.formatter._allowedTags)<0&&this.editor.formatter._allowedTags.push(e);return this.editor.on("selectionchanged",function(a){return function(b){return a.editor.inputManager.focused?a._status():void 0}}(this))},c.prototype.iconClassOf=function(a){return a?"simditor-icon simditor-icon-"+a:""},c.prototype.setIcon=function(a){return this.el.find("span").removeClass().addClass(this.iconClassOf(a)).text(this.text)},c.prototype.render=function(){return this.wrapper=a(this._tpl.item).appendTo(this.editor.toolbar.list),this.el=this.wrapper.find("a.toolbar-item"),this.el.attr("title",this.title).addClass("toolbar-item-"+this.name).data("button",this),this.setIcon(this.icon),this.menu?(this.menuWrapper=a(this._tpl.menuWrapper).appendTo(this.wrapper),this.menuWrapper.addClass("toolbar-menu-"+this.name),this.renderMenu()):void 0},c.prototype.renderMenu=function(){var b,c,d,e,f,g,h,i;if(a.isArray(this.menu)){for(this.menuEl=a("<ul/>").appendTo(this.menuWrapper),g=this.menu,i=[],d=0,e=g.length;e>d;d++)f=g[d],"|"!==f?(c=a(this._tpl.menuItem).appendTo(this.menuEl),b=c.find("a.menu-item").attr({title:null!=(h=f.title)?h:f.text,"data-param":f.param}).addClass("menu-item-"+f.name),f.icon?i.push(b.find("span").addClass(this.iconClassOf(f.icon))):i.push(b.find("span").text(f.text))):a(this._tpl.separator).appendTo(this.menuEl);return i}},c.prototype.setActive=function(a){return a!==this.active?(this.active=a,this.el.toggleClass("active",this.active)):void 0},c.prototype.setDisabled=function(a){return a!==this.disabled?(this.disabled=a,this.el.toggleClass("disabled",this.disabled)):void 0},c.prototype._disableStatus=function(){var a,b,c;return c=this.editor.selection.startNodes(),b=this.editor.selection.endNodes(),a=c.filter(this.disableTag).length>0||b.filter(this.disableTag).length>0,this.setDisabled(a),this.disabled&&this.setActive(!1),this.disabled},c.prototype._activeStatus=function(){var a,b,c,d,e;return e=this.editor.selection.startNodes(),c=this.editor.selection.endNodes(),d=e.filter(this.htmlTag),b=c.filter(this.htmlTag),a=d.length>0&&b.length>0&&d.is(b),this.node=a?d:null,this.setActive(a),this.active},c.prototype._status=function(){return this._disableStatus(),this.disabled?void 0:this._activeStatus()},c.prototype.command=function(a){},c.prototype._t=function(){var a,b,d;return a=1<=arguments.length?P.call(arguments,0):[],d=c.__super__._t.apply(this,a),d||(d=(b=this.editor)._t.apply(b,a)),d},c}(b),D.Button=h,B=function(b){function c(a){this.button=a.button,this.editor=a.button.editor,c.__super__.constructor.call(this,a)}return M(c,b),c.prototype.offset={top:4,left:0},c.prototype.target=null,c.prototype.active=!1,c.prototype._init=function(){return this.el=a('<div class="simditor-popover"></div>').appendTo(this.editor.el).data("popover",this),this.render(),this.el.on("mouseenter",function(a){return function(b){return a.el.addClass("hover")}}(this)),this.el.on("mouseleave",function(a){return function(b){return a.el.removeClass("hover")}}(this))},c.prototype.render=function(){},c.prototype._initLabelWidth=function(){var b;return b=this.el.find(".settings-field"),b.length>0?(this._labelWidth=0,b.each(function(b){return function(c,d){var e,f;return e=a(d),f=e.find("label"),f.length>0?b._labelWidth=Math.max(b._labelWidth,f.width()):void 0}}(this)),b.find("label").width(this._labelWidth)):void 0},c.prototype.show=function(b,c){return null==c&&(c="bottom"),null!=b?(this.el.siblings(".simditor-popover").each(function(b,c){return c=a(c).data("popover"),c.active?c.hide():void 0}),this.active&&this.target&&this.target.removeClass("selected"),this.target=b.addClass("selected"),this.active?(this.refresh(c),this.trigger("popovershow")):(this.active=!0,this.el.css({left:-9999}).show(),this._labelWidth||this._initLabelWidth(),this.editor.util.reflow(),this.refresh(c),this.trigger("popovershow"))):void 0},c.prototype.hide=function(){return this.active?(this.target&&this.target.removeClass("selected"),this.target=null,this.active=!1,this.el.hide(),this.trigger("popoverhide")):void 0},c.prototype.refresh=function(a){var b,c,d,e,f,g;return null==a&&(a="bottom"),this.active?(b=this.editor.el.offset(),f=this.target.offset(),e=this.target.outerHeight(),"bottom"===a?g=f.top-b.top+e:"top"===a&&(g=f.top-b.top-this.el.height()),d=this.editor.wrapper.width()-this.el.outerWidth()-10,c=Math.min(f.left-b.left,d),this.el.css({top:g+this.offset.top,left:c+this.offset.left})):void 0},c.prototype.destroy=function(){return this.target=null,this.active=!1,this.editor.off(".linkpopover"),this.el.remove()},c.prototype._t=function(){var a,b,d;return a=1<=arguments.length?P.call(arguments,0):[],d=c.__super__._t.apply(this,a),d||(d=(b=this.button)._t.apply(b,a)),d},c}(b),D.Popover=B,G=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return M(c,b),c.prototype.name="title",c.prototype.htmlTag="h1, h2, h3, h4, h5",c.prototype.disableTag="pre, table",c.prototype._init=function(){return this.menu=[{name:"normal",text:this._t("normalText"),param:"p"},"|",{name:"h1",text:this._t("title")+" 1",param:"h1"},{name:"h2",text:this._t("title")+" 2",param:"h2"},{name:"h3",text:this._t("title")+" 3",param:"h3"},{name:"h4",text:this._t("title")+" 4",param:"h4"},{name:"h5",text:this._t("title")+" 5",param:"h5"}],c.__super__._init.call(this)},c.prototype.setActive=function(a,b){return c.__super__.setActive.call(this,a),a&&(b||(b=this.node[0].tagName.toLowerCase())),this.el.removeClass("active-p active-h1 active-h2 active-h3 active-h4 active-h5"),a?this.el.addClass("active active-"+b):void 0},c.prototype.command=function(b){var c;return c=this.editor.selection.rootNodes(),this.editor.selection.save(),c.each(function(c){return function(d,e){var f;return f=a(e),f.is("blockquote")||f.is(b)||f.is(c.disableTag)||c.editor.util.isDecoratedNode(f)?void 0:a("<"+b+"/>").append(f.contents()).replaceAll(f)}}(this)),this.editor.selection.restore(),this.editor.trigger("valuechanged")},c}(h),D.Toolbar.addButton(G),m=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return M(c,b),c.prototype.name="fontScale",c.prototype.icon="font",c.prototype.disableTag="pre",c.prototype.htmlTag="span",c.prototype.sizeMap={"x-large":"1.5em",large:"1.25em",small:".75em","x-small":".5em"},c.prototype._init=function(){return this.menu=[{name:"150%",text:this._t("fontScaleXLarge"),param:"5"},{name:"125%",text:this._t("fontScaleLarge"),param:"4"},{name:"100%",text:this._t("fontScaleNormal"),param:"3"},{name:"75%",text:this._t("fontScaleSmall"),param:"2"},{name:"50%",text:this._t("fontScaleXSmall"),param:"1"}],c.__super__._init.call(this)},c.prototype._activeStatus=function(){var a,b,c,d,e,f;return d=this.editor.selection.range(),f=this.editor.selection.startNodes(),c=this.editor.selection.endNodes(),e=f.filter('span[style*="font-size"]'),b=c.filter('span[style*="font-size"]'),a=f.length>0&&c.length>0&&e.is(b),this.setActive(a),this.active},c.prototype.command=function(b){var c,d,e;return e=this.editor.selection.range(),e.collapsed?void 0:(document.execCommand("styleWithCSS",!1,!0),document.execCommand("fontSize",!1,b),document.execCommand("styleWithCSS",!1,!1),this.editor.selection.reset(),this.editor.selection.range(),d=this.editor.selection.containerNode(),c=d[0].nodeType===Node.TEXT_NODE?d.closest('span[style*="font-size"]'):d.find('span[style*="font-size"]'),c.each(function(b){return function(c,d){var e,f;return e=a(d),f=d.style.fontSize,/large|x-large|small|x-small/.test(f)?e.css("fontSize",b.sizeMap[f]):"medium"===f?e.replaceWith(e.contents()):void 0}}(this)),this.editor.trigger("valuechanged"))},c}(h),D.Toolbar.addButton(m),g=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return M(c,b),c.prototype.name="bold",c.prototype.icon="bold",c.prototype.htmlTag="b, strong",c.prototype.disableTag="pre",c.prototype.shortcut="cmd+b",c.prototype._init=function(){return this.editor.util.os.mac?this.title=this.title+" ( Cmd + b )":(this.title=this.title+" ( Ctrl + b )",this.shortcut="ctrl+b"),c.__super__._init.call(this)},c.prototype._activeStatus=function(){var a;return a=document.queryCommandState("bold")===!0,this.setActive(a),this.active},c.prototype.command=function(){return document.execCommand("bold"),this.editor.util.support.oninput||this.editor.trigger("valuechanged"),a(document).trigger("selectionchange")},c}(h),D.Toolbar.addButton(g),u=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return M(c,b),c.prototype.name="italic",c.prototype.icon="italic",c.prototype.htmlTag="i",c.prototype.disableTag="pre",c.prototype.shortcut="cmd+i",c.prototype._init=function(){return this.editor.util.os.mac?this.title=this.title+" ( Cmd + i )":(this.title=this.title+" ( Ctrl + i )",this.shortcut="ctrl+i"),c.__super__._init.call(this)},c.prototype._activeStatus=function(){var a;return a=document.queryCommandState("italic")===!0,this.setActive(a),this.active},c.prototype.command=function(){return document.execCommand("italic"),this.editor.util.support.oninput||this.editor.trigger("valuechanged"),a(document).trigger("selectionchange")},c}(h),D.Toolbar.addButton(u),I=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return M(c,b),c.prototype.name="underline",c.prototype.icon="underline",c.prototype.htmlTag="u",c.prototype.disableTag="pre",c.prototype.shortcut="cmd+u",c.prototype.render=function(){return this.editor.util.os.mac?this.title=this.title+" ( Cmd + u )":(this.title=this.title+" ( Ctrl + u )",this.shortcut="ctrl+u"),c.__super__.render.call(this)},c.prototype._activeStatus=function(){var a;return a=document.queryCommandState("underline")===!0,this.setActive(a),this.active},c.prototype.command=function(){return document.execCommand("underline"),this.editor.util.support.oninput||this.editor.trigger("valuechanged"),a(document).trigger("selectionchange")},c}(h),D.Toolbar.addButton(I),l=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return M(c,b),c.prototype.name="color",c.prototype.icon="tint",c.prototype.disableTag="pre",c.prototype.menu=!0,c.prototype.render=function(){var a;return a=1<=arguments.length?P.call(arguments,0):[],c.__super__.render.apply(this,a)},c.prototype.renderMenu=function(){return a('<ul class="color-list">\n <li><a href="javascript:;" class="font-color font-color-1"></a></li>\n <li><a href="javascript:;" class="font-color font-color-2"></a></li>\n <li><a href="javascript:;" class="font-color font-color-3"></a></li>\n <li><a href="javascript:;" class="font-color font-color-4"></a></li>\n <li><a href="javascript:;" class="font-color font-color-5"></a></li>\n <li><a href="javascript:;" class="font-color font-color-6"></a></li>\n <li><a href="javascript:;" class="font-color font-color-7"></a></li>\n <li><a href="javascript:;" class="font-color font-color-default"></a></li>\n</ul>').appendTo(this.menuWrapper),this.menuWrapper.on("mousedown",".color-list",function(a){return!1}),this.menuWrapper.on("click",".font-color",function(b){return function(c){var d,e,f,g,h,i;if(b.wrapper.removeClass("menu-on"),d=a(c.currentTarget),d.hasClass("font-color-default")){if(e=b.editor.body.find("p, li"),!(e.length>0))return;h=window.getComputedStyle(e[0],null).getPropertyValue("color"),f=b._convertRgbToHex(h)}else h=window.getComputedStyle(d[0],null).getPropertyValue("background-color"),f=b._convertRgbToHex(h);return f?(g=b.editor.selection.range(),!d.hasClass("font-color-default")&&g.collapsed&&(i=document.createTextNode(b._t("coloredText")),g.insertNode(i),g.selectNodeContents(i),b.editor.selection.range(g)),document.execCommand("styleWithCSS",!1,!0),document.execCommand("foreColor",!1,f),document.execCommand("styleWithCSS",!1,!1),b.editor.util.support.oninput?void 0:b.editor.trigger("valuechanged")):void 0}}(this))},c.prototype._convertRgbToHex=function(a){var b,c,d;return c=/rgb\((\d+),\s?(\d+),\s?(\d+)\)/g,(b=c.exec(a))?(d=function(a,b,c){var d;return d=function(a){var b;return b=a.toString(16),1===b.length?"0"+b:b},"#"+d(a)+d(b)+d(c)})(1*b[1],1*b[2],1*b[3]):""},c}(h),D.Toolbar.addButton(l),y=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return M(c,b),c.prototype.type="",c.prototype.disableTag="pre, table",c.prototype.command=function(b){var c,d,e;return d=this.editor.selection.blockNodes(),e="ul"===this.type?"ol":"ul",this.editor.selection.save(),c=null,d.each(function(b){return function(d,f){ |
|
24 |
+var g;return g=a(f),g.is("blockquote, li")||g.is(b.disableTag)||b.editor.util.isDecoratedNode(g)||!a.contains(document,f)?void 0:g.is(b.type)?(g.children("li").each(function(c,d){var e,f;return f=a(d),e=f.children("ul, ol").insertAfter(g),a("<p/>").append(a(d).html()||b.editor.util.phBr).insertBefore(g)}),g.remove()):g.is(e)?a("<"+b.type+"/>").append(g.contents()).replaceAll(g):c&&g.prev().is(c)?(a("<li/>").append(g.html()||b.editor.util.phBr).appendTo(c),g.remove()):(c=a("<"+b.type+"><li></li></"+b.type+">"),c.find("li").append(g.html()||b.editor.util.phBr),c.replaceAll(g))}}(this)),this.editor.selection.restore(),this.editor.trigger("valuechanged")},c}(h),z=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return M(b,a),b.prototype.type="ol",b.prototype.name="ol",b.prototype.icon="list-ol",b.prototype.htmlTag="ol",b.prototype.shortcut="cmd+/",b.prototype._init=function(){return this.editor.util.os.mac?this.title=this.title+" ( Cmd + / )":(this.title=this.title+" ( ctrl + / )",this.shortcut="ctrl+/"),b.__super__._init.call(this)},b}(y),K=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return M(b,a),b.prototype.type="ul",b.prototype.name="ul",b.prototype.icon="list-ul",b.prototype.htmlTag="ul",b.prototype.shortcut="cmd+.",b.prototype._init=function(){return this.editor.util.os.mac?this.title=this.title+" ( Cmd + . )":(this.title=this.title+" ( Ctrl + . )",this.shortcut="ctrl+."),b.__super__._init.call(this)},b}(y),D.Toolbar.addButton(z),D.Toolbar.addButton(K),f=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return M(c,b),c.prototype.name="blockquote",c.prototype.icon="quote-left",c.prototype.htmlTag="blockquote",c.prototype.disableTag="pre, table",c.prototype.command=function(){var b,c,d;return b=this.editor.selection.rootNodes(),b=b.filter(function(b,c){return!a(c).parent().is("blockquote")}),this.editor.selection.save(),d=[],c=function(b){return function(){return d.length>0?(a("<"+b.htmlTag+"/>").insertBefore(d[0]).append(d),d.length=0):void 0}}(this),b.each(function(b){return function(e,f){var g;return g=a(f),g.parent().is(b.editor.body)?g.is(b.htmlTag)?(c(),g.children().unwrap()):g.is(b.disableTag)||b.editor.util.isDecoratedNode(g)?c():d.push(f):void 0}}(this)),c(),this.editor.selection.restore(),this.editor.trigger("valuechanged")},c}(h),D.Toolbar.addButton(f),j=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return M(c,b),c.prototype.name="code",c.prototype.icon="code",c.prototype.htmlTag="pre",c.prototype.disableTag="ul, ol, table",c.prototype._init=function(){return c.__super__._init.call(this),this.editor.on("decorate",function(b){return function(c,d){return d.find("pre").each(function(c,d){return b.decorate(a(d))})}}(this)),this.editor.on("undecorate",function(b){return function(c,d){return d.find("pre").each(function(c,d){return b.undecorate(a(d))})}}(this))},c.prototype.render=function(){var a;return a=1<=arguments.length?P.call(arguments,0):[],c.__super__.render.apply(this,a),this.popover=new k({button:this})},c.prototype._checkMode=function(){var b,c;return c=this.editor.selection.range(),(b=a(c.cloneContents()).find(this.editor.util.blockNodes.join(",")))>0||c.collapsed&&0===this.editor.selection.startNodes().filter("code").length?(this.inlineMode=!1,this.htmlTag="pre"):(this.inlineMode=!0,this.htmlTag="code")},c.prototype._status=function(){return this._checkMode(),c.__super__._status.call(this),this.inlineMode?void 0:this.active?this.popover.show(this.node):this.popover.hide()},c.prototype.decorate=function(a){var b,c,d,e;return b=a.find("> code"),b.length>0&&(c=null!=(d=b.attr("class"))&&null!=(e=d.match(/lang-(\S+)/))?e[1]:void 0,b.contents().unwrap(),c)?a.attr("data-lang",c):void 0},c.prototype.undecorate=function(b){var c,d;return d=b.attr("data-lang"),c=a("<code/>"),d&&-1!==d&&c.addClass("lang-"+d),b.wrapInner(c).removeAttr("data-lang")},c.prototype.command=function(){return this.inlineMode?this._inlineCommand():this._blockCommand()},c.prototype._blockCommand=function(){var b,c,d,e;return b=this.editor.selection.rootNodes(),d=[],e=[],c=function(b){return function(){var c;if(d.length>0)return c=a("<"+b.htmlTag+"/>").insertBefore(d[0]).text(b.editor.formatter.clearHtml(d)),e.push(c[0]),d.length=0}}(this),b.each(function(b){return function(f,g){var h,i;return h=a(g),h.is(b.htmlTag)?(c(),i=a("<p/>").append(h.html().replace("\n","<br/>")).replaceAll(h),e.push(i[0])):h.is(b.disableTag)||b.editor.util.isDecoratedNode(h)||h.is("blockquote")?c():d.push(g)}}(this)),c(),this.editor.selection.setRangeAtEndOf(a(e).last()),this.editor.trigger("valuechanged")},c.prototype._inlineCommand=function(){var b,c,d;return d=this.editor.selection.range(),this.active?(d.selectNodeContents(this.node[0]),this.editor.selection.save(d),this.node.contents().unwrap(),this.editor.selection.restore()):(c=a(d.extractContents()),b=a("<"+this.htmlTag+"/>").append(c.contents()),d.insertNode(b[0]),d.selectNodeContents(b[0]),this.editor.selection.range(d)),this.editor.trigger("valuechanged")},c}(h),k=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return M(c,b),c.prototype.render=function(){var b,c,d,e,f;for(this._tpl='<div class="code-settings">\n <div class="settings-field">\n <select class="select-lang">\n <option value="-1">'+this._t("selectLanguage")+"</option>\n </select>\n </div>\n</div>",this.langs=this.editor.opts.codeLanguages||[{name:"Bash",value:"bash"},{name:"C++",value:"c++"},{name:"C#",value:"cs"},{name:"CSS",value:"css"},{name:"Erlang",value:"erlang"},{name:"Less",value:"less"},{name:"Sass",value:"sass"},{name:"Diff",value:"diff"},{name:"CoffeeScript",value:"coffeescript"},{name:"HTML,XML",value:"html"},{name:"JSON",value:"json"},{name:"Java",value:"java"},{name:"JavaScript",value:"js"},{name:"Markdown",value:"markdown"},{name:"Objective C",value:"oc"},{name:"PHP",value:"php"},{name:"Perl",value:"parl"},{name:"Python",value:"python"},{name:"Ruby",value:"ruby"},{name:"SQL",value:"sql"}],this.el.addClass("code-popover").append(this._tpl),this.selectEl=this.el.find(".select-lang"),f=this.langs,c=0,e=f.length;e>c;c++)d=f[c],b=a("<option/>",{text:d.name,value:d.value}).appendTo(this.selectEl);return this.selectEl.on("change",function(a){return function(b){var c;return a.lang=a.selectEl.val(),c=a.target.hasClass("selected"),a.target.removeClass().removeAttr("data-lang"),-1!==a.lang&&a.target.attr("data-lang",a.lang),c&&a.target.addClass("selected"),a.editor.trigger("valuechanged")}}(this)),this.editor.on("valuechanged",function(a){return function(b){return a.active?a.refresh():void 0}}(this))},c.prototype.show=function(){var a;return a=1<=arguments.length?P.call(arguments,0):[],c.__super__.show.apply(this,a),this.lang=this.target.attr("data-lang"),null!=this.lang?this.selectEl.val(this.lang):this.selectEl.val(-1)},c}(B),D.Toolbar.addButton(j),w=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return M(c,b),c.prototype.name="link",c.prototype.icon="link",c.prototype.htmlTag="a",c.prototype.disableTag="pre",c.prototype.render=function(){var a;return a=1<=arguments.length?P.call(arguments,0):[],c.__super__.render.apply(this,a),this.popover=new x({button:this})},c.prototype._status=function(){return c.__super__._status.call(this),this.active&&!this.editor.selection.rangeAtEndOf(this.node)?this.popover.show(this.node):this.popover.hide()},c.prototype.command=function(){var b,c,d,e,f,g;return f=this.editor.selection.range(),this.active?(g=document.createTextNode(this.node.text()),this.node.replaceWith(g),f.selectNode(g)):(b=a(f.extractContents()),e=this.editor.formatter.clearHtml(b.contents(),!1),c=a("<a/>",{href:"http://www.example.com",target:"_blank",text:e||this._t("linkText")}),this.editor.selection.blockNodes().length>0?f.insertNode(c[0]):(d=a("<p/>").append(c),f.insertNode(d[0])),f.selectNodeContents(c[0]),this.popover.one("popovershow",function(a){return function(){return e?(a.popover.urlEl.focus(),a.popover.urlEl[0].select()):(a.popover.textEl.focus(),a.popover.textEl[0].select())}}(this))),this.editor.selection.range(f),this.editor.trigger("valuechanged")},c}(h),x=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return M(c,b),c.prototype.render=function(){var b;return b='<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>",this.el.addClass("link-popover").append(b),this.textEl=this.el.find(".link-text"),this.urlEl=this.el.find(".link-url"),this.unlinkEl=this.el.find(".btn-unlink"),this.selectTarget=this.el.find(".link-target"),this.textEl.on("keyup",function(a){return function(b){return 13!==b.which?(a.target.text(a.textEl.val()),a.editor.inputManager.throttledValueChanged()):void 0}}(this)),this.urlEl.on("keyup",function(a){return function(b){var c;if(13!==b.which)return c=a.urlEl.val(),!/https?:\/\/|^\//gi.test(c)&&c&&(c="http://"+c),a.target.attr("href",c),a.editor.inputManager.throttledValueChanged()}}(this)),a([this.urlEl[0],this.textEl[0]]).on("keydown",function(b){return function(c){var d;return 13===c.which||27===c.which||!c.shiftKey&&9===c.which&&a(c.target).hasClass("link-url")?(c.preventDefault(),d=document.createRange(),b.editor.selection.setRangeAfter(b.target,d),b.hide(),b.editor.inputManager.throttledValueChanged()):void 0}}(this)),this.unlinkEl.on("click",function(a){return function(b){var c,d;return d=document.createTextNode(a.target.text()),a.target.replaceWith(d),a.hide(),c=document.createRange(),a.editor.selection.setRangeAfter(d,c),a.editor.inputManager.throttledValueChanged()}}(this)),this.selectTarget.on("change",function(a){return function(b){return a.target.attr("target",a.selectTarget.val()),a.editor.inputManager.throttledValueChanged()}}(this))},c.prototype.show=function(){var a;return a=1<=arguments.length?P.call(arguments,0):[],c.__super__.show.apply(this,a),this.textEl.val(this.target.text()),this.urlEl.val(this.target.attr("href"))},c}(B),D.Toolbar.addButton(w),p=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return M(c,b),c.prototype.name="image",c.prototype.icon="picture-o",c.prototype.htmlTag="img",c.prototype.disableTag="pre, table",c.prototype.defaultImage="",c.prototype.needFocus=!1,c.prototype._init=function(){var b,d,e,f;if(this.editor.opts.imageButton)if(Array.isArray(this.editor.opts.imageButton))for(this.menu=[],f=this.editor.opts.imageButton,d=0,e=f.length;e>d;d++)b=f[d],this.menu.push({name:b+"-image",text:this._t(b+"Image")});else this.menu=!1;else null!=this.editor.uploader?this.menu=[{name:"upload-image",text:this._t("uploadImage")},{name:"external-image",text:this._t("externalImage")}]:this.menu=!1;return this.defaultImage=this.editor.opts.defaultImage,this.editor.body.on("click","img:not([data-non-image])",function(b){return function(c){var d,e;return d=a(c.currentTarget),e=document.createRange(),e.selectNode(d[0]),b.editor.selection.range(e),b.editor.util.support.onselectionchange||b.editor.trigger("selectionchanged"),!1}}(this)),this.editor.body.on("mouseup","img:not([data-non-image])",function(a){return!1}),this.editor.on("selectionchanged.image",function(b){return function(){var c,d,e;return e=b.editor.selection.range(),null!=e?(c=a(e.cloneContents()).contents(),1===c.length&&c.is("img:not([data-non-image])")?(d=a(e.startContainer).contents().eq(e.startOffset),b.popover.show(d)):b.popover.hide()):void 0}}(this)),this.editor.on("valuechanged.image",function(b){return function(){var c;return c=b.editor.wrapper.find(".simditor-image-loading"),c.length>0?c.each(function(c,d){var e,f,g;return f=a(d),e=f.data("img"),!(e&&e.parent().length>0)&&(f.remove(),e&&(g=e.data("file"),g&&(b.editor.uploader.cancel(g),b.editor.body.find("img.uploading").length<1)))?b.editor.uploader.trigger("uploadready",[g]):void 0}):void 0}}(this)),c.__super__._init.call(this)},c.prototype.render=function(){var a;return a=1<=arguments.length?P.call(arguments,0):[],c.__super__.render.apply(this,a),this.popover=new q({button:this}),"upload"===this.editor.opts.imageButton?this._initUploader(this.el):void 0},c.prototype.renderMenu=function(){return c.__super__.renderMenu.call(this),this._initUploader()},c.prototype._initUploader=function(b){var c,d,e;return null==b&&(b=this.menuEl.find(".menu-item-upload-image")),null==this.editor.uploader?void this.el.find(".btn-upload").remove():(c=null,d=function(d){return function(){return c&&c.remove(),c=a("<input/>",{type:"file",title:d._t("uploadImage"),multiple:!0,accept:"image/*"}).appendTo(b)}}(this),d(),b.on("click mousedown","input[type=file]",function(a){return a.stopPropagation()}),b.on("change","input[type=file]",function(a){return function(b){return a.editor.inputManager.focused?(a.editor.uploader.upload(c,{inline:!0}),d()):(a.editor.one("focus",function(b){return a.editor.uploader.upload(c,{inline:!0}),d()}),a.editor.focus()),a.wrapper.removeClass("menu-on")}}(this)),this.editor.uploader.on("beforeupload",function(b){return function(c,d){var e;if(d.inline)return d.img?e=a(d.img):(e=b.createImage(d.name),d.img=e),e.addClass("uploading"),e.data("file",d),b.editor.uploader.readImageFile(d.obj,function(a){var c;if(e.hasClass("uploading"))return c=a?a.src:b.defaultImage,b.loadImage(e,c,function(){return b.popover.active?(b.popover.refresh(),b.popover.srcEl.val(b._t("uploading")).prop("disabled",!0)):void 0})})}}(this)),e=a.proxy(this.editor.util.throttle(function(a,b,c,d){var e,f,g;if(b.inline&&(f=b.img.data("mask")))return e=f.data("img"),e.hasClass("uploading")&&e.parent().length>0?(g=c/d,g=(100*g).toFixed(0),g>99&&(g=99),f.find(".progress").height(100-g+"%")):void f.remove()},500),this),this.editor.uploader.on("uploadprogress",e),this.editor.uploader.on("uploadsuccess",function(b){return function(c,d,e){var f,g,h;if(d.inline&&(f=d.img,f.hasClass("uploading")&&f.parent().length>0)){if("object"!=typeof e)try{e=a.parseJSON(e)}catch(i){c=i,e={success:!1}}return e.success===!1?(h=e.msg||b._t("uploadFailed"),alert(h),g=b.defaultImage):g=e.file_path,b.loadImage(f,g,function(){var a;return f.removeData("file"),f.removeClass("uploading").removeClass("loading"),a=f.data("mask"),a&&a.remove(),f.removeData("mask"),b.editor.trigger("valuechanged"),b.editor.body.find("img.uploading").length<1?b.editor.uploader.trigger("uploadready",[d,e]):void 0}),b.popover.active?(b.popover.srcEl.prop("disabled",!1),b.popover.srcEl.val(e.file_path)):void 0}}}(this)),this.editor.uploader.on("uploaderror",function(b){return function(c,d,e){var f,g,h;if(d.inline&&"abort"!==e.statusText){if(e.responseText){try{h=a.parseJSON(e.responseText),g=h.msg}catch(i){c=i,g=b._t("uploadError")}alert(g)}if(f=d.img,f.hasClass("uploading")&&f.parent().length>0)return b.loadImage(f,b.defaultImage,function(){var a;return f.removeData("file"),f.removeClass("uploading").removeClass("loading"),a=f.data("mask"),a&&a.remove(),f.removeData("mask")}),b.popover.active&&(b.popover.srcEl.prop("disabled",!1),b.popover.srcEl.val(b.defaultImage)),b.editor.trigger("valuechanged"),b.editor.body.find("img.uploading").length<1?b.editor.uploader.trigger("uploadready",[d,h]):void 0}}}(this)))},c.prototype._status=function(){return this._disableStatus()},c.prototype.loadImage=function(b,c,d){var e,f,g;return g=function(a){return function(){var c,d;return c=b.offset(),d=a.editor.wrapper.offset(),e.css({top:c.top-d.top,left:c.left-d.left,width:b.width(),height:b.height()}).show()}}(this),b.addClass("loading"),e=b.data("mask"),e||(e=a('<div class="simditor-image-loading">\n <div class="progress"></div>\n</div>').hide().appendTo(this.editor.wrapper),g(),b.data("mask",e),e.data("img",b)),f=new Image,f.onload=function(h){return function(){var i,j;if(b.hasClass("loading")||b.hasClass("uploading"))return j=f.width,i=f.height,b.attr({src:c,width:j,height:i,"data-image-size":j+","+i}).removeClass("loading"),b.hasClass("uploading")?(h.editor.util.reflow(h.editor.body),g()):(e.remove(),b.removeData("mask")),a.isFunction(d)?d(f):void 0}}(this),f.onerror=function(){return a.isFunction(d)&&d(!1),e.remove(),b.removeData("mask").removeClass("loading")},f.src=c},c.prototype.createImage=function(b){var c,d;return null==b&&(b="Image"),this.editor.inputManager.focused||this.editor.focus(),d=this.editor.selection.range(),d.deleteContents(),this.editor.selection.range(d),c=a("<img/>").attr("alt",b),d.insertNode(c[0]),this.editor.selection.setRangeAfter(c,d),this.editor.trigger("valuechanged"),c},c.prototype.command=function(a){var b;return b=this.createImage(),this.loadImage(b,a||this.defaultImage,function(a){return function(){return a.editor.trigger("valuechanged"),a.editor.util.reflow(b),b.click(),a.popover.one("popovershow",function(){return a.popover.srcEl.focus(),a.popover.srcEl[0].select()})}}(this))},c}(h),q=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return M(c,b),c.prototype.offset={top:6,left:-4},c.prototype.render=function(){var b;return b='<div class="link-settings">\n <div class="settings-field">\n <label>'+this._t("imageUrl")+'</label>\n <input class="image-src" type="text" tabindex="1" />\n <a class="btn-upload" href="javascript:;"\n title="'+this._t("uploadImage")+'" tabindex="-1">\n <span class="simditor-icon simditor-icon-upload"></span>\n </a>\n </div>\n <div class=\'settings-field\'>\n <label>'+this._t("imageAlt")+'</label>\n <input class="image-alt" id="image-alt" type="text" tabindex="1" />\n </div>\n <div class="settings-field">\n <label>'+this._t("imageSize")+'</label>\n <input class="image-size" id="image-width" type="text" tabindex="2" />\n <span class="times">×</span>\n <input class="image-size" id="image-height" type="text" tabindex="3" />\n <a class="btn-restore" href="javascript:;"\n title="'+this._t("restoreImageSize")+'" tabindex="-1">\n <span class="simditor-icon simditor-icon-undo"></span>\n </a>\n </div>\n</div>',this.el.addClass("image-popover").append(b),this.srcEl=this.el.find(".image-src"),this.widthEl=this.el.find("#image-width"),this.heightEl=this.el.find("#image-height"),this.altEl=this.el.find("#image-alt"),this.srcEl.on("keydown",function(a){return function(b){var c;if(13===b.which&&!a.target.hasClass("uploading"))return b.preventDefault(),c=document.createRange(),a.button.editor.selection.setRangeAfter(a.target,c),a.hide()}}(this)),this.srcEl.on("blur",function(a){return function(b){return a._loadImage(a.srcEl.val())}}(this)),this.el.find(".image-size").on("blur",function(b){return function(c){return b._resizeImg(a(c.currentTarget)),b.el.data("popover").refresh()}}(this)),this.el.find(".image-size").on("keyup",function(b){return function(c){var d;return d=a(c.currentTarget),13!==c.which&&27!==c.which&&9!==c.which?b._resizeImg(d,!0):void 0}}(this)),this.el.find(".image-size").on("keydown",function(b){return function(c){var d,e,f;return e=a(c.currentTarget),13===c.which||27===c.which?(c.preventDefault(),13===c.which?b._resizeImg(e):b._restoreImg(),d=b.target,b.hide(),f=document.createRange(),b.button.editor.selection.setRangeAfter(d,f)):9===c.which?b.el.data("popover").refresh():void 0}}(this)),this.altEl.on("keydown",function(a){return function(b){var c;return 13===b.which?(b.preventDefault(),c=document.createRange(),a.button.editor.selection.setRangeAfter(a.target,c),a.hide()):void 0}}(this)),this.altEl.on("keyup",function(a){return function(b){return 13!==b.which&&27!==b.which&&9!==b.which?(a.alt=a.altEl.val(),a.target.attr("alt",a.alt)):void 0}}(this)),this.el.find(".btn-restore").on("click",function(a){return function(b){return a._restoreImg(),a.el.data("popover").refresh()}}(this)),this.editor.on("valuechanged",function(a){return function(b){return a.active?a.refresh():void 0}}(this)),this._initUploader()},c.prototype._initUploader=function(){var b,c;return b=this.el.find(".btn-upload"),null==this.editor.uploader?void b.remove():(c=function(c){return function(){return c.input&&c.input.remove(),c.input=a("<input/>",{type:"file",title:c._t("uploadImage"),multiple:!0,accept:"image/*"}).appendTo(b)}}(this),c(),this.el.on("click mousedown","input[type=file]",function(a){return a.stopPropagation()}),this.el.on("change","input[type=file]",function(a){return function(b){return a.editor.uploader.upload(a.input,{inline:!0,img:a.target}),c()}}(this)))},c.prototype._resizeImg=function(b,c){var d,e,f;return null==c&&(c=!1),e=1*b.val(),this.target&&(a.isNumeric(e)||0>e)?(b.is(this.widthEl)?(f=e,d=this.height*e/this.width,this.heightEl.val(d)):(d=e,f=this.width*e/this.height,this.widthEl.val(f)),c?void 0:(this.target.attr({width:f,height:d}),this.editor.trigger("valuechanged"))):void 0},c.prototype._restoreImg=function(){var a,b;return b=(null!=(a=this.target.data("image-size"))?a.split(","):void 0)||[this.width,this.height],this.target.attr({width:1*b[0],height:1*b[1]}),this.widthEl.val(b[0]),this.heightEl.val(b[1]),this.editor.trigger("valuechanged")},c.prototype._loadImage=function(a,b){if(/^data:image/.test(a)&&!this.editor.uploader)return void(b&&b(!1));if(this.target.attr("src")!==a)return this.button.loadImage(this.target,a,function(c){return function(d){var e;if(d)return c.active&&(c.width=d.width,c.height=d.height,c.widthEl.val(c.width),c.heightEl.val(c.height)),/^data:image/.test(a)?(e=c.editor.util.dataURLtoBlob(a),e.name="Base64 Image.png",c.editor.uploader.upload(e,{inline:!0,img:c.target})):c.editor.trigger("valuechanged"),b?b(d):void 0}}(this))},c.prototype.show=function(){var a,b;return b=1<=arguments.length?P.call(arguments,0):[],c.__super__.show.apply(this,b),a=this.target,this.width=a.width(),this.height=a.height(),this.alt=a.attr("alt"),a.hasClass("uploading")?this.srcEl.val(this._t("uploading")).prop("disabled",!0):(this.srcEl.val(a.attr("src")).prop("disabled",!1),this.widthEl.val(this.width),this.heightEl.val(this.height),this.altEl.val(this.alt))},c}(B),D.Toolbar.addButton(p),r=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return M(b,a),b.prototype.name="indent",b.prototype.icon="indent",b.prototype._init=function(){return this.title=this._t(this.name)+" (Tab)",b.__super__._init.call(this)},b.prototype._status=function(){},b.prototype.command=function(){return this.editor.indentation.indent()},b}(h),D.Toolbar.addButton(r),A=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return M(b,a),b.prototype.name="outdent",b.prototype.icon="outdent",b.prototype._init=function(){return this.title=this._t(this.name)+" (Shift + Tab)",b.__super__._init.call(this)},b.prototype._status=function(){},b.prototype.command=function(){return this.editor.indentation.indent(!0)},b}(h),D.Toolbar.addButton(A),o=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return M(c,b),c.prototype.name="hr",c.prototype.icon="minus",c.prototype.htmlTag="hr",c.prototype._status=function(){},c.prototype.command=function(){var b,c,d,e;return e=this.editor.selection.rootNodes().first(),d=e.next(),d.length>0?this.editor.selection.save():c=a("<p/>").append(this.editor.util.phBr),b=a("<hr/>").insertAfter(e),c?(c.insertAfter(b),this.editor.selection.setRangeAtStartOf(c)):this.editor.selection.restore(),this.editor.trigger("valuechanged")},c}(h),D.Toolbar.addButton(o),F=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return M(c,b),c.prototype.name="table",c.prototype.icon="table",c.prototype.htmlTag="table",c.prototype.disableTag="pre, li, blockquote",c.prototype.menu=!0,c.prototype._init=function(){return c.__super__._init.call(this),a.merge(this.editor.formatter._allowedTags,["thead","th","tbody","tr","td","colgroup","col"]),a.extend(this.editor.formatter._allowedAttributes,{td:["rowspan","colspan"],col:["width"]}),a.extend(this.editor.formatter._allowedStyles,{td:["text-align"],th:["text-align"]}),this._initShortcuts(),this.editor.on("decorate",function(b){return function(c,d){return d.find("table").each(function(c,d){return b.decorate(a(d))})}}(this)),this.editor.on("undecorate",function(b){return function(c,d){return d.find("table").each(function(c,d){return b.undecorate(a(d))})}}(this)),this.editor.on("selectionchanged.table",function(a){return function(b){var c,d;return a.editor.body.find(".simditor-table td, .simditor-table th").removeClass("active"),(d=a.editor.selection.range())?(c=a.editor.selection.containerNode(),d.collapsed&&c.is(".simditor-table")&&(c=a.editor.selection.rangeAtStartOf(c)?c.find("th:first"):c.find("td:last"),a.editor.selection.setRangeAtEndOf(c)),c.closest("td, th",a.editor.body).addClass("active")):void 0}}(this)),this.editor.on("blur.table",function(a){return function(b){return a.editor.body.find(".simditor-table td, .simditor-table th").removeClass("active")}}(this)),this.editor.keystroke.add("up","td",function(a){return function(b,c){return a._tdNav(c,"up"),!0}}(this)),this.editor.keystroke.add("up","th",function(a){return function(b,c){return a._tdNav(c,"up"),!0}}(this)),this.editor.keystroke.add("down","td",function(a){return function(b,c){return a._tdNav(c,"down"),!0}}(this)),this.editor.keystroke.add("down","th",function(a){return function(b,c){return a._tdNav(c,"down"),!0}}(this))},c.prototype._tdNav=function(a,b){var c,d,e,f,g,h,i;return null==b&&(b="up"),e="up"===b?"prev":"next",i="up"===b?["tbody","thead"]:["thead","tbody"],h=i[0],f=i[1],d=a.parent("tr"),c=this["_"+e+"Row"](d),c.length>0?(g=d.find("td, th").index(a),this.editor.selection.setRangeAtEndOf(c.find("td, th").eq(g))):!0},c.prototype._nextRow=function(a){var b;return b=a.next("tr"),b.length<1&&a.parent("thead").length>0&&(b=a.parent("thead").next("tbody").find("tr:first")),b},c.prototype._prevRow=function(a){var b;return b=a.prev("tr"),b.length<1&&a.parent("tbody").length>0&&(b=a.parent("tbody").prev("thead").find("tr")),b},c.prototype.initResize=function(b){var c,d,e;return e=b.parent(".simditor-table"),c=b.find("colgroup"),c.length<1&&(c=a("<colgroup/>").prependTo(b),b.find("thead tr th").each(function(b,d){var e;return e=a("<col/>").appendTo(c)}),this.refreshTableWidth(b)),d=a("<div />",{"class":"simditor-resize-handle",contenteditable:"false"}).appendTo(e),e.on("mousemove","td, th",function(b){var f,g,h,i,j,k;if(!e.hasClass("resizing"))return g=a(b.currentTarget),k=b.pageX-a(b.currentTarget).offset().left,5>k&&g.prev().length>0&&(g=g.prev()),g.next("td, th").length<1?void d.hide():(null!=(i=d.data("td"))?i.is(g):void 0)?void d.show():(h=g.parent().find("td, th").index(g),f=c.find("col").eq(h),(null!=(j=d.data("col"))?j.is(f):void 0)?void d.show():d.css("left",g.position().left+g.outerWidth()-5).data("td",g).data("col",f).show())}),e.on("mouseleave",function(a){return d.hide()}),e.on("mousedown",".simditor-resize-handle",function(b){var c,d,f,g,h,i,j,k,l,m,n;return c=a(b.currentTarget),f=c.data("td"),d=c.data("col"),h=f.next("td, th"),g=d.next("col"),m=b.pageX,k=1*f.outerWidth(),l=1*h.outerWidth(),j=parseFloat(c.css("left")),n=f.closest("table").width(),i=50,a(document).on("mousemove.simditor-resize-table",function(a){var b,e,f;return b=a.pageX-m,e=k+b,f=l-b,i>e?(e=i,b=i-k,f=l-b):i>f&&(f=i,b=l-i,e=k+b),d.attr("width",e/n*100+"%"),g.attr("width",f/n*100+"%"),c.css("left",j+b)}),a(document).one("mouseup.simditor-resize-table",function(b){return a(document).off(".simditor-resize-table"),e.removeClass("resizing")}),e.addClass("resizing"),!1})},c.prototype._initShortcuts=function(){return this.editor.hotkeys.add("ctrl+alt+up",function(a){return function(b){return a.editMenu.find(".menu-item[data-param=insertRowAbove]").click(),!1}}(this)),this.editor.hotkeys.add("ctrl+alt+down",function(a){return function(b){return a.editMenu.find(".menu-item[data-param=insertRowBelow]").click(),!1}}(this)),this.editor.hotkeys.add("ctrl+alt+left",function(a){return function(b){return a.editMenu.find(".menu-item[data-param=insertColLeft]").click(),!1}}(this)),this.editor.hotkeys.add("ctrl+alt+right",function(a){return function(b){return a.editMenu.find(".menu-item[data-param=insertColRight]").click(),!1}}(this))},c.prototype.decorate=function(b){var c,d,e;return b.parent(".simditor-table").length>0&&this.undecorate(b),b.wrap('<div class="simditor-table"></div>'),b.find("thead").length<1&&(e=a("<thead />"),c=b.find("tr").first(),e.append(c),this._changeCellTag(c,"th"),d=b.find("tbody"),d.length>0?d.before(e):b.prepend(e)),this.initResize(b),b.parent()},c.prototype.undecorate=function(a){return a.parent(".simditor-table").length>0?a.parent().replaceWith(a):void 0},c.prototype.renderMenu=function(){var b;return a('<div class="menu-create-table">\n</div>\n<div class="menu-edit-table">\n <ul>\n <li>\n <a tabindex="-1" unselectable="on" class="menu-item"\n href="javascript:;" data-param="deleteRow">\n <span>'+this._t("deleteRow")+'</span>\n </a>\n </li>\n <li>\n <a tabindex="-1" unselectable="on" class="menu-item"\n href="javascript:;" data-param="insertRowAbove">\n <span>'+this._t("insertRowAbove")+' ( Ctrl + Alt + ↑ )</span>\n </a>\n </li>\n <li>\n <a tabindex="-1" unselectable="on" class="menu-item"\n href="javascript:;" data-param="insertRowBelow">\n <span>'+this._t("insertRowBelow")+' ( Ctrl + Alt + ↓ )</span>\n </a>\n </li>\n <li><span class="separator"></span></li>\n <li>\n <a tabindex="-1" unselectable="on" class="menu-item"\n href="javascript:;" data-param="deleteCol">\n <span>'+this._t("deleteColumn")+'</span>\n </a>\n </li>\n <li>\n <a tabindex="-1" unselectable="on" class="menu-item"\n href="javascript:;" data-param="insertColLeft">\n <span>'+this._t("insertColumnLeft")+' ( Ctrl + Alt + ← )</span>\n </a>\n </li>\n <li>\n <a tabindex="-1" unselectable="on" class="menu-item"\n href="javascript:;" data-param="insertColRight">\n <span>'+this._t("insertColumnRight")+' ( Ctrl + Alt + → )</span>\n </a>\n </li>\n <li><span class="separator"></span></li>\n <li>\n <a tabindex="-1" unselectable="on" class="menu-item"\n href="javascript:;" data-param="deleteTable">\n <span>'+this._t("deleteTable")+"</span>\n </a>\n </li>\n </ul>\n</div>").appendTo(this.menuWrapper),this.createMenu=this.menuWrapper.find(".menu-create-table"),this.editMenu=this.menuWrapper.find(".menu-edit-table"),b=this.createTable(6,6).appendTo(this.createMenu),this.createMenu.on("mouseenter","td, th",function(c){return function(d){var e,f,g,h;return c.createMenu.find("td, th").removeClass("selected"),e=a(d.currentTarget),f=e.parent(),h=f.find("td, th").index(e)+1,g=f.prevAll("tr").addBack(),f.parent().is("tbody")&&(g=g.add(b.find("thead tr"))),g.find("td:lt("+h+"), th:lt("+h+")").addClass("selected")}}(this)),this.createMenu.on("mouseleave",function(b){return a(b.currentTarget).find("td, th").removeClass("selected")}),this.createMenu.on("mousedown","td, th",function(c){return function(d){var e,f,g,h,i;return c.wrapper.removeClass("menu-on"),c.editor.inputManager.focused?(f=a(d.currentTarget),g=f.parent(),h=g.find("td").index(f)+1,i=g.prevAll("tr").length+1,g.parent().is("tbody")&&(i+=1),b=c.createTable(i,h,!0),e=c.editor.selection.blockNodes().last(),c.editor.util.isEmptyNode(e)?e.replaceWith(b):e.after(b),c.decorate(b),c.editor.selection.setRangeAtStartOf(b.find("th:first")), |
|
25 |
+c.editor.trigger("valuechanged"),!1):void 0}}(this))},c.prototype.createTable=function(b,c,d){var e,f,g,h,i,j,k,l,m,n,o;for(e=a("<table/>"),h=a("<thead/>").appendTo(e),f=a("<tbody/>").appendTo(e),m=k=0,n=b;n>=0?n>k:k>n;m=n>=0?++k:--k)for(i=a("<tr/>"),i.appendTo(0===m?h:f),j=l=0,o=c;o>=0?o>l:l>o;j=o>=0?++l:--l)g=a(0===m?"<th/>":"<td/>").appendTo(i),d&&g.append(this.editor.util.phBr);return e},c.prototype.refreshTableWidth=function(b){var c,d;return d=b.width(),c=b.find("col"),b.find("thead tr th").each(function(b,e){var f;return f=c.eq(b),f.attr("width",a(e).outerWidth()/d*100+"%")})},c.prototype.setActive=function(a){return c.__super__.setActive.call(this,a),a?(this.createMenu.hide(),this.editMenu.show()):(this.createMenu.show(),this.editMenu.hide())},c.prototype._changeCellTag=function(b,c){return b.find("td, th").each(function(b,d){var e;return e=a(d),e.replaceWith("<"+c+">"+e.html()+"</"+c+">")})},c.prototype.deleteRow=function(a){var b,c,d;return c=a.parent("tr"),c.closest("table").find("tr").length<1?this.deleteTable(a):(b=this._nextRow(c),b.length>0||(b=this._prevRow(c)),d=c.find("td, th").index(a),c.parent().is("thead")&&(b.appendTo(c.parent()),this._changeCellTag(b,"th")),c.remove(),this.editor.selection.setRangeAtEndOf(b.find("td, th").eq(d)))},c.prototype.insertRow=function(b,c){var d,e,f,g,h,i,j,k,l;for(null==c&&(c="after"),f=b.parent("tr"),e=f.closest("table"),h=0,e.find("tr").each(function(b,c){return h=Math.max(h,a(c).find("td").length)}),j=f.find("td, th").index(b),d=a("<tr/>"),g="td","after"===c&&f.parent().is("thead")?f.parent().next("tbody").prepend(d):"before"===c&&f.parent().is("thead")?(f.before(d),f.parent().next("tbody").prepend(f),this._changeCellTag(f,"td"),g="th"):f[c](d),i=k=1,l=h;l>=1?l>=k:k>=l;i=l>=1?++k:--k)a("<"+g+"/>").append(this.editor.util.phBr).appendTo(d);return this.editor.selection.setRangeAtStartOf(d.find("td, th").eq(j))},c.prototype.deleteCol=function(b){var c,d,e,f,g,h;return e=b.parent("tr"),h=e.closest("table").find("tr").length<2,g=b.siblings("td, th").length<1,h&&g?this.deleteTable(b):(f=e.find("td, th").index(b),c=b.next("td, th"),c.length>0||(c=e.prev("td, th")),d=e.closest("table"),d.find("col").eq(f).remove(),d.find("tr").each(function(b,c){return a(c).find("td, th").eq(f).remove()}),this.refreshTableWidth(d),this.editor.selection.setRangeAtEndOf(c))},c.prototype.insertCol=function(b,c){var d,e,f,g,h,i,j,k;return null==c&&(c="after"),h=b.parent("tr"),i=h.find("td, th").index(b),g=b.closest("table"),d=g.find("col").eq(i),g.find("tr").each(function(b){return function(d,e){var f,g;return g=a(e).parent().is("thead")?"th":"td",f=a("<"+g+"/>").append(b.editor.util.phBr),a(e).find("td, th").eq(i)[c](f)}}(this)),e=a("<col/>"),d[c](e),j=g.width(),k=Math.max(parseFloat(d.attr("width"))/2,50/j*100),d.attr("width",k+"%"),e.attr("width",k+"%"),this.refreshTableWidth(g),f="after"===c?b.next("td, th"):b.prev("td, th"),this.editor.selection.setRangeAtStartOf(f)},c.prototype.deleteTable=function(a){var b,c;return c=a.closest(".simditor-table"),b=c.next("p"),c.remove(),b.length>0?this.editor.selection.setRangeAtStartOf(b):void 0},c.prototype.command=function(a){var b;if(b=this.editor.selection.containerNode().closest("td, th"),b.length>0){if("deleteRow"===a)this.deleteRow(b);else if("insertRowAbove"===a)this.insertRow(b,"before");else if("insertRowBelow"===a)this.insertRow(b);else if("deleteCol"===a)this.deleteCol(b);else if("insertColLeft"===a)this.insertCol(b,"before");else if("insertColRight"===a)this.insertCol(b);else{if("deleteTable"!==a)return;this.deleteTable(b)}return this.editor.trigger("valuechanged")}},c}(h),D.Toolbar.addButton(F),E=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return M(c,b),c.prototype.name="strikethrough",c.prototype.icon="strikethrough",c.prototype.htmlTag="strike",c.prototype.disableTag="pre",c.prototype._activeStatus=function(){var a;return a=document.queryCommandState("strikethrough")===!0,this.setActive(a),this.active},c.prototype.command=function(){return document.execCommand("strikethrough"),this.editor.util.support.oninput||this.editor.trigger("valuechanged"),a(document).trigger("selectionchange")},c}(h),D.Toolbar.addButton(E),e=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return M(b,a),b.prototype.name="alignment",b.prototype.icon="align-left",b.prototype.htmlTag="p, h1, h2, h3, h4, td, th",b.prototype._init=function(){return this.menu=[{name:"left",text:this._t("alignLeft"),icon:"align-left",param:"left"},{name:"center",text:this._t("alignCenter"),icon:"align-center",param:"center"},{name:"right",text:this._t("alignRight"),icon:"align-right",param:"right"}],b.__super__._init.call(this)},b.prototype.setActive=function(a,c){return null==c&&(c="left"),"left"!==c&&"center"!==c&&"right"!==c&&(c="left"),"left"===c?b.__super__.setActive.call(this,!1):b.__super__.setActive.call(this,a),this.el.removeClass("align-left align-center align-right"),a&&this.el.addClass("align-"+c),this.setIcon("align-"+c),this.menuEl.find(".menu-item").show().end().find(".menu-item-"+c).hide()},b.prototype._status=function(){return this.nodes=this.editor.selection.nodes().filter(this.htmlTag),this.nodes.length<1?(this.setDisabled(!0),this.setActive(!1)):(this.setDisabled(!1),this.setActive(!0,this.nodes.first().css("text-align")))},b.prototype.command=function(a){if("left"!==a&&"center"!==a&&"right"!==a)throw new Error("simditor alignment button: invalid align "+a);return this.nodes.css({"text-align":"left"===a?"":a}),this.editor.trigger("valuechanged"),this.editor.inputManager.throttledSelectionChanged()},b}(h),D.Toolbar.addButton(e),D});(function(root,factory){if(typeof define==="function"&&define.amd){define("simditor-checklist",["jquery","simditor"],function(a0,b1){return(root["ChecklistButton"]=factory(a0,b1))})}else{if(typeof exports==="object"){module.exports=factory(require("jquery"),require("simditor"))}else{root["ChecklistButton"]=factory(jQuery,Simditor)}}}(this,function($,Simditor){var ChecklistButton,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},hasProp={}.hasOwnProperty,slice=[].slice;ChecklistButton=(function(superClass){extend(ChecklistButton,superClass);ChecklistButton.prototype.type="ul.simditor-checklist";ChecklistButton.prototype.name="checklist";ChecklistButton.prototype.icon="checklist";ChecklistButton.prototype.htmlTag="li";ChecklistButton.prototype.disableTag="pre, table";function ChecklistButton(){var args;args=1<=arguments.length?slice.call(arguments,0):[];ChecklistButton.__super__.constructor.apply(this,args);if("input"&&$.inArray("input",this.editor.formatter._allowedTags)<0){this.editor.formatter._allowedTags.push("input")}$.extend(this.editor.formatter._allowedAttributes,{input:["type","checked"]})}ChecklistButton.prototype._init=function(){ChecklistButton.__super__._init.call(this);this.editor.on("decorate",(function(_this){return function(e,$el){return $el.find("ul > li input[type=checkbox]").each(function(i,checkbox){return _this._decorate($(checkbox))})}})(this));this.editor.on("undecorate",(function(_this){return function(e,$el){return $el.find(".simditor-checklist > li").each(function(i,node){return _this._undecorate($(node))})}})(this));this.editor.body.on("click",".simditor-checklist > li",(function(_this){return function(e){var $node,range;e.preventDefault();e.stopPropagation();$node=$(e.currentTarget);range=document.createRange();_this.editor.selection.save();range.setStart($node[0],0);range.setEnd($node[0],_this.editor.util.getNodeLength($node[0]));_this.editor.selection.range(range);document.execCommand("strikethrough");$node.attr("checked",!$node.attr("checked"));_this.editor.selection.restore();return _this.editor.trigger("valuechanged")}})(this));return this.editor.keystroke.add("13","li",(function(_this){return function(e,$node){return setTimeout(function(){var $li;$li=_this.editor.selection.blockNodes().last().next();if($li.length){$li[0].removeAttribute("checked");if(document.queryCommandState("strikethrough")){return document.execCommand("strikethrough")}}},0)}})(this))};ChecklistButton.prototype._status=function(){var $node;ChecklistButton.__super__._status.call(this);$node=this.editor.selection.rootNodes();if($node.is(".simditor-checklist")){this.editor.toolbar.findButton("ul").setActive(false);this.editor.toolbar.findButton("ol").setActive(false);this.editor.toolbar.findButton("ul").setDisabled(true);return this.editor.toolbar.findButton("ol").setDisabled(true)}else{return this.editor.toolbar.findButton("checklist").setActive(false)}};ChecklistButton.prototype.command=function(param){var $list,$rootNodes;$rootNodes=this.editor.selection.blockNodes();this.editor.selection.save();$list=null;$rootNodes.each((function(_this){return function(i,node){var $node;$node=$(node);if($node.is("blockquote, li")||$node.is(_this.disableTag)||!$.contains(document,node)){return}if($node.is(".simditor-checklist")){$node.children("li").each(function(i,li){var $childList,$li;$li=$(li);$childList=$li.children("ul, ol").insertAfter($node);return $("<p/>").append($(li).html()||_this.editor.util.phBr).insertBefore($node)});return $node.remove()}else{if($node.is("ul, ol")){return $('<ul class="simditor-checklist" />').append($node.contents()).replaceAll($node)}else{if($list&&$node.prev().is($list)){$("<li/>").append($node.html()||_this.editor.util.phBr).appendTo($list);return $node.remove()}else{$list=$('<ul class="simditor-checklist"><li></li></ul>');$list.find("li").append($node.html()||_this.editor.util.phBr);return $list.replaceAll($node)}}}}})(this));this.editor.selection.restore();return this.editor.trigger("valuechanged")};ChecklistButton.prototype._decorate=function($checkbox){var $node,checked;checked=!!$checkbox.attr("checked");$node=$checkbox.closest("li");$checkbox.remove();$node.attr("checked",checked);return $node.closest("ul").addClass("simditor-checklist")};ChecklistButton.prototype._undecorate=function($node){var $checkbox,checked;checked=!!$node.attr("checked");$checkbox=$('<input type="checkbox">').attr("checked",checked);return $node.attr("checked","").prepend($checkbox)};return ChecklistButton})(Simditor.Button);Simditor.Toolbar.addButton(ChecklistButton);return ChecklistButton})); |
@@ -0,0 +1,32 @@ |
||
1 |
+/*! |
|
2 |
+* Simditor v2.3.6 |
|
3 |
+* http://simditor.tower.im/ |
|
4 |
+* 2015-12-21 |
|
5 |
+*/ |
|
6 |
+(function(root,factory){if(typeof define==="function"&&define.amd){define("simditor",["jquery","simple-module","simple-hotkeys","simple-uploader"],function($,SimpleModule,simpleHotkeys,simpleUploader){return(root["Simditor"]=factory($,SimpleModule,simpleHotkeys,simpleUploader))})}else{if(typeof exports==="object"){module.exports=factory(require("jquery"),require("simple-module"),require("simple-hotkeys"),require("simple-uploader"))}else{root["Simditor"]=factory(jQuery,SimpleModule,simple.hotkeys,simple.uploader)}}}(this,function($,SimpleModule,simpleHotkeys,simpleUploader){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,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},hasProp={}.hasOwnProperty,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},slice=[].slice;Selection=(function(superClass){extend(Selection,superClass);function Selection(){return Selection.__super__.constructor.apply(this,arguments)}Selection.pluginName="Selection";Selection.prototype._range=null;Selection.prototype._startNodes=null;Selection.prototype._endNodes=null;Selection.prototype._containerNode=null;Selection.prototype._nodes=null;Selection.prototype._blockNodes=null;Selection.prototype._rootNodes=null;Selection.prototype._init=function(){this.editor=this._module;this._selection=document.getSelection();this.editor.on("selectionchanged",(function(_this){return function(e){_this.reset();return _this._range=_this._selection.getRangeAt(0)}})(this));return this.editor.on("blur",(function(_this){return function(e){return _this.reset()}})(this))};Selection.prototype.reset=function(){this._range=null;this._startNodes=null;this._endNodes=null;this._containerNode=null;this._nodes=null;this._blockNodes=null;return this._rootNodes=null};Selection.prototype.clear=function(){var e;try{this._selection.removeAllRanges()}catch(_error){e=_error}return this.reset()};Selection.prototype.range=function(range){var ffOrIE;if(range){this.clear();this._selection.addRange(range);this._range=range;ffOrIE=this.editor.util.browser.firefox||this.editor.util.browser.msie;if(!this.editor.inputManager.focused&&ffOrIE){this.editor.body.focus()}}else{if(!this._range&&this.editor.inputManager.focused&&this._selection.rangeCount){this._range=this._selection.getRangeAt(0)}}return this._range};Selection.prototype.startNodes=function(){if(this._range){this._startNodes||(this._startNodes=(function(_this){return function(){var startNodes;startNodes=$(_this._range.startContainer).parentsUntil(_this.editor.body).get();startNodes.unshift(_this._range.startContainer);return $(startNodes)}})(this)())}return this._startNodes};Selection.prototype.endNodes=function(){var endNodes;if(this._range){this._endNodes||(this._endNodes=this._range.collapsed?this.startNodes():(endNodes=$(this._range.endContainer).parentsUntil(this.editor.body).get(),endNodes.unshift(this._range.endContainer),$(endNodes)))}return this._endNodes};Selection.prototype.containerNode=function(){if(this._range){this._containerNode||(this._containerNode=$(this._range.commonAncestorContainer))}return this._containerNode};Selection.prototype.nodes=function(){if(this._range){this._nodes||(this._nodes=(function(_this){return function(){var nodes;nodes=[];if(_this.startNodes().first().is(_this.endNodes().first())){nodes=_this.startNodes().get()}else{_this.startNodes().each(function(i,node){var $endNode,$node,$nodes,endIndex,index,sharedIndex,startIndex;$node=$(node);if(_this.endNodes().index($node)>-1){return nodes.push(node)}else{if($node.parent().is(_this.editor.body)||(sharedIndex=_this.endNodes().index($node.parent()))>-1){if(sharedIndex&&sharedIndex>-1){$endNode=_this.endNodes().eq(sharedIndex-1)}else{$endNode=_this.endNodes().last()}$nodes=$node.parent().contents();startIndex=$nodes.index($node);endIndex=$nodes.index($endNode);return $.merge(nodes,$nodes.slice(startIndex,endIndex).get())}else{$nodes=$node.parent().contents();index=$nodes.index($node);return $.merge(nodes,$nodes.slice(index).get())}}});_this.endNodes().each(function(i,node){var $node,$nodes,index;$node=$(node);if($node.parent().is(_this.editor.body)||_this.startNodes().index($node.parent())>-1){nodes.push(node);return false}else{$nodes=$node.parent().contents();index=$nodes.index($node);return $.merge(nodes,$nodes.slice(0,index+1))}})}return $($.unique(nodes))} |
|
7 |
+})(this)())}return this._nodes};Selection.prototype.blockNodes=function(){if(!this._range){return}this._blockNodes||(this._blockNodes=(function(_this){return function(){return _this.nodes().filter(function(i,node){return _this.editor.util.isBlockNode(node)})}})(this)());return this._blockNodes};Selection.prototype.rootNodes=function(){if(!this._range){return}this._rootNodes||(this._rootNodes=(function(_this){return function(){return _this.nodes().filter(function(i,node){var $parent;$parent=$(node).parent();return $parent.is(_this.editor.body)||$parent.is("blockquote")})}})(this)());return this._rootNodes};Selection.prototype.rangeAtEndOf=function(node,range){var afterLastNode,beforeLastNode,endNode,endNodeLength,lastNodeIsBr,result;if(range==null){range=this.range()}if(!(range&&range.collapsed)){return}node=$(node)[0];endNode=range.endContainer;endNodeLength=this.editor.util.getNodeLength(endNode);beforeLastNode=range.endOffset===endNodeLength-1;lastNodeIsBr=$(endNode).contents().last().is("br");afterLastNode=range.endOffset===endNodeLength;if(!((beforeLastNode&&lastNodeIsBr)||afterLastNode)){return false}if(node===endNode){return true}else{if(!$.contains(node,endNode)){return false}}result=true;$(endNode).parentsUntil(node).addBack().each(function(i,n){var $lastChild,beforeLastbr,isLastNode,nodes;nodes=$(n).parent().contents().filter(function(){return !(this!==n&&this.nodeType===3&&!this.nodeValue)});$lastChild=nodes.last();isLastNode=$lastChild.get(0)===n;beforeLastbr=$lastChild.is("br")&&$lastChild.prev().get(0)===n;if(!(isLastNode||beforeLastbr)){result=false;return false}});return result};Selection.prototype.rangeAtStartOf=function(node,range){var result,startNode;if(range==null){range=this.range()}if(!(range&&range.collapsed)){return}node=$(node)[0];startNode=range.startContainer;if(range.startOffset!==0){return false}if(node===startNode){return true}else{if(!$.contains(node,startNode)){return false}}result=true;$(startNode).parentsUntil(node).addBack().each(function(i,n){var nodes;nodes=$(n).parent().contents().filter(function(){return !(this!==n&&this.nodeType===3&&!this.nodeValue)});if(nodes.first().get(0)!==n){return result=false}});return result};Selection.prototype.insertNode=function(node,range){if(range==null){range=this.range()}if(!range){return}node=$(node)[0];range.insertNode(node);return this.setRangeAfter(node,range)};Selection.prototype.setRangeAfter=function(node,range){if(range==null){range=this.range()}if(range==null){return}node=$(node)[0];range.setEndAfter(node);range.collapse(false);return this.range(range)};Selection.prototype.setRangeBefore=function(node,range){if(range==null){range=this.range()}if(range==null){return}node=$(node)[0];range.setEndBefore(node);range.collapse(false);return this.range(range)};Selection.prototype.setRangeAtStartOf=function(node,range){if(range==null){range=this.range()}node=$(node).get(0);range.setEnd(node,0);range.collapse(false);return this.range(range)};Selection.prototype.setRangeAtEndOf=function(node,range){var $lastNode,$node,contents,lastChild,lastChildLength,lastText,nodeLength;if(range==null){range=this.range()}$node=$(node);node=$node[0];if($node.is("pre")){contents=$node.contents();if(contents.length>0){lastChild=contents.last();lastText=lastChild.text();lastChildLength=this.editor.util.getNodeLength(lastChild[0]);if(lastText.charAt(lastText.length-1)==="\n"){range.setEnd(lastChild[0],lastChildLength-1)}else{range.setEnd(lastChild[0],lastChildLength)}}else{range.setEnd(node,0)}}else{nodeLength=this.editor.util.getNodeLength(node);if(node.nodeType!==3&&nodeLength>0){$lastNode=$(node).contents().last();if($lastNode.is("br")){nodeLength-=1}else{if($lastNode[0].nodeType!==3&&this.editor.util.isEmptyNode($lastNode)){$lastNode.append(this.editor.util.phBr);node=$lastNode[0];nodeLength=0}}}range.setEnd(node,nodeLength)}range.collapse(false);return this.range(range)};Selection.prototype.deleteRangeContents=function(range){var atEndOfBody,atStartOfBody,endRange,startRange;if(range==null){range=this.range()}startRange=range.cloneRange();endRange=range.cloneRange();startRange.collapse(true);endRange.collapse(false);atStartOfBody=this.rangeAtStartOf(this.editor.body,startRange);atEndOfBody=this.rangeAtEndOf(this.editor.body,endRange);if(!range.collapsed&&atStartOfBody&&atEndOfBody){this.editor.body.empty();range.setStart(this.editor.body[0],0);range.collapse(true);this.range(range)}else{range.deleteContents()}return range};Selection.prototype.breakBlockEl=function(el,range){var $el;if(range==null){range=this.range()}$el=$(el);if(!range.collapsed){return $el}range.setStartBefore($el.get(0));if(range.collapsed){return $el}return $el.before(range.extractContents())};Selection.prototype.save=function(range){var endCaret,endRange,startCaret;if(range==null){range=this.range()}if(this._selectionSaved){return}endRange=range.cloneRange();endRange.collapse(false);startCaret=$("<span/>").addClass("simditor-caret-start");endCaret=$("<span/>").addClass("simditor-caret-end"); |
|
8 |
+endRange.insertNode(endCaret[0]);range.insertNode(startCaret[0]);this.clear();return this._selectionSaved=true};Selection.prototype.restore=function(){var endCaret,endContainer,endOffset,range,startCaret,startContainer,startOffset;if(!this._selectionSaved){return false}startCaret=this.editor.body.find(".simditor-caret-start");endCaret=this.editor.body.find(".simditor-caret-end");if(startCaret.length&&endCaret.length){startContainer=startCaret.parent();startOffset=startContainer.contents().index(startCaret);endContainer=endCaret.parent();endOffset=endContainer.contents().index(endCaret);if(startContainer[0]===endContainer[0]){endOffset-=1}range=document.createRange();range.setStart(startContainer.get(0),startOffset);range.setEnd(endContainer.get(0),endOffset);startCaret.remove();endCaret.remove();this.range(range)}else{startCaret.remove();endCaret.remove()}this._selectionSaved=false;return range};return Selection})(SimpleModule);Formatter=(function(superClass){extend(Formatter,superClass);function Formatter(){return Formatter.__super__.constructor.apply(this,arguments)}Formatter.pluginName="Formatter";Formatter.prototype.opts={allowedTags:[],allowedAttributes:{},allowedStyles:{}};Formatter.prototype._init=function(){this.editor=this._module;this._allowedTags=$.merge(["br","span","a","img","b","strong","i","strike","u","font","p","ul","ol","li","blockquote","pre","code","h1","h2","h3","h4","hr"],this.opts.allowedTags);this._allowedAttributes=$.extend({img:["src","alt","width","height","data-non-image"],a:["href","target"],font:["color"],code:["class"]},this.opts.allowedAttributes);this._allowedStyles=$.extend({span:["color","font-size"],b:["color"],i:["color"],strong:["color"],strike:["color"],u:["color"],p:["margin-left","text-align"],h1:["margin-left","text-align"],h2:["margin-left","text-align"],h3:["margin-left","text-align"],h4:["margin-left","text-align"]},this.opts.allowedStyles);return this.editor.body.on("click","a",function(e){return false})};Formatter.prototype.decorate=function($el){if($el==null){$el=this.editor.body}this.editor.trigger("decorate",[$el]);return $el};Formatter.prototype.undecorate=function($el){if($el==null){$el=this.editor.body.clone()}this.editor.trigger("undecorate",[$el]);return $el};Formatter.prototype.autolink=function($el){var $link,$node,findLinkNode,k,lastIndex,len,linkNodes,match,re,replaceEls,subStr,text,uri;if($el==null){$el=this.editor.body}linkNodes=[];findLinkNode=function($parentNode){return $parentNode.contents().each(function(i,node){var $node,text;$node=$(node);if($node.is("a")||$node.closest("a, pre",$el).length){return}if(!$node.is("iframe")&&$node.contents().length){return findLinkNode($node)}else{if((text=$node.text())&&/https?:\/\/|www\./ig.test(text)){return linkNodes.push($node)}}})};findLinkNode($el);re=/(https?:\/\/|www\.)[\w\-\.\?&=\/#%:,@\!\+]+/ig;for(k=0,len=linkNodes.length;k<len;k++){$node=linkNodes[k];text=$node.text();replaceEls=[];match=null;lastIndex=0;while((match=re.exec(text))!==null){subStr=text.substring(lastIndex,match.index);replaceEls.push(document.createTextNode(subStr));lastIndex=re.lastIndex;uri=/^(http(s)?:\/\/|\/)/.test(match[0])?match[0]:"http://"+match[0];$link=$('<a href="'+uri+'" rel="nofollow"></a>').text(match[0]);replaceEls.push($link[0])}replaceEls.push(document.createTextNode(text.substring(lastIndex)));$node.replaceWith($(replaceEls))}return $el};Formatter.prototype.format=function($el){var $node,blockNode,k,l,len,len1,n,node,ref,ref1;if($el==null){$el=this.editor.body}if($el.is(":empty")){$el.append("<p>"+this.editor.util.phBr+"</p>");return $el}ref=$el.contents();for(k=0,len=ref.length;k<len;k++){n=ref[k];this.cleanNode(n,true)}ref1=$el.contents();for(l=0,len1=ref1.length;l<len1;l++){node=ref1[l];$node=$(node);if($node.is("br")){if(typeof blockNode!=="undefined"&&blockNode!==null){blockNode=null}$node.remove()}else{if(this.editor.util.isBlockNode(node)){if($node.is("li")){if(blockNode&&blockNode.is("ul, ol")){blockNode.append(node)}else{blockNode=$("<ul/>").insertBefore(node);blockNode.append(node)}}else{blockNode=null}}else{if(!blockNode||blockNode.is("ul, ol")){blockNode=$("<p/>").insertBefore(node)}blockNode.append(node);if(this.editor.util.isEmptyNode(blockNode)){blockNode.append(this.editor.util.phBr)}}}}return $el};Formatter.prototype.cleanNode=function(node,recursive){var $blockEls,$childImg,$node,$p,$td,allowedAttributes,attr,contents,isDecoration,k,l,len,len1,n,ref,ref1,text,textNode;$node=$(node);if(!($node.length>0)){return}if($node[0].nodeType===3){text=$node.text().replace(/(\r\n|\n|\r)/gm,"");if(text){textNode=document.createTextNode(text);$node.replaceWith(textNode)}else{$node.remove()}return}contents=$node.is("iframe")?null:$node.contents();isDecoration=this.editor.util.isDecoratedNode($node);if($node.is(this._allowedTags.join(","))||isDecoration){if($node.is("a")&&($childImg=$node.find("img")).length>0){$node.replaceWith($childImg);$node=$childImg;contents=null}if($node.is("td")&&($blockEls=$node.find(this.editor.util.blockNodes.join(","))).length>0){$blockEls.each((function(_this){return function(i,blockEl){return $(blockEl).contents().unwrap() |
|
9 |
+}})(this));contents=$node.contents()}if($node.is("img")&&$node.hasClass("uploading")){$node.remove()}if(!isDecoration){allowedAttributes=this._allowedAttributes[$node[0].tagName.toLowerCase()];ref=$.makeArray($node[0].attributes);for(k=0,len=ref.length;k<len;k++){attr=ref[k];if(attr.name==="style"){continue}if(!((allowedAttributes!=null)&&(ref1=attr.name,indexOf.call(allowedAttributes,ref1)>=0))){$node.removeAttr(attr.name)}}this._cleanNodeStyles($node);if($node.is("span")&&$node[0].attributes.length===0){$node.contents().first().unwrap()}}}else{if($node[0].nodeType===1&&!$node.is(":empty")){if($node.is("div, article, dl, header, footer, tr")){$node.append("<br/>");contents.first().unwrap()}else{if($node.is("table")){$p=$("<p/>");$node.find("tr").each(function(i,tr){return $p.append($(tr).text()+"<br/>")});$node.replaceWith($p);contents=null}else{if($node.is("thead, tfoot")){$node.remove();contents=null}else{if($node.is("th")){$td=$("<td/>").append($node.contents());$node.replaceWith($td)}else{contents.first().unwrap()}}}}}else{$node.remove();contents=null}}if(recursive&&(contents!=null)&&!$node.is("pre")){for(l=0,len1=contents.length;l<len1;l++){n=contents[l];this.cleanNode(n,true)}}return null};Formatter.prototype._cleanNodeStyles=function($node){var allowedStyles,k,len,pair,ref,ref1,style,styleStr,styles;styleStr=$node.attr("style");if(!styleStr){return}$node.removeAttr("style");allowedStyles=this._allowedStyles[$node[0].tagName.toLowerCase()];if(!(allowedStyles&&allowedStyles.length>0)){return $node}styles={};ref=styleStr.split(";");for(k=0,len=ref.length;k<len;k++){style=ref[k];style=$.trim(style);pair=style.split(":");if(!(pair.length=2)){continue}if(ref1=pair[0],indexOf.call(allowedStyles,ref1)>=0){styles[$.trim(pair[0])]=$.trim(pair[1])}}if(Object.keys(styles).length>0){$node.css(styles)}return $node};Formatter.prototype.clearHtml=function(html,lineBreak){var container,contents,result;if(lineBreak==null){lineBreak=true}container=$("<div/>").append(html);contents=container.contents();result="";contents.each((function(_this){return function(i,node){var $node,children;if(node.nodeType===3){return result+=node.nodeValue}else{if(node.nodeType===1){$node=$(node);children=$node.is("iframe")?null:$node.contents();if(children&&children.length>0){result+=_this.clearHtml(children)}if(lineBreak&&i<contents.length-1&&$node.is("br, p, div, li,tr, pre, address, artticle, aside, dl, figcaption, footer, h1, h2,h3, h4, header")){return result+="\n"}}}}})(this));return result};Formatter.prototype.beautify=function($contents){var uselessP;uselessP=function($el){return !!($el.is("p")&&!$el.text()&&$el.children(":not(br)").length<1)};return $contents.each(function(i,el){var $el,invalid;$el=$(el);invalid=$el.is(':not(img, br, col, td, hr, [class^="simditor-"]):empty');if(invalid||uselessP($el)){$el.remove()}return $el.find(':not(img, br, col, td, hr, [class^="simditor-"]):empty').remove()})};return Formatter})(SimpleModule);InputManager=(function(superClass){extend(InputManager,superClass);function InputManager(){return InputManager.__super__.constructor.apply(this,arguments)}InputManager.pluginName="InputManager";InputManager.prototype._modifierKeys=[16,17,18,91,93,224];InputManager.prototype._arrowKeys=[37,38,39,40];InputManager.prototype._init=function(){var selectAllKey,submitKey;this.editor=this._module;this.throttledValueChanged=this.editor.util.throttle((function(_this){return function(params){return setTimeout(function(){return _this.editor.trigger("valuechanged",params)},10)}})(this),300);this.throttledSelectionChanged=this.editor.util.throttle((function(_this){return function(){return _this.editor.trigger("selectionchanged")}})(this),50);$(document).on("selectionchange.simditor"+this.editor.id,(function(_this){return function(e){var triggerEvent;if(!(_this.focused&&!_this.editor.clipboard.pasting)){return}triggerEvent=function(){if(_this._selectionTimer){clearTimeout(_this._selectionTimer);_this._selectionTimer=null}if(_this.editor.selection._selection.rangeCount>0){return _this.throttledSelectionChanged()}else{return _this._selectionTimer=setTimeout(function(){_this._selectionTimer=null;if(_this.focused){return triggerEvent()}},10)}};return triggerEvent()}})(this));this.editor.on("valuechanged",(function(_this){return function(){var $rootBlocks;_this.lastCaretPosition=null;$rootBlocks=_this.editor.body.children().filter(function(i,node){return _this.editor.util.isBlockNode(node)});if(_this.focused&&$rootBlocks.length===0){_this.editor.selection.save();_this.editor.formatter.format();_this.editor.selection.restore()}_this.editor.body.find("hr, pre, .simditor-table").each(function(i,el){var $el,formatted;$el=$(el);if($el.parent().is("blockquote")||$el.parent()[0]===_this.editor.body[0]){formatted=false;if($el.next().length===0){$("<p/>").append(_this.editor.util.phBr).insertAfter($el);formatted=true}if($el.prev().length===0){$("<p/>").append(_this.editor.util.phBr).insertBefore($el);formatted=true}if(formatted){return _this.throttledValueChanged() |
|
10 |
+}}});_this.editor.body.find("pre:empty").append(_this.editor.util.phBr);if(!_this.editor.util.support.onselectionchange&&_this.focused){return _this.throttledSelectionChanged()}}})(this));this.editor.body.on("keydown",$.proxy(this._onKeyDown,this)).on("keypress",$.proxy(this._onKeyPress,this)).on("keyup",$.proxy(this._onKeyUp,this)).on("mouseup",$.proxy(this._onMouseUp,this)).on("focus",$.proxy(this._onFocus,this)).on("blur",$.proxy(this._onBlur,this)).on("drop",$.proxy(this._onDrop,this)).on("input",$.proxy(this._onInput,this));if(this.editor.util.browser.firefox){this.editor.hotkeys.add("cmd+left",(function(_this){return function(e){e.preventDefault();_this.editor.selection._selection.modify("move","backward","lineboundary");return false}})(this));this.editor.hotkeys.add("cmd+right",(function(_this){return function(e){e.preventDefault();_this.editor.selection._selection.modify("move","forward","lineboundary");return false}})(this));selectAllKey=this.editor.util.os.mac?"cmd+a":"ctrl+a";this.editor.hotkeys.add(selectAllKey,(function(_this){return function(e){var $children,firstBlock,lastBlock,range;$children=_this.editor.body.children();if(!($children.length>0)){return}firstBlock=$children.first().get(0);lastBlock=$children.last().get(0);range=document.createRange();range.setStart(firstBlock,0);range.setEnd(lastBlock,_this.editor.util.getNodeLength(lastBlock));_this.editor.selection.range(range);return false}})(this))}submitKey=this.editor.util.os.mac?"cmd+enter":"ctrl+enter";return this.editor.hotkeys.add(submitKey,(function(_this){return function(e){_this.editor.el.closest("form").find("button:submit").click();return false}})(this))};InputManager.prototype._onFocus=function(e){if(this.editor.clipboard.pasting){return}this.editor.el.addClass("focus").removeClass("error");this.focused=true;return setTimeout((function(_this){return function(){var $blockEl,range;range=_this.editor.selection._selection.getRangeAt(0);if(range.startContainer===_this.editor.body[0]){if(_this.lastCaretPosition){_this.editor.undoManager.caretPosition(_this.lastCaretPosition)}else{$blockEl=_this.editor.body.children().first();range=document.createRange();_this.editor.selection.setRangeAtStartOf($blockEl,range)}}_this.lastCaretPosition=null;_this.editor.triggerHandler("focus");if(!_this.editor.util.support.onselectionchange){return _this.throttledSelectionChanged()}}})(this),0)};InputManager.prototype._onBlur=function(e){var ref;if(this.editor.clipboard.pasting){return}this.editor.el.removeClass("focus");this.editor.sync();this.focused=false;this.lastCaretPosition=(ref=this.editor.undoManager.currentState())!=null?ref.caret:void 0;return this.editor.triggerHandler("blur")};InputManager.prototype._onMouseUp=function(e){if(!this.editor.util.support.onselectionchange){return this.throttledSelectionChanged()}};InputManager.prototype._onKeyDown=function(e){var ref,ref1;if(this.editor.triggerHandler(e)===false){return false}if(this.editor.hotkeys.respondTo(e)){return}if(this.editor.keystroke.respondTo(e)){this.throttledValueChanged();return false}if((ref=e.which,indexOf.call(this._modifierKeys,ref)>=0)||(ref1=e.which,indexOf.call(this._arrowKeys,ref1)>=0)){return}if(this.editor.util.metaKey(e)&&e.which===86){return}if(!this.editor.util.support.oninput){this.throttledValueChanged(["typing"])}return null};InputManager.prototype._onKeyPress=function(e){if(this.editor.triggerHandler(e)===false){return false}};InputManager.prototype._onKeyUp=function(e){var p,ref;if(this.editor.triggerHandler(e)===false){return false}if(!this.editor.util.support.onselectionchange&&(ref=e.which,indexOf.call(this._arrowKeys,ref)>=0)){this.throttledValueChanged();return}if((e.which===8||e.which===46)&&this.editor.util.isEmptyNode(this.editor.body)){this.editor.body.empty();p=$("<p/>").append(this.editor.util.phBr).appendTo(this.editor.body);this.editor.selection.setRangeAtStartOf(p)}};InputManager.prototype._onDrop=function(e){if(this.editor.triggerHandler(e)===false){return false}return this.throttledValueChanged()};InputManager.prototype._onInput=function(e){return this.throttledValueChanged(["oninput"])};return InputManager})(SimpleModule);Keystroke=(function(superClass){extend(Keystroke,superClass);function Keystroke(){return Keystroke.__super__.constructor.apply(this,arguments)}Keystroke.pluginName="Keystroke";Keystroke.prototype._init=function(){this.editor=this._module;this._keystrokeHandlers={};return this._initKeystrokeHandlers()};Keystroke.prototype.add=function(key,node,handler){key=key.toLowerCase();key=this.editor.hotkeys.constructor.aliases[key]||key;if(!this._keystrokeHandlers[key]){this._keystrokeHandlers[key]={}}return this._keystrokeHandlers[key][node]=handler};Keystroke.prototype.respondTo=function(e){var base,key,ref,result;key=(ref=this.editor.hotkeys.constructor.keyNameMap[e.which])!=null?ref.toLowerCase():void 0;if(!key){return}if(key in this._keystrokeHandlers){result=typeof(base=this._keystrokeHandlers[key])["*"]==="function"?base["*"](e):void 0; |
|
11 |
+if(!result){this.editor.selection.startNodes().each((function(_this){return function(i,node){var handler,ref1;if(node.nodeType!==Node.ELEMENT_NODE){return}handler=(ref1=_this._keystrokeHandlers[key])!=null?ref1[node.tagName.toLowerCase()]:void 0;result=typeof handler==="function"?handler(e,$(node)):void 0;if(result===true||result===false){return false}}})(this))}if(result){return true}}};Keystroke.prototype._initKeystrokeHandlers=function(){var titleEnterHandler;if(this.editor.util.browser.safari){this.add("enter","*",(function(_this){return function(e){var $blockEl,$br;if(!e.shiftKey){return}$blockEl=_this.editor.selection.blockNodes().last();if($blockEl.is("pre")){return}$br=$("<br/>");if(_this.editor.selection.rangeAtEndOf($blockEl)){_this.editor.selection.insertNode($br);_this.editor.selection.insertNode($("<br/>"));_this.editor.selection.setRangeBefore($br)}else{_this.editor.selection.insertNode($br)}return true}})(this))}if(this.editor.util.browser.webkit||this.editor.util.browser.msie){titleEnterHandler=(function(_this){return function(e,$node){var $p;if(!_this.editor.selection.rangeAtEndOf($node)){return}$p=$("<p/>").append(_this.editor.util.phBr).insertAfter($node);_this.editor.selection.setRangeAtStartOf($p);return true}})(this);this.add("enter","h1",titleEnterHandler);this.add("enter","h2",titleEnterHandler);this.add("enter","h3",titleEnterHandler);this.add("enter","h4",titleEnterHandler);this.add("enter","h5",titleEnterHandler);this.add("enter","h6",titleEnterHandler)}this.add("backspace","*",(function(_this){return function(e){var $blockEl,$prevBlockEl,$rootBlock,isWebkit;$rootBlock=_this.editor.selection.rootNodes().first();$prevBlockEl=$rootBlock.prev();if($prevBlockEl.is("hr")&&_this.editor.selection.rangeAtStartOf($rootBlock)){_this.editor.selection.save();$prevBlockEl.remove();_this.editor.selection.restore();return true}$blockEl=_this.editor.selection.blockNodes().last();isWebkit=_this.editor.util.browser.webkit;if(isWebkit&&_this.editor.selection.rangeAtStartOf($blockEl)){_this.editor.selection.save();_this.editor.formatter.cleanNode($blockEl,true);_this.editor.selection.restore();return null}}})(this));this.add("enter","li",(function(_this){return function(e,$node){var $cloneNode,listEl,newBlockEl,newListEl;$cloneNode=$node.clone();$cloneNode.find("ul, ol").remove();if(!(_this.editor.util.isEmptyNode($cloneNode)&&$node.is(_this.editor.selection.blockNodes().last()))){return}listEl=$node.parent();if($node.next("li").length>0){if(!_this.editor.util.isEmptyNode($node)){return}if(listEl.parent("li").length>0){newBlockEl=$("<li/>").append(_this.editor.util.phBr).insertAfter(listEl.parent("li"));newListEl=$("<"+listEl[0].tagName+"/>").append($node.nextAll("li"));newBlockEl.append(newListEl)}else{newBlockEl=$("<p/>").append(_this.editor.util.phBr).insertAfter(listEl);newListEl=$("<"+listEl[0].tagName+"/>").append($node.nextAll("li"));newBlockEl.after(newListEl)}}else{if(listEl.parent("li").length>0){newBlockEl=$("<li/>").insertAfter(listEl.parent("li"));if($node.contents().length>0){newBlockEl.append($node.contents())}else{newBlockEl.append(_this.editor.util.phBr)}}else{newBlockEl=$("<p/>").append(_this.editor.util.phBr).insertAfter(listEl);if($node.children("ul, ol").length>0){newBlockEl.after($node.children("ul, ol"))}}}if($node.prev("li").length){$node.remove()}else{listEl.remove()}_this.editor.selection.setRangeAtStartOf(newBlockEl);return true}})(this));this.add("enter","pre",(function(_this){return function(e,$node){var $p,breakNode,range;e.preventDefault();if(e.shiftKey){$p=$("<p/>").append(_this.editor.util.phBr).insertAfter($node);_this.editor.selection.setRangeAtStartOf($p);return true}range=_this.editor.selection.range();breakNode=null;range.deleteContents();if(!_this.editor.util.browser.msie&&_this.editor.selection.rangeAtEndOf($node)){breakNode=document.createTextNode("\n\n");range.insertNode(breakNode);range.setEnd(breakNode,1)}else{breakNode=document.createTextNode("\n");range.insertNode(breakNode);range.setStartAfter(breakNode)}range.collapse(false);_this.editor.selection.range(range);return true}})(this));this.add("enter","blockquote",(function(_this){return function(e,$node){var $closestBlock,range;$closestBlock=_this.editor.selection.blockNodes().last();if(!($closestBlock.is("p")&&!$closestBlock.next().length&&_this.editor.util.isEmptyNode($closestBlock))){return}$node.after($closestBlock);range=document.createRange();_this.editor.selection.setRangeAtStartOf($closestBlock,range);return true}})(this));this.add("backspace","li",(function(_this){return function(e,$node){var $br,$childList,$newLi,$prevChildList,$prevNode,$textNode,isFF,range,text;$childList=$node.children("ul, ol");$prevNode=$node.prev("li");if(!($childList.length>0&&$prevNode.length>0)){return false}text="";$textNode=null;$node.contents().each(function(i,n){if(n.nodeType===1&&/UL|OL/.test(n.nodeName)){return false}if(n.nodeType===1&&/BR/.test(n.nodeName)){return}if(n.nodeType===3&&n.nodeValue){text+=n.nodeValue}else{if(n.nodeType===1){text+=$(n).text() |
|
12 |
+}}return $textNode=$(n)});isFF=_this.editor.util.browser.firefox&&!$textNode.next("br").length;if($textNode&&text.length===1&&isFF){$br=$(_this.editor.util.phBr).insertAfter($textNode);$textNode.remove();_this.editor.selection.setRangeBefore($br);return true}else{if(text.length>0){return false}}range=document.createRange();$prevChildList=$prevNode.children("ul, ol");if($prevChildList.length>0){$newLi=$("<li/>").append(_this.editor.util.phBr).appendTo($prevChildList);$prevChildList.append($childList.children("li"));$node.remove();_this.editor.selection.setRangeAtEndOf($newLi,range)}else{_this.editor.selection.setRangeAtEndOf($prevNode,range);$prevNode.append($childList);$node.remove();_this.editor.selection.range(range)}return true}})(this));this.add("backspace","pre",(function(_this){return function(e,$node){var $newNode,codeStr,range;if(!_this.editor.selection.rangeAtStartOf($node)){return}codeStr=$node.html().replace("\n","<br/>")||_this.editor.util.phBr;$newNode=$("<p/>").append(codeStr).insertAfter($node);$node.remove();range=document.createRange();_this.editor.selection.setRangeAtStartOf($newNode,range);return true}})(this));return this.add("backspace","blockquote",(function(_this){return function(e,$node){var $firstChild,range;if(!_this.editor.selection.rangeAtStartOf($node)){return}$firstChild=$node.children().first().unwrap();range=document.createRange();_this.editor.selection.setRangeAtStartOf($firstChild,range);return true}})(this))};return Keystroke})(SimpleModule);UndoManager=(function(superClass){extend(UndoManager,superClass);function UndoManager(){return UndoManager.__super__.constructor.apply(this,arguments)}UndoManager.pluginName="UndoManager";UndoManager.prototype._index=-1;UndoManager.prototype._capacity=20;UndoManager.prototype._startPosition=null;UndoManager.prototype._endPosition=null;UndoManager.prototype._init=function(){var redoShortcut,undoShortcut;this.editor=this._module;this._stack=[];if(this.editor.util.os.mac){undoShortcut="cmd+z";redoShortcut="shift+cmd+z"}else{if(this.editor.util.os.win){undoShortcut="ctrl+z";redoShortcut="ctrl+y"}else{undoShortcut="ctrl+z";redoShortcut="shift+ctrl+z"}}this.editor.hotkeys.add(undoShortcut,(function(_this){return function(e){e.preventDefault();_this.undo();return false}})(this));this.editor.hotkeys.add(redoShortcut,(function(_this){return function(e){e.preventDefault();_this.redo();return false}})(this));this.throttledPushState=this.editor.util.throttle((function(_this){return function(){return _this._pushUndoState()}})(this),2000);this.editor.on("valuechanged",(function(_this){return function(e,src){if(src==="undo"||src==="redo"){return}return _this.throttledPushState()}})(this));this.editor.on("selectionchanged",(function(_this){return function(e){_this.resetCaretPosition();return _this.update()}})(this));this.editor.on("focus",(function(_this){return function(e){if(_this._stack.length===0){return _this._pushUndoState()}}})(this));return this.editor.on("blur",(function(_this){return function(e){return _this.resetCaretPosition()}})(this))};UndoManager.prototype.resetCaretPosition=function(){this._startPosition=null;return this._endPosition=null};UndoManager.prototype.startPosition=function(){if(this.editor.selection._range){this._startPosition||(this._startPosition=this._getPosition("start"))}return this._startPosition};UndoManager.prototype.endPosition=function(){if(this.editor.selection._range){this._endPosition||(this._endPosition=(function(_this){return function(){var range;range=_this.editor.selection.range();if(range.collapsed){return _this._startPosition}return _this._getPosition("end")}})(this)())}return this._endPosition};UndoManager.prototype._pushUndoState=function(){var caret;if(this.editor.triggerHandler("pushundostate")===false){return}caret=this.caretPosition();if(!caret.start){return}this._index+=1;this._stack.length=this._index;this._stack.push({html:this.editor.body.html(),caret:this.caretPosition()});if(this._stack.length>this._capacity){this._stack.shift();return this._index-=1}};UndoManager.prototype.currentState=function(){if(this._stack.length&&this._index>-1){return this._stack[this._index]}else{return null}};UndoManager.prototype.undo=function(){var state;if(this._index<1||this._stack.length<2){return}this.editor.hidePopover();this._index-=1;state=this._stack[this._index];this.editor.body.get(0).innerHTML=state.html;this.caretPosition(state.caret);this.editor.body.find(".selected").removeClass("selected");this.editor.sync();return this.editor.trigger("valuechanged",["undo"])};UndoManager.prototype.redo=function(){var state;if(this._index<0||this._stack.length<this._index+2){return}this.editor.hidePopover();this._index+=1;state=this._stack[this._index];this.editor.body.get(0).innerHTML=state.html;this.caretPosition(state.caret);this.editor.body.find(".selected").removeClass("selected");this.editor.sync();return this.editor.trigger("valuechanged",["redo"])};UndoManager.prototype.update=function(){var currentState;currentState=this.currentState(); |
|
13 |
+if(!currentState){return}currentState.html=this.editor.body.html();return currentState.caret=this.caretPosition()};UndoManager.prototype._getNodeOffset=function(node,index){var $parent,merging,offset;if($.isNumeric(index)){$parent=$(node)}else{$parent=$(node).parent()}offset=0;merging=false;$parent.contents().each(function(i,child){if(node===child||(index===i&&i===0)){return false}if(child.nodeType===Node.TEXT_NODE){if(!merging&&child.nodeValue.length>0){offset+=1;merging=true}}else{offset+=1;merging=false}if(index-1===i){return false}return null});return offset};UndoManager.prototype._getPosition=function(type){var $nodes,node,nodes,offset,position,prevNode,range;if(type==null){type="start"}range=this.editor.selection.range();offset=range[type+"Offset"];$nodes=this.editor.selection[type+"Nodes"]();node=$nodes.first()[0];if(node.nodeType===Node.TEXT_NODE){prevNode=node.previousSibling;while(prevNode&&prevNode.nodeType===Node.TEXT_NODE){node=prevNode;offset+=this.editor.util.getNodeLength(prevNode);prevNode=prevNode.previousSibling}nodes=$nodes.get();nodes[0]=node;$nodes=$(nodes)}else{offset=this._getNodeOffset(node,offset)}position=[offset];$nodes.each((function(_this){return function(i,node){return position.unshift(_this._getNodeOffset(node))}})(this));return position};UndoManager.prototype._getNodeByPosition=function(position){var child,childNodes,i,k,len,node,offset,ref;node=this.editor.body[0];ref=position.slice(0,position.length-1);for(i=k=0,len=ref.length;k<len;i=++k){offset=ref[i];childNodes=node.childNodes;if(offset>childNodes.length-1){if(i===position.length-2&&$(node).is("pre:empty")){child=document.createTextNode("");node.appendChild(child);childNodes=node.childNodes}else{node=null;break}}node=childNodes[offset]}return node};UndoManager.prototype.caretPosition=function(caret){var endContainer,endOffset,range,startContainer,startOffset;if(!caret){range=this.editor.selection.range();caret=this.editor.inputManager.focused&&(range!=null)?{start:this.startPosition(),end:this.endPosition(),collapsed:range.collapsed}:{};return caret}else{if(!caret.start){return}startContainer=this._getNodeByPosition(caret.start);startOffset=caret.start[caret.start.length-1];if(caret.collapsed){endContainer=startContainer;endOffset=startOffset}else{endContainer=this._getNodeByPosition(caret.end);endOffset=caret.start[caret.start.length-1]}if(!startContainer||!endContainer){if(typeof console!=="undefined"&&console!==null){if(typeof console.warn==="function"){console.warn("simditor: invalid caret state")}}return}range=document.createRange();range.setStart(startContainer,startOffset);range.setEnd(endContainer,endOffset);return this.editor.selection.range(range)}};return UndoManager})(SimpleModule);Util=(function(superClass){extend(Util,superClass);function Util(){return Util.__super__.constructor.apply(this,arguments)}Util.pluginName="Util";Util.prototype._init=function(){this.editor=this._module;if(this.browser.msie&&this.browser.version<11){return this.phBr=""}};Util.prototype.phBr="<br/>";Util.prototype.os=(function(){var os;os={};if(/Mac/.test(navigator.appVersion)){os.mac=true}else{if(/Linux/.test(navigator.appVersion)){os.linux=true}else{if(/Win/.test(navigator.appVersion)){os.win=true}else{if(/X11/.test(navigator.appVersion)){os.unix=true}}}}if(/Mobi/.test(navigator.appVersion)){os.mobile=true}return os})();Util.prototype.browser=(function(){var chrome,edge,firefox,ie,ref,ref1,ref2,ref3,ref4,safari,ua;ua=navigator.userAgent;ie=/(msie|trident)/i.test(ua);chrome=/chrome|crios/i.test(ua);safari=/safari/i.test(ua)&&!chrome;firefox=/firefox/i.test(ua);edge=/edge/i.test(ua);if(ie){return{msie:true,version:((ref=ua.match(/(msie |rv:)(\d+(\.\d+)?)/i))!=null?ref[2]:void 0)*1}}else{if(edge){return{edge:true,webkit:true,version:((ref1=ua.match(/edge\/(\d+(\.\d+)?)/i))!=null?ref1[1]:void 0)*1}}else{if(chrome){return{webkit:true,chrome:true,version:((ref2=ua.match(/(?:chrome|crios)\/(\d+(\.\d+)?)/i))!=null?ref2[1]:void 0)*1}}else{if(safari){return{webkit:true,safari:true,version:((ref3=ua.match(/version\/(\d+(\.\d+)?)/i))!=null?ref3[1]:void 0)*1}}else{if(firefox){return{mozilla:true,firefox:true,version:((ref4=ua.match(/firefox\/(\d+(\.\d+)?)/i))!=null?ref4[1]:void 0)*1}}else{return{}}}}}}})();Util.prototype.support=(function(){return{onselectionchange:(function(){var e,onselectionchange;onselectionchange=document.onselectionchange;if(onselectionchange!==void 0){try{document.onselectionchange=0;return document.onselectionchange===null}catch(_error){e=_error}finally{document.onselectionchange=onselectionchange}}return false})(),oninput:(function(){return !/(msie|trident)/i.test(navigator.userAgent)})()}})();Util.prototype.reflow=function(el){if(el==null){el=document}return $(el)[0].offsetHeight};Util.prototype.metaKey=function(e){var isMac;isMac=/Mac/.test(navigator.userAgent);if(isMac){return e.metaKey}else{return e.ctrlKey}};Util.prototype.isEmptyNode=function(node){var $node;$node=$(node);return $node.is(":empty")||(!$node.text()&&!$node.find(":not(br, span, div)").length) |
|
14 |
+};Util.prototype.isDecoratedNode=function(node){return $(node).is('[class^="simditor-"]')};Util.prototype.blockNodes=["div","p","ul","ol","li","blockquote","hr","pre","h1","h2","h3","h4","h5","table"];Util.prototype.isBlockNode=function(node){node=$(node)[0];if(!node||node.nodeType===3){return false}return new RegExp("^("+(this.blockNodes.join("|"))+")$").test(node.nodeName.toLowerCase())};Util.prototype.getNodeLength=function(node){node=$(node)[0];switch(node.nodeType){case 7:case 10:return 0;case 3:case 8:return node.length;default:return node.childNodes.length}};Util.prototype.dataURLtoBlob=function(dataURL){var BlobBuilder,arrayBuffer,bb,blobArray,byteString,hasArrayBufferViewSupport,hasBlobConstructor,i,intArray,k,mimeString,ref,supportBlob;hasBlobConstructor=window.Blob&&(function(){var e;try{return Boolean(new Blob())}catch(_error){e=_error;return false}})();hasArrayBufferViewSupport=hasBlobConstructor&&window.Uint8Array&&(function(){var e;try{return new Blob([new Uint8Array(100)]).size===100}catch(_error){e=_error;return false}})();BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;supportBlob=hasBlobConstructor||BlobBuilder;if(!(supportBlob&&window.atob&&window.ArrayBuffer&&window.Uint8Array)){return false}if(dataURL.split(",")[0].indexOf("base64")>=0){byteString=atob(dataURL.split(",")[1])}else{byteString=decodeURIComponent(dataURL.split(",")[1])}arrayBuffer=new ArrayBuffer(byteString.length);intArray=new Uint8Array(arrayBuffer);for(i=k=0,ref=byteString.length;0<=ref?k<=ref:k>=ref;i=0<=ref?++k:--k){intArray[i]=byteString.charCodeAt(i)}mimeString=dataURL.split(",")[0].split(":")[1].split(";")[0];if(hasBlobConstructor){blobArray=hasArrayBufferViewSupport?intArray:arrayBuffer;return new Blob([blobArray],{type:mimeString})}bb=new BlobBuilder();bb.append(arrayBuffer);return bb.getBlob(mimeString)};Util.prototype.throttle=function(func,wait){var args,call,ctx,last,rtn,throttled,timeoutID;last=0;timeoutID=0;ctx=args=rtn=null;call=function(){timeoutID=0;last=+new Date();rtn=func.apply(ctx,args);ctx=null;return args=null};throttled=function(){var delta;ctx=this;args=arguments;delta=new Date()-last;if(!timeoutID){if(delta>=wait){call()}else{timeoutID=setTimeout(call,wait-delta)}}return rtn};throttled.clear=function(){if(!timeoutID){return}clearTimeout(timeoutID);return call()};return throttled};Util.prototype.formatHTML=function(html){var cursor,indentString,lastMatch,level,match,re,repeatString,result,str;re=/<(\/?)(.+?)(\/?)>/g;result="";level=0;lastMatch=null;indentString=" ";repeatString=function(str,n){return new Array(n+1).join(str)};while((match=re.exec(html))!==null){match.isBlockNode=$.inArray(match[2],this.blockNodes)>-1;match.isStartTag=match[1]!=="/"&&match[3]!=="/";match.isEndTag=match[1]==="/"||match[3]==="/";cursor=lastMatch?lastMatch.index+lastMatch[0].length:0;if((str=html.substring(cursor,match.index)).length>0&&$.trim(str)){result+=str}if(match.isBlockNode&&match.isEndTag&&!match.isStartTag){level-=1}if(match.isBlockNode&&match.isStartTag){if(!(lastMatch&&lastMatch.isBlockNode&&lastMatch.isEndTag)){result+="\n"}result+=repeatString(indentString,level)}result+=match[0];if(match.isBlockNode&&match.isEndTag){result+="\n"}if(match.isBlockNode&&match.isStartTag){level+=1}lastMatch=match}return $.trim(result)};return Util})(SimpleModule);Toolbar=(function(superClass){extend(Toolbar,superClass);function Toolbar(){return Toolbar.__super__.constructor.apply(this,arguments)}Toolbar.pluginName="Toolbar";Toolbar.prototype.opts={toolbar:true,toolbarFloat:true,toolbarHidden:false,toolbarFloatOffset:0};Toolbar.prototype._tpl={wrapper:'<div class="simditor-toolbar"><ul></ul></div>',separator:'<li><span class="separator"></span></li>'};Toolbar.prototype._init=function(){var floatInitialized,initToolbarFloat,toolbarHeight;this.editor=this._module;if(!this.opts.toolbar){return}if(!$.isArray(this.opts.toolbar)){this.opts.toolbar=["bold","italic","underline","strikethrough","|","ol","ul","blockquote","code","|","link","image","|","indent","outdent"]}this._render();this.list.on("click",function(e){return false});this.wrapper.on("mousedown",(function(_this){return function(e){return _this.list.find(".menu-on").removeClass(".menu-on")}})(this));$(document).on("mousedown.simditor"+this.editor.id,(function(_this){return function(e){return _this.list.find(".menu-on").removeClass(".menu-on")}})(this));if(!this.opts.toolbarHidden&&this.opts.toolbarFloat){this.wrapper.css("top",this.opts.toolbarFloatOffset);toolbarHeight=0;initToolbarFloat=(function(_this){return function(){_this.wrapper.css("position","static");_this.wrapper.width("auto");_this.editor.util.reflow(_this.wrapper);_this.wrapper.width(_this.wrapper.outerWidth());_this.wrapper.css("left",_this.editor.util.os.mobile?_this.wrapper.position().left:_this.wrapper.offset().left);_this.wrapper.css("position","");_this.editor.wrapper.width(_this.wrapper.outerWidth());toolbarHeight=_this.wrapper.outerHeight();_this.editor.placeholderEl.css("top",toolbarHeight); |
|
15 |
+return true}})(this);floatInitialized=null;$(window).on("resize.simditor-"+this.editor.id,function(e){return floatInitialized=initToolbarFloat()});$(window).on("scroll.simditor-"+this.editor.id,(function(_this){return function(e){var bottomEdge,scrollTop,topEdge;if(!_this.wrapper.is(":visible")){return}topEdge=_this.editor.wrapper.offset().top;bottomEdge=topEdge+_this.editor.wrapper.outerHeight()-80;scrollTop=$(document).scrollTop()+_this.opts.toolbarFloatOffset;if(scrollTop<=topEdge||scrollTop>=bottomEdge){_this.editor.wrapper.removeClass("toolbar-floating").css("padding-top","");if(_this.editor.util.os.mobile){return _this.wrapper.css("top",_this.opts.toolbarFloatOffset)}}else{floatInitialized||(floatInitialized=initToolbarFloat());_this.editor.wrapper.addClass("toolbar-floating").css("padding-top",toolbarHeight);if(_this.editor.util.os.mobile){return _this.wrapper.css("top",scrollTop-topEdge+_this.opts.toolbarFloatOffset)}}}})(this))}this.editor.on("destroy",(function(_this){return function(){return _this.buttons.length=0}})(this));return $(document).on("mousedown.simditor-"+this.editor.id,(function(_this){return function(e){return _this.list.find("li.menu-on").removeClass("menu-on")}})(this))};Toolbar.prototype._render=function(){var k,len,name,ref;this.buttons=[];this.wrapper=$(this._tpl.wrapper).prependTo(this.editor.wrapper);this.list=this.wrapper.find("ul");ref=this.opts.toolbar;for(k=0,len=ref.length;k<len;k++){name=ref[k];if(name==="|"){$(this._tpl.separator).appendTo(this.list);continue}if(!this.constructor.buttons[name]){throw new Error("simditor: invalid toolbar button "+name);continue}this.buttons.push(new this.constructor.buttons[name]({editor:this.editor}))}if(this.opts.toolbarHidden){return this.wrapper.hide()}};Toolbar.prototype.findButton=function(name){var button;button=this.list.find(".toolbar-item-"+name).data("button");return button!=null?button:null};Toolbar.addButton=function(btn){return this.buttons[btn.prototype.name]=btn};Toolbar.buttons={};return Toolbar})(SimpleModule);Indentation=(function(superClass){extend(Indentation,superClass);function Indentation(){return Indentation.__super__.constructor.apply(this,arguments)}Indentation.pluginName="Indentation";Indentation.prototype.opts={tabIndent:true};Indentation.prototype._init=function(){this.editor=this._module;return this.editor.keystroke.add("tab","*",(function(_this){return function(e){var codeButton;codeButton=_this.editor.toolbar.findButton("code");if(!(_this.opts.tabIndent||(codeButton&&codeButton.active))){return}return _this.indent(e.shiftKey)}})(this))};Indentation.prototype.indent=function(isBackward){var $blockNodes,$endNodes,$startNodes,nodes,result;$startNodes=this.editor.selection.startNodes();$endNodes=this.editor.selection.endNodes();$blockNodes=this.editor.selection.blockNodes();nodes=[];$blockNodes=$blockNodes.each(function(i,node){var include,j,k,len,n;include=true;for(j=k=0,len=nodes.length;k<len;j=++k){n=nodes[j];if($.contains(node,n)){include=false;break}else{if($.contains(n,node)){nodes.splice(j,1,node);include=false;break}}}if(include){return nodes.push(node)}});$blockNodes=$(nodes);result=false;$blockNodes.each((function(_this){return function(i,blockEl){var r;r=isBackward?_this.outdentBlock(blockEl):_this.indentBlock(blockEl);if(r){return result=r}}})(this));return result};Indentation.prototype.indentBlock=function(blockEl){var $blockEl,$childList,$nextTd,$nextTr,$parentLi,$pre,$td,$tr,marginLeft,tagName;$blockEl=$(blockEl);if(!$blockEl.length){return}if($blockEl.is("pre")){$pre=this.editor.selection.containerNode();if(!($pre.is($blockEl)||$pre.closest("pre").is($blockEl))){return}this.indentText(this.editor.selection.range())}else{if($blockEl.is("li")){$parentLi=$blockEl.prev("li");if($parentLi.length<1){return}this.editor.selection.save();tagName=$blockEl.parent()[0].tagName;$childList=$parentLi.children("ul, ol");if($childList.length>0){$childList.append($blockEl)}else{$("<"+tagName+"/>").append($blockEl).appendTo($parentLi)}this.editor.selection.restore()}else{if($blockEl.is("p, h1, h2, h3, h4")){marginLeft=parseInt($blockEl.css("margin-left"))||0;marginLeft=(Math.round(marginLeft/this.opts.indentWidth)+1)*this.opts.indentWidth;$blockEl.css("margin-left",marginLeft)}else{if($blockEl.is("table")||$blockEl.is(".simditor-table")){$td=this.editor.selection.containerNode().closest("td, th");$nextTd=$td.next("td, th");if(!($nextTd.length>0)){$tr=$td.parent("tr");$nextTr=$tr.next("tr");if($nextTr.length<1&&$tr.parent().is("thead")){$nextTr=$tr.parent("thead").next("tbody").find("tr:first")}$nextTd=$nextTr.find("td:first, th:first")}if(!($td.length>0&&$nextTd.length>0)){return}this.editor.selection.setRangeAtEndOf($nextTd)}else{return false}}}}return true};Indentation.prototype.indentText=function(range){var text,textNode;text=range.toString().replace(/^(?=.+)/mg,"\u00A0\u00A0");textNode=document.createTextNode(text||"\u00A0\u00A0");range.deleteContents();range.insertNode(textNode);if(text){range.selectNode(textNode); |
|
16 |
+return this.editor.selection.range(range)}else{return this.editor.selection.setRangeAfter(textNode)}};Indentation.prototype.outdentBlock=function(blockEl){var $blockEl,$parent,$parentLi,$pre,$prevTd,$prevTr,$td,$tr,marginLeft,range;$blockEl=$(blockEl);if(!($blockEl&&$blockEl.length>0)){return}if($blockEl.is("pre")){$pre=this.editor.selection.containerNode();if(!($pre.is($blockEl)||$pre.closest("pre").is($blockEl))){return}this.outdentText(range)}else{if($blockEl.is("li")){$parent=$blockEl.parent();$parentLi=$parent.parent("li");this.editor.selection.save();if($parentLi.length<1){range=document.createRange();range.setStartBefore($parent[0]);range.setEndBefore($blockEl[0]);$parent.before(range.extractContents());$("<p/>").insertBefore($parent).after($blockEl.children("ul, ol")).append($blockEl.contents());$blockEl.remove()}else{if($blockEl.next("li").length>0){$("<"+$parent[0].tagName+"/>").append($blockEl.nextAll("li")).appendTo($blockEl)}$blockEl.insertAfter($parentLi);if($parent.children("li").length<1){$parent.remove()}}this.editor.selection.restore()}else{if($blockEl.is("p, h1, h2, h3, h4")){marginLeft=parseInt($blockEl.css("margin-left"))||0;marginLeft=Math.max(Math.round(marginLeft/this.opts.indentWidth)-1,0)*this.opts.indentWidth;$blockEl.css("margin-left",marginLeft===0?"":marginLeft)}else{if($blockEl.is("table")||$blockEl.is(".simditor-table")){$td=this.editor.selection.containerNode().closest("td, th");$prevTd=$td.prev("td, th");if(!($prevTd.length>0)){$tr=$td.parent("tr");$prevTr=$tr.prev("tr");if($prevTr.length<1&&$tr.parent().is("tbody")){$prevTr=$tr.parent("tbody").prev("thead").find("tr:first")}$prevTd=$prevTr.find("td:last, th:last")}if(!($td.length>0&&$prevTd.length>0)){return}this.editor.selection.setRangeAtEndOf($prevTd)}else{return false}}}}return true};Indentation.prototype.outdentText=function(range){};return Indentation})(SimpleModule);Clipboard=(function(superClass){extend(Clipboard,superClass);function Clipboard(){return Clipboard.__super__.constructor.apply(this,arguments)}Clipboard.pluginName="Clipboard";Clipboard.prototype.opts={pasteImage:false,cleanPaste:false};Clipboard.prototype._init=function(){this.editor=this._module;if(this.opts.pasteImage&&typeof this.opts.pasteImage!=="string"){this.opts.pasteImage="inline"}return this.editor.body.on("paste",(function(_this){return function(e){var range;if(_this.pasting||_this._pasteBin){return}if(_this.editor.triggerHandler(e)===false){return false}range=_this.editor.selection.deleteRangeContents();if(_this.editor.body.html()){if(!range.collapsed){range.collapse(true)}}else{_this.editor.formatter.format();_this.editor.selection.setRangeAtStartOf(_this.editor.body.find("p:first"))}if(_this._processPasteByClipboardApi(e)){return false}_this.editor.inputManager.throttledValueChanged.clear();_this.editor.inputManager.throttledSelectionChanged.clear();_this.editor.undoManager.throttledPushState.clear();_this.editor.selection.reset();_this.editor.undoManager.resetCaretPosition();_this.pasting=true;return _this._getPasteContent(function(pasteContent){_this._processPasteContent(pasteContent);_this._pasteInBlockEl=null;_this._pastePlainText=null;return _this.pasting=false})}})(this))};Clipboard.prototype._processPasteByClipboardApi=function(e){var imageFile,pasteItem,ref,uploadOpt;if(this.editor.util.browser.edge){return}if(e.originalEvent.clipboardData&&e.originalEvent.clipboardData.items&&e.originalEvent.clipboardData.items.length>0){pasteItem=e.originalEvent.clipboardData.items[0];if(/^image\//.test(pasteItem.type)){imageFile=pasteItem.getAsFile();if(!((imageFile!=null)&&this.opts.pasteImage)){return}if(!imageFile.name){imageFile.name="Clipboard Image.png"}if(this.editor.triggerHandler("pasting",[imageFile])===false){return}uploadOpt={};uploadOpt[this.opts.pasteImage]=true;if((ref=this.editor.uploader)!=null){ref.upload(imageFile,uploadOpt)}return true}}};Clipboard.prototype._getPasteContent=function(callback){var state;this._pasteBin=$('<div contenteditable="true" />').addClass("simditor-paste-bin").attr("tabIndex","-1").appendTo(this.editor.el);state={html:this.editor.body.html(),caret:this.editor.undoManager.caretPosition()};this._pasteBin.focus();return setTimeout((function(_this){return function(){var pasteContent;_this.editor.hidePopover();_this.editor.body.get(0).innerHTML=state.html;_this.editor.undoManager.caretPosition(state.caret);_this.editor.body.focus();_this.editor.selection.reset();_this.editor.selection.range();_this._pasteInBlockEl=_this.editor.selection.blockNodes().last();_this._pastePlainText=_this.opts.cleanPaste||_this._pasteInBlockEl.is("pre, table");if(_this._pastePlainText){pasteContent=_this.editor.formatter.clearHtml(_this._pasteBin.html(),true)}else{pasteContent=$("<div/>").append(_this._pasteBin.contents());pasteContent.find("table colgroup").remove();_this.editor.formatter.format(pasteContent);_this.editor.formatter.decorate(pasteContent);_this.editor.formatter.beautify(pasteContent.children());pasteContent=pasteContent.contents() |
|
17 |
+}_this._pasteBin.remove();_this._pasteBin=null;return callback(pasteContent)}})(this),0)};Clipboard.prototype._processPasteContent=function(pasteContent){var $blockEl,$img,blob,children,insertPosition,k,l,lastLine,len,len1,len2,len3,len4,line,lines,m,node,o,q,ref,ref1,ref2,uploadOpt;if(this.editor.triggerHandler("pasting",[pasteContent])===false){return}$blockEl=this._pasteInBlockEl;if(!pasteContent){return}else{if(this._pastePlainText){if($blockEl.is("table")){lines=pasteContent.split("\n");lastLine=lines.pop();for(k=0,len=lines.length;k<len;k++){line=lines[k];this.editor.selection.insertNode(document.createTextNode(line));this.editor.selection.insertNode($("<br/>"))}this.editor.selection.insertNode(document.createTextNode(lastLine))}else{pasteContent=$("<div/>").text(pasteContent);ref=pasteContent.contents();for(l=0,len1=ref.length;l<len1;l++){node=ref[l];this.editor.selection.insertNode($(node)[0])}}}else{if($blockEl.is(this.editor.body)){for(m=0,len2=pasteContent.length;m<len2;m++){node=pasteContent[m];this.editor.selection.insertNode(node)}}else{if(pasteContent.length<1){return}else{if(pasteContent.length===1){if(pasteContent.is("p")){children=pasteContent.contents();if(children.length===1&&children.is("img")){$img=children;if(/^data:image/.test($img.attr("src"))){if(!this.opts.pasteImage){return}blob=this.editor.util.dataURLtoBlob($img.attr("src"));blob.name="Clipboard Image.png";uploadOpt={};uploadOpt[this.opts.pasteImage]=true;if((ref1=this.editor.uploader)!=null){ref1.upload(blob,uploadOpt)}return}else{if($img.is('img[src^="webkit-fake-url://"]')){return}}}for(o=0,len3=children.length;o<len3;o++){node=children[o];this.editor.selection.insertNode(node)}}else{if($blockEl.is("p")&&this.editor.util.isEmptyNode($blockEl)){$blockEl.replaceWith(pasteContent);this.editor.selection.setRangeAtEndOf(pasteContent)}else{if(pasteContent.is("ul, ol")){if(pasteContent.find("li").length===1){pasteContent=$("<div/>").text(pasteContent.text());ref2=pasteContent.contents();for(q=0,len4=ref2.length;q<len4;q++){node=ref2[q];this.editor.selection.insertNode($(node)[0])}}else{if($blockEl.is("li")){$blockEl.parent().after(pasteContent);this.editor.selection.setRangeAtEndOf(pasteContent)}else{$blockEl.after(pasteContent);this.editor.selection.setRangeAtEndOf(pasteContent)}}}else{$blockEl.after(pasteContent);this.editor.selection.setRangeAtEndOf(pasteContent)}}}}else{if($blockEl.is("li")){$blockEl=$blockEl.parent()}if(this.editor.selection.rangeAtStartOf($blockEl)){insertPosition="before"}else{if(this.editor.selection.rangeAtEndOf($blockEl)){insertPosition="after"}else{this.editor.selection.breakBlockEl($blockEl);insertPosition="before"}}$blockEl[insertPosition](pasteContent);this.editor.selection.setRangeAtEndOf(pasteContent.last())}}}}}return this.editor.inputManager.throttledValueChanged()};return Clipboard})(SimpleModule);Simditor=(function(superClass){extend(Simditor,superClass);function Simditor(){return Simditor.__super__.constructor.apply(this,arguments)}Simditor.connect(Util);Simditor.connect(InputManager);Simditor.connect(Selection);Simditor.connect(UndoManager);Simditor.connect(Keystroke);Simditor.connect(Formatter);Simditor.connect(Toolbar);Simditor.connect(Indentation);Simditor.connect(Clipboard);Simditor.count=0;Simditor.prototype.opts={textarea:null,placeholder:"",defaultImage:"images/image.png",params:{},upload:false,indentWidth:40};Simditor.prototype._init=function(){var e,editor,form,uploadOpts;this.textarea=$(this.opts.textarea);this.opts.placeholder=this.opts.placeholder||this.textarea.attr("placeholder");if(!this.textarea.length){throw new Error("simditor: param textarea is required.");return}editor=this.textarea.data("simditor");if(editor!=null){editor.destroy()}this.id=++Simditor.count;this._render();if(simpleHotkeys){this.hotkeys=simpleHotkeys({el:this.body})}else{throw new Error("simditor: simple-hotkeys is required.");return}if(this.opts.upload&&simpleUploader){uploadOpts=typeof this.opts.upload==="object"?this.opts.upload:{};this.uploader=simpleUploader(uploadOpts)}form=this.textarea.closest("form");if(form.length){form.on("submit.simditor-"+this.id,(function(_this){return function(){return _this.sync()}})(this));form.on("reset.simditor-"+this.id,(function(_this){return function(){return _this.setValue("")}})(this))}this.on("initialized",(function(_this){return function(){if(_this.opts.placeholder){_this.on("valuechanged",function(){return _this._placeholder()})}_this.setValue(_this.textarea.val().trim()||"");if(_this.textarea.attr("autofocus")){return _this.focus()}}})(this));if(this.util.browser.mozilla){this.util.reflow();try{document.execCommand("enableObjectResizing",false,false);return document.execCommand("enableInlineTableEditing",false,false)}catch(_error){e=_error}}};Simditor.prototype._tpl='<div class="simditor">\n <div class="simditor-wrapper">\n <div class="simditor-placeholder"></div>\n <div class="simditor-body" contenteditable="true">\n </div>\n </div>\n</div>';Simditor.prototype._render=function(){var key,ref,results,val; |
|
18 |
+this.el=$(this._tpl).insertBefore(this.textarea);this.wrapper=this.el.find(".simditor-wrapper");this.body=this.wrapper.find(".simditor-body");this.placeholderEl=this.wrapper.find(".simditor-placeholder").append(this.opts.placeholder);this.el.data("simditor",this);this.wrapper.append(this.textarea);this.textarea.data("simditor",this).blur();this.body.attr("tabindex",this.textarea.attr("tabindex"));if(this.util.os.mac){this.el.addClass("simditor-mac")}else{if(this.util.os.linux){this.el.addClass("simditor-linux")}}if(this.util.os.mobile){this.el.addClass("simditor-mobile")}if(this.opts.params){ref=this.opts.params;results=[];for(key in ref){val=ref[key];results.push($("<input/>",{type:"hidden",name:key,value:val}).insertAfter(this.textarea))}return results}};Simditor.prototype._placeholder=function(){var children;children=this.body.children();if(children.length===0||(children.length===1&&this.util.isEmptyNode(children)&&parseInt(children.css("margin-left")||0)<this.opts.indentWidth)){return this.placeholderEl.show()}else{return this.placeholderEl.hide()}};Simditor.prototype.setValue=function(val){this.hidePopover();this.textarea.val(val);this.body.get(0).innerHTML=val;this.formatter.format();this.formatter.decorate();this.util.reflow(this.body);this.inputManager.lastCaretPosition=null;return this.trigger("valuechanged")};Simditor.prototype.getValue=function(){return this.sync()};Simditor.prototype.sync=function(){var children,cloneBody,emptyP,firstP,lastP,val;cloneBody=this.body.clone();this.formatter.undecorate(cloneBody);this.formatter.format(cloneBody);this.formatter.autolink(cloneBody);children=cloneBody.children();lastP=children.last("p");firstP=children.first("p");while(lastP.is("p")&&this.util.isEmptyNode(lastP)){emptyP=lastP;lastP=lastP.prev("p");emptyP.remove()}while(firstP.is("p")&&this.util.isEmptyNode(firstP)){emptyP=firstP;firstP=lastP.next("p");emptyP.remove()}cloneBody.find("img.uploading").remove();val=$.trim(cloneBody.html());this.textarea.val(val);return val};Simditor.prototype.focus=function(){var $blockEl,range;if(!(this.body.is(":visible")&&this.body.is("[contenteditable]"))){this.el.find("textarea:visible").focus();return}if(this.inputManager.lastCaretPosition){this.undoManager.caretPosition(this.inputManager.lastCaretPosition);return this.inputManager.lastCaretPosition=null}else{$blockEl=this.body.children().last();if(!$blockEl.is("p")){$blockEl=$("<p/>").append(this.util.phBr).appendTo(this.body)}range=document.createRange();return this.selection.setRangeAtEndOf($blockEl,range)}};Simditor.prototype.blur=function(){if(this.body.is(":visible")&&this.body.is("[contenteditable]")){return this.body.blur()}else{return this.body.find("textarea:visible").blur()}};Simditor.prototype.hidePopover=function(){return this.el.find(".simditor-popover").each(function(i,popover){popover=$(popover).data("popover");if(popover.active){return popover.hide()}})};Simditor.prototype.destroy=function(){this.triggerHandler("destroy");this.textarea.closest("form").off(".simditor .simditor-"+this.id);this.selection.clear();this.inputManager.focused=false;this.textarea.insertBefore(this.el).hide().val("").removeData("simditor");this.el.remove();$(document).off(".simditor-"+this.id);$(window).off(".simditor-"+this.id);return this.off()};return Simditor})(SimpleModule);Simditor.i18n={"zh-CN":{"blockquote":"引用","bold":"加粗文字","code":"插入代码","color":"文字颜色","coloredText":"彩色文字","hr":"分隔线","image":"插入图片","externalImage":"外链图片","uploadImage":"上传图片","uploadFailed":"上传失败了","uploadError":"上传出错了","imageUrl":"图片地址","imageSize":"图片尺寸","imageAlt":"图片描述","restoreImageSize":"还原图片尺寸","uploading":"正在上传","indent":"向右缩进","outdent":"向左缩进","italic":"斜体文字","link":"插入链接","linkText":"链接文字","linkUrl":"链接地址","linkTarget":"打开方式","openLinkInCurrentWindow":"在新窗口中打开","openLinkInNewWindow":"在当前窗口中打开","removeLink":"移除链接","ol":"有序列表","ul":"无序列表","strikethrough":"删除线文字","table":"表格","deleteRow":"删除行","insertRowAbove":"在上面插入行","insertRowBelow":"在下面插入行","deleteColumn":"删除列","insertColumnLeft":"在左边插入列","insertColumnRight":"在右边插入列","deleteTable":"删除表格","title":"标题","normalText":"普通文本","underline":"下划线文字","alignment":"水平对齐","alignCenter":"居中","alignLeft":"居左","alignRight":"居右","selectLanguage":"选择程序语言","fontScale":"字体大小","fontScaleXLarge":"超大字体","fontScaleLarge":"大号字体","fontScaleNormal":"正常大小","fontScaleSmall":"小号字体","fontScaleXSmall":"超小字体"},"en-US":{"blockquote":"Block Quote","bold":"Bold","code":"Code","color":"Text Color","coloredText":"Colored Text","hr":"Horizontal Line","image":"Insert Image","externalImage":"External Image","uploadImage":"Upload Image","uploadFailed":"Upload failed","uploadError":"Error occurs during upload","imageUrl":"Url","imageSize":"Size","imageAlt":"Alt","restoreImageSize":"Restore Origin Size","uploading":"Uploading","indent":"Indent","outdent":"Outdent","italic":"Italic","link":"Insert Link","linkText":"Text","linkUrl":"Url","linkTarget":"Target","openLinkInCurrentWindow":"Open link in current window","openLinkInNewWindow":"Open link in new window","removeLink":"Remove Link","ol":"Ordered List","ul":"Unordered List","strikethrough":"Strikethrough","table":"Table","deleteRow":"Delete Row","insertRowAbove":"Insert Row Above","insertRowBelow":"Insert Row Below","deleteColumn":"Delete Column","insertColumnLeft":"Insert Column Left","insertColumnRight":"Insert Column Right","deleteTable":"Delete Table","title":"Title","normalText":"Text","underline":"Underline","alignment":"Alignment","alignCenter":"Align Center","alignLeft":"Align Left","alignRight":"Align Right","selectLanguage":"Select Language","fontScale":"Font Size","fontScaleXLarge":"X Large Size","fontScaleLarge":"Large Size","fontScaleNormal":"Normal Size","fontScaleSmall":"Small Size","fontScaleXSmall":"X Small Size"}}; |
|
19 |
+Button=(function(superClass){extend(Button,superClass);Button.prototype._tpl={item:'<li><a tabindex="-1" unselectable="on" class="toolbar-item" href="javascript:;"><span></span></a></li>',menuWrapper:'<div class="toolbar-menu"></div>',menuItem:'<li><a tabindex="-1" unselectable="on" class="menu-item" href="javascript:;"><span></span></a></li>',separator:'<li><span class="separator"></span></li>'};Button.prototype.name="";Button.prototype.icon="";Button.prototype.title="";Button.prototype.text="";Button.prototype.htmlTag="";Button.prototype.disableTag="";Button.prototype.menu=false;Button.prototype.active=false;Button.prototype.disabled=false;Button.prototype.needFocus=true;Button.prototype.shortcut=null;function Button(opts){this.editor=opts.editor;this.title=this._t(this.name);Button.__super__.constructor.call(this,opts)}Button.prototype._init=function(){var k,len,ref,tag;this.render();this.el.on("mousedown",(function(_this){return function(e){var exceed,noFocus,param;e.preventDefault();noFocus=_this.needFocus&&!_this.editor.inputManager.focused;if(_this.el.hasClass("disabled")||noFocus){return false}if(_this.menu){_this.wrapper.toggleClass("menu-on").siblings("li").removeClass("menu-on");if(_this.wrapper.is(".menu-on")){exceed=_this.menuWrapper.offset().left+_this.menuWrapper.outerWidth()+5-_this.editor.wrapper.offset().left-_this.editor.wrapper.outerWidth();if(exceed>0){_this.menuWrapper.css({"left":"auto","right":0})}_this.trigger("menuexpand")}return false}param=_this.el.data("param");_this.command(param);return false}})(this));this.wrapper.on("click","a.menu-item",(function(_this){return function(e){var btn,noFocus,param;e.preventDefault();btn=$(e.currentTarget);_this.wrapper.removeClass("menu-on");noFocus=_this.needFocus&&!_this.editor.inputManager.focused;if(btn.hasClass("disabled")||noFocus){return false}_this.editor.toolbar.wrapper.removeClass("menu-on");param=btn.data("param");_this.command(param);return false}})(this));this.wrapper.on("mousedown","a.menu-item",function(e){return false});this.editor.on("blur",(function(_this){return function(){var editorActive;editorActive=_this.editor.body.is(":visible")&&_this.editor.body.is("[contenteditable]");if(!(editorActive&&!_this.editor.clipboard.pasting)){return}_this.setActive(false);return _this.setDisabled(false)}})(this));if(this.shortcut!=null){this.editor.hotkeys.add(this.shortcut,(function(_this){return function(e){_this.el.mousedown();return false}})(this))}ref=this.htmlTag.split(",");for(k=0,len=ref.length;k<len;k++){tag=ref[k];tag=$.trim(tag);if(tag&&$.inArray(tag,this.editor.formatter._allowedTags)<0){this.editor.formatter._allowedTags.push(tag)}}return this.editor.on("selectionchanged",(function(_this){return function(e){if(_this.editor.inputManager.focused){return _this._status()}}})(this))};Button.prototype.iconClassOf=function(icon){if(icon){return"simditor-icon simditor-icon-"+icon}else{return""}};Button.prototype.setIcon=function(icon){return this.el.find("span").removeClass().addClass(this.iconClassOf(icon)).text(this.text)};Button.prototype.render=function(){this.wrapper=$(this._tpl.item).appendTo(this.editor.toolbar.list);this.el=this.wrapper.find("a.toolbar-item");this.el.attr("title",this.title).addClass("toolbar-item-"+this.name).data("button",this);this.setIcon(this.icon);if(!this.menu){return}this.menuWrapper=$(this._tpl.menuWrapper).appendTo(this.wrapper);this.menuWrapper.addClass("toolbar-menu-"+this.name);return this.renderMenu()};Button.prototype.renderMenu=function(){var $menuBtnEl,$menuItemEl,k,len,menuItem,ref,ref1,results;if(!$.isArray(this.menu)){return}this.menuEl=$("<ul/>").appendTo(this.menuWrapper);ref=this.menu;results=[];for(k=0,len=ref.length;k<len;k++){menuItem=ref[k];if(menuItem==="|"){$(this._tpl.separator).appendTo(this.menuEl);continue}$menuItemEl=$(this._tpl.menuItem).appendTo(this.menuEl);$menuBtnEl=$menuItemEl.find("a.menu-item").attr({"title":(ref1=menuItem.title)!=null?ref1:menuItem.text,"data-param":menuItem.param}).addClass("menu-item-"+menuItem.name);if(menuItem.icon){results.push($menuBtnEl.find("span").addClass(this.iconClassOf(menuItem.icon)))}else{results.push($menuBtnEl.find("span").text(menuItem.text))}}return results};Button.prototype.setActive=function(active){if(active===this.active){return}this.active=active;return this.el.toggleClass("active",this.active)};Button.prototype.setDisabled=function(disabled){if(disabled===this.disabled){return}this.disabled=disabled;return this.el.toggleClass("disabled",this.disabled)};Button.prototype._disableStatus=function(){var disabled,endNodes,startNodes;startNodes=this.editor.selection.startNodes();endNodes=this.editor.selection.endNodes();disabled=startNodes.filter(this.disableTag).length>0||endNodes.filter(this.disableTag).length>0;this.setDisabled(disabled);if(this.disabled){this.setActive(false)}return this.disabled};Button.prototype._activeStatus=function(){var active,endNode,endNodes,startNode,startNodes;startNodes=this.editor.selection.startNodes(); |
|
20 |
+endNodes=this.editor.selection.endNodes();startNode=startNodes.filter(this.htmlTag);endNode=endNodes.filter(this.htmlTag);active=startNode.length>0&&endNode.length>0&&startNode.is(endNode);this.node=active?startNode:null;this.setActive(active);return this.active};Button.prototype._status=function(){this._disableStatus();if(this.disabled){return}return this._activeStatus()};Button.prototype.command=function(param){};Button.prototype._t=function(){var args,ref,result;args=1<=arguments.length?slice.call(arguments,0):[];result=Button.__super__._t.apply(this,args);if(!result){result=(ref=this.editor)._t.apply(ref,args)}return result};return Button})(SimpleModule);Simditor.Button=Button;Popover=(function(superClass){extend(Popover,superClass);Popover.prototype.offset={top:4,left:0};Popover.prototype.target=null;Popover.prototype.active=false;function Popover(opts){this.button=opts.button;this.editor=opts.button.editor;Popover.__super__.constructor.call(this,opts)}Popover.prototype._init=function(){this.el=$('<div class="simditor-popover"></div>').appendTo(this.editor.el).data("popover",this);this.render();this.el.on("mouseenter",(function(_this){return function(e){return _this.el.addClass("hover")}})(this));return this.el.on("mouseleave",(function(_this){return function(e){return _this.el.removeClass("hover")}})(this))};Popover.prototype.render=function(){};Popover.prototype._initLabelWidth=function(){var $fields;$fields=this.el.find(".settings-field");if(!($fields.length>0)){return}this._labelWidth=0;$fields.each((function(_this){return function(i,field){var $field,$label;$field=$(field);$label=$field.find("label");if(!($label.length>0)){return}return _this._labelWidth=Math.max(_this._labelWidth,$label.width())}})(this));return $fields.find("label").width(this._labelWidth)};Popover.prototype.show=function($target,position){if(position==null){position="bottom"}if($target==null){return}this.el.siblings(".simditor-popover").each(function(i,popover){popover=$(popover).data("popover");if(popover.active){return popover.hide()}});if(this.active&&this.target){this.target.removeClass("selected")}this.target=$target.addClass("selected");if(this.active){this.refresh(position);return this.trigger("popovershow")}else{this.active=true;this.el.css({left:-9999}).show();if(!this._labelWidth){this._initLabelWidth()}this.editor.util.reflow();this.refresh(position);return this.trigger("popovershow")}};Popover.prototype.hide=function(){if(!this.active){return}if(this.target){this.target.removeClass("selected")}this.target=null;this.active=false;this.el.hide();return this.trigger("popoverhide")};Popover.prototype.refresh=function(position){var editorOffset,left,maxLeft,targetH,targetOffset,top;if(position==null){position="bottom"}if(!this.active){return}editorOffset=this.editor.el.offset();targetOffset=this.target.offset();targetH=this.target.outerHeight();if(position==="bottom"){top=targetOffset.top-editorOffset.top+targetH}else{if(position==="top"){top=targetOffset.top-editorOffset.top-this.el.height()}}maxLeft=this.editor.wrapper.width()-this.el.outerWidth()-10;left=Math.min(targetOffset.left-editorOffset.left,maxLeft);return this.el.css({top:top+this.offset.top,left:left+this.offset.left})};Popover.prototype.destroy=function(){this.target=null;this.active=false;this.editor.off(".linkpopover");return this.el.remove()};Popover.prototype._t=function(){var args,ref,result;args=1<=arguments.length?slice.call(arguments,0):[];result=Popover.__super__._t.apply(this,args);if(!result){result=(ref=this.button)._t.apply(ref,args)}return result};return Popover})(SimpleModule);Simditor.Popover=Popover;TitleButton=(function(superClass){extend(TitleButton,superClass);function TitleButton(){return TitleButton.__super__.constructor.apply(this,arguments)}TitleButton.prototype.name="title";TitleButton.prototype.htmlTag="h1, h2, h3, h4, h5";TitleButton.prototype.disableTag="pre, table";TitleButton.prototype._init=function(){this.menu=[{name:"normal",text:this._t("normalText"),param:"p"},"|",{name:"h1",text:this._t("title")+" 1",param:"h1"},{name:"h2",text:this._t("title")+" 2",param:"h2"},{name:"h3",text:this._t("title")+" 3",param:"h3"},{name:"h4",text:this._t("title")+" 4",param:"h4"},{name:"h5",text:this._t("title")+" 5",param:"h5"}];return TitleButton.__super__._init.call(this)};TitleButton.prototype.setActive=function(active,param){TitleButton.__super__.setActive.call(this,active);if(active){param||(param=this.node[0].tagName.toLowerCase())}this.el.removeClass("active-p active-h1 active-h2 active-h3 active-h4 active-h5");if(active){return this.el.addClass("active active-"+param)}};TitleButton.prototype.command=function(param){var $rootNodes;$rootNodes=this.editor.selection.rootNodes();this.editor.selection.save();$rootNodes.each((function(_this){return function(i,node){var $node;$node=$(node);if($node.is("blockquote")||$node.is(param)||$node.is(_this.disableTag)||_this.editor.util.isDecoratedNode($node)){return}return $("<"+param+"/>").append($node.contents()).replaceAll($node) |
|
21 |
+}})(this));this.editor.selection.restore();return this.editor.trigger("valuechanged")};return TitleButton})(Button);Simditor.Toolbar.addButton(TitleButton);FontScaleButton=(function(superClass){extend(FontScaleButton,superClass);function FontScaleButton(){return FontScaleButton.__super__.constructor.apply(this,arguments)}FontScaleButton.prototype.name="fontScale";FontScaleButton.prototype.icon="font";FontScaleButton.prototype.disableTag="pre";FontScaleButton.prototype.htmlTag="span";FontScaleButton.prototype.sizeMap={"x-large":"1.5em","large":"1.25em","small":".75em","x-small":".5em"};FontScaleButton.prototype._init=function(){this.menu=[{name:"150%",text:this._t("fontScaleXLarge"),param:"5"},{name:"125%",text:this._t("fontScaleLarge"),param:"4"},{name:"100%",text:this._t("fontScaleNormal"),param:"3"},{name:"75%",text:this._t("fontScaleSmall"),param:"2"},{name:"50%",text:this._t("fontScaleXSmall"),param:"1"}];return FontScaleButton.__super__._init.call(this)};FontScaleButton.prototype._activeStatus=function(){var active,endNode,endNodes,range,startNode,startNodes;range=this.editor.selection.range();startNodes=this.editor.selection.startNodes();endNodes=this.editor.selection.endNodes();startNode=startNodes.filter('span[style*="font-size"]');endNode=endNodes.filter('span[style*="font-size"]');active=startNodes.length>0&&endNodes.length>0&&startNode.is(endNode);this.setActive(active);return this.active};FontScaleButton.prototype.command=function(param){var $scales,containerNode,range;range=this.editor.selection.range();if(range.collapsed){return}document.execCommand("styleWithCSS",false,true);document.execCommand("fontSize",false,param);document.execCommand("styleWithCSS",false,false);this.editor.selection.reset();this.editor.selection.range();containerNode=this.editor.selection.containerNode();if(containerNode[0].nodeType===Node.TEXT_NODE){$scales=containerNode.closest('span[style*="font-size"]')}else{$scales=containerNode.find('span[style*="font-size"]')}$scales.each((function(_this){return function(i,n){var $span,size;$span=$(n);size=n.style.fontSize;if(/large|x-large|small|x-small/.test(size)){return $span.css("fontSize",_this.sizeMap[size])}else{if(size==="medium"){return $span.replaceWith($span.contents())}}}})(this));return this.editor.trigger("valuechanged")};return FontScaleButton})(Button);Simditor.Toolbar.addButton(FontScaleButton);BoldButton=(function(superClass){extend(BoldButton,superClass);function BoldButton(){return BoldButton.__super__.constructor.apply(this,arguments)}BoldButton.prototype.name="bold";BoldButton.prototype.icon="bold";BoldButton.prototype.htmlTag="b, strong";BoldButton.prototype.disableTag="pre";BoldButton.prototype.shortcut="cmd+b";BoldButton.prototype._init=function(){if(this.editor.util.os.mac){this.title=this.title+" ( Cmd + b )"}else{this.title=this.title+" ( Ctrl + b )";this.shortcut="ctrl+b"}return BoldButton.__super__._init.call(this)};BoldButton.prototype._activeStatus=function(){var active;active=document.queryCommandState("bold")===true;this.setActive(active);return this.active};BoldButton.prototype.command=function(){document.execCommand("bold");if(!this.editor.util.support.oninput){this.editor.trigger("valuechanged")}return $(document).trigger("selectionchange")};return BoldButton})(Button);Simditor.Toolbar.addButton(BoldButton);ItalicButton=(function(superClass){extend(ItalicButton,superClass);function ItalicButton(){return ItalicButton.__super__.constructor.apply(this,arguments)}ItalicButton.prototype.name="italic";ItalicButton.prototype.icon="italic";ItalicButton.prototype.htmlTag="i";ItalicButton.prototype.disableTag="pre";ItalicButton.prototype.shortcut="cmd+i";ItalicButton.prototype._init=function(){if(this.editor.util.os.mac){this.title=this.title+" ( Cmd + i )"}else{this.title=this.title+" ( Ctrl + i )";this.shortcut="ctrl+i"}return ItalicButton.__super__._init.call(this)};ItalicButton.prototype._activeStatus=function(){var active;active=document.queryCommandState("italic")===true;this.setActive(active);return this.active};ItalicButton.prototype.command=function(){document.execCommand("italic");if(!this.editor.util.support.oninput){this.editor.trigger("valuechanged")}return $(document).trigger("selectionchange")};return ItalicButton})(Button);Simditor.Toolbar.addButton(ItalicButton);UnderlineButton=(function(superClass){extend(UnderlineButton,superClass);function UnderlineButton(){return UnderlineButton.__super__.constructor.apply(this,arguments)}UnderlineButton.prototype.name="underline";UnderlineButton.prototype.icon="underline";UnderlineButton.prototype.htmlTag="u";UnderlineButton.prototype.disableTag="pre";UnderlineButton.prototype.shortcut="cmd+u";UnderlineButton.prototype.render=function(){if(this.editor.util.os.mac){this.title=this.title+" ( Cmd + u )"}else{this.title=this.title+" ( Ctrl + u )";this.shortcut="ctrl+u"}return UnderlineButton.__super__.render.call(this)};UnderlineButton.prototype._activeStatus=function(){var active;active=document.queryCommandState("underline")===true; |
|
22 |
+this.setActive(active);return this.active};UnderlineButton.prototype.command=function(){document.execCommand("underline");if(!this.editor.util.support.oninput){this.editor.trigger("valuechanged")}return $(document).trigger("selectionchange")};return UnderlineButton})(Button);Simditor.Toolbar.addButton(UnderlineButton);ColorButton=(function(superClass){extend(ColorButton,superClass);function ColorButton(){return ColorButton.__super__.constructor.apply(this,arguments)}ColorButton.prototype.name="color";ColorButton.prototype.icon="tint";ColorButton.prototype.disableTag="pre";ColorButton.prototype.menu=true;ColorButton.prototype.render=function(){var args;args=1<=arguments.length?slice.call(arguments,0):[];return ColorButton.__super__.render.apply(this,args)};ColorButton.prototype.renderMenu=function(){$('<ul class="color-list">\n <li><a href="javascript:;" class="font-color font-color-1"></a></li>\n <li><a href="javascript:;" class="font-color font-color-2"></a></li>\n <li><a href="javascript:;" class="font-color font-color-3"></a></li>\n <li><a href="javascript:;" class="font-color font-color-4"></a></li>\n <li><a href="javascript:;" class="font-color font-color-5"></a></li>\n <li><a href="javascript:;" class="font-color font-color-6"></a></li>\n <li><a href="javascript:;" class="font-color font-color-7"></a></li>\n <li><a href="javascript:;" class="font-color font-color-default"></a></li>\n</ul>').appendTo(this.menuWrapper);this.menuWrapper.on("mousedown",".color-list",function(e){return false});return this.menuWrapper.on("click",".font-color",(function(_this){return function(e){var $link,$p,hex,range,rgb,textNode;_this.wrapper.removeClass("menu-on");$link=$(e.currentTarget);if($link.hasClass("font-color-default")){$p=_this.editor.body.find("p, li");if(!($p.length>0)){return}rgb=window.getComputedStyle($p[0],null).getPropertyValue("color");hex=_this._convertRgbToHex(rgb)}else{rgb=window.getComputedStyle($link[0],null).getPropertyValue("background-color");hex=_this._convertRgbToHex(rgb)}if(!hex){return}range=_this.editor.selection.range();if(!$link.hasClass("font-color-default")&&range.collapsed){textNode=document.createTextNode(_this._t("coloredText"));range.insertNode(textNode);range.selectNodeContents(textNode);_this.editor.selection.range(range)}document.execCommand("styleWithCSS",false,true);document.execCommand("foreColor",false,hex);document.execCommand("styleWithCSS",false,false);if(!_this.editor.util.support.oninput){return _this.editor.trigger("valuechanged")}}})(this))};ColorButton.prototype._convertRgbToHex=function(rgb){var match,re,rgbToHex;re=/rgb\((\d+),\s?(\d+),\s?(\d+)\)/g;match=re.exec(rgb);if(!match){return""}rgbToHex=function(r,g,b){var componentToHex;componentToHex=function(c){var hex;hex=c.toString(16);if(hex.length===1){return"0"+hex}else{return hex}};return"#"+componentToHex(r)+componentToHex(g)+componentToHex(b)};return rgbToHex(match[1]*1,match[2]*1,match[3]*1)};return ColorButton})(Button);Simditor.Toolbar.addButton(ColorButton);ListButton=(function(superClass){extend(ListButton,superClass);function ListButton(){return ListButton.__super__.constructor.apply(this,arguments)}ListButton.prototype.type="";ListButton.prototype.disableTag="pre, table";ListButton.prototype.command=function(param){var $list,$rootNodes,anotherType;$rootNodes=this.editor.selection.blockNodes();anotherType=this.type==="ul"?"ol":"ul";this.editor.selection.save();$list=null;$rootNodes.each((function(_this){return function(i,node){var $node;$node=$(node);if($node.is("blockquote, li")||$node.is(_this.disableTag)||_this.editor.util.isDecoratedNode($node)||!$.contains(document,node)){return}if($node.is(_this.type)){$node.children("li").each(function(i,li){var $childList,$li;$li=$(li);$childList=$li.children("ul, ol").insertAfter($node);return $("<p/>").append($(li).html()||_this.editor.util.phBr).insertBefore($node)});return $node.remove()}else{if($node.is(anotherType)){return $("<"+_this.type+"/>").append($node.contents()).replaceAll($node)}else{if($list&&$node.prev().is($list)){$("<li/>").append($node.html()||_this.editor.util.phBr).appendTo($list);return $node.remove()}else{$list=$("<"+_this.type+"><li></li></"+_this.type+">");$list.find("li").append($node.html()||_this.editor.util.phBr);return $list.replaceAll($node)}}}}})(this));this.editor.selection.restore();return this.editor.trigger("valuechanged")};return ListButton})(Button);OrderListButton=(function(superClass){extend(OrderListButton,superClass);function OrderListButton(){return OrderListButton.__super__.constructor.apply(this,arguments)}OrderListButton.prototype.type="ol";OrderListButton.prototype.name="ol";OrderListButton.prototype.icon="list-ol";OrderListButton.prototype.htmlTag="ol";OrderListButton.prototype.shortcut="cmd+/";OrderListButton.prototype._init=function(){if(this.editor.util.os.mac){this.title=this.title+" ( Cmd + / )"}else{this.title=this.title+" ( ctrl + / )";this.shortcut="ctrl+/"}return OrderListButton.__super__._init.call(this) |
|
23 |
+};return OrderListButton})(ListButton);UnorderListButton=(function(superClass){extend(UnorderListButton,superClass);function UnorderListButton(){return UnorderListButton.__super__.constructor.apply(this,arguments)}UnorderListButton.prototype.type="ul";UnorderListButton.prototype.name="ul";UnorderListButton.prototype.icon="list-ul";UnorderListButton.prototype.htmlTag="ul";UnorderListButton.prototype.shortcut="cmd+.";UnorderListButton.prototype._init=function(){if(this.editor.util.os.mac){this.title=this.title+" ( Cmd + . )"}else{this.title=this.title+" ( Ctrl + . )";this.shortcut="ctrl+."}return UnorderListButton.__super__._init.call(this)};return UnorderListButton})(ListButton);Simditor.Toolbar.addButton(OrderListButton);Simditor.Toolbar.addButton(UnorderListButton);BlockquoteButton=(function(superClass){extend(BlockquoteButton,superClass);function BlockquoteButton(){return BlockquoteButton.__super__.constructor.apply(this,arguments)}BlockquoteButton.prototype.name="blockquote";BlockquoteButton.prototype.icon="quote-left";BlockquoteButton.prototype.htmlTag="blockquote";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){$("<"+_this.htmlTag+"/>").insertBefore(nodeCache[0]).append(nodeCache);return nodeCache.length=0}}})(this);$rootNodes.each((function(_this){return function(i,node){var $node;$node=$(node);if(!$node.parent().is(_this.editor.body)){return}if($node.is(_this.htmlTag)){clearCache();return $node.children().unwrap()}else{if($node.is(_this.disableTag)||_this.editor.util.isDecoratedNode($node)){return clearCache()}else{return nodeCache.push(node)}}}})(this));clearCache();this.editor.selection.restore();return this.editor.trigger("valuechanged")};return BlockquoteButton})(Button);Simditor.Toolbar.addButton(BlockquoteButton);CodeButton=(function(superClass){extend(CodeButton,superClass);function CodeButton(){return CodeButton.__super__.constructor.apply(this,arguments)}CodeButton.prototype.name="code";CodeButton.prototype.icon="code";CodeButton.prototype.htmlTag="pre";CodeButton.prototype.disableTag="ul, ol, table";CodeButton.prototype._init=function(){CodeButton.__super__._init.call(this);this.editor.on("decorate",(function(_this){return function(e,$el){return $el.find("pre").each(function(i,pre){return _this.decorate($(pre))})}})(this));return this.editor.on("undecorate",(function(_this){return function(e,$el){return $el.find("pre").each(function(i,pre){return _this.undecorate($(pre))})}})(this))};CodeButton.prototype.render=function(){var args;args=1<=arguments.length?slice.call(arguments,0):[];CodeButton.__super__.render.apply(this,args);return this.popover=new CodePopover({button:this})};CodeButton.prototype._checkMode=function(){var $blockNodes,range;range=this.editor.selection.range();if(($blockNodes=$(range.cloneContents()).find(this.editor.util.blockNodes.join(",")))>0||(range.collapsed&&this.editor.selection.startNodes().filter("code").length===0)){this.inlineMode=false;return this.htmlTag="pre"}else{this.inlineMode=true;return this.htmlTag="code"}};CodeButton.prototype._status=function(){this._checkMode();CodeButton.__super__._status.call(this);if(this.inlineMode){return}if(this.active){return this.popover.show(this.node)}else{return this.popover.hide()}};CodeButton.prototype.decorate=function($pre){var $code,lang,ref,ref1;$code=$pre.find("> code");if($code.length>0){lang=(ref=$code.attr("class"))!=null?(ref1=ref.match(/lang-(\S+)/))!=null?ref1[1]:void 0:void 0;$code.contents().unwrap();if(lang){return $pre.attr("data-lang",lang)}}};CodeButton.prototype.undecorate=function($pre){var $code,lang;lang=$pre.attr("data-lang");$code=$("<code/>");if(lang&&lang!==-1){$code.addClass("lang-"+lang)}return $pre.wrapInner($code).removeAttr("data-lang")};CodeButton.prototype.command=function(){if(this.inlineMode){return this._inlineCommand()}else{return this._blockCommand()}};CodeButton.prototype._blockCommand=function(){var $rootNodes,clearCache,nodeCache,resultNodes;$rootNodes=this.editor.selection.rootNodes();nodeCache=[];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));resultNodes.push($pre[0]);return nodeCache.length=0}})(this);$rootNodes.each((function(_this){return function(i,node){var $node,$p;$node=$(node);if($node.is(_this.htmlTag)){clearCache();$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(); |
|
24 |
+this.editor.selection.setRangeAtEndOf($(resultNodes).last());return this.editor.trigger("valuechanged")};CodeButton.prototype._inlineCommand=function(){var $code,$contents,range;range=this.editor.selection.range();if(this.active){range.selectNodeContents(this.node[0]);this.editor.selection.save(range);this.node.contents().unwrap();this.editor.selection.restore()}else{$contents=$(range.extractContents());$code=$("<"+this.htmlTag+"/>").append($contents.contents());range.insertNode($code[0]);range.selectNodeContents($code[0]);this.editor.selection.range(range)}return this.editor.trigger("valuechanged")};return CodeButton})(Button);CodePopover=(function(superClass){extend(CodePopover,superClass);function CodePopover(){return CodePopover.__super__.constructor.apply(this,arguments)}CodePopover.prototype.render=function(){var $option,k,lang,len,ref;this._tpl='<div class="code-settings">\n <div class="settings-field">\n <select class="select-lang">\n <option value="-1">'+(this._t("selectLanguage"))+"</option>\n </select>\n </div>\n</div>";this.langs=this.editor.opts.codeLanguages||[{name:"Bash",value:"bash"},{name:"C++",value:"c++"},{name:"C#",value:"cs"},{name:"CSS",value:"css"},{name:"Erlang",value:"erlang"},{name:"Less",value:"less"},{name:"Sass",value:"sass"},{name:"Diff",value:"diff"},{name:"CoffeeScript",value:"coffeescript"},{name:"HTML,XML",value:"html"},{name:"JSON",value:"json"},{name:"Java",value:"java"},{name:"JavaScript",value:"js"},{name:"Markdown",value:"markdown"},{name:"Objective C",value:"oc"},{name:"PHP",value:"php"},{name:"Perl",value:"parl"},{name:"Python",value:"python"},{name:"Ruby",value:"ruby"},{name:"SQL",value:"sql"}];this.el.addClass("code-popover").append(this._tpl);this.selectEl=this.el.find(".select-lang");ref=this.langs;for(k=0,len=ref.length;k<len;k++){lang=ref[k];$option=$("<option/>",{text:lang.name,value:lang.value}).appendTo(this.selectEl)}this.selectEl.on("change",(function(_this){return function(e){var selected;_this.lang=_this.selectEl.val();selected=_this.target.hasClass("selected");_this.target.removeClass().removeAttr("data-lang");if(_this.lang!==-1){_this.target.attr("data-lang",_this.lang)}if(selected){_this.target.addClass("selected")}return _this.editor.trigger("valuechanged")}})(this));return this.editor.on("valuechanged",(function(_this){return function(e){if(_this.active){return _this.refresh()}}})(this))};CodePopover.prototype.show=function(){var args;args=1<=arguments.length?slice.call(arguments,0):[];CodePopover.__super__.show.apply(this,args);this.lang=this.target.attr("data-lang");if(this.lang!=null){return this.selectEl.val(this.lang)}else{return this.selectEl.val(-1)}};return CodePopover})(Popover);Simditor.Toolbar.addButton(CodeButton);LinkButton=(function(superClass){extend(LinkButton,superClass);function LinkButton(){return LinkButton.__super__.constructor.apply(this,arguments)}LinkButton.prototype.name="link";LinkButton.prototype.icon="link";LinkButton.prototype.htmlTag="a";LinkButton.prototype.disableTag="pre";LinkButton.prototype.render=function(){var args;args=1<=arguments.length?slice.call(arguments,0):[];LinkButton.__super__.render.apply(this,args);return this.popover=new LinkPopover({button:this})};LinkButton.prototype._status=function(){LinkButton.__super__._status.call(this);if(this.active&&!this.editor.selection.rangeAtEndOf(this.node)){return this.popover.show(this.node)}else{return this.popover.hide()}};LinkButton.prototype.command=function(){var $contents,$link,$newBlock,linkText,range,txtNode;range=this.editor.selection.range();if(this.active){txtNode=document.createTextNode(this.node.text());this.node.replaceWith(txtNode);range.selectNode(txtNode)}else{$contents=$(range.extractContents());linkText=this.editor.formatter.clearHtml($contents.contents(),false);$link=$("<a/>",{href:"http://www.example.com",target:"_blank",text:linkText||this._t("linkText")});if(this.editor.selection.blockNodes().length>0){range.insertNode($link[0])}else{$newBlock=$("<p/>").append($link);range.insertNode($newBlock[0])}range.selectNodeContents($link[0]);this.popover.one("popovershow",(function(_this){return function(){if(linkText){_this.popover.urlEl.focus();return _this.popover.urlEl[0].select()}else{_this.popover.textEl.focus();return _this.popover.textEl[0].select()}}})(this))}this.editor.selection.range(range);return this.editor.trigger("valuechanged")};return LinkButton})(Button);LinkPopover=(function(superClass){extend(LinkPopover,superClass);function LinkPopover(){return LinkPopover.__super__.constructor.apply(this,arguments)}LinkPopover.prototype.render=function(){var tpl;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>"; |
|
25 |
+this.el.addClass("link-popover").append(tpl);this.textEl=this.el.find(".link-text");this.urlEl=this.el.find(".link-url");this.unlinkEl=this.el.find(".btn-unlink");this.selectTarget=this.el.find(".link-target");this.textEl.on("keyup",(function(_this){return function(e){if(e.which===13){return}_this.target.text(_this.textEl.val());return _this.editor.inputManager.throttledValueChanged()}})(this));this.urlEl.on("keyup",(function(_this){return function(e){var val;if(e.which===13){return}val=_this.urlEl.val();if(!(/https?:\/\/|^\//ig.test(val)||!val)){val="http://"+val}_this.target.attr("href",val);return _this.editor.inputManager.throttledValueChanged()}})(this));$([this.urlEl[0],this.textEl[0]]).on("keydown",(function(_this){return function(e){var range;if(e.which===13||e.which===27||(!e.shiftKey&&e.which===9&&$(e.target).hasClass("link-url"))){e.preventDefault();range=document.createRange();_this.editor.selection.setRangeAfter(_this.target,range);_this.hide();return _this.editor.inputManager.throttledValueChanged()}}})(this));this.unlinkEl.on("click",(function(_this){return function(e){var range,txtNode;txtNode=document.createTextNode(_this.target.text());_this.target.replaceWith(txtNode);_this.hide();range=document.createRange();_this.editor.selection.setRangeAfter(txtNode,range);return _this.editor.inputManager.throttledValueChanged()}})(this));return this.selectTarget.on("change",(function(_this){return function(e){_this.target.attr("target",_this.selectTarget.val());return _this.editor.inputManager.throttledValueChanged()}})(this))};LinkPopover.prototype.show=function(){var args;args=1<=arguments.length?slice.call(arguments,0):[];LinkPopover.__super__.show.apply(this,args);this.textEl.val(this.target.text());return this.urlEl.val(this.target.attr("href"))};return LinkPopover})(Popover);Simditor.Toolbar.addButton(LinkButton);ImageButton=(function(superClass){extend(ImageButton,superClass);function ImageButton(){return ImageButton.__super__.constructor.apply(this,arguments)}ImageButton.prototype.name="image";ImageButton.prototype.icon="picture-o";ImageButton.prototype.htmlTag="img";ImageButton.prototype.disableTag="pre, table";ImageButton.prototype.defaultImage="";ImageButton.prototype.needFocus=false;ImageButton.prototype._init=function(){var item,k,len,ref;if(this.editor.opts.imageButton){if(Array.isArray(this.editor.opts.imageButton)){this.menu=[];ref=this.editor.opts.imageButton;for(k=0,len=ref.length;k<len;k++){item=ref[k];this.menu.push({name:item+"-image",text:this._t(item+"Image")})}}else{this.menu=false}}else{if(this.editor.uploader!=null){this.menu=[{name:"upload-image",text:this._t("uploadImage")},{name:"external-image",text:this._t("externalImage")}]}else{this.menu=false}}this.defaultImage=this.editor.opts.defaultImage;this.editor.body.on("click","img:not([data-non-image])",(function(_this){return function(e){var $img,range;$img=$(e.currentTarget);range=document.createRange();range.selectNode($img[0]);_this.editor.selection.range(range);if(!_this.editor.util.support.onselectionchange){_this.editor.trigger("selectionchanged")}return false}})(this));this.editor.body.on("mouseup","img:not([data-non-image])",function(e){return false});this.editor.on("selectionchanged.image",(function(_this){return function(){var $contents,$img,range;range=_this.editor.selection.range();if(range==null){return}$contents=$(range.cloneContents()).contents();if($contents.length===1&&$contents.is("img:not([data-non-image])")){$img=$(range.startContainer).contents().eq(range.startOffset);return _this.popover.show($img)}else{return _this.popover.hide()}}})(this));this.editor.on("valuechanged.image",(function(_this){return function(){var $masks;$masks=_this.editor.wrapper.find(".simditor-image-loading");if(!($masks.length>0)){return}return $masks.each(function(i,mask){var $img,$mask,file;$mask=$(mask);$img=$mask.data("img");if(!($img&&$img.parent().length>0)){$mask.remove();if($img){file=$img.data("file");if(file){_this.editor.uploader.cancel(file);if(_this.editor.body.find("img.uploading").length<1){return _this.editor.uploader.trigger("uploadready",[file])}}}}})}})(this));return ImageButton.__super__._init.call(this)};ImageButton.prototype.render=function(){var args;args=1<=arguments.length?slice.call(arguments,0):[];ImageButton.__super__.render.apply(this,args);this.popover=new ImagePopover({button:this});if(this.editor.opts.imageButton==="upload"){return this._initUploader(this.el)}};ImageButton.prototype.renderMenu=function(){ImageButton.__super__.renderMenu.call(this);return this._initUploader()};ImageButton.prototype._initUploader=function($uploadItem){var $input,createInput,uploadProgress;if($uploadItem==null){$uploadItem=this.menuEl.find(".menu-item-upload-image")}if(this.editor.uploader==null){this.el.find(".btn-upload").remove();return}$input=null;createInput=(function(_this){return function(){if($input){$input.remove()}return $input=$("<input/>",{type:"file",title:_this._t("uploadImage"),multiple:true,accept:"image/*"}).appendTo($uploadItem) |
|
26 |
+}})(this);createInput();$uploadItem.on("click mousedown","input[type=file]",function(e){return e.stopPropagation()});$uploadItem.on("change","input[type=file]",(function(_this){return function(e){if(_this.editor.inputManager.focused){_this.editor.uploader.upload($input,{inline:true});createInput()}else{_this.editor.one("focus",function(e){_this.editor.uploader.upload($input,{inline:true});return createInput()});_this.editor.focus()}return _this.wrapper.removeClass("menu-on")}})(this));this.editor.uploader.on("beforeupload",(function(_this){return function(e,file){var $img;if(!file.inline){return}if(file.img){$img=$(file.img)}else{$img=_this.createImage(file.name);file.img=$img}$img.addClass("uploading");$img.data("file",file);return _this.editor.uploader.readImageFile(file.obj,function(img){var src;if(!$img.hasClass("uploading")){return}src=img?img.src:_this.defaultImage;return _this.loadImage($img,src,function(){if(_this.popover.active){_this.popover.refresh();return _this.popover.srcEl.val(_this._t("uploading")).prop("disabled",true)}})})}})(this));uploadProgress=$.proxy(this.editor.util.throttle(function(e,file,loaded,total){var $img,$mask,percent;if(!file.inline){return}$mask=file.img.data("mask");if(!$mask){return}$img=$mask.data("img");if(!($img.hasClass("uploading")&&$img.parent().length>0)){$mask.remove();return}percent=loaded/total;percent=(percent*100).toFixed(0);if(percent>99){percent=99}return $mask.find(".progress").height((100-percent)+"%")},500),this);this.editor.uploader.on("uploadprogress",uploadProgress);this.editor.uploader.on("uploadsuccess",(function(_this){return function(e,file,result){var $img,img_path,msg;if(!file.inline){return}$img=file.img;if(!($img.hasClass("uploading")&&$img.parent().length>0)){return}if(typeof result!=="object"){try{result=$.parseJSON(result)}catch(_error){e=_error;result={success:false}}}if(result.success===false){msg=result.msg||_this._t("uploadFailed");alert(msg);img_path=_this.defaultImage}else{img_path=result.file_path}_this.loadImage($img,img_path,function(){var $mask;$img.removeData("file");$img.removeClass("uploading").removeClass("loading");$mask=$img.data("mask");if($mask){$mask.remove()}$img.removeData("mask");_this.editor.trigger("valuechanged");if(_this.editor.body.find("img.uploading").length<1){return _this.editor.uploader.trigger("uploadready",[file,result])}});if(_this.popover.active){_this.popover.srcEl.prop("disabled",false);return _this.popover.srcEl.val(result.file_path)}}})(this));return this.editor.uploader.on("uploaderror",(function(_this){return function(e,file,xhr){var $img,msg,result;if(!file.inline){return}if(xhr.statusText==="abort"){return}if(xhr.responseText){try{result=$.parseJSON(xhr.responseText);msg=result.msg}catch(_error){e=_error;msg=_this._t("uploadError")}alert(msg)}$img=file.img;if(!($img.hasClass("uploading")&&$img.parent().length>0)){return}_this.loadImage($img,_this.defaultImage,function(){var $mask;$img.removeData("file");$img.removeClass("uploading").removeClass("loading");$mask=$img.data("mask");if($mask){$mask.remove()}return $img.removeData("mask")});if(_this.popover.active){_this.popover.srcEl.prop("disabled",false);_this.popover.srcEl.val(_this.defaultImage)}_this.editor.trigger("valuechanged");if(_this.editor.body.find("img.uploading").length<1){return _this.editor.uploader.trigger("uploadready",[file,result])}}})(this))};ImageButton.prototype._status=function(){return this._disableStatus()};ImageButton.prototype.loadImage=function($img,src,callback){var $mask,img,positionMask;positionMask=(function(_this){return function(){var imgOffset,wrapperOffset;imgOffset=$img.offset();wrapperOffset=_this.editor.wrapper.offset();return $mask.css({top:imgOffset.top-wrapperOffset.top,left:imgOffset.left-wrapperOffset.left,width:$img.width(),height:$img.height()}).show()}})(this);$img.addClass("loading");$mask=$img.data("mask");if(!$mask){$mask=$('<div class="simditor-image-loading">\n <div class="progress"></div>\n</div>').hide().appendTo(this.editor.wrapper);positionMask();$img.data("mask",$mask);$mask.data("img",$img)}img=new Image();img.onload=(function(_this){return function(){var height,width;if(!$img.hasClass("loading")&&!$img.hasClass("uploading")){return}width=img.width;height=img.height;$img.attr({src:src,width:width,height:height,"data-image-size":width+","+height}).removeClass("loading");if($img.hasClass("uploading")){_this.editor.util.reflow(_this.editor.body);positionMask()}else{$mask.remove();$img.removeData("mask")}if($.isFunction(callback)){return callback(img)}}})(this);img.onerror=function(){if($.isFunction(callback)){callback(false)}$mask.remove();return $img.removeData("mask").removeClass("loading")};return img.src=src};ImageButton.prototype.createImage=function(name){var $img,range;if(name==null){name="Image"}if(!this.editor.inputManager.focused){this.editor.focus()}range=this.editor.selection.range();range.deleteContents();this.editor.selection.range(range);$img=$("<img/>").attr("alt",name);range.insertNode($img[0]); |
|
27 |
+this.editor.selection.setRangeAfter($img,range);this.editor.trigger("valuechanged");return $img};ImageButton.prototype.command=function(src){var $img;$img=this.createImage();return this.loadImage($img,src||this.defaultImage,(function(_this){return function(){_this.editor.trigger("valuechanged");_this.editor.util.reflow($img);$img.click();return _this.popover.one("popovershow",function(){_this.popover.srcEl.focus();return _this.popover.srcEl[0].select()})}})(this))};return ImageButton})(Button);ImagePopover=(function(superClass){extend(ImagePopover,superClass);function ImagePopover(){return ImagePopover.__super__.constructor.apply(this,arguments)}ImagePopover.prototype.offset={top:6,left:-4};ImagePopover.prototype.render=function(){var tpl;tpl='<div class="link-settings">\n <div class="settings-field">\n <label>'+(this._t("imageUrl"))+'</label>\n <input class="image-src" type="text" tabindex="1" />\n <a class="btn-upload" href="javascript:;"\n title="'+(this._t("uploadImage"))+'" tabindex="-1">\n <span class="simditor-icon simditor-icon-upload"></span>\n </a>\n </div>\n <div class=\'settings-field\'>\n <label>'+(this._t("imageAlt"))+'</label>\n <input class="image-alt" id="image-alt" type="text" tabindex="1" />\n </div>\n <div class="settings-field">\n <label>'+(this._t("imageSize"))+'</label>\n <input class="image-size" id="image-width" type="text" tabindex="2" />\n <span class="times">×</span>\n <input class="image-size" id="image-height" type="text" tabindex="3" />\n <a class="btn-restore" href="javascript:;"\n title="'+(this._t("restoreImageSize"))+'" tabindex="-1">\n <span class="simditor-icon simditor-icon-undo"></span>\n </a>\n </div>\n</div>';this.el.addClass("image-popover").append(tpl);this.srcEl=this.el.find(".image-src");this.widthEl=this.el.find("#image-width");this.heightEl=this.el.find("#image-height");this.altEl=this.el.find("#image-alt");this.srcEl.on("keydown",(function(_this){return function(e){var range;if(!(e.which===13&&!_this.target.hasClass("uploading"))){return}e.preventDefault();range=document.createRange();_this.button.editor.selection.setRangeAfter(_this.target,range);return _this.hide()}})(this));this.srcEl.on("blur",(function(_this){return function(e){return _this._loadImage(_this.srcEl.val())}})(this));this.el.find(".image-size").on("blur",(function(_this){return function(e){_this._resizeImg($(e.currentTarget));return _this.el.data("popover").refresh()}})(this));this.el.find(".image-size").on("keyup",(function(_this){return function(e){var inputEl;inputEl=$(e.currentTarget);if(!(e.which===13||e.which===27||e.which===9)){return _this._resizeImg(inputEl,true)}}})(this));this.el.find(".image-size").on("keydown",(function(_this){return function(e){var $img,inputEl,range;inputEl=$(e.currentTarget);if(e.which===13||e.which===27){e.preventDefault();if(e.which===13){_this._resizeImg(inputEl)}else{_this._restoreImg()}$img=_this.target;_this.hide();range=document.createRange();return _this.button.editor.selection.setRangeAfter($img,range)}else{if(e.which===9){return _this.el.data("popover").refresh()}}}})(this));this.altEl.on("keydown",(function(_this){return function(e){var range;if(e.which===13){e.preventDefault();range=document.createRange();_this.button.editor.selection.setRangeAfter(_this.target,range);return _this.hide()}}})(this));this.altEl.on("keyup",(function(_this){return function(e){if(e.which===13||e.which===27||e.which===9){return}_this.alt=_this.altEl.val();return _this.target.attr("alt",_this.alt)}})(this));this.el.find(".btn-restore").on("click",(function(_this){return function(e){_this._restoreImg();return _this.el.data("popover").refresh()}})(this));this.editor.on("valuechanged",(function(_this){return function(e){if(_this.active){return _this.refresh()}}})(this));return this._initUploader()};ImagePopover.prototype._initUploader=function(){var $uploadBtn,createInput;$uploadBtn=this.el.find(".btn-upload");if(this.editor.uploader==null){$uploadBtn.remove();return}createInput=(function(_this){return function(){if(_this.input){_this.input.remove()}return _this.input=$("<input/>",{type:"file",title:_this._t("uploadImage"),multiple:true,accept:"image/*"}).appendTo($uploadBtn)}})(this);createInput();this.el.on("click mousedown","input[type=file]",function(e){return e.stopPropagation()});return this.el.on("change","input[type=file]",(function(_this){return function(e){_this.editor.uploader.upload(_this.input,{inline:true,img:_this.target});return createInput()}})(this))};ImagePopover.prototype._resizeImg=function(inputEl,onlySetVal){var height,value,width;if(onlySetVal==null){onlySetVal=false}value=inputEl.val()*1;if(!(this.target&&($.isNumeric(value)||value<0))){return}if(inputEl.is(this.widthEl)){width=value;height=this.height*value/this.width;this.heightEl.val(height)}else{height=value;width=this.width*value/this.height;this.widthEl.val(width)}if(!onlySetVal){this.target.attr({width:width,height:height});return this.editor.trigger("valuechanged") |
|
28 |
+}};ImagePopover.prototype._restoreImg=function(){var ref,size;size=((ref=this.target.data("image-size"))!=null?ref.split(","):void 0)||[this.width,this.height];this.target.attr({width:size[0]*1,height:size[1]*1});this.widthEl.val(size[0]);this.heightEl.val(size[1]);return this.editor.trigger("valuechanged")};ImagePopover.prototype._loadImage=function(src,callback){if(/^data:image/.test(src)&&!this.editor.uploader){if(callback){callback(false)}return}if(this.target.attr("src")===src){return}return this.button.loadImage(this.target,src,(function(_this){return function(img){var blob;if(!img){return}if(_this.active){_this.width=img.width;_this.height=img.height;_this.widthEl.val(_this.width);_this.heightEl.val(_this.height)}if(/^data:image/.test(src)){blob=_this.editor.util.dataURLtoBlob(src);blob.name="Base64 Image.png";_this.editor.uploader.upload(blob,{inline:true,img:_this.target})}else{_this.editor.trigger("valuechanged")}if(callback){return callback(img)}}})(this))};ImagePopover.prototype.show=function(){var $img,args;args=1<=arguments.length?slice.call(arguments,0):[];ImagePopover.__super__.show.apply(this,args);$img=this.target;this.width=$img.width();this.height=$img.height();this.alt=$img.attr("alt");if($img.hasClass("uploading")){return this.srcEl.val(this._t("uploading")).prop("disabled",true)}else{this.srcEl.val($img.attr("src")).prop("disabled",false);this.widthEl.val(this.width);this.heightEl.val(this.height);return this.altEl.val(this.alt)}};return ImagePopover})(Popover);Simditor.Toolbar.addButton(ImageButton);IndentButton=(function(superClass){extend(IndentButton,superClass);function IndentButton(){return IndentButton.__super__.constructor.apply(this,arguments)}IndentButton.prototype.name="indent";IndentButton.prototype.icon="indent";IndentButton.prototype._init=function(){this.title=this._t(this.name)+" (Tab)";return IndentButton.__super__._init.call(this)};IndentButton.prototype._status=function(){};IndentButton.prototype.command=function(){return this.editor.indentation.indent()};return IndentButton})(Button);Simditor.Toolbar.addButton(IndentButton);OutdentButton=(function(superClass){extend(OutdentButton,superClass);function OutdentButton(){return OutdentButton.__super__.constructor.apply(this,arguments)}OutdentButton.prototype.name="outdent";OutdentButton.prototype.icon="outdent";OutdentButton.prototype._init=function(){this.title=this._t(this.name)+" (Shift + Tab)";return OutdentButton.__super__._init.call(this)};OutdentButton.prototype._status=function(){};OutdentButton.prototype.command=function(){return this.editor.indentation.indent(true)};return OutdentButton})(Button);Simditor.Toolbar.addButton(OutdentButton);HrButton=(function(superClass){extend(HrButton,superClass);function HrButton(){return HrButton.__super__.constructor.apply(this,arguments)}HrButton.prototype.name="hr";HrButton.prototype.icon="minus";HrButton.prototype.htmlTag="hr";HrButton.prototype._status=function(){};HrButton.prototype.command=function(){var $hr,$newBlock,$nextBlock,$rootBlock;$rootBlock=this.editor.selection.rootNodes().first();$nextBlock=$rootBlock.next();if($nextBlock.length>0){this.editor.selection.save()}else{$newBlock=$("<p/>").append(this.editor.util.phBr)}$hr=$("<hr/>").insertAfter($rootBlock);if($newBlock){$newBlock.insertAfter($hr);this.editor.selection.setRangeAtStartOf($newBlock)}else{this.editor.selection.restore()}return this.editor.trigger("valuechanged")};return HrButton})(Button);Simditor.Toolbar.addButton(HrButton);TableButton=(function(superClass){extend(TableButton,superClass);function TableButton(){return TableButton.__super__.constructor.apply(this,arguments)}TableButton.prototype.name="table";TableButton.prototype.icon="table";TableButton.prototype.htmlTag="table";TableButton.prototype.disableTag="pre, li, blockquote";TableButton.prototype.menu=true;TableButton.prototype._init=function(){TableButton.__super__._init.call(this);$.merge(this.editor.formatter._allowedTags,["thead","th","tbody","tr","td","colgroup","col"]);$.extend(this.editor.formatter._allowedAttributes,{td:["rowspan","colspan"],col:["width"]});$.extend(this.editor.formatter._allowedStyles,{td:["text-align"],th:["text-align"]});this._initShortcuts();this.editor.on("decorate",(function(_this){return function(e,$el){return $el.find("table").each(function(i,table){return _this.decorate($(table))})}})(this));this.editor.on("undecorate",(function(_this){return function(e,$el){return $el.find("table").each(function(i,table){return _this.undecorate($(table))})}})(this));this.editor.on("selectionchanged.table",(function(_this){return function(e){var $container,range;_this.editor.body.find(".simditor-table td, .simditor-table th").removeClass("active");range=_this.editor.selection.range();if(!range){return}$container=_this.editor.selection.containerNode();if(range.collapsed&&$container.is(".simditor-table")){if(_this.editor.selection.rangeAtStartOf($container)){$container=$container.find("th:first")}else{$container=$container.find("td:last") |
|
29 |
+}_this.editor.selection.setRangeAtEndOf($container)}return $container.closest("td, th",_this.editor.body).addClass("active")}})(this));this.editor.on("blur.table",(function(_this){return function(e){return _this.editor.body.find(".simditor-table td, .simditor-table th").removeClass("active")}})(this));this.editor.keystroke.add("up","td",(function(_this){return function(e,$node){_this._tdNav($node,"up");return true}})(this));this.editor.keystroke.add("up","th",(function(_this){return function(e,$node){_this._tdNav($node,"up");return true}})(this));this.editor.keystroke.add("down","td",(function(_this){return function(e,$node){_this._tdNav($node,"down");return true}})(this));return this.editor.keystroke.add("down","th",(function(_this){return function(e,$node){_this._tdNav($node,"down");return true}})(this))};TableButton.prototype._tdNav=function($td,direction){var $anotherTr,$tr,action,anotherTag,index,parentTag,ref;if(direction==null){direction="up"}action=direction==="up"?"prev":"next";ref=direction==="up"?["tbody","thead"]:["thead","tbody"],parentTag=ref[0],anotherTag=ref[1];$tr=$td.parent("tr");$anotherTr=this["_"+action+"Row"]($tr);if(!($anotherTr.length>0)){return true}index=$tr.find("td, th").index($td);return this.editor.selection.setRangeAtEndOf($anotherTr.find("td, th").eq(index))};TableButton.prototype._nextRow=function($tr){var $nextTr;$nextTr=$tr.next("tr");if($nextTr.length<1&&$tr.parent("thead").length>0){$nextTr=$tr.parent("thead").next("tbody").find("tr:first")}return $nextTr};TableButton.prototype._prevRow=function($tr){var $prevTr;$prevTr=$tr.prev("tr");if($prevTr.length<1&&$tr.parent("tbody").length>0){$prevTr=$tr.parent("tbody").prev("thead").find("tr")}return $prevTr};TableButton.prototype.initResize=function($table){var $colgroup,$resizeHandle,$wrapper;$wrapper=$table.parent(".simditor-table");$colgroup=$table.find("colgroup");if($colgroup.length<1){$colgroup=$("<colgroup/>").prependTo($table);$table.find("thead tr th").each(function(i,td){var $col;return $col=$("<col/>").appendTo($colgroup)});this.refreshTableWidth($table)}$resizeHandle=$("<div />",{"class":"simditor-resize-handle",contenteditable:"false"}).appendTo($wrapper);$wrapper.on("mousemove","td, th",function(e){var $col,$td,index,ref,ref1,x;if($wrapper.hasClass("resizing")){return}$td=$(e.currentTarget);x=e.pageX-$(e.currentTarget).offset().left;if(x<5&&$td.prev().length>0){$td=$td.prev()}if($td.next("td, th").length<1){$resizeHandle.hide();return}if((ref=$resizeHandle.data("td"))!=null?ref.is($td):void 0){$resizeHandle.show();return}index=$td.parent().find("td, th").index($td);$col=$colgroup.find("col").eq(index);if((ref1=$resizeHandle.data("col"))!=null?ref1.is($col):void 0){$resizeHandle.show();return}return $resizeHandle.css("left",$td.position().left+$td.outerWidth()-5).data("td",$td).data("col",$col).show()});$wrapper.on("mouseleave",function(e){return $resizeHandle.hide()});return $wrapper.on("mousedown",".simditor-resize-handle",function(e){var $handle,$leftCol,$leftTd,$rightCol,$rightTd,minWidth,startHandleLeft,startLeftWidth,startRightWidth,startX,tableWidth;$handle=$(e.currentTarget);$leftTd=$handle.data("td");$leftCol=$handle.data("col");$rightTd=$leftTd.next("td, th");$rightCol=$leftCol.next("col");startX=e.pageX;startLeftWidth=$leftTd.outerWidth()*1;startRightWidth=$rightTd.outerWidth()*1;startHandleLeft=parseFloat($handle.css("left"));tableWidth=$leftTd.closest("table").width();minWidth=50;$(document).on("mousemove.simditor-resize-table",function(e){var deltaX,leftWidth,rightWidth;deltaX=e.pageX-startX;leftWidth=startLeftWidth+deltaX;rightWidth=startRightWidth-deltaX;if(leftWidth<minWidth){leftWidth=minWidth;deltaX=minWidth-startLeftWidth;rightWidth=startRightWidth-deltaX}else{if(rightWidth<minWidth){rightWidth=minWidth;deltaX=startRightWidth-minWidth;leftWidth=startLeftWidth+deltaX}}$leftCol.attr("width",(leftWidth/tableWidth*100)+"%");$rightCol.attr("width",(rightWidth/tableWidth*100)+"%");return $handle.css("left",startHandleLeft+deltaX)});$(document).one("mouseup.simditor-resize-table",function(e){$(document).off(".simditor-resize-table");return $wrapper.removeClass("resizing")});$wrapper.addClass("resizing");return false})};TableButton.prototype._initShortcuts=function(){this.editor.hotkeys.add("ctrl+alt+up",(function(_this){return function(e){_this.editMenu.find(".menu-item[data-param=insertRowAbove]").click();return false}})(this));this.editor.hotkeys.add("ctrl+alt+down",(function(_this){return function(e){_this.editMenu.find(".menu-item[data-param=insertRowBelow]").click();return false}})(this));this.editor.hotkeys.add("ctrl+alt+left",(function(_this){return function(e){_this.editMenu.find(".menu-item[data-param=insertColLeft]").click();return false}})(this));return this.editor.hotkeys.add("ctrl+alt+right",(function(_this){return function(e){_this.editMenu.find(".menu-item[data-param=insertColRight]").click();return false}})(this))};TableButton.prototype.decorate=function($table){var $headRow,$tbody,$thead; |
|
30 |
+if($table.parent(".simditor-table").length>0){this.undecorate($table)}$table.wrap('<div class="simditor-table"></div>');if($table.find("thead").length<1){$thead=$("<thead />");$headRow=$table.find("tr").first();$thead.append($headRow);this._changeCellTag($headRow,"th");$tbody=$table.find("tbody");if($tbody.length>0){$tbody.before($thead)}else{$table.prepend($thead)}}this.initResize($table);return $table.parent()};TableButton.prototype.undecorate=function($table){if(!($table.parent(".simditor-table").length>0)){return}return $table.parent().replaceWith($table)};TableButton.prototype.renderMenu=function(){var $table;$('<div class="menu-create-table">\n</div>\n<div class="menu-edit-table">\n <ul>\n <li>\n <a tabindex="-1" unselectable="on" class="menu-item"\n href="javascript:;" data-param="deleteRow">\n <span>'+(this._t("deleteRow"))+'</span>\n </a>\n </li>\n <li>\n <a tabindex="-1" unselectable="on" class="menu-item"\n href="javascript:;" data-param="insertRowAbove">\n <span>'+(this._t("insertRowAbove"))+' ( Ctrl + Alt + ↑ )</span>\n </a>\n </li>\n <li>\n <a tabindex="-1" unselectable="on" class="menu-item"\n href="javascript:;" data-param="insertRowBelow">\n <span>'+(this._t("insertRowBelow"))+' ( Ctrl + Alt + ↓ )</span>\n </a>\n </li>\n <li><span class="separator"></span></li>\n <li>\n <a tabindex="-1" unselectable="on" class="menu-item"\n href="javascript:;" data-param="deleteCol">\n <span>'+(this._t("deleteColumn"))+'</span>\n </a>\n </li>\n <li>\n <a tabindex="-1" unselectable="on" class="menu-item"\n href="javascript:;" data-param="insertColLeft">\n <span>'+(this._t("insertColumnLeft"))+' ( Ctrl + Alt + ← )</span>\n </a>\n </li>\n <li>\n <a tabindex="-1" unselectable="on" class="menu-item"\n href="javascript:;" data-param="insertColRight">\n <span>'+(this._t("insertColumnRight"))+' ( Ctrl + Alt + → )</span>\n </a>\n </li>\n <li><span class="separator"></span></li>\n <li>\n <a tabindex="-1" unselectable="on" class="menu-item"\n href="javascript:;" data-param="deleteTable">\n <span>'+(this._t("deleteTable"))+"</span>\n </a>\n </li>\n </ul>\n</div>").appendTo(this.menuWrapper);this.createMenu=this.menuWrapper.find(".menu-create-table");this.editMenu=this.menuWrapper.find(".menu-edit-table");$table=this.createTable(6,6).appendTo(this.createMenu);this.createMenu.on("mouseenter","td, th",(function(_this){return function(e){var $td,$tr,$trs,num;_this.createMenu.find("td, th").removeClass("selected");$td=$(e.currentTarget);$tr=$td.parent();num=$tr.find("td, th").index($td)+1;$trs=$tr.prevAll("tr").addBack();if($tr.parent().is("tbody")){$trs=$trs.add($table.find("thead tr"))}return $trs.find("td:lt("+num+"), th:lt("+num+")").addClass("selected")}})(this));this.createMenu.on("mouseleave",function(e){return $(e.currentTarget).find("td, th").removeClass("selected")});return this.createMenu.on("mousedown","td, th",(function(_this){return function(e){var $closestBlock,$td,$tr,colNum,rowNum;_this.wrapper.removeClass("menu-on");if(!_this.editor.inputManager.focused){return}$td=$(e.currentTarget);$tr=$td.parent();colNum=$tr.find("td").index($td)+1;rowNum=$tr.prevAll("tr").length+1;if($tr.parent().is("tbody")){rowNum+=1}$table=_this.createTable(rowNum,colNum,true);$closestBlock=_this.editor.selection.blockNodes().last();if(_this.editor.util.isEmptyNode($closestBlock)){$closestBlock.replaceWith($table)}else{$closestBlock.after($table)}_this.decorate($table);_this.editor.selection.setRangeAtStartOf($table.find("th:first"));_this.editor.trigger("valuechanged");return false}})(this))};TableButton.prototype.createTable=function(row,col,phBr){var $table,$tbody,$td,$thead,$tr,c,k,l,r,ref,ref1;$table=$("<table/>");$thead=$("<thead/>").appendTo($table);$tbody=$("<tbody/>").appendTo($table);for(r=k=0,ref=row;0<=ref?k<ref:k>ref;r=0<=ref?++k:--k){$tr=$("<tr/>");$tr.appendTo(r===0?$thead:$tbody);for(c=l=0,ref1=col;0<=ref1?l<ref1:l>ref1;c=0<=ref1?++l:--l){$td=$(r===0?"<th/>":"<td/>").appendTo($tr);if(phBr){$td.append(this.editor.util.phBr)}}}return $table};TableButton.prototype.refreshTableWidth=function($table){var cols,tableWidth;tableWidth=$table.width();cols=$table.find("col");return $table.find("thead tr th").each(function(i,td){var $col;$col=cols.eq(i);return $col.attr("width",($(td).outerWidth()/tableWidth*100)+"%")})};TableButton.prototype.setActive=function(active){TableButton.__super__.setActive.call(this,active);if(active){this.createMenu.hide();return this.editMenu.show()}else{this.createMenu.show();return this.editMenu.hide()}};TableButton.prototype._changeCellTag=function($tr,tagName){return $tr.find("td, th").each(function(i,cell){var $cell;$cell=$(cell);return $cell.replaceWith("<"+tagName+">"+($cell.html())+"</"+tagName+">")})};TableButton.prototype.deleteRow=function($td){var $newTr,$tr,index;$tr=$td.parent("tr"); |
|
31 |
+if($tr.closest("table").find("tr").length<1){return this.deleteTable($td)}else{$newTr=this._nextRow($tr);if(!($newTr.length>0)){$newTr=this._prevRow($tr)}index=$tr.find("td, th").index($td);if($tr.parent().is("thead")){$newTr.appendTo($tr.parent());this._changeCellTag($newTr,"th")}$tr.remove();return this.editor.selection.setRangeAtEndOf($newTr.find("td, th").eq(index))}};TableButton.prototype.insertRow=function($td,direction){var $newTr,$table,$tr,cellTag,colNum,i,index,k,ref;if(direction==null){direction="after"}$tr=$td.parent("tr");$table=$tr.closest("table");colNum=0;$table.find("tr").each(function(i,tr){return colNum=Math.max(colNum,$(tr).find("td").length)});index=$tr.find("td, th").index($td);$newTr=$("<tr/>");cellTag="td";if(direction==="after"&&$tr.parent().is("thead")){$tr.parent().next("tbody").prepend($newTr)}else{if(direction==="before"&&$tr.parent().is("thead")){$tr.before($newTr);$tr.parent().next("tbody").prepend($tr);this._changeCellTag($tr,"td");cellTag="th"}else{$tr[direction]($newTr)}}for(i=k=1,ref=colNum;1<=ref?k<=ref:k>=ref;i=1<=ref?++k:--k){$("<"+cellTag+"/>").append(this.editor.util.phBr).appendTo($newTr)}return this.editor.selection.setRangeAtStartOf($newTr.find("td, th").eq(index))};TableButton.prototype.deleteCol=function($td){var $newTd,$table,$tr,index,noOtherCol,noOtherRow;$tr=$td.parent("tr");noOtherRow=$tr.closest("table").find("tr").length<2;noOtherCol=$td.siblings("td, th").length<1;if(noOtherRow&&noOtherCol){return this.deleteTable($td)}else{index=$tr.find("td, th").index($td);$newTd=$td.next("td, th");if(!($newTd.length>0)){$newTd=$tr.prev("td, th")}$table=$tr.closest("table");$table.find("col").eq(index).remove();$table.find("tr").each(function(i,tr){return $(tr).find("td, th").eq(index).remove()});this.refreshTableWidth($table);return this.editor.selection.setRangeAtEndOf($newTd)}};TableButton.prototype.insertCol=function($td,direction){var $col,$newCol,$newTd,$table,$tr,index,tableWidth,width;if(direction==null){direction="after"}$tr=$td.parent("tr");index=$tr.find("td, th").index($td);$table=$td.closest("table");$col=$table.find("col").eq(index);$table.find("tr").each((function(_this){return function(i,tr){var $newTd,cellTag;cellTag=$(tr).parent().is("thead")?"th":"td";$newTd=$("<"+cellTag+"/>").append(_this.editor.util.phBr);return $(tr).find("td, th").eq(index)[direction]($newTd)}})(this));$newCol=$("<col/>");$col[direction]($newCol);tableWidth=$table.width();width=Math.max(parseFloat($col.attr("width"))/2,50/tableWidth*100);$col.attr("width",width+"%");$newCol.attr("width",width+"%");this.refreshTableWidth($table);$newTd=direction==="after"?$td.next("td, th"):$td.prev("td, th");return this.editor.selection.setRangeAtStartOf($newTd)};TableButton.prototype.deleteTable=function($td){var $block,$table;$table=$td.closest(".simditor-table");$block=$table.next("p");$table.remove();if($block.length>0){return this.editor.selection.setRangeAtStartOf($block)}};TableButton.prototype.command=function(param){var $td;$td=this.editor.selection.containerNode().closest("td, th");if(!($td.length>0)){return}if(param==="deleteRow"){this.deleteRow($td)}else{if(param==="insertRowAbove"){this.insertRow($td,"before")}else{if(param==="insertRowBelow"){this.insertRow($td)}else{if(param==="deleteCol"){this.deleteCol($td)}else{if(param==="insertColLeft"){this.insertCol($td,"before")}else{if(param==="insertColRight"){this.insertCol($td)}else{if(param==="deleteTable"){this.deleteTable($td)}else{return}}}}}}}return this.editor.trigger("valuechanged")};return TableButton})(Button);Simditor.Toolbar.addButton(TableButton);StrikethroughButton=(function(superClass){extend(StrikethroughButton,superClass);function StrikethroughButton(){return StrikethroughButton.__super__.constructor.apply(this,arguments)}StrikethroughButton.prototype.name="strikethrough";StrikethroughButton.prototype.icon="strikethrough";StrikethroughButton.prototype.htmlTag="strike";StrikethroughButton.prototype.disableTag="pre";StrikethroughButton.prototype._activeStatus=function(){var active;active=document.queryCommandState("strikethrough")===true;this.setActive(active);return this.active};StrikethroughButton.prototype.command=function(){document.execCommand("strikethrough");if(!this.editor.util.support.oninput){this.editor.trigger("valuechanged")}return $(document).trigger("selectionchange")};return StrikethroughButton})(Button);Simditor.Toolbar.addButton(StrikethroughButton);AlignmentButton=(function(superClass){extend(AlignmentButton,superClass);function AlignmentButton(){return AlignmentButton.__super__.constructor.apply(this,arguments)}AlignmentButton.prototype.name="alignment";AlignmentButton.prototype.icon="align-left";AlignmentButton.prototype.htmlTag="p, h1, h2, h3, h4, td, th";AlignmentButton.prototype._init=function(){this.menu=[{name:"left",text:this._t("alignLeft"),icon:"align-left",param:"left"},{name:"center",text:this._t("alignCenter"),icon:"align-center",param:"center"},{name:"right",text:this._t("alignRight"),icon:"align-right",param:"right"}]; |
|
32 |
+return AlignmentButton.__super__._init.call(this)};AlignmentButton.prototype.setActive=function(active,align){if(align==null){align="left"}if(align!=="left"&&align!=="center"&&align!=="right"){align="left"}if(align==="left"){AlignmentButton.__super__.setActive.call(this,false)}else{AlignmentButton.__super__.setActive.call(this,active)}this.el.removeClass("align-left align-center align-right");if(active){this.el.addClass("align-"+align)}this.setIcon("align-"+align);return this.menuEl.find(".menu-item").show().end().find(".menu-item-"+align).hide()};AlignmentButton.prototype._status=function(){this.nodes=this.editor.selection.nodes().filter(this.htmlTag);if(this.nodes.length<1){this.setDisabled(true);return this.setActive(false)}else{this.setDisabled(false);return this.setActive(true,this.nodes.first().css("text-align"))}};AlignmentButton.prototype.command=function(align){if(align!=="left"&&align!=="center"&&align!=="right"){throw new Error("simditor alignment button: invalid align "+align)}this.nodes.css({"text-align":align==="left"?"":align});this.editor.trigger("valuechanged");return this.editor.inputManager.throttledSelectionChanged()};return AlignmentButton})(Button);Simditor.Toolbar.addButton(AlignmentButton);return Simditor})); |
@@ -0,0 +1,789 @@ |
||
1 |
+(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.toMarkdown = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ |
|
2 |
+/* |
|
3 |
+ * to-markdown - an HTML to Markdown converter |
|
4 |
+ * |
|
5 |
+ * Copyright 2011+, Dom Christie |
|
6 |
+ * Licenced under the MIT licence |
|
7 |
+ * |
|
8 |
+ */ |
|
9 |
+ |
|
10 |
+'use strict' |
|
11 |
+ |
|
12 |
+var toMarkdown |
|
13 |
+var converters |
|
14 |
+var mdConverters = require('./lib/md-converters') |
|
15 |
+var gfmConverters = require('./lib/gfm-converters') |
|
16 |
+var HtmlParser = require('./lib/html-parser') |
|
17 |
+var collapse = require('collapse-whitespace') |
|
18 |
+ |
|
19 |
+/* |
|
20 |
+ * Utilities |
|
21 |
+ */ |
|
22 |
+ |
|
23 |
+var blocks = ['address', 'article', 'aside', 'audio', 'blockquote', 'body', |
|
24 |
+ 'canvas', 'center', 'dd', 'dir', 'div', 'dl', 'dt', 'fieldset', 'figcaption', |
|
25 |
+ 'figure', 'footer', 'form', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', |
|
26 |
+ 'header', 'hgroup', 'hr', 'html', 'isindex', 'li', 'main', 'menu', 'nav', |
|
27 |
+ 'noframes', 'noscript', 'ol', 'output', 'p', 'pre', 'section', 'table', |
|
28 |
+ 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr', 'ul' |
|
29 |
+] |
|
30 |
+ |
|
31 |
+function isBlock (node) { |
|
32 |
+ return blocks.indexOf(node.nodeName.toLowerCase()) !== -1 |
|
33 |
+} |
|
34 |
+ |
|
35 |
+var voids = [ |
|
36 |
+ 'area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', |
|
37 |
+ 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr' |
|
38 |
+] |
|
39 |
+ |
|
40 |
+function isVoid (node) { |
|
41 |
+ return voids.indexOf(node.nodeName.toLowerCase()) !== -1 |
|
42 |
+} |
|
43 |
+ |
|
44 |
+function htmlToDom (string) { |
|
45 |
+ var tree = new HtmlParser().parseFromString(string, 'text/html') |
|
46 |
+ collapse(tree.documentElement, isBlock) |
|
47 |
+ return tree |
|
48 |
+} |
|
49 |
+ |
|
50 |
+/* |
|
51 |
+ * Flattens DOM tree into single array |
|
52 |
+ */ |
|
53 |
+ |
|
54 |
+function bfsOrder (node) { |
|
55 |
+ var inqueue = [node] |
|
56 |
+ var outqueue = [] |
|
57 |
+ var elem |
|
58 |
+ var children |
|
59 |
+ var i |
|
60 |
+ |
|
61 |
+ while (inqueue.length > 0) { |
|
62 |
+ elem = inqueue.shift() |
|
63 |
+ outqueue.push(elem) |
|
64 |
+ children = elem.childNodes |
|
65 |
+ for (i = 0; i < children.length; i++) { |
|
66 |
+ if (children[i].nodeType === 1) inqueue.push(children[i]) |
|
67 |
+ } |
|
68 |
+ } |
|
69 |
+ outqueue.shift() |
|
70 |
+ return outqueue |
|
71 |
+} |
|
72 |
+ |
|
73 |
+/* |
|
74 |
+ * Contructs a Markdown string of replacement text for a given node |
|
75 |
+ */ |
|
76 |
+ |
|
77 |
+function getContent (node) { |
|
78 |
+ var text = '' |
|
79 |
+ for (var i = 0; i < node.childNodes.length; i++) { |
|
80 |
+ if (node.childNodes[i].nodeType === 1) { |
|
81 |
+ text += node.childNodes[i]._replacement |
|
82 |
+ } else if (node.childNodes[i].nodeType === 3) { |
|
83 |
+ text += node.childNodes[i].data |
|
84 |
+ } else continue |
|
85 |
+ } |
|
86 |
+ return text |
|
87 |
+} |
|
88 |
+ |
|
89 |
+/* |
|
90 |
+ * Returns the HTML string of an element with its contents converted |
|
91 |
+ */ |
|
92 |
+ |
|
93 |
+function outer (node, content) { |
|
94 |
+ return node.cloneNode(false).outerHTML.replace('><', '>' + content + '<') |
|
95 |
+} |
|
96 |
+ |
|
97 |
+function canConvert (node, filter) { |
|
98 |
+ if (typeof filter === 'string') { |
|
99 |
+ return filter === node.nodeName.toLowerCase() |
|
100 |
+ } |
|
101 |
+ if (Array.isArray(filter)) { |
|
102 |
+ return filter.indexOf(node.nodeName.toLowerCase()) !== -1 |
|
103 |
+ } else if (typeof filter === 'function') { |
|
104 |
+ return filter.call(toMarkdown, node) |
|
105 |
+ } else { |
|
106 |
+ throw new TypeError('`filter` needs to be a string, array, or function') |
|
107 |
+ } |
|
108 |
+} |
|
109 |
+ |
|
110 |
+function isFlankedByWhitespace (side, node) { |
|
111 |
+ var sibling |
|
112 |
+ var regExp |
|
113 |
+ var isFlanked |
|
114 |
+ |
|
115 |
+ if (side === 'left') { |
|
116 |
+ sibling = node.previousSibling |
|
117 |
+ regExp = / $/ |
|
118 |
+ } else { |
|
119 |
+ sibling = node.nextSibling |
|
120 |
+ regExp = /^ / |
|
121 |
+ } |
|
122 |
+ |
|
123 |
+ if (sibling) { |
|
124 |
+ if (sibling.nodeType === 3) { |
|
125 |
+ isFlanked = regExp.test(sibling.nodeValue) |
|
126 |
+ } else if (sibling.nodeType === 1 && !isBlock(sibling)) { |
|
127 |
+ isFlanked = regExp.test(sibling.textContent) |
|
128 |
+ } |
|
129 |
+ } |
|
130 |
+ return isFlanked |
|
131 |
+} |
|
132 |
+ |
|
133 |
+function flankingWhitespace (node, content) { |
|
134 |
+ var leading = '' |
|
135 |
+ var trailing = '' |
|
136 |
+ |
|
137 |
+ if (!isBlock(node)) { |
|
138 |
+ var hasLeading = /^[ \r\n\t]/.test(content) |
|
139 |
+ var hasTrailing = /[ \r\n\t]$/.test(content) |
|
140 |
+ |
|
141 |
+ if (hasLeading && !isFlankedByWhitespace('left', node)) { |
|
142 |
+ leading = ' ' |
|
143 |
+ } |
|
144 |
+ if (hasTrailing && !isFlankedByWhitespace('right', node)) { |
|
145 |
+ trailing = ' ' |
|
146 |
+ } |
|
147 |
+ } |
|
148 |
+ |
|
149 |
+ return { leading: leading, trailing: trailing } |
|
150 |
+} |
|
151 |
+ |
|
152 |
+/* |
|
153 |
+ * Finds a Markdown converter, gets the replacement, and sets it on |
|
154 |
+ * `_replacement` |
|
155 |
+ */ |
|
156 |
+ |
|
157 |
+function process (node) { |
|
158 |
+ var replacement |
|
159 |
+ var content = getContent(node) |
|
160 |
+ |
|
161 |
+ // Remove blank nodes |
|
162 |
+ if (!isVoid(node) && !/A|TH|TD/.test(node.nodeName) && /^\s*$/i.test(content)) { |
|
163 |
+ node._replacement = '' |
|
164 |
+ return |
|
165 |
+ } |
|
166 |
+ |
|
167 |
+ for (var i = 0; i < converters.length; i++) { |
|
168 |
+ var converter = converters[i] |
|
169 |
+ |
|
170 |
+ if (canConvert(node, converter.filter)) { |
|
171 |
+ if (typeof converter.replacement !== 'function') { |
|
172 |
+ throw new TypeError( |
|
173 |
+ '`replacement` needs to be a function that returns a string' |
|
174 |
+ ) |
|
175 |
+ } |
|
176 |
+ |
|
177 |
+ var whitespace = flankingWhitespace(node, content) |
|
178 |
+ |
|
179 |
+ if (whitespace.leading || whitespace.trailing) { |
|
180 |
+ content = content.trim() |
|
181 |
+ } |
|
182 |
+ replacement = whitespace.leading + |
|
183 |
+ converter.replacement.call(toMarkdown, content, node) + |
|
184 |
+ whitespace.trailing |
|
185 |
+ break |
|
186 |
+ } |
|
187 |
+ } |
|
188 |
+ |
|
189 |
+ node._replacement = replacement |
|
190 |
+} |
|
191 |
+ |
|
192 |
+toMarkdown = function (input, options) { |
|
193 |
+ options = options || {} |
|
194 |
+ |
|
195 |
+ if (typeof input !== 'string') { |
|
196 |
+ throw new TypeError(input + ' is not a string') |
|
197 |
+ } |
|
198 |
+ |
|
199 |
+ if (input === '') { |
|
200 |
+ return '' |
|
201 |
+ } |
|
202 |
+ |
|
203 |
+ // Escape potential ol triggers |
|
204 |
+ input = input.replace(/(\d+)\. /g, '$1\\. ') |
|
205 |
+ |
|
206 |
+ var clone = htmlToDom(input).body |
|
207 |
+ var nodes = bfsOrder(clone) |
|
208 |
+ var output |
|
209 |
+ |
|
210 |
+ converters = mdConverters.slice(0) |
|
211 |
+ if (options.gfm) { |
|
212 |
+ converters = gfmConverters.concat(converters) |
|
213 |
+ } |
|
214 |
+ |
|
215 |
+ if (options.converters) { |
|
216 |
+ converters = options.converters.concat(converters) |
|
217 |
+ } |
|
218 |
+ |
|
219 |
+ // Process through nodes in reverse (so deepest child elements are first). |
|
220 |
+ for (var i = nodes.length - 1; i >= 0; i--) { |
|
221 |
+ process(nodes[i]) |
|
222 |
+ } |
|
223 |
+ output = getContent(clone) |
|
224 |
+ |
|
225 |
+ return output.replace(/^[\t\r\n]+|[\t\r\n\s]+$/g, '') |
|
226 |
+ .replace(/\n\s+\n/g, '\n\n') |
|
227 |
+ .replace(/\n{3,}/g, '\n\n') |
|
228 |
+} |
|
229 |
+ |
|
230 |
+toMarkdown.isBlock = isBlock |
|
231 |
+toMarkdown.isVoid = isVoid |
|
232 |
+toMarkdown.outer = outer |
|
233 |
+ |
|
234 |
+module.exports = toMarkdown |
|
235 |
+ |
|
236 |
+},{"./lib/gfm-converters":2,"./lib/html-parser":3,"./lib/md-converters":4,"collapse-whitespace":7}],2:[function(require,module,exports){ |
|
237 |
+'use strict' |
|
238 |
+ |
|
239 |
+function cell (content, node) { |
|
240 |
+ var index = Array.prototype.indexOf.call(node.parentNode.childNodes, node) |
|
241 |
+ var prefix = ' ' |
|
242 |
+ if (index === 0) prefix = '| ' |
|
243 |
+ return prefix + content + ' |' |
|
244 |
+} |
|
245 |
+ |
|
246 |
+var highlightRegEx = /highlight highlight-(\S+)/ |
|
247 |
+ |
|
248 |
+module.exports = [ |
|
249 |
+ { |
|
250 |
+ filter: 'br', |
|
251 |
+ replacement: function () { |
|
252 |
+ return '\n' |
|
253 |
+ } |
|
254 |
+ }, |
|
255 |
+ { |
|
256 |
+ filter: ['del', 's', 'strike'], |
|
257 |
+ replacement: function (content) { |
|
258 |
+ return '~~' + content + '~~' |
|
259 |
+ } |
|
260 |
+ }, |
|
261 |
+ |
|
262 |
+ { |
|
263 |
+ filter: function (node) { |
|
264 |
+ return node.type === 'checkbox' && node.parentNode.nodeName === 'LI' |
|
265 |
+ }, |
|
266 |
+ replacement: function (content, node) { |
|
267 |
+ return (node.checked ? '[x]' : '[ ]') + ' ' |
|
268 |
+ } |
|
269 |
+ }, |
|
270 |
+ |
|
271 |
+ { |
|
272 |
+ filter: ['th', 'td'], |
|
273 |
+ replacement: function (content, node) { |
|
274 |
+ return cell(content, node) |
|
275 |
+ } |
|
276 |
+ }, |
|
277 |
+ |
|
278 |
+ { |
|
279 |
+ filter: 'tr', |
|
280 |
+ replacement: function (content, node) { |
|
281 |
+ var borderCells = '' |
|
282 |
+ var alignMap = { left: ':--', right: '--:', center: ':-:' } |
|
283 |
+ |
|
284 |
+ if (node.parentNode.nodeName === 'THEAD') { |
|
285 |
+ for (var i = 0; i < node.childNodes.length; i++) { |
|
286 |
+ var align = node.childNodes[i].attributes.align |
|
287 |
+ var border = '---' |
|
288 |
+ |
|
289 |
+ if (align) border = alignMap[align.value] || border |
|
290 |
+ |
|
291 |
+ borderCells += cell(border, node.childNodes[i]) |
|
292 |
+ } |
|
293 |
+ } |
|
294 |
+ return '\n' + content + (borderCells ? '\n' + borderCells : '') |
|
295 |
+ } |
|
296 |
+ }, |
|
297 |
+ |
|
298 |
+ { |
|
299 |
+ filter: 'table', |
|
300 |
+ replacement: function (content) { |
|
301 |
+ return '\n\n' + content + '\n\n' |
|
302 |
+ } |
|
303 |
+ }, |
|
304 |
+ |
|
305 |
+ { |
|
306 |
+ filter: ['thead', 'tbody', 'tfoot'], |
|
307 |
+ replacement: function (content) { |
|
308 |
+ return content |
|
309 |
+ } |
|
310 |
+ }, |
|
311 |
+ |
|
312 |
+ // Fenced code blocks |
|
313 |
+ { |
|
314 |
+ filter: function (node) { |
|
315 |
+ return node.nodeName === 'PRE' && |
|
316 |
+ node.firstChild && |
|
317 |
+ node.firstChild.nodeName === 'CODE' |
|
318 |
+ }, |
|
319 |
+ replacement: function (content, node) { |
|
320 |
+ return '\n\n```\n' + node.firstChild.textContent + '\n```\n\n' |
|
321 |
+ } |
|
322 |
+ }, |
|
323 |
+ |
|
324 |
+ // Syntax-highlighted code blocks |
|
325 |
+ { |
|
326 |
+ filter: function (node) { |
|
327 |
+ return node.nodeName === 'PRE' && |
|
328 |
+ node.parentNode.nodeName === 'DIV' && |
|
329 |
+ highlightRegEx.test(node.parentNode.className) |
|
330 |
+ }, |
|
331 |
+ replacement: function (content, node) { |
|
332 |
+ var language = node.parentNode.className.match(highlightRegEx)[1] |
|
333 |
+ return '\n\n```' + language + '\n' + node.textContent + '\n```\n\n' |
|
334 |
+ } |
|
335 |
+ }, |
|
336 |
+ |
|
337 |
+ { |
|
338 |
+ filter: function (node) { |
|
339 |
+ return node.nodeName === 'DIV' && |
|
340 |
+ highlightRegEx.test(node.className) |
|
341 |
+ }, |
|
342 |
+ replacement: function (content) { |
|
343 |
+ return '\n\n' + content + '\n\n' |
|
344 |
+ } |
|
345 |
+ } |
|
346 |
+] |
|
347 |
+ |
|
348 |
+},{}],3:[function(require,module,exports){ |
|
349 |
+/* |
|
350 |
+ * Set up window for Node.js |
|
351 |
+ */ |
|
352 |
+ |
|
353 |
+var _window = (typeof window !== 'undefined' ? window : this) |
|
354 |
+ |
|
355 |
+/* |
|
356 |
+ * Parsing HTML strings |
|
357 |
+ */ |
|
358 |
+ |
|
359 |
+function canParseHtmlNatively () { |
|
360 |
+ var Parser = _window.DOMParser |
|
361 |
+ var canParse = false |
|
362 |
+ |
|
363 |
+ // Adapted from https://gist.github.com/1129031 |
|
364 |
+ // Firefox/Opera/IE throw errors on unsupported types |
|
365 |
+ try { |
|
366 |
+ // WebKit returns null on unsupported types |
|
367 |
+ if (new Parser().parseFromString('', 'text/html')) { |
|
368 |
+ canParse = true |
|
369 |
+ } |
|
370 |
+ } catch (e) {} |
|
371 |
+ |
|
372 |
+ return canParse |
|
373 |
+} |
|
374 |
+ |
|
375 |
+function createHtmlParser () { |
|
376 |
+ var Parser = function () {} |
|
377 |
+ |
|
378 |
+ // For Node.js environments |
|
379 |
+ if (typeof document === 'undefined') { |
|
380 |
+ var jsdom = require('jsdom') |
|
381 |
+ Parser.prototype.parseFromString = function (string) { |
|
382 |
+ return jsdom.jsdom(string, { |
|
383 |
+ features: { |
|
384 |
+ FetchExternalResources: [], |
|
385 |
+ ProcessExternalResources: false |
|
386 |
+ } |
|
387 |
+ }) |
|
388 |
+ } |
|
389 |
+ } else { |
|
390 |
+ if (!shouldUseActiveX()) { |
|
391 |
+ Parser.prototype.parseFromString = function (string) { |
|
392 |
+ var doc = document.implementation.createHTMLDocument('') |
|
393 |
+ doc.open() |
|
394 |
+ doc.write(string) |
|
395 |
+ doc.close() |
|
396 |
+ return doc |
|
397 |
+ } |
|
398 |
+ } else { |
|
399 |
+ Parser.prototype.parseFromString = function (string) { |
|
400 |
+ var doc = new window.ActiveXObject('htmlfile') |
|
401 |
+ doc.designMode = 'on' // disable on-page scripts |
|
402 |
+ doc.open() |
|
403 |
+ doc.write(string) |
|
404 |
+ doc.close() |
|
405 |
+ return doc |
|
406 |
+ } |
|
407 |
+ } |
|
408 |
+ } |
|
409 |
+ return Parser |
|
410 |
+} |
|
411 |
+ |
|
412 |
+function shouldUseActiveX () { |
|
413 |
+ var useActiveX = false |
|
414 |
+ |
|
415 |
+ try { |
|
416 |
+ document.implementation.createHTMLDocument('').open() |
|
417 |
+ } catch (e) { |
|
418 |
+ if (window.ActiveXObject) useActiveX = true |
|
419 |
+ } |
|
420 |
+ |
|
421 |
+ return useActiveX |
|
422 |
+} |
|
423 |
+ |
|
424 |
+module.exports = canParseHtmlNatively() ? _window.DOMParser : createHtmlParser() |
|
425 |
+ |
|
426 |
+},{"jsdom":6}],4:[function(require,module,exports){ |
|
427 |
+'use strict' |
|
428 |
+ |
|
429 |
+module.exports = [ |
|
430 |
+ { |
|
431 |
+ filter: 'p', |
|
432 |
+ replacement: function (content) { |
|
433 |
+ return '\n\n' + content + '\n\n' |
|
434 |
+ } |
|
435 |
+ }, |
|
436 |
+ |
|
437 |
+ { |
|
438 |
+ filter: 'br', |
|
439 |
+ replacement: function () { |
|
440 |
+ return ' \n' |
|
441 |
+ } |
|
442 |
+ }, |
|
443 |
+ |
|
444 |
+ { |
|
445 |
+ filter: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'], |
|
446 |
+ replacement: function (content, node) { |
|
447 |
+ var hLevel = node.nodeName.charAt(1) |
|
448 |
+ var hPrefix = '' |
|
449 |
+ for (var i = 0; i < hLevel; i++) { |
|
450 |
+ hPrefix += '#' |
|
451 |
+ } |
|
452 |
+ return '\n\n' + hPrefix + ' ' + content + '\n\n' |
|
453 |
+ } |
|
454 |
+ }, |
|
455 |
+ |
|
456 |
+ { |
|
457 |
+ filter: 'hr', |
|
458 |
+ replacement: function () { |
|
459 |
+ return '\n\n* * *\n\n' |
|
460 |
+ } |
|
461 |
+ }, |
|
462 |
+ |
|
463 |
+ { |
|
464 |
+ filter: ['em', 'i'], |
|
465 |
+ replacement: function (content) { |
|
466 |
+ return '_' + content + '_' |
|
467 |
+ } |
|
468 |
+ }, |
|
469 |
+ |
|
470 |
+ { |
|
471 |
+ filter: ['strong', 'b'], |
|
472 |
+ replacement: function (content) { |
|
473 |
+ return '**' + content + '**' |
|
474 |
+ } |
|
475 |
+ }, |
|
476 |
+ |
|
477 |
+ // Inline code |
|
478 |
+ { |
|
479 |
+ filter: function (node) { |
|
480 |
+ var hasSiblings = node.previousSibling || node.nextSibling |
|
481 |
+ var isCodeBlock = node.parentNode.nodeName === 'PRE' && !hasSiblings |
|
482 |
+ |
|
483 |
+ return node.nodeName === 'CODE' && !isCodeBlock |
|
484 |
+ }, |
|
485 |
+ replacement: function (content) { |
|
486 |
+ return '`' + content + '`' |
|
487 |
+ } |
|
488 |
+ }, |
|
489 |
+ |
|
490 |
+ { |
|
491 |
+ filter: function (node) { |
|
492 |
+ return node.nodeName === 'A' && node.getAttribute('href') |
|
493 |
+ }, |
|
494 |
+ replacement: function (content, node) { |
|
495 |
+ var titlePart = node.title ? ' "' + node.title + '"' : '' |
|
496 |
+ return '[' + content + '](' + node.getAttribute('href') + titlePart + ')' |
|
497 |
+ } |
|
498 |
+ }, |
|
499 |
+ |
|
500 |
+ { |
|
501 |
+ filter: 'img', |
|
502 |
+ replacement: function (content, node) { |
|
503 |
+ var alt = node.alt || '' |
|
504 |
+ var src = node.getAttribute('src') || '' |
|
505 |
+ var title = node.title || '' |
|
506 |
+ var titlePart = title ? ' "' + title + '"' : '' |
|
507 |
+ return src ? '![' + alt + ']' + '(' + src + titlePart + ')' : '' |
|
508 |
+ } |
|
509 |
+ }, |
|
510 |
+ |
|
511 |
+ // Code blocks |
|
512 |
+ { |
|
513 |
+ filter: function (node) { |
|
514 |
+ return node.nodeName === 'PRE' && node.firstChild.nodeName === 'CODE' |
|
515 |
+ }, |
|
516 |
+ replacement: function (content, node) { |
|
517 |
+ return '\n\n ' + node.firstChild.textContent.replace(/\n/g, '\n ') + '\n\n' |
|
518 |
+ } |
|
519 |
+ }, |
|
520 |
+ |
|
521 |
+ { |
|
522 |
+ filter: 'blockquote', |
|
523 |
+ replacement: function (content) { |
|
524 |
+ content = content.trim() |
|
525 |
+ content = content.replace(/\n{3,}/g, '\n\n') |
|
526 |
+ content = content.replace(/^/gm, '> ') |
|
527 |
+ return '\n\n' + content + '\n\n' |
|
528 |
+ } |
|
529 |
+ }, |
|
530 |
+ |
|
531 |
+ { |
|
532 |
+ filter: 'li', |
|
533 |
+ replacement: function (content, node) { |
|
534 |
+ content = content.replace(/^\s+/, '').replace(/\n/gm, '\n ') |
|
535 |
+ var prefix = '* ' |
|
536 |
+ var parent = node.parentNode |
|
537 |
+ var index = Array.prototype.indexOf.call(parent.children, node) + 1 |
|
538 |
+ |
|
539 |
+ prefix = /ol/i.test(parent.nodeName) ? index + '. ' : '* ' |
|
540 |
+ return prefix + content |
|
541 |
+ } |
|
542 |
+ }, |
|
543 |
+ |
|
544 |
+ { |
|
545 |
+ filter: ['ul', 'ol'], |
|
546 |
+ replacement: function (content, node) { |
|
547 |
+ var strings = [] |
|
548 |
+ for (var i = 0; i < node.childNodes.length; i++) { |
|
549 |
+ strings.push(node.childNodes[i]._replacement) |
|
550 |
+ } |
|
551 |
+ |
|
552 |
+ if (/li/i.test(node.parentNode.nodeName)) { |
|
553 |
+ return '\n' + strings.join('\n') |
|
554 |
+ } |
|
555 |
+ return '\n\n' + strings.join('\n') + '\n\n' |
|
556 |
+ } |
|
557 |
+ }, |
|
558 |
+ |
|
559 |
+ { |
|
560 |
+ filter: function (node) { |
|
561 |
+ return this.isBlock(node) |
|
562 |
+ }, |
|
563 |
+ replacement: function (content, node) { |
|
564 |
+ return '\n\n' + this.outer(node, content) + '\n\n' |
|
565 |
+ } |
|
566 |
+ }, |
|
567 |
+ |
|
568 |
+ // Anything else! |
|
569 |
+ { |
|
570 |
+ filter: function () { |
|
571 |
+ return true |
|
572 |
+ }, |
|
573 |
+ replacement: function (content, node) { |
|
574 |
+ return this.outer(node, content) |
|
575 |
+ } |
|
576 |
+ } |
|
577 |
+] |
|
578 |
+ |
|
579 |
+},{}],5:[function(require,module,exports){ |
|
580 |
+/** |
|
581 |
+ * This file automatically generated from `build.js`. |
|
582 |
+ * Do not manually edit. |
|
583 |
+ */ |
|
584 |
+ |
|
585 |
+module.exports = [ |
|
586 |
+ "address", |
|
587 |
+ "article", |
|
588 |
+ "aside", |
|
589 |
+ "audio", |
|
590 |
+ "blockquote", |
|
591 |
+ "canvas", |
|
592 |
+ "dd", |
|
593 |
+ "div", |
|
594 |
+ "dl", |
|
595 |
+ "fieldset", |
|
596 |
+ "figcaption", |
|
597 |
+ "figure", |
|
598 |
+ "footer", |
|
599 |
+ "form", |
|
600 |
+ "h1", |
|
601 |
+ "h2", |
|
602 |
+ "h3", |
|
603 |
+ "h4", |
|
604 |
+ "h5", |
|
605 |
+ "h6", |
|
606 |
+ "header", |
|
607 |
+ "hgroup", |
|
608 |
+ "hr", |
|
609 |
+ "main", |
|
610 |
+ "nav", |
|
611 |
+ "noscript", |
|
612 |
+ "ol", |
|
613 |
+ "output", |
|
614 |
+ "p", |
|
615 |
+ "pre", |
|
616 |
+ "section", |
|
617 |
+ "table", |
|
618 |
+ "tfoot", |
|
619 |
+ "ul", |
|
620 |
+ "video" |
|
621 |
+]; |
|
622 |
+ |
|
623 |
+},{}],6:[function(require,module,exports){ |
|
624 |
+ |
|
625 |
+},{}],7:[function(require,module,exports){ |
|
626 |
+'use strict'; |
|
627 |
+ |
|
628 |
+var voidElements = require('void-elements'); |
|
629 |
+Object.keys(voidElements).forEach(function (name) { |
|
630 |
+ voidElements[name.toUpperCase()] = 1; |
|
631 |
+}); |
|
632 |
+ |
|
633 |
+var blockElements = {}; |
|
634 |
+require('block-elements').forEach(function (name) { |
|
635 |
+ blockElements[name.toUpperCase()] = 1; |
|
636 |
+}); |
|
637 |
+ |
|
638 |
+/** |
|
639 |
+ * isBlockElem(node) determines if the given node is a block element. |
|
640 |
+ * |
|
641 |
+ * @param {Node} node |
|
642 |
+ * @return {Boolean} |
|
643 |
+ */ |
|
644 |
+function isBlockElem(node) { |
|
645 |
+ return !!(node && blockElements[node.nodeName]); |
|
646 |
+} |
|
647 |
+ |
|
648 |
+/** |
|
649 |
+ * isVoid(node) determines if the given node is a void element. |
|
650 |
+ * |
|
651 |
+ * @param {Node} node |
|
652 |
+ * @return {Boolean} |
|
653 |
+ */ |
|
654 |
+function isVoid(node) { |
|
655 |
+ return !!(node && voidElements[node.nodeName]); |
|
656 |
+} |
|
657 |
+ |
|
658 |
+/** |
|
659 |
+ * whitespace(elem [, isBlock]) removes extraneous whitespace from an |
|
660 |
+ * the given element. The function isBlock may optionally be passed in |
|
661 |
+ * to determine whether or not an element is a block element; if none |
|
662 |
+ * is provided, defaults to using the list of block elements provided |
|
663 |
+ * by the `block-elements` module. |
|
664 |
+ * |
|
665 |
+ * @param {Node} elem |
|
666 |
+ * @param {Function} blockTest |
|
667 |
+ */ |
|
668 |
+function collapseWhitespace(elem, isBlock) { |
|
669 |
+ if (!elem.firstChild || elem.nodeName === 'PRE') return; |
|
670 |
+ |
|
671 |
+ if (typeof isBlock !== 'function') { |
|
672 |
+ isBlock = isBlockElem; |
|
673 |
+ } |
|
674 |
+ |
|
675 |
+ var prevText = null; |
|
676 |
+ var prevVoid = false; |
|
677 |
+ |
|
678 |
+ var prev = null; |
|
679 |
+ var node = next(prev, elem); |
|
680 |
+ |
|
681 |
+ while (node !== elem) { |
|
682 |
+ if (node.nodeType === 3) { |
|
683 |
+ // Node.TEXT_NODE |
|
684 |
+ var text = node.data.replace(/[ \r\n\t]+/g, ' '); |
|
685 |
+ |
|
686 |
+ if ((!prevText || / $/.test(prevText.data)) && !prevVoid && text[0] === ' ') { |
|
687 |
+ text = text.substr(1); |
|
688 |
+ } |
|
689 |
+ |
|
690 |
+ // `text` might be empty at this point. |
|
691 |
+ if (!text) { |
|
692 |
+ node = remove(node); |
|
693 |
+ continue; |
|
694 |
+ } |
|
695 |
+ |
|
696 |
+ node.data = text; |
|
697 |
+ prevText = node; |
|
698 |
+ } else if (node.nodeType === 1) { |
|
699 |
+ // Node.ELEMENT_NODE |
|
700 |
+ if (isBlock(node) || node.nodeName === 'BR') { |
|
701 |
+ if (prevText) { |
|
702 |
+ prevText.data = prevText.data.replace(/ $/, ''); |
|
703 |
+ } |
|
704 |
+ |
|
705 |
+ prevText = null; |
|
706 |
+ prevVoid = false; |
|
707 |
+ } else if (isVoid(node)) { |
|
708 |
+ // Avoid trimming space around non-block, non-BR void elements. |
|
709 |
+ prevText = null; |
|
710 |
+ prevVoid = true; |
|
711 |
+ } |
|
712 |
+ } else { |
|
713 |
+ node = remove(node); |
|
714 |
+ continue; |
|
715 |
+ } |
|
716 |
+ |
|
717 |
+ var nextNode = next(prev, node); |
|
718 |
+ prev = node; |
|
719 |
+ node = nextNode; |
|
720 |
+ } |
|
721 |
+ |
|
722 |
+ if (prevText) { |
|
723 |
+ prevText.data = prevText.data.replace(/ $/, ''); |
|
724 |
+ if (!prevText.data) { |
|
725 |
+ remove(prevText); |
|
726 |
+ } |
|
727 |
+ } |
|
728 |
+} |
|
729 |
+ |
|
730 |
+/** |
|
731 |
+ * remove(node) removes the given node from the DOM and returns the |
|
732 |
+ * next node in the sequence. |
|
733 |
+ * |
|
734 |
+ * @param {Node} node |
|
735 |
+ * @return {Node} node |
|
736 |
+ */ |
|
737 |
+function remove(node) { |
|
738 |
+ var next = node.nextSibling || node.parentNode; |
|
739 |
+ |
|
740 |
+ node.parentNode.removeChild(node); |
|
741 |
+ |
|
742 |
+ return next; |
|
743 |
+} |
|
744 |
+ |
|
745 |
+/** |
|
746 |
+ * next(prev, current) returns the next node in the sequence, given the |
|
747 |
+ * current and previous nodes. |
|
748 |
+ * |
|
749 |
+ * @param {Node} prev |
|
750 |
+ * @param {Node} current |
|
751 |
+ * @return {Node} |
|
752 |
+ */ |
|
753 |
+function next(prev, current) { |
|
754 |
+ if (prev && prev.parentNode === current || current.nodeName === 'PRE') { |
|
755 |
+ return current.nextSibling || current.parentNode; |
|
756 |
+ } |
|
757 |
+ |
|
758 |
+ return current.firstChild || current.nextSibling || current.parentNode; |
|
759 |
+} |
|
760 |
+ |
|
761 |
+module.exports = collapseWhitespace; |
|
762 |
+ |
|
763 |
+},{"block-elements":5,"void-elements":8}],8:[function(require,module,exports){ |
|
764 |
+/** |
|
765 |
+ * This file automatically generated from `pre-publish.js`. |
|
766 |
+ * Do not manually edit. |
|
767 |
+ */ |
|
768 |
+ |
|
769 |
+module.exports = { |
|
770 |
+ "area": true, |
|
771 |
+ "base": true, |
|
772 |
+ "br": true, |
|
773 |
+ "col": true, |
|
774 |
+ "embed": true, |
|
775 |
+ "hr": true, |
|
776 |
+ "img": true, |
|
777 |
+ "input": true, |
|
778 |
+ "keygen": true, |
|
779 |
+ "link": true, |
|
780 |
+ "menuitem": true, |
|
781 |
+ "meta": true, |
|
782 |
+ "param": true, |
|
783 |
+ "source": true, |
|
784 |
+ "track": true, |
|
785 |
+ "wbr": true |
|
786 |
+}; |
|
787 |
+ |
|
788 |
+},{}]},{},[1])(1) |
|
789 |
+}); |
@@ -0,0 +1,3 @@ |
||
1 |
+(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else{if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else{if(typeof global!=="undefined"){g=global}else{if(typeof self!=="undefined"){g=self}else{g=this}}}g.toMarkdown=f()}}})(function(){var define,module,exports;return(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a){return a(o,!0)}if(i){return i(o,!0)}var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++){s(r[o])}return s})({1:[function(require,module,exports){var toMarkdown;var converters;var mdConverters=require("./lib/md-converters");var gfmConverters=require("./lib/gfm-converters");var HtmlParser=require("./lib/html-parser");var collapse=require("collapse-whitespace");var blocks=["address","article","aside","audio","blockquote","body","canvas","center","dd","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frameset","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","isindex","li","main","menu","nav","noframes","noscript","ol","output","p","pre","section","table","tbody","td","tfoot","th","thead","tr","ul"];function isBlock(node){return blocks.indexOf(node.nodeName.toLowerCase())!==-1}var voids=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"];function isVoid(node){return voids.indexOf(node.nodeName.toLowerCase())!==-1}function htmlToDom(string){var tree=new HtmlParser().parseFromString(string,"text/html");collapse(tree.documentElement,isBlock);return tree}function bfsOrder(node){var inqueue=[node];var outqueue=[];var elem;var children;var i;while(inqueue.length>0){elem=inqueue.shift();outqueue.push(elem);children=elem.childNodes;for(i=0;i<children.length;i++){if(children[i].nodeType===1){inqueue.push(children[i])}}}outqueue.shift();return outqueue}function getContent(node){var text="";for(var i=0;i<node.childNodes.length;i++){if(node.childNodes[i].nodeType===1){text+=node.childNodes[i]._replacement}else{if(node.childNodes[i].nodeType===3){text+=node.childNodes[i].data}else{continue}}}return text}function outer(node,content){return node.cloneNode(false).outerHTML.replace("><",">"+content+"<")}function canConvert(node,filter){if(typeof filter==="string"){return filter===node.nodeName.toLowerCase()}if(Array.isArray(filter)){return filter.indexOf(node.nodeName.toLowerCase())!==-1}else{if(typeof filter==="function"){return filter.call(toMarkdown,node)}else{throw new TypeError("`filter` needs to be a string, array, or function")}}}function isFlankedByWhitespace(side,node){var sibling;var regExp;var isFlanked;if(side==="left"){sibling=node.previousSibling;regExp=/ $/}else{sibling=node.nextSibling;regExp=/^ /}if(sibling){if(sibling.nodeType===3){isFlanked=regExp.test(sibling.nodeValue)}else{if(sibling.nodeType===1&&!isBlock(sibling)){isFlanked=regExp.test(sibling.textContent)}}}return isFlanked}function flankingWhitespace(node,content){var leading="";var trailing="";if(!isBlock(node)){var hasLeading=/^[ \r\n\t]/.test(content);var hasTrailing=/[ \r\n\t]$/.test(content);if(hasLeading&&!isFlankedByWhitespace("left",node)){leading=" "}if(hasTrailing&&!isFlankedByWhitespace("right",node)){trailing=" "}}return{leading:leading,trailing:trailing}}function process(node){var replacement;var content=getContent(node);if(!isVoid(node)&&!/A|TH|TD/.test(node.nodeName)&&/^\s*$/i.test(content)){node._replacement="";return}for(var i=0;i<converters.length;i++){var converter=converters[i];if(canConvert(node,converter.filter)){if(typeof converter.replacement!=="function"){throw new TypeError("`replacement` needs to be a function that returns a string")}var whitespace=flankingWhitespace(node,content);if(whitespace.leading||whitespace.trailing){content=content.trim()}replacement=whitespace.leading+converter.replacement.call(toMarkdown,content,node)+whitespace.trailing;break}}node._replacement=replacement}toMarkdown=function(input,options){options=options||{};if(typeof input!=="string"){throw new TypeError(input+" is not a string")}if(input===""){return""}input=input.replace(/(\d+)\. /g,"$1\\. ");var clone=htmlToDom(input).body;var nodes=bfsOrder(clone);var output;converters=mdConverters.slice(0);if(options.gfm){converters=gfmConverters.concat(converters)}if(options.converters){converters=options.converters.concat(converters)}for(var i=nodes.length-1;i>=0;i--){process(nodes[i])}output=getContent(clone);return output.replace(/^[\t\r\n]+|[\t\r\n\s]+$/g,"").replace(/\n\s+\n/g,"\n\n").replace(/\n{3,}/g,"\n\n")};toMarkdown.isBlock=isBlock;toMarkdown.isVoid=isVoid;toMarkdown.outer=outer;module.exports=toMarkdown},{"./lib/gfm-converters":2,"./lib/html-parser":3,"./lib/md-converters":4,"collapse-whitespace":7}],2:[function(require,module,exports){function cell(content,node){var index=Array.prototype.indexOf.call(node.parentNode.childNodes,node); |
|
2 |
+var prefix=" ";if(index===0){prefix="| "}return prefix+content+" |"}var highlightRegEx=/highlight highlight-(\S+)/;module.exports=[{filter:"br",replacement:function(){return"\n"}},{filter:["del","s","strike"],replacement:function(content){return"~~"+content+"~~"}},{filter:function(node){return node.type==="checkbox"&&node.parentNode.nodeName==="LI"},replacement:function(content,node){return(node.checked?"[x]":"[ ]")+" "}},{filter:["th","td"],replacement:function(content,node){return cell(content,node)}},{filter:"tr",replacement:function(content,node){var borderCells="";var alignMap={left:":--",right:"--:",center:":-:"};if(node.parentNode.nodeName==="THEAD"){for(var i=0;i<node.childNodes.length;i++){var align=node.childNodes[i].attributes.align;var border="---";if(align){border=alignMap[align.value]||border}borderCells+=cell(border,node.childNodes[i])}}return"\n"+content+(borderCells?"\n"+borderCells:"")}},{filter:"table",replacement:function(content){return"\n\n"+content+"\n\n"}},{filter:["thead","tbody","tfoot"],replacement:function(content){return content}},{filter:function(node){return node.nodeName==="PRE"&&node.firstChild&&node.firstChild.nodeName==="CODE"},replacement:function(content,node){return"\n\n```\n"+node.firstChild.textContent+"\n```\n\n"}},{filter:function(node){return node.nodeName==="PRE"&&node.parentNode.nodeName==="DIV"&&highlightRegEx.test(node.parentNode.className)},replacement:function(content,node){var language=node.parentNode.className.match(highlightRegEx)[1];return"\n\n```"+language+"\n"+node.textContent+"\n```\n\n"}},{filter:function(node){return node.nodeName==="DIV"&&highlightRegEx.test(node.className)},replacement:function(content){return"\n\n"+content+"\n\n"}}]},{}],3:[function(require,module,exports){var _window=(typeof window!=="undefined"?window:this);function canParseHtmlNatively(){var Parser=_window.DOMParser;var canParse=false;try{if(new Parser().parseFromString("","text/html")){canParse=true}}catch(e){}return canParse}function createHtmlParser(){var Parser=function(){};if(typeof document==="undefined"){var jsdom=require("jsdom");Parser.prototype.parseFromString=function(string){return jsdom.jsdom(string,{features:{FetchExternalResources:[],ProcessExternalResources:false}})}}else{if(!shouldUseActiveX()){Parser.prototype.parseFromString=function(string){var doc=document.implementation.createHTMLDocument("");doc.open();doc.write(string);doc.close();return doc}}else{Parser.prototype.parseFromString=function(string){var doc=new window.ActiveXObject("htmlfile");doc.designMode="on";doc.open();doc.write(string);doc.close();return doc}}}return Parser}function shouldUseActiveX(){var useActiveX=false;try{document.implementation.createHTMLDocument("").open()}catch(e){if(window.ActiveXObject){useActiveX=true}}return useActiveX}module.exports=canParseHtmlNatively()?_window.DOMParser:createHtmlParser()},{"jsdom":6}],4:[function(require,module,exports){module.exports=[{filter:"p",replacement:function(content){return"\n\n"+content+"\n\n"}},{filter:"br",replacement:function(){return" \n"}},{filter:["h1","h2","h3","h4","h5","h6"],replacement:function(content,node){var hLevel=node.nodeName.charAt(1);var hPrefix="";for(var i=0;i<hLevel;i++){hPrefix+="#"}return"\n\n"+hPrefix+" "+content+"\n\n"}},{filter:"hr",replacement:function(){return"\n\n* * *\n\n"}},{filter:["em","i"],replacement:function(content){return"_"+content+"_"}},{filter:["strong","b"],replacement:function(content){return"**"+content+"**"}},{filter:function(node){var hasSiblings=node.previousSibling||node.nextSibling;var isCodeBlock=node.parentNode.nodeName==="PRE"&&!hasSiblings;return node.nodeName==="CODE"&&!isCodeBlock},replacement:function(content){return"`"+content+"`"}},{filter:function(node){return node.nodeName==="A"&&node.getAttribute("href")},replacement:function(content,node){var titlePart=node.title?' "'+node.title+'"':"";return"["+content+"]("+node.getAttribute("href")+titlePart+")"}},{filter:"img",replacement:function(content,node){var alt=node.alt||"";var src=node.getAttribute("src")||"";var title=node.title||"";var titlePart=title?' "'+title+'"':"";return src?"!["+alt+"]"+"("+src+titlePart+")":""}},{filter:function(node){return node.nodeName==="PRE"&&node.firstChild.nodeName==="CODE"},replacement:function(content,node){return"\n\n "+node.firstChild.textContent.replace(/\n/g,"\n ")+"\n\n"}},{filter:"blockquote",replacement:function(content){content=content.trim();content=content.replace(/\n{3,}/g,"\n\n");content=content.replace(/^/gm,"> ");return"\n\n"+content+"\n\n"}},{filter:"li",replacement:function(content,node){content=content.replace(/^\s+/,"").replace(/\n/gm,"\n ");var prefix="* ";var parent=node.parentNode;var index=Array.prototype.indexOf.call(parent.children,node)+1;prefix=/ol/i.test(parent.nodeName)?index+". ":"* ";return prefix+content}},{filter:["ul","ol"],replacement:function(content,node){var strings=[];for(var i=0;i<node.childNodes.length;i++){strings.push(node.childNodes[i]._replacement) |
|
3 |
+}if(/li/i.test(node.parentNode.nodeName)){return"\n"+strings.join("\n")}return"\n\n"+strings.join("\n")+"\n\n"}},{filter:function(node){return this.isBlock(node)},replacement:function(content,node){return"\n\n"+this.outer(node,content)+"\n\n"}},{filter:function(){return true},replacement:function(content,node){return this.outer(node,content)}}]},{}],5:[function(require,module,exports){module.exports=["address","article","aside","audio","blockquote","canvas","dd","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","main","nav","noscript","ol","output","p","pre","section","table","tfoot","ul","video"]},{}],6:[function(require,module,exports){},{}],7:[function(require,module,exports){var voidElements=require("void-elements");Object.keys(voidElements).forEach(function(name){voidElements[name.toUpperCase()]=1});var blockElements={};require("block-elements").forEach(function(name){blockElements[name.toUpperCase()]=1});function isBlockElem(node){return !!(node&&blockElements[node.nodeName])}function isVoid(node){return !!(node&&voidElements[node.nodeName])}function collapseWhitespace(elem,isBlock){if(!elem.firstChild||elem.nodeName==="PRE"){return}if(typeof isBlock!=="function"){isBlock=isBlockElem}var prevText=null;var prevVoid=false;var prev=null;var node=next(prev,elem);while(node!==elem){if(node.nodeType===3){var text=node.data.replace(/[ \r\n\t]+/g," ");if((!prevText||/ $/.test(prevText.data))&&!prevVoid&&text[0]===" "){text=text.substr(1)}if(!text){node=remove(node);continue}node.data=text;prevText=node}else{if(node.nodeType===1){if(isBlock(node)||node.nodeName==="BR"){if(prevText){prevText.data=prevText.data.replace(/ $/,"")}prevText=null;prevVoid=false}else{if(isVoid(node)){prevText=null;prevVoid=true}}}else{node=remove(node);continue}}var nextNode=next(prev,node);prev=node;node=nextNode}if(prevText){prevText.data=prevText.data.replace(/ $/,"");if(!prevText.data){remove(prevText)}}}function remove(node){var next=node.nextSibling||node.parentNode;node.parentNode.removeChild(node);return next}function next(prev,current){if(prev&&prev.parentNode===current||current.nodeName==="PRE"){return current.nextSibling||current.parentNode}return current.firstChild||current.nextSibling||current.parentNode}module.exports=collapseWhitespace},{"block-elements":5,"void-elements":8}],8:[function(require,module,exports){module.exports={"area":true,"base":true,"br":true,"col":true,"embed":true,"hr":true,"img":true,"input":true,"keygen":true,"link":true,"menuitem":true,"meta":true,"param":true,"source":true,"track":true,"wbr":true}},{}]},{},[1])(1)}); |
@@ -0,0 +1,261 @@ |
||
1 |
+(function (root, factory) { |
|
2 |
+ if (typeof define === 'function' && define.amd) { |
|
3 |
+ // AMD. Register as an anonymous module unless amdModuleId is set |
|
4 |
+ define('simple-uploader', ["jquery","simple-module"], function ($, SimpleModule) { |
|
5 |
+ return (root['uploader'] = factory($, SimpleModule)); |
|
6 |
+ }); |
|
7 |
+ } else if (typeof exports === 'object') { |
|
8 |
+ // Node. Does not work with strict CommonJS, but |
|
9 |
+ // only CommonJS-like environments that support module.exports, |
|
10 |
+ // like Node. |
|
11 |
+ module.exports = factory(require("jquery"),require("simple-module")); |
|
12 |
+ } else { |
|
13 |
+ root.simple = root.simple || {}; |
|
14 |
+ root.simple['uploader'] = factory(jQuery,SimpleModule); |
|
15 |
+ } |
|
16 |
+}(this, function ($, SimpleModule) { |
|
17 |
+ |
|
18 |
+var Uploader, uploader, |
|
19 |
+ 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; }, |
|
20 |
+ hasProp = {}.hasOwnProperty; |
|
21 |
+ |
|
22 |
+Uploader = (function(superClass) { |
|
23 |
+ extend(Uploader, superClass); |
|
24 |
+ |
|
25 |
+ function Uploader() { |
|
26 |
+ return Uploader.__super__.constructor.apply(this, arguments); |
|
27 |
+ } |
|
28 |
+ |
|
29 |
+ Uploader.count = 0; |
|
30 |
+ |
|
31 |
+ Uploader.prototype.opts = { |
|
32 |
+ url: '', |
|
33 |
+ params: null, |
|
34 |
+ fileKey: 'upload_file', |
|
35 |
+ connectionCount: 3 |
|
36 |
+ }; |
|
37 |
+ |
|
38 |
+ Uploader.prototype._init = function() { |
|
39 |
+ this.files = []; |
|
40 |
+ this.queue = []; |
|
41 |
+ this.id = ++Uploader.count; |
|
42 |
+ this.on('uploadcomplete', (function(_this) { |
|
43 |
+ return function(e, file) { |
|
44 |
+ _this.files.splice($.inArray(file, _this.files), 1); |
|
45 |
+ if (_this.queue.length > 0 && _this.files.length < _this.opts.connectionCount) { |
|
46 |
+ return _this.upload(_this.queue.shift()); |
|
47 |
+ } else { |
|
48 |
+ return _this.uploading = false; |
|
49 |
+ } |
|
50 |
+ }; |
|
51 |
+ })(this)); |
|
52 |
+ return $(window).on('beforeunload.uploader-' + this.id, (function(_this) { |
|
53 |
+ return function(e) { |
|
54 |
+ if (!_this.uploading) { |
|
55 |
+ return; |
|
56 |
+ } |
|
57 |
+ e.originalEvent.returnValue = _this._t('leaveConfirm'); |
|
58 |
+ return _this._t('leaveConfirm'); |
|
59 |
+ }; |
|
60 |
+ })(this)); |
|
61 |
+ }; |
|
62 |
+ |
|
63 |
+ Uploader.prototype.generateId = (function() { |
|
64 |
+ var id; |
|
65 |
+ id = 0; |
|
66 |
+ return function() { |
|
67 |
+ return id += 1; |
|
68 |
+ }; |
|
69 |
+ })(); |
|
70 |
+ |
|
71 |
+ Uploader.prototype.upload = function(file, opts) { |
|
72 |
+ var f, i, key, len; |
|
73 |
+ if (opts == null) { |
|
74 |
+ opts = {}; |
|
75 |
+ } |
|
76 |
+ if (file == null) { |
|
77 |
+ return; |
|
78 |
+ } |
|
79 |
+ if ($.isArray(file) || file instanceof FileList) { |
|
80 |
+ for (i = 0, len = file.length; i < len; i++) { |
|
81 |
+ f = file[i]; |
|
82 |
+ this.upload(f, opts); |
|
83 |
+ } |
|
84 |
+ } else if ($(file).is('input:file')) { |
|
85 |
+ key = $(file).attr('name'); |
|
86 |
+ if (key) { |
|
87 |
+ opts.fileKey = key; |
|
88 |
+ } |
|
89 |
+ this.upload($.makeArray($(file)[0].files), opts); |
|
90 |
+ } else if (!file.id || !file.obj) { |
|
91 |
+ file = this.getFile(file); |
|
92 |
+ } |
|
93 |
+ if (!(file && file.obj)) { |
|
94 |
+ return; |
|
95 |
+ } |
|
96 |
+ $.extend(file, opts); |
|
97 |
+ if (this.files.length >= this.opts.connectionCount) { |
|
98 |
+ this.queue.push(file); |
|
99 |
+ return; |
|
100 |
+ } |
|
101 |
+ if (this.triggerHandler('beforeupload', [file]) === false) { |
|
102 |
+ return; |
|
103 |
+ } |
|
104 |
+ this.files.push(file); |
|
105 |
+ this._xhrUpload(file); |
|
106 |
+ return this.uploading = true; |
|
107 |
+ }; |
|
108 |
+ |
|
109 |
+ Uploader.prototype.getFile = function(fileObj) { |
|
110 |
+ var name, ref, ref1; |
|
111 |
+ if (fileObj instanceof window.File || fileObj instanceof window.Blob) { |
|
112 |
+ name = (ref = fileObj.fileName) != null ? ref : fileObj.name; |
|
113 |
+ } else { |
|
114 |
+ return null; |
|
115 |
+ } |
|
116 |
+ return { |
|
117 |
+ id: this.generateId(), |
|
118 |
+ url: this.opts.url, |
|
119 |
+ params: this.opts.params, |
|
120 |
+ fileKey: this.opts.fileKey, |
|
121 |
+ name: name, |
|
122 |
+ size: (ref1 = fileObj.fileSize) != null ? ref1 : fileObj.size, |
|
123 |
+ ext: name ? name.split('.').pop().toLowerCase() : '', |
|
124 |
+ obj: fileObj |
|
125 |
+ }; |
|
126 |
+ }; |
|
127 |
+ |
|
128 |
+ Uploader.prototype._xhrUpload = function(file) { |
|
129 |
+ var formData, k, ref, v; |
|
130 |
+ formData = new FormData(); |
|
131 |
+ formData.append(file.fileKey, file.obj); |
|
132 |
+ formData.append("original_filename", file.name); |
|
133 |
+ if (file.params) { |
|
134 |
+ ref = file.params; |
|
135 |
+ for (k in ref) { |
|
136 |
+ v = ref[k]; |
|
137 |
+ formData.append(k, v); |
|
138 |
+ } |
|
139 |
+ } |
|
140 |
+ return file.xhr = $.ajax({ |
|
141 |
+ url: file.url, |
|
142 |
+ data: formData, |
|
143 |
+ processData: false, |
|
144 |
+ contentType: false, |
|
145 |
+ type: 'POST', |
|
146 |
+ headers: { |
|
147 |
+ 'X-File-Name': encodeURIComponent(file.name) |
|
148 |
+ }, |
|
149 |
+ xhr: function() { |
|
150 |
+ var req; |
|
151 |
+ req = $.ajaxSettings.xhr(); |
|
152 |
+ if (req) { |
|
153 |
+ req.upload.onprogress = (function(_this) { |
|
154 |
+ return function(e) { |
|
155 |
+ return _this.progress(e); |
|
156 |
+ }; |
|
157 |
+ })(this); |
|
158 |
+ } |
|
159 |
+ return req; |
|
160 |
+ }, |
|
161 |
+ progress: (function(_this) { |
|
162 |
+ return function(e) { |
|
163 |
+ if (!e.lengthComputable) { |
|
164 |
+ return; |
|
165 |
+ } |
|
166 |
+ return _this.trigger('uploadprogress', [file, e.loaded, e.total]); |
|
167 |
+ }; |
|
168 |
+ })(this), |
|
169 |
+ error: (function(_this) { |
|
170 |
+ return function(xhr, status, err) { |
|
171 |
+ return _this.trigger('uploaderror', [file, xhr, status]); |
|
172 |
+ }; |
|
173 |
+ })(this), |
|
174 |
+ success: (function(_this) { |
|
175 |
+ return function(result) { |
|
176 |
+ _this.trigger('uploadprogress', [file, file.size, file.size]); |
|
177 |
+ _this.trigger('uploadsuccess', [file, result]); |
|
178 |
+ return $(document).trigger('uploadsuccess', [file, result, _this]); |
|
179 |
+ }; |
|
180 |
+ })(this), |
|
181 |
+ complete: (function(_this) { |
|
182 |
+ return function(xhr, status) { |
|
183 |
+ return _this.trigger('uploadcomplete', [file, xhr.responseText]); |
|
184 |
+ }; |
|
185 |
+ })(this) |
|
186 |
+ }); |
|
187 |
+ }; |
|
188 |
+ |
|
189 |
+ Uploader.prototype.cancel = function(file) { |
|
190 |
+ var f, i, len, ref; |
|
191 |
+ if (!file.id) { |
|
192 |
+ ref = this.files; |
|
193 |
+ for (i = 0, len = ref.length; i < len; i++) { |
|
194 |
+ f = ref[i]; |
|
195 |
+ if (f.id === file * 1) { |
|
196 |
+ file = f; |
|
197 |
+ break; |
|
198 |
+ } |
|
199 |
+ } |
|
200 |
+ } |
|
201 |
+ this.trigger('uploadcancel', [file]); |
|
202 |
+ if (file.xhr) { |
|
203 |
+ file.xhr.abort(); |
|
204 |
+ } |
|
205 |
+ return file.xhr = null; |
|
206 |
+ }; |
|
207 |
+ |
|
208 |
+ Uploader.prototype.readImageFile = function(fileObj, callback) { |
|
209 |
+ var fileReader, img; |
|
210 |
+ if (!$.isFunction(callback)) { |
|
211 |
+ return; |
|
212 |
+ } |
|
213 |
+ img = new Image(); |
|
214 |
+ img.onload = function() { |
|
215 |
+ return callback(img); |
|
216 |
+ }; |
|
217 |
+ img.onerror = function() { |
|
218 |
+ return callback(); |
|
219 |
+ }; |
|
220 |
+ if (window.FileReader && FileReader.prototype.readAsDataURL && /^image/.test(fileObj.type)) { |
|
221 |
+ fileReader = new FileReader(); |
|
222 |
+ fileReader.onload = function(e) { |
|
223 |
+ return img.src = e.target.result; |
|
224 |
+ }; |
|
225 |
+ return fileReader.readAsDataURL(fileObj); |
|
226 |
+ } else { |
|
227 |
+ return callback(); |
|
228 |
+ } |
|
229 |
+ }; |
|
230 |
+ |
|
231 |
+ Uploader.prototype.destroy = function() { |
|
232 |
+ var file, i, len, ref; |
|
233 |
+ this.queue.length = 0; |
|
234 |
+ ref = this.files; |
|
235 |
+ for (i = 0, len = ref.length; i < len; i++) { |
|
236 |
+ file = ref[i]; |
|
237 |
+ this.cancel(file); |
|
238 |
+ } |
|
239 |
+ $(window).off('.uploader-' + this.id); |
|
240 |
+ return $(document).off('.uploader-' + this.id); |
|
241 |
+ }; |
|
242 |
+ |
|
243 |
+ Uploader.i18n = { |
|
244 |
+ 'zh-CN': { |
|
245 |
+ leaveConfirm: '正在上传文件,如果离开上传会自动取消' |
|
246 |
+ } |
|
247 |
+ }; |
|
248 |
+ |
|
249 |
+ Uploader.locale = 'zh-CN'; |
|
250 |
+ |
|
251 |
+ return Uploader; |
|
252 |
+ |
|
253 |
+})(SimpleModule); |
|
254 |
+ |
|
255 |
+uploader = function(opts) { |
|
256 |
+ return new Uploader(opts); |
|
257 |
+}; |
|
258 |
+ |
|
259 |
+return uploader; |
|
260 |
+ |
|
261 |
+})); |
@@ -0,0 +1,7 @@ |
||
1 |
+!function(a,b){"function"==typeof define&&define.amd? |
|
2 |
+// AMD. Register as an anonymous module unless amdModuleId is set |
|
3 |
+define("simple-uploader",["jquery","simple-module"],function(c,d){return a.uploader=b(c,d)}):"object"==typeof exports? |
|
4 |
+// Node. Does not work with strict CommonJS, but |
|
5 |
+// only CommonJS-like environments that support module.exports, |
|
6 |
+// like Node. |
|
7 |
+module.exports=b(require("jquery"),require("simple-module")):(a.simple=a.simple||{},a.simple.uploader=b(jQuery,SimpleModule))}(this,function(a,b){var c,d,e=function(a,b){function c(){this.constructor=a}for(var d in b)f.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},f={}.hasOwnProperty;return c=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return e(c,b),c.count=0,c.prototype.opts={url:"",params:null,fileKey:"upload_file",connectionCount:3},c.prototype._init=function(){return this.files=[],this.queue=[],this.id=++c.count,this.on("uploadcomplete",function(b){return function(c,d){return b.files.splice(a.inArray(d,b.files),1),b.queue.length>0&&b.files.length<b.opts.connectionCount?b.upload(b.queue.shift()):b.uploading=!1}}(this)),a(window).on("beforeunload.uploader-"+this.id,function(a){return function(b){return a.uploading?(b.originalEvent.returnValue=a._t("leaveConfirm"),a._t("leaveConfirm")):void 0}}(this))},c.prototype.generateId=function(){var a;return a=0,function(){return a+=1}}(),c.prototype.upload=function(b,c){var d,e,f,g;if(null==c&&(c={}),null!=b){if(a.isArray(b)||b instanceof FileList)for(e=0,g=b.length;g>e;e++)d=b[e],this.upload(d,c);else a(b).is("input:file")?(f=a(b).attr("name"),f&&(c.fileKey=f),this.upload(a.makeArray(a(b)[0].files),c)):b.id&&b.obj||(b=this.getFile(b));if(b&&b.obj){if(a.extend(b,c),this.files.length>=this.opts.connectionCount)return void this.queue.push(b);if(this.triggerHandler("beforeupload",[b])!==!1)return this.files.push(b),this._xhrUpload(b),this.uploading=!0}}},c.prototype.getFile=function(a){var b,c,d;return a instanceof window.File||a instanceof window.Blob?(b=null!=(c=a.fileName)?c:a.name,{id:this.generateId(),url:this.opts.url,params:this.opts.params,fileKey:this.opts.fileKey,name:b,size:null!=(d=a.fileSize)?d:a.size,ext:b?b.split(".").pop().toLowerCase():"",obj:a}):null},c.prototype._xhrUpload=function(b){var c,d,e,f;if(c=new FormData,c.append(b.fileKey,b.obj),c.append("original_filename",b.name),b.params){e=b.params;for(d in e)f=e[d],c.append(d,f)}return b.xhr=a.ajax({url:b.url,data:c,processData:!1,contentType:!1,type:"POST",headers:{"X-File-Name":encodeURIComponent(b.name)},xhr:function(){var b;return b=a.ajaxSettings.xhr(),b&&(b.upload.onprogress=function(a){return function(b){return a.progress(b)}}(this)),b},progress:function(a){return function(c){return c.lengthComputable?a.trigger("uploadprogress",[b,c.loaded,c.total]):void 0}}(this),error:function(a){return function(c,d,e){return a.trigger("uploaderror",[b,c,d])}}(this),success:function(c){return function(d){return c.trigger("uploadprogress",[b,b.size,b.size]),c.trigger("uploadsuccess",[b,d]),a(document).trigger("uploadsuccess",[b,d,c])}}(this),complete:function(a){return function(c,d){return a.trigger("uploadcomplete",[b,c.responseText])}}(this)})},c.prototype.cancel=function(a){var b,c,d,e;if(!a.id)for(e=this.files,c=0,d=e.length;d>c;c++)if(b=e[c],b.id===1*a){a=b;break}return this.trigger("uploadcancel",[a]),a.xhr&&a.xhr.abort(),a.xhr=null},c.prototype.readImageFile=function(b,c){var d,e;if(a.isFunction(c))return e=new Image,e.onload=function(){return c(e)},e.onerror=function(){return c()},window.FileReader&&FileReader.prototype.readAsDataURL&&/^image/.test(b.type)?(d=new FileReader,d.onload=function(a){return e.src=a.target.result},d.readAsDataURL(b)):c()},c.prototype.destroy=function(){var b,c,d,e;for(this.queue.length=0,e=this.files,c=0,d=e.length;d>c;c++)b=e[c],this.cancel(b);return a(window).off(".uploader-"+this.id),a(document).off(".uploader-"+this.id)},c.i18n={"zh-CN":{leaveConfirm:"正在上传文件,如果离开上传会自动取消"}},c.locale="zh-CN",c}(b),d=function(a){return new c(a)}}); |
@@ -0,0 +1,34 @@ |
||
1 |
+(function() { |
|
2 |
+ var djangoJQuery; |
|
3 |
+ if (typeof jQuery == 'undefined' && typeof django == 'undefined') { |
|
4 |
+ console.error('ERROR django-simditor missing jQuery. Set SIMDITOR_JQUERY_URL or provide jQuery in the template.'); |
|
5 |
+ } else if (typeof django != 'undefined') { |
|
6 |
+ djangoJQuery = django.jQuery; |
|
7 |
+ } |
|
8 |
+ |
|
9 |
+ var $ = jQuery || djangoJQuery; |
|
10 |
+ $(function() { |
|
11 |
+ |
|
12 |
+ initialiseSimditor(); |
|
13 |
+ function initialiseSimditor() { |
|
14 |
+ $('textarea[data-type=simditortype]').each(function() { |
|
15 |
+ |
|
16 |
+ if($(this).data('processed') == "0" && $(this).attr('data-id').indexOf('__prefix__') == -1){ |
|
17 |
+ $(this).data('processed', "1"); |
|
18 |
+ var dataConfig = $(this).data('config'); |
|
19 |
+ new Simditor({ |
|
20 |
+ textarea: $(this), |
|
21 |
+ upload: dataConfig.upload, |
|
22 |
+ cleanPaste: dataConfig.cleanPaste, |
|
23 |
+ tabIndent: dataConfig.tabIndent, |
|
24 |
+ pasteImage: dataConfig.pasteImage, |
|
25 |
+ toolbar: dataConfig.toolbar, |
|
26 |
+ emoji: dataConfig.emoji |
|
27 |
+ }); |
|
28 |
+ } |
|
29 |
+ }); |
|
30 |
+ } |
|
31 |
+ |
|
32 |
+ }); |
|
33 |
+ |
|
34 |
+})(); |
@@ -0,0 +1,696 @@ |
||
1 |
+@charset "UTF-8"; |
|
2 |
+ |
|
3 |
+$simditor-button-height: 40px; |
|
4 |
+$simditor-button-width: 46px; |
|
5 |
+ |
|
6 |
+.simditor { |
|
7 |
+ position: relative; |
|
8 |
+ border: 1px solid #c9d8db; |
|
9 |
+ |
|
10 |
+ .simditor-wrapper { |
|
11 |
+ position: relative; |
|
12 |
+ background: #ffffff; |
|
13 |
+ |
|
14 |
+ & > textarea { |
|
15 |
+ display: none !important; |
|
16 |
+ width: 100%; |
|
17 |
+ box-sizing: border-box; |
|
18 |
+ font-family: monaco; |
|
19 |
+ font-size: 16px; |
|
20 |
+ line-height: 1.6; |
|
21 |
+ border: none; |
|
22 |
+ padding: 22px 15px 40px; |
|
23 |
+ min-height: 300px; |
|
24 |
+ outline: none; |
|
25 |
+ background: transparent; |
|
26 |
+ resize: none; |
|
27 |
+ } |
|
28 |
+ |
|
29 |
+ .simditor-placeholder { |
|
30 |
+ display: none; |
|
31 |
+ position: absolute; |
|
32 |
+ left: 0; |
|
33 |
+ z-index: 0; |
|
34 |
+ padding: 22px 15px; |
|
35 |
+ font-size: 16px; |
|
36 |
+ font-family: arial, sans-serif; |
|
37 |
+ line-height: 1.5; |
|
38 |
+ color: #999999; |
|
39 |
+ background: transparent; |
|
40 |
+ } |
|
41 |
+ |
|
42 |
+ &.toolbar-floating { |
|
43 |
+ .simditor-toolbar { |
|
44 |
+ position: fixed; |
|
45 |
+ top: 0; |
|
46 |
+ z-index: 10; |
|
47 |
+ box-shadow: 0 0 6px rgba(0,0,0,0.1); |
|
48 |
+ } |
|
49 |
+ } |
|
50 |
+ |
|
51 |
+ .simditor-image-loading { |
|
52 |
+ width: 100%; |
|
53 |
+ height: 100%; |
|
54 |
+ position: absolute; |
|
55 |
+ top: 0; |
|
56 |
+ left: 0; |
|
57 |
+ z-index: 2; |
|
58 |
+ |
|
59 |
+ .progress { |
|
60 |
+ width: 100%; |
|
61 |
+ height: 100%; |
|
62 |
+ background: rgba(0,0,0,0.4); |
|
63 |
+ position: absolute; |
|
64 |
+ bottom: 0; |
|
65 |
+ left: 0; |
|
66 |
+ } |
|
67 |
+ } |
|
68 |
+ } |
|
69 |
+ |
|
70 |
+ .simditor-body { |
|
71 |
+ padding: 22px 15px 40px; |
|
72 |
+ min-height: 300px; |
|
73 |
+ outline: none; |
|
74 |
+ cursor: text; |
|
75 |
+ position: relative; |
|
76 |
+ z-index: 1; |
|
77 |
+ background: transparent; |
|
78 |
+ |
|
79 |
+ a.selected { |
|
80 |
+ background: #b3d4fd; |
|
81 |
+ } |
|
82 |
+ |
|
83 |
+ a.simditor-mention { |
|
84 |
+ cursor: pointer; |
|
85 |
+ } |
|
86 |
+ |
|
87 |
+ .simditor-table { |
|
88 |
+ position: relative; |
|
89 |
+ |
|
90 |
+ &.resizing { |
|
91 |
+ cursor: col-resize; |
|
92 |
+ } |
|
93 |
+ |
|
94 |
+ .simditor-resize-handle { |
|
95 |
+ position: absolute; |
|
96 |
+ left: 0; |
|
97 |
+ top: 0; |
|
98 |
+ width: 10px; |
|
99 |
+ height: 100%; |
|
100 |
+ cursor: col-resize; |
|
101 |
+ } |
|
102 |
+ } |
|
103 |
+ |
|
104 |
+ pre { |
|
105 |
+ /*min-height: 28px;*/ |
|
106 |
+ box-sizing: border-box; |
|
107 |
+ -moz-box-sizing: border-box; |
|
108 |
+ word-wrap: break-word!important; |
|
109 |
+ white-space: pre-wrap!important; |
|
110 |
+ } |
|
111 |
+ |
|
112 |
+ img { |
|
113 |
+ cursor: pointer; |
|
114 |
+ |
|
115 |
+ &.selected { |
|
116 |
+ box-shadow: 0 0 0 4px #cccccc; |
|
117 |
+ } |
|
118 |
+ } |
|
119 |
+ } |
|
120 |
+ |
|
121 |
+ .simditor-paste-bin { |
|
122 |
+ position: fixed; |
|
123 |
+ bottom: 10px; |
|
124 |
+ right: 10px; |
|
125 |
+ width: 1px; |
|
126 |
+ height: 20px; |
|
127 |
+ font-size: 1px; |
|
128 |
+ line-height: 1px; |
|
129 |
+ overflow: hidden; |
|
130 |
+ padding: 0; |
|
131 |
+ margin: 0; |
|
132 |
+ opacity: 0; |
|
133 |
+ -webkit-user-select: text; |
|
134 |
+ } |
|
135 |
+ |
|
136 |
+ .simditor-toolbar { |
|
137 |
+ border-bottom: 1px solid #eeeeee; |
|
138 |
+ background: #ffffff; |
|
139 |
+ width: 100%; |
|
140 |
+ |
|
141 |
+ & > ul { |
|
142 |
+ margin: 0; |
|
143 |
+ padding: 0 0 0 6px; |
|
144 |
+ list-style: none; |
|
145 |
+ |
|
146 |
+ & > li { |
|
147 |
+ position: relative; |
|
148 |
+ display: inline-block; |
|
149 |
+ font-size: 0; |
|
150 |
+ |
|
151 |
+ & > span.separator { |
|
152 |
+ display: inline-block; |
|
153 |
+ background: #cfcfcf; |
|
154 |
+ width: 1px; |
|
155 |
+ height: 18px; |
|
156 |
+ margin: ($simditor-button-height - 18px) / 2 15px; |
|
157 |
+ vertical-align: middle; |
|
158 |
+ } |
|
159 |
+ |
|
160 |
+ & > .toolbar-item { |
|
161 |
+ display: inline-block; |
|
162 |
+ width: $simditor-button-width; |
|
163 |
+ height: $simditor-button-height; |
|
164 |
+ outline: none; |
|
165 |
+ color: #333333; |
|
166 |
+ font-size: 15px; |
|
167 |
+ line-height: $simditor-button-height; |
|
168 |
+ vertical-align: middle; |
|
169 |
+ text-align: center; |
|
170 |
+ text-decoration: none; |
|
171 |
+ |
|
172 |
+ span { |
|
173 |
+ opacity: 0.6; |
|
174 |
+ |
|
175 |
+ &.simditor-icon { |
|
176 |
+ display: inline; |
|
177 |
+ line-height: normal; |
|
178 |
+ } |
|
179 |
+ } |
|
180 |
+ |
|
181 |
+ &:hover span { |
|
182 |
+ opacity: 1; |
|
183 |
+ } |
|
184 |
+ |
|
185 |
+ &.active { |
|
186 |
+ background: #eeeeee; |
|
187 |
+ |
|
188 |
+ span { |
|
189 |
+ opacity: 1; |
|
190 |
+ } |
|
191 |
+ } |
|
192 |
+ |
|
193 |
+ &.disabled { |
|
194 |
+ cursor: default; |
|
195 |
+ |
|
196 |
+ span { |
|
197 |
+ opacity: 0.3; |
|
198 |
+ } |
|
199 |
+ } |
|
200 |
+ |
|
201 |
+ &.toolbar-item-title { |
|
202 |
+ span:before { |
|
203 |
+ content: "H"; |
|
204 |
+ font-size: 19px; |
|
205 |
+ font-weight: bold; |
|
206 |
+ font-family: 'Times New Roman'; |
|
207 |
+ } |
|
208 |
+ |
|
209 |
+ &.active-h1 span:before { |
|
210 |
+ content: 'H1'; |
|
211 |
+ font-size: 18px; |
|
212 |
+ } |
|
213 |
+ |
|
214 |
+ &.active-h2 span:before { |
|
215 |
+ content: 'H2'; |
|
216 |
+ font-size: 18px; |
|
217 |
+ } |
|
218 |
+ |
|
219 |
+ &.active-h3 span:before { |
|
220 |
+ content: 'H3'; |
|
221 |
+ font-size: 18px; |
|
222 |
+ } |
|
223 |
+ } |
|
224 |
+ |
|
225 |
+ &.toolbar-item-image { |
|
226 |
+ position: relative; |
|
227 |
+ overflow: hidden; |
|
228 |
+ |
|
229 |
+ & > input[type=file] { |
|
230 |
+ position: absolute; |
|
231 |
+ right: 0px; |
|
232 |
+ top: 0px; |
|
233 |
+ opacity: 0; |
|
234 |
+ font-size: 100px; |
|
235 |
+ cursor: pointer; |
|
236 |
+ } |
|
237 |
+ } |
|
238 |
+ } |
|
239 |
+ |
|
240 |
+ &.menu-on { |
|
241 |
+ .toolbar-item { |
|
242 |
+ position: relative; |
|
243 |
+ z-index: 20; |
|
244 |
+ background: #ffffff; |
|
245 |
+ box-shadow: 0 1px 4px rgba(0,0,0,0.3); |
|
246 |
+ |
|
247 |
+ span { |
|
248 |
+ opacity: 1; |
|
249 |
+ } |
|
250 |
+ } |
|
251 |
+ |
|
252 |
+ .toolbar-menu { |
|
253 |
+ display: block; |
|
254 |
+ } |
|
255 |
+ } |
|
256 |
+ } |
|
257 |
+ } |
|
258 |
+ |
|
259 |
+ .toolbar-menu { |
|
260 |
+ display: none; |
|
261 |
+ position: absolute; |
|
262 |
+ top: $simditor-button-height; |
|
263 |
+ left: 0; |
|
264 |
+ z-index: 21; |
|
265 |
+ background: #ffffff; |
|
266 |
+ text-align: left; |
|
267 |
+ box-shadow: 0 0 4px rgba(0,0,0,0.3); |
|
268 |
+ |
|
269 |
+ &:before { |
|
270 |
+ content: ''; |
|
271 |
+ display: block; |
|
272 |
+ width: $simditor-button-width; |
|
273 |
+ height: 4px; |
|
274 |
+ background: #ffffff; |
|
275 |
+ position: absolute; |
|
276 |
+ top: -3px; |
|
277 |
+ left: 0; |
|
278 |
+ } |
|
279 |
+ |
|
280 |
+ ul { |
|
281 |
+ min-width: 160px; |
|
282 |
+ list-style: none; |
|
283 |
+ margin: 0; |
|
284 |
+ padding: 10px 1px; |
|
285 |
+ |
|
286 |
+ & > li { |
|
287 |
+ |
|
288 |
+ .menu-item { |
|
289 |
+ display: block; |
|
290 |
+ font-size:16px; |
|
291 |
+ line-height: 2em; |
|
292 |
+ padding: 0 10px; |
|
293 |
+ text-decoration: none; |
|
294 |
+ color: #666666; |
|
295 |
+ |
|
296 |
+ &:hover { |
|
297 |
+ background: #f6f6f6; |
|
298 |
+ } |
|
299 |
+ |
|
300 |
+ &.menu-item-h1 { |
|
301 |
+ font-size: 24px; |
|
302 |
+ color: #333333; |
|
303 |
+ } |
|
304 |
+ |
|
305 |
+ &.menu-item-h2 { |
|
306 |
+ font-size: 22px; |
|
307 |
+ color: #333333; |
|
308 |
+ } |
|
309 |
+ |
|
310 |
+ &.menu-item-h3 { |
|
311 |
+ font-size: 20px; |
|
312 |
+ color: #333333; |
|
313 |
+ } |
|
314 |
+ |
|
315 |
+ &.menu-item-h4 { |
|
316 |
+ font-size: 18px; |
|
317 |
+ color: #333333; |
|
318 |
+ } |
|
319 |
+ |
|
320 |
+ &.menu-item-h5 { |
|
321 |
+ font-size: 16px; |
|
322 |
+ color: #333333; |
|
323 |
+ } |
|
324 |
+ } |
|
325 |
+ |
|
326 |
+ .separator { |
|
327 |
+ display: block; |
|
328 |
+ border-top: 1px solid #cccccc; |
|
329 |
+ height: 0; |
|
330 |
+ line-height: 0; |
|
331 |
+ font-size: 0; |
|
332 |
+ margin: 6px 0; |
|
333 |
+ } |
|
334 |
+ } |
|
335 |
+ |
|
336 |
+ } |
|
337 |
+ |
|
338 |
+ &.toolbar-menu-color { |
|
339 |
+ width: 96px; |
|
340 |
+ |
|
341 |
+ .color-list { |
|
342 |
+ height: 40px; |
|
343 |
+ margin: 10px 6px 6px 10px; |
|
344 |
+ padding: 0; |
|
345 |
+ |
|
346 |
+ min-width: 0; |
|
347 |
+ |
|
348 |
+ li { |
|
349 |
+ float: left; |
|
350 |
+ margin: 0 4px 4px 0; |
|
351 |
+ |
|
352 |
+ .font-color { |
|
353 |
+ display: block; |
|
354 |
+ width: 16px; |
|
355 |
+ height: 16px; |
|
356 |
+ background: #dfdfdf; |
|
357 |
+ border-radius: 2px; |
|
358 |
+ |
|
359 |
+ &:hover { |
|
360 |
+ opacity: 0.8; |
|
361 |
+ } |
|
362 |
+ |
|
363 |
+ &.font-color-default { |
|
364 |
+ background: #333333; |
|
365 |
+ } |
|
366 |
+ } |
|
367 |
+ |
|
368 |
+ $font-colors: #E33737 #e28b41 #c8a732 #209361 #418caf #aa8773 #999999; |
|
369 |
+ $i: 1; |
|
370 |
+ @each $color in $font-colors { |
|
371 |
+ .font-color-#{$i} { |
|
372 |
+ background: $color; |
|
373 |
+ } |
|
374 |
+ $i: $i + 1; |
|
375 |
+ } |
|
376 |
+ } |
|
377 |
+ } |
|
378 |
+ } |
|
379 |
+ |
|
380 |
+ &.toolbar-menu-table { |
|
381 |
+ .menu-create-table { |
|
382 |
+ background: #ffffff; |
|
383 |
+ padding: 1px; |
|
384 |
+ |
|
385 |
+ table { |
|
386 |
+ border: none; |
|
387 |
+ border-collapse: collapse; |
|
388 |
+ border-spacing: 0; |
|
389 |
+ table-layout: fixed; |
|
390 |
+ |
|
391 |
+ td { |
|
392 |
+ padding: 0; |
|
393 |
+ cursor: pointer; |
|
394 |
+ |
|
395 |
+ &:before { |
|
396 |
+ width: 16px; |
|
397 |
+ height: 16px; |
|
398 |
+ border: 1px solid #ffffff; |
|
399 |
+ background: #f3f3f3; |
|
400 |
+ display: block; |
|
401 |
+ content: '' |
|
402 |
+ } |
|
403 |
+ |
|
404 |
+ &.selected:before { |
|
405 |
+ background: #cfcfcf; |
|
406 |
+ } |
|
407 |
+ } |
|
408 |
+ } |
|
409 |
+ } |
|
410 |
+ |
|
411 |
+ .menu-edit-table { |
|
412 |
+ display: none; |
|
413 |
+ |
|
414 |
+ ul { |
|
415 |
+ li { |
|
416 |
+ white-space: nowrap; |
|
417 |
+ } |
|
418 |
+ } |
|
419 |
+ } |
|
420 |
+ } |
|
421 |
+ |
|
422 |
+ &.toolbar-menu-image { |
|
423 |
+ .menu-item-upload-image { |
|
424 |
+ position: relative; |
|
425 |
+ overflow: hidden; |
|
426 |
+ |
|
427 |
+ input[type=file] { |
|
428 |
+ position: absolute; |
|
429 |
+ right: 0px; |
|
430 |
+ top: 0px; |
|
431 |
+ opacity: 0; |
|
432 |
+ font-size: 100px; |
|
433 |
+ cursor: pointer; |
|
434 |
+ } |
|
435 |
+ } |
|
436 |
+ } |
|
437 |
+ |
|
438 |
+ &.toolbar-menu-alignment { |
|
439 |
+ width: 100%; |
|
440 |
+ ul { |
|
441 |
+ min-width: 100%; |
|
442 |
+ } |
|
443 |
+ .menu-item { |
|
444 |
+ text-align: center; |
|
445 |
+ } |
|
446 |
+ } |
|
447 |
+ } |
|
448 |
+ } |
|
449 |
+ |
|
450 |
+ .simditor-popover { |
|
451 |
+ display: none; |
|
452 |
+ padding: 5px 8px 0; |
|
453 |
+ background: #ffffff; |
|
454 |
+ box-shadow: 0 1px 4px rgba(0,0,0,0.4); |
|
455 |
+ border-radius: 2px; |
|
456 |
+ position: absolute; |
|
457 |
+ z-index: 2; |
|
458 |
+ |
|
459 |
+ .settings-field { |
|
460 |
+ margin: 0 0 5px 0; |
|
461 |
+ font-size: 12px; |
|
462 |
+ height: 25px; |
|
463 |
+ line-height: 25px; |
|
464 |
+ |
|
465 |
+ label { |
|
466 |
+ display: inline-block; |
|
467 |
+ margin: 0 5px 0 0; |
|
468 |
+ } |
|
469 |
+ |
|
470 |
+ input[type=text] { |
|
471 |
+ display: inline-block; |
|
472 |
+ width: 200px; |
|
473 |
+ box-sizing: border-box; |
|
474 |
+ font-size: 12px; |
|
475 |
+ |
|
476 |
+ &.image-size { |
|
477 |
+ width: 83px; |
|
478 |
+ } |
|
479 |
+ } |
|
480 |
+ |
|
481 |
+ .times { |
|
482 |
+ display: inline-block; |
|
483 |
+ width: 26px; |
|
484 |
+ font-size: 12px; |
|
485 |
+ text-align: center; |
|
486 |
+ } |
|
487 |
+ } |
|
488 |
+ |
|
489 |
+ &.link-popover .btn-unlink, |
|
490 |
+ &.image-popover .btn-upload, |
|
491 |
+ &.image-popover .btn-restore { |
|
492 |
+ display: inline-block; |
|
493 |
+ margin: 0 0 0 5px; |
|
494 |
+ color: #333333; |
|
495 |
+ font-size: 14px; |
|
496 |
+ outline: 0; |
|
497 |
+ |
|
498 |
+ span { |
|
499 |
+ opacity: 0.6; |
|
500 |
+ } |
|
501 |
+ |
|
502 |
+ &:hover span { |
|
503 |
+ opacity: 1; |
|
504 |
+ } |
|
505 |
+ } |
|
506 |
+ |
|
507 |
+ &.image-popover .btn-upload { |
|
508 |
+ position: relative; |
|
509 |
+ display: inline-block; |
|
510 |
+ overflow: hidden; |
|
511 |
+ vertical-align: middle; |
|
512 |
+ |
|
513 |
+ input[type=file] { |
|
514 |
+ position: absolute; |
|
515 |
+ right: 0px; |
|
516 |
+ top: 0px; |
|
517 |
+ opacity: 0; |
|
518 |
+ height: 100%; |
|
519 |
+ width: 28px; |
|
520 |
+ } |
|
521 |
+ } |
|
522 |
+ } |
|
523 |
+ |
|
524 |
+ &.simditor-mobile { |
|
525 |
+ .simditor-wrapper.toolbar-floating .simditor-toolbar { |
|
526 |
+ position: absolute; |
|
527 |
+ top: 0; |
|
528 |
+ z-index: 10; |
|
529 |
+ box-shadow: 0 0 6px rgba(0,0,0,0.1); |
|
530 |
+ } |
|
531 |
+ } |
|
532 |
+} |
|
533 |
+ |
|
534 |
+ |
|
535 |
+ |
|
536 |
+.simditor .simditor-body, .editor-style { |
|
537 |
+ font-size: 16px; |
|
538 |
+ font-family: arial, sans-serif; |
|
539 |
+ line-height: 1.6; |
|
540 |
+ color: #333; |
|
541 |
+ outline: none; |
|
542 |
+ word-wrap: break-word; |
|
543 |
+ |
|
544 |
+ & > :first-child { |
|
545 |
+ margin-top: 0!important; |
|
546 |
+ } |
|
547 |
+ |
|
548 |
+ a{ color: #4298BA; text-decoration: none; word-break: break-all;} |
|
549 |
+ a:visited{ color: #4298BA; } |
|
550 |
+ a:hover{ color: #0F769F; } |
|
551 |
+ a:active{ color:#9E792E; } |
|
552 |
+ a:hover, a:active{ outline: 0; } |
|
553 |
+ |
|
554 |
+ h1,h2,h3,h4,h5,h6 { |
|
555 |
+ font-weight: normal; |
|
556 |
+ margin: 40px 0 20px; |
|
557 |
+ color: #000000; |
|
558 |
+ } |
|
559 |
+ |
|
560 |
+ h1 { font-size: 24px; } |
|
561 |
+ h2 { font-size: 22px; } |
|
562 |
+ h3 { font-size: 20px; } |
|
563 |
+ h4 { font-size: 18px; } |
|
564 |
+ h5 { font-size: 16px; } |
|
565 |
+ h6 { font-size: 16px; } |
|
566 |
+ |
|
567 |
+ p, div { |
|
568 |
+ word-wrap: break-word; |
|
569 |
+ margin: 0 0 15px 0; |
|
570 |
+ color: #333; |
|
571 |
+ word-wrap: break-word; |
|
572 |
+ } |
|
573 |
+ |
|
574 |
+ b, strong { |
|
575 |
+ font-weight: bold; |
|
576 |
+ } |
|
577 |
+ |
|
578 |
+ i, em { |
|
579 |
+ font-style: italic; |
|
580 |
+ } |
|
581 |
+ |
|
582 |
+ u { |
|
583 |
+ text-decoration: underline; |
|
584 |
+ } |
|
585 |
+ |
|
586 |
+ strike, del { |
|
587 |
+ text-decoration: line-through; |
|
588 |
+ } |
|
589 |
+ |
|
590 |
+ ul, ol { |
|
591 |
+ list-style:disc outside none; |
|
592 |
+ margin: 15px 0; |
|
593 |
+ padding: 0 0 0 40px; |
|
594 |
+ line-height: 1.6; |
|
595 |
+ |
|
596 |
+ ul, ol { |
|
597 |
+ padding-left: 30px; |
|
598 |
+ } |
|
599 |
+ |
|
600 |
+ ul { |
|
601 |
+ list-style: circle outside none; |
|
602 |
+ |
|
603 |
+ ul { |
|
604 |
+ list-style: square outside none; |
|
605 |
+ } |
|
606 |
+ } |
|
607 |
+ } |
|
608 |
+ |
|
609 |
+ ol { |
|
610 |
+ list-style:decimal; |
|
611 |
+ } |
|
612 |
+ |
|
613 |
+ blockquote { |
|
614 |
+ border-left: 6px solid #ddd; |
|
615 |
+ padding: 5px 0 5px 10px; |
|
616 |
+ margin: 15px 0 15px 15px; |
|
617 |
+ |
|
618 |
+ & > :first-child { |
|
619 |
+ margin-top: 0; |
|
620 |
+ } |
|
621 |
+ } |
|
622 |
+ |
|
623 |
+ code { |
|
624 |
+ display: inline-block; |
|
625 |
+ padding: 0 4px; |
|
626 |
+ margin: 0 5px; |
|
627 |
+ background: #eeeeee; |
|
628 |
+ border-radius: 3px; |
|
629 |
+ font-size: 13px; |
|
630 |
+ font-family: 'monaco', 'Consolas', "Liberation Mono", Courier, monospace; |
|
631 |
+ } |
|
632 |
+ |
|
633 |
+ pre { |
|
634 |
+ padding: 10px 5px 10px 10px; |
|
635 |
+ margin: 15px 0; |
|
636 |
+ display: block; |
|
637 |
+ line-height: 18px; |
|
638 |
+ background: #F0F0F0; |
|
639 |
+ border-radius: 3px; |
|
640 |
+ font-size:13px; |
|
641 |
+ font-family: 'monaco', 'Consolas', "Liberation Mono", Courier, monospace; |
|
642 |
+ white-space: pre; |
|
643 |
+ word-wrap: normal; |
|
644 |
+ overflow-x: auto; |
|
645 |
+ |
|
646 |
+ code { |
|
647 |
+ display: block; |
|
648 |
+ padding: 0; |
|
649 |
+ margin: 0; |
|
650 |
+ background: none; |
|
651 |
+ border-radius: 0; |
|
652 |
+ } |
|
653 |
+ } |
|
654 |
+ |
|
655 |
+ hr { |
|
656 |
+ display: block; |
|
657 |
+ height: 0px; |
|
658 |
+ border: 0; |
|
659 |
+ border-top: 1px solid #ccc; |
|
660 |
+ margin: 15px 0; |
|
661 |
+ padding: 0; |
|
662 |
+ } |
|
663 |
+ |
|
664 |
+ table { |
|
665 |
+ width: 100%; |
|
666 |
+ table-layout: fixed; |
|
667 |
+ border-collapse: collapse; |
|
668 |
+ border-spacing: 0; |
|
669 |
+ margin: 15px 0; |
|
670 |
+ |
|
671 |
+ thead { |
|
672 |
+ background-color: #f9f9f9; |
|
673 |
+ } |
|
674 |
+ |
|
675 |
+ td, th { |
|
676 |
+ min-width: 40px; |
|
677 |
+ height: 30px; |
|
678 |
+ border: 1px solid #ccc; |
|
679 |
+ vertical-align: top; |
|
680 |
+ padding: 2px 4px; |
|
681 |
+ text-align: left; |
|
682 |
+ box-sizing: border-box; |
|
683 |
+ |
|
684 |
+ &.active { |
|
685 |
+ background-color: #ffffee; |
|
686 |
+ } |
|
687 |
+ } |
|
688 |
+ } |
|
689 |
+ |
|
690 |
+ |
|
691 |
+ img { |
|
692 |
+ margin: 0 5px; |
|
693 |
+ vertical-align: middle; |
|
694 |
+ } |
|
695 |
+ |
|
696 |
+} |
@@ -0,0 +1 @@ |
||
1 |
+@font-face{font-family:'Simditor';src:url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAABp8AA4AAAAAKmwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAaYAAAABoAAAAcdO8GE09TLzIAAAG0AAAARQAAAGAQ+ZFXY21hcAAAAkgAAABRAAABWuA2Gx9jdnQgAAAEgAAAAAoAAAAKAwQAxGZwZ20AAAKcAAABsQAAAmUPtC+nZ2x5ZgAABNgAABPeAAAgZG/p6QxoZWFkAAABRAAAADAAAAA2BvuCgGhoZWEAAAF0AAAAHgAAACQH9QTlaG10eAAAAfwAAABKAAAAlHv7AItsb2NhAAAEjAAAAEwAAABMi4qTXm1heHAAAAGUAAAAIAAAACABRwHNbmFtZQAAGLgAAAEFAAAB12vS/ulwb3N0AAAZwAAAAJ4AAAFsyCrvunByZXAAAARQAAAALgAAAC6w8isUeNpjYGRgYADiKAkPy3h+m68M8swfgCIMF0/IVyDo/84sFswJQC4HAxNIFAAZwAnyeNpjYGRgYE5gmMAQzWLBwPD/O5AEiqAAVQBa6wPkAAAAAQAAACUAoAAKAAAAA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bGtdI19Jamv1cvFCIL5+lLf7p4g1HFheP3IC3PHZk8QbmzkK80+cM/DBe6Aj4dxYXOw+ev+ee8/HvOoHm8t1mEU2hQ6s2lbBbCVrwo0QBCv4ep1im59rm3G52Iz8cg+Y42+E0mX4o+pXhStOJ7z2QxrWH6036gw2RFCfVu1xer1b5EN8hGS1i51e2tdsAsDkIPGYliDdesazes7CRI9OdoekjR6bxa8mk4OL7XB7OJ3aGoMLP4ddyVS7j5kK/36mLGfHnojgBj4/h49BOiPiadnfd9BGRDfJ9nKua6657hIdVGMMiWEOnOmvoYoT+C93/Vj8AAHjafY+/asMwEIc/JU6aQhsyltJBQ6eCg20IgdCt1GTwlNJsHUJijCCxwHaeqVufpM/Qta/Ri31ZOkTipO9Ov/sjYMwXhm7d8qBsGPGs3OOKd+U+j3wqB6L5UR5wY4zykJGxojTBtXj3bdaJDROelHvS91W5z5IP5UA038oD7vhVHjIxY1I8JQ2ObUs1lkz2C6S+bNzWl7XNMnHfRHNgJ2cjykoC7rBzjRdakVNwZM/m9LDKi+N+I3AunrYJhagsCVMiuRdi/0t20Vg0IXOxRJQxs26U1FdFbpNpZBf23FowTsJ5mETx7OKEa+ldyedcO9GpRzcF67yqnS9tLHUvVfgDz/ZF8gAAAHjabc25DgFhGIXh/53B2Pd9J9HPN/bSWolC4iI0OjfgxhFO6SQnT/k6z333errI/dvkc5yHh+98YsRJEJAkRZoMWXLkKVCkRJkKVWrUadCkRZsOXXr0GTBkxDh2vp5O3u4SPO63YxiG0mQkp3Im53Ihl3Il13Ijt3In9/Igjz9NfVPf1Df1TX1T39Q39U19U9/UN/VNfVPfDm8tR0peAAB42mNgYGBkAIKLcceVwfQJ+XIoXQEARe8GegAA) format('woff');font-weight:normal;font-style:normal}.simditor-icon{display:inline-block;font:normal normal normal 14px/1 'Simditor';font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;transform:translate(0,0)}.simditor-icon-code:before{content:'\f000'}.simditor-icon-bold:before{content:'\f001'}.simditor-icon-italic:before{content:'\f002'}.simditor-icon-underline:before{content:'\f003'}.simditor-icon-times:before{content:'\f004'}.simditor-icon-strikethrough:before{content:'\f005'}.simditor-icon-list-ol:before{content:'\f006'}.simditor-icon-list-ul:before{content:'\f007'}.simditor-icon-quote-left:before{content:'\f008'}.simditor-icon-table:before{content:'\f009'}.simditor-icon-link:before{content:'\f00a'}.simditor-icon-picture-o:before{content:'\f00b'}.simditor-icon-minus:before{content:'\f00c'}.simditor-icon-indent:before{content:'\f00d'}.simditor-icon-outdent:before{content:'\f00e'}.simditor-icon-unlink:before{content:'\f00f'}.simditor-icon-caret-down:before{content:'\f010'}.simditor-icon-caret-right:before{content:'\f011'}.simditor-icon-upload:before{content:'\f012'}.simditor-icon-undo:before{content:'\f013'}.simditor-icon-smile-o:before{content:'\f014'}.simditor-icon-tint:before{content:'\f015'}.simditor-icon-font:before{content:'\f016'}.simditor-icon-html5:before{content:'\f017'}.simditor-icon-mark:before{content:'\f018'}.simditor-icon-align-center:before{content:'\f019'}.simditor-icon-align-left:before{content:'\f01a'}.simditor-icon-align-right:before{content:'\f01b'}.simditor-icon-font-minus:before{content:'\f01c'}.simditor-icon-markdown:before{content:'\f01d'}.simditor-icon-checklist:before{content:'\f01e'} |
@@ -0,0 +1,25 @@ |
||
1 |
+.simditor .simditor-body .simditor-checklist { |
|
2 |
+ margin: 15px 0; |
|
3 |
+ padding: 0 0 0 40px; |
|
4 |
+ line-height: 1.6; |
|
5 |
+ list-style-type: none; |
|
6 |
+} |
|
7 |
+ |
|
8 |
+.simditor .simditor-body .simditor-checklist > li { |
|
9 |
+ margin: 0; |
|
10 |
+ pointer-events: none; |
|
11 |
+} |
|
12 |
+.simditor .simditor-body .simditor-checklist > li::before { |
|
13 |
+ content: ''; |
|
14 |
+ pointer-events: all; |
|
15 |
+ display: inline-block; |
|
16 |
+ margin: 0 5px 0 -25px; |
|
17 |
+ width: 20px; |
|
18 |
+ height: 20px; |
|
19 |
+ cursor: default; |
|
20 |
+ vertical-align: middle; |
|
21 |
+ background-image: url("data:image/gif;base64,R0lGODlhFAAUAPUAAP///9nZ2XV1dWNjY3Z2dv7+/mpqasbGxsPDw21tbfv7+2RkZM/Pz/X19crKymdnZ+/v725ubsvLy/Hx8XBwcO7u7nd3d83Nzezs7Hp6eoCAgNfX14SEhIqKitLS0uDg4I2NjZSUlNTU1Ojo6NXV1ZaWlp6entjY2J+fn6WlpeXl5ebm5qmpqY6OjvPz85CQkP39/Xt7e/Ly8t3d3dzc3P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAAA1ACwAAAAAFAAUAAAG/8BarVar1Wq1Wq1Wq9VqtVqtVqvVarVarVar1Wq1Wq1Wq9VqtVqtVqvVarVarVar1Wq1Wq1Wq9WAtVpAMBgMBoPBYEAI1Gq1Wq1WKxgOAAAAAAAAAIhEoVar1Wo1xYLRaDQajUaj4XgoarVarVaDACOSyWQymUwmEwkFUqvVarVaxXLBYDAYDAaDuWQqtVqtVqtVNIzNZrPZbDYbBqdSq9VqtVql4wF+Pp/P5/P5eECVWq1Wq9UqIdFoNBqNRqMRqVSp1Wq1Wq1i2kwmk8lkMpmcUJVarVar1SopFQAABAAAAABgxarUarVaraZoOVwul8vlcrkuL0WtVqvVajBHTGYgEAgEAoEg5oDVarVarVaDyWY0Gg1Io9FmMlitVqvVarVarVYoFAqFQqFQq9VqtVqtVqvVarVarVar1Wq1Wq1Wq9VqtVqtVqvVarUasFar1Wq1Wq1Wq9VqtVqtVqvVarVarVar1YIAOw=="); |
|
22 |
+} |
|
23 |
+.simditor .simditor-body .simditor-checklist > li[checked]::before { |
|
24 |
+ background-image: url("data:image/gif;base64,R0lGODlhFAAUAPYAAAAAAHeHkD9QYB8wSOjo6Haw6C1huLbn8MfY8Ja42I630Ia48NjY2IefoJbH6Ja44H648D9CkCVZsE9XWFWY2D5wqI+foH6gwE9fYHeIoF93iPj4+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15px 0;padding:0 0 0 40px;line-height:1.6;list-style-type:none}.simditor .simditor-body .simditor-checklist>li{margin:0;pointer-events:none}.simditor .simditor-body .simditor-checklist>li::before{content:'';pointer-events:all;display:inline-block;margin:0 5px 0 -25px;width:20px;height:20px;cursor:default;vertical-align:middle;background-image:url("data:image/gif;base64,R0lGODlhFAAUAPUAAP///9nZ2XV1dWNjY3Z2dv7+/mpqasbGxsPDw21tbfv7+2RkZM/Pz/X19crKymdnZ+/v725ubsvLy/Hx8XBwcO7u7nd3d83Nzezs7Hp6eoCAgNfX14SEhIqKitLS0uDg4I2NjZSUlNTU1Ojo6NXV1ZaWlp6entjY2J+fn6WlpeXl5ebm5qmpqY6OjvPz85CQkP39/Xt7e/Ly8t3d3dzc3P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAAA1ACwAAAAAFAAUAAAG/8BarVar1Wq1Wq1Wq9VqtVqtVqvVarVarVar1Wq1Wq1Wq9VqtVqtVqvVarVarVar1Wq1Wq1Wq9WAtVpAMBgMBoPBYEAI1Gq1Wq1WKxgOAAAAAAAAAIhEoVar1Wo1xYLRaDQajUaj4XgoarVarVaDACOSyWQymUwmEwkFUqvVarVaxXLBYDAYDAaDuWQqtVqtVqtVNIzNZrPZbDYbBqdSq9VqtVql4wF+Pp/P5/P5eECVWq1Wq9UqIdFoNBqNRqMRqVSp1Wq1Wq1i2kwmk8lkMpmcUJVarVar1SopFQAABAAAAABgxarUarVaraZoOVwul8vlcrkuL0WtVqvVajBHTGYgEAgEAoEg5oDVarVarVaDyWY0Gg1Io9FmMlitVqvVarVarVYoFAqFQqFQq9VqtVqtVqvVarVarVar1Wq1Wq1Wq9VqtVqtVqvVarUasFar1Wq1Wq1Wq9VqtVqtVqvVarVarVar1YIAOw==")}.simditor .simditor-body .simditor-checklist>li[checked]::before{background-image:url("data:image/gif;base64,R0lGODlhFAAUAPYAAAAAAHeHkD9QYB8wSOjo6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KSkpKSkpKSkpKSkpKSoEAOw==")} |
@@ -0,0 +1,37 @@ |
||
1 |
+@font-face { |
|
2 |
+ font-family: 'icomoon'; |
|
3 |
+ src: url("../fonts/icomoon.eot?4vkjot"); |
|
4 |
+ src: url("../fonts/icomoon.eot?#iefix4vkjot") format("embedded-opentype"), url("../fonts/icomoon.ttf?4vkjot") format("truetype"), url("../fonts/icomoon.woff?4vkjot") format("woff"), url("../fonts/icomoon.svg?4vkjot#icomoon") format("svg"); |
|
5 |
+ font-weight: normal; |
|
6 |
+ font-style: normal; |
|
7 |
+} |
|
8 |
+[class^="icon-"], [class*=" icon-"] { |
|
9 |
+ font-family: 'icomoon'; |
|
10 |
+ speak: none; |
|
11 |
+ font-style: normal; |
|
12 |
+ font-weight: normal; |
|
13 |
+ font-variant: normal; |
|
14 |
+ text-transform: none; |
|
15 |
+ line-height: 1; |
|
16 |
+ /* Better Font Rendering =========== */ |
|
17 |
+ -webkit-font-smoothing: antialiased; |
|
18 |
+ -moz-osx-font-smoothing: grayscale; |
|
19 |
+} |
|
20 |
+ |
|
21 |
+.icon-fullscreen:before { |
|
22 |
+ content: "\e600"; |
|
23 |
+} |
|
24 |
+ |
|
25 |
+.simditor-fullscreen { |
|
26 |
+ overflow: hidden; |
|
27 |
+} |
|
28 |
+.simditor-fullscreen .simditor { |
|
29 |
+ position: fixed; |
|
30 |
+ top: 0; |
|
31 |
+ left: 0; |
|
32 |
+ z-index: 9999; |
|
33 |
+ width: 100%; |
|
34 |
+} |
|
35 |
+.simditor-fullscreen .simditor .simditor-body { |
|
36 |
+ overflow: auto; |
|
37 |
+} |
@@ -0,0 +1 @@ |
||
1 |
+@font-face{font-family:'icomoon';src:url("../fonts/icomoon.eot?4vkjot");src:url("../fonts/icomoon.eot?#iefix4vkjot") format("embedded-opentype"),url("../fonts/icomoon.ttf?4vkjot") format("truetype"),url("../fonts/icomoon.woff?4vkjot") format("woff"),url("../fonts/icomoon.svg?4vkjot#icomoon") format("svg");font-weight:normal;font-style:normal}[class^="icon-"],[class*=" icon-"]{font-family:'icomoon';speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-fullscreen:before{content:"\e600"}.simditor-fullscreen{overflow:hidden}.simditor-fullscreen .simditor{position:fixed;top:0;left:0;z-index:9999;width:100%}.simditor-fullscreen .simditor .simditor-body{overflow:auto} |
@@ -0,0 +1,28 @@ |
||
1 |
+.simditor .markdown-editor { |
|
2 |
+ display: none; |
|
3 |
+} |
|
4 |
+.simditor .markdown-editor textarea { |
|
5 |
+ display: block; |
|
6 |
+ width: 100%; |
|
7 |
+ min-height: 200px; |
|
8 |
+ box-sizing: border-box; |
|
9 |
+ padding: 22px 15px 40px; |
|
10 |
+ border: none; |
|
11 |
+ border-bottom: 1px solid #dfdfdf; |
|
12 |
+ resize: none; |
|
13 |
+ outline: none; |
|
14 |
+ font-size: 16px; |
|
15 |
+} |
|
16 |
+.simditor.simditor-markdown .markdown-editor { |
|
17 |
+ display: block; |
|
18 |
+} |
|
19 |
+.simditor.simditor-markdown .simditor-body { |
|
20 |
+ min-height: 100px; |
|
21 |
+ background: #f3f3f3; |
|
22 |
+} |
|
23 |
+.simditor.simditor-markdown .simditor-placeholder { |
|
24 |
+ display: none !important; |
|
25 |
+} |
|
26 |
+.simditor .simditor-toolbar .toolbar-item.toolbar-item-markdown .simditor-icon { |
|
27 |
+ font-size: 18px; |
|
28 |
+} |
@@ -0,0 +1 @@ |
||
1 |
+.simditor .markdown-editor{display:none}.simditor .markdown-editor textarea{display:block;width:100%;min-height:200px;box-sizing:border-box;padding:22px 15px 40px;border:0;border-bottom:1px solid #dfdfdf;resize:none;outline:0;font-size:16px}.simditor.simditor-markdown .markdown-editor{display:block}.simditor.simditor-markdown .simditor-body{min-height:100px;background:#f3f3f3}.simditor.simditor-markdown .simditor-placeholder{display:none!important}.simditor .simditor-toolbar .toolbar-item.toolbar-item-markdown .simditor-icon{font-size:18px} |
@@ -0,0 +1,746 @@ |
||
1 |
+/*! |
|
2 |
+* Simditor v2.3.6 |
|
3 |
+* http://simditor.tower.im/ |
|
4 |
+* 2015-12-21 |
|
5 |
+*/ |
|
6 |
+@font-face { |
|
7 |
+ font-family: 'Simditor'; |
|
8 |
+ src: url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAABp8AA4AAAAAKmwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAaYAAAABoAAAAcdO8GE09TLzIAAAG0AAAARQAAAGAQ+ZFXY21hcAAAAkgAAABRAAABWuA2Gx9jdnQgAAAEgAAAAAoAAAAKAwQAxGZwZ20AAAKcAAABsQAAAmUPtC+nZ2x5ZgAABNgAABPeAAAgZG/p6QxoZWFkAAABRAAAADAAAAA2BvuCgGhoZWEAAAF0AAAAHgAAACQH9QTlaG10eAAAAfwAAABKAAAAlHv7AItsb2NhAAAEjAAAAEwAAABMi4qTXm1heHAAAAGUAAAAIAAAACABRwHNbmFtZQAAGLgAAAEFAAAB12vS/ulwb3N0AAAZwAAAAJ4AAAFsyCrvunByZXAAAARQAAAALgAAAC6w8isUeNpjYGRgYADiKAkPy3h+m68M8swfgCIMF0/IVyDo/84sFswJQC4HAxNIFAAZwAnyeNpjYGRgYE5gmMAQzWLBwPD/O5AEiqAAVQBa6wPkAAAAAQAAACUAoAAKAAAAAAACAAEAAgAWAAABAAEpAAAAAHjaY2BhnsA4gYGVgYGpn+kgAwNDL4RmfMxgxMgCFGVgZWaAAUYBBjTQwMDwQY454X8BQzRzAsMEIJcRSVaBgREAQ9oK6QAAAHjaY8xhUGQAAsYABgbmDwjMYsEgxCzBwMDkAOQnALEEgx1UjhNMr4BjTqBakDxC/wqIPsYMqJoEKIbpk0C1C4zXM3DA5AEzchbtAAB42mNgYGBmgGAZBkYGEAgB8hjBfBYGCyDNxcDBwASEDAy8DAof5P7/B6sCsRmAbOb/3/8/FWCD6oUCRjaIkWA2SCcLAyoAqmZlGN4AALmUC0k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EIc/JU6aQhsyltJBQ6eCg20IgdCt1GTwlNJsHUJijCCxwHaeqVufpM/Qta/Ri31ZOkTipO9Ov/sjYMwXhm7d8qBsGPGs3OOKd+U+j3wqB6L5UR5wY4zykJGxojTBtXj3bdaJDROelHvS91W5z5IP5UA038oD7vhVHjIxY1I8JQ2ObUs1lkz2C6S+bNzWl7XNMnHfRHNgJ2cjykoC7rBzjRdakVNwZM/m9LDKi+N+I3AunrYJhagsCVMiuRdi/0t20Vg0IXOxRJQxs26U1FdFbpNpZBf23FowTsJ5mETx7OKEa+ldyedcO9GpRzcF67yqnS9tLHUvVfgDz/ZF8gAAAHjabc25DgFhGIXh/53B2Pd9J9HPN/bSWolC4iI0OjfgxhFO6SQnT/k6z333errI/dvkc5yHh+98YsRJEJAkRZoMWXLkKVCkRJkKVWrUadCkRZsOXXr0GTBkxDh2vp5O3u4SPO63YxiG0mQkp3Im53Ihl3Il13Ijt3In9/Igjz9NfVPf1Df1TX1T39Q39U19U9/UN/VNfVPfDm8tR0peAAB42mNgYGBkAIKLcceVwfQJ+XIoXQEARe8GegAA) format("woff"); |
|
9 |
+ font-weight: normal; |
|
10 |
+ font-style: normal; |
|
11 |
+} |
|
12 |
+.simditor-icon { |
|
13 |
+ display: inline-block; |
|
14 |
+ font: normal normal normal 14px/1 'Simditor'; |
|
15 |
+ font-size: inherit; |
|
16 |
+ text-rendering: auto; |
|
17 |
+ -webkit-font-smoothing: antialiased; |
|
18 |
+ -moz-osx-font-smoothing: grayscale; |
|
19 |
+ transform: translate(0, 0); |
|
20 |
+} |
|
21 |
+ |
|
22 |
+.simditor-icon-code:before { |
|
23 |
+ content: '\f000'; |
|
24 |
+} |
|
25 |
+ |
|
26 |
+.simditor-icon-bold:before { |
|
27 |
+ content: '\f001'; |
|
28 |
+} |
|
29 |
+ |
|
30 |
+.simditor-icon-italic:before { |
|
31 |
+ content: '\f002'; |
|
32 |
+} |
|
33 |
+ |
|
34 |
+.simditor-icon-underline:before { |
|
35 |
+ content: '\f003'; |
|
36 |
+} |
|
37 |
+ |
|
38 |
+.simditor-icon-times:before { |
|
39 |
+ content: '\f004'; |
|
40 |
+} |
|
41 |
+ |
|
42 |
+.simditor-icon-strikethrough:before { |
|
43 |
+ content: '\f005'; |
|
44 |
+} |
|
45 |
+ |
|
46 |
+.simditor-icon-list-ol:before { |
|
47 |
+ content: '\f006'; |
|
48 |
+} |
|
49 |
+ |
|
50 |
+.simditor-icon-list-ul:before { |
|
51 |
+ content: '\f007'; |
|
52 |
+} |
|
53 |
+ |
|
54 |
+.simditor-icon-quote-left:before { |
|
55 |
+ content: '\f008'; |
|
56 |
+} |
|
57 |
+ |
|
58 |
+.simditor-icon-table:before { |
|
59 |
+ content: '\f009'; |
|
60 |
+} |
|
61 |
+ |
|
62 |
+.simditor-icon-link:before { |
|
63 |
+ content: '\f00a'; |
|
64 |
+} |
|
65 |
+ |
|
66 |
+.simditor-icon-picture-o:before { |
|
67 |
+ content: '\f00b'; |
|
68 |
+} |
|
69 |
+ |
|
70 |
+.simditor-icon-minus:before { |
|
71 |
+ content: '\f00c'; |
|
72 |
+} |
|
73 |
+ |
|
74 |
+.simditor-icon-indent:before { |
|
75 |
+ content: '\f00d'; |
|
76 |
+} |
|
77 |
+ |
|
78 |
+.simditor-icon-outdent:before { |
|
79 |
+ content: '\f00e'; |
|
80 |
+} |
|
81 |
+ |
|
82 |
+.simditor-icon-unlink:before { |
|
83 |
+ content: '\f00f'; |
|
84 |
+} |
|
85 |
+ |
|
86 |
+.simditor-icon-caret-down:before { |
|
87 |
+ content: '\f010'; |
|
88 |
+} |
|
89 |
+ |
|
90 |
+.simditor-icon-caret-right:before { |
|
91 |
+ content: '\f011'; |
|
92 |
+} |
|
93 |
+ |
|
94 |
+.simditor-icon-upload:before { |
|
95 |
+ content: '\f012'; |
|
96 |
+} |
|
97 |
+ |
|
98 |
+.simditor-icon-undo:before { |
|
99 |
+ content: '\f013'; |
|
100 |
+} |
|
101 |
+ |
|
102 |
+.simditor-icon-smile-o:before { |
|
103 |
+ content: '\f014'; |
|
104 |
+} |
|
105 |
+ |
|
106 |
+.simditor-icon-tint:before { |
|
107 |
+ content: '\f015'; |
|
108 |
+} |
|
109 |
+ |
|
110 |
+.simditor-icon-font:before { |
|
111 |
+ content: '\f016'; |
|
112 |
+} |
|
113 |
+ |
|
114 |
+.simditor-icon-html5:before { |
|
115 |
+ content: '\f017'; |
|
116 |
+} |
|
117 |
+ |
|
118 |
+.simditor-icon-mark:before { |
|
119 |
+ content: '\f018'; |
|
120 |
+} |
|
121 |
+ |
|
122 |
+.simditor-icon-align-center:before { |
|
123 |
+ content: '\f019'; |
|
124 |
+} |
|
125 |
+ |
|
126 |
+.simditor-icon-align-left:before { |
|
127 |
+ content: '\f01a'; |
|
128 |
+} |
|
129 |
+ |
|
130 |
+.simditor-icon-align-right:before { |
|
131 |
+ content: '\f01b'; |
|
132 |
+} |
|
133 |
+ |
|
134 |
+.simditor-icon-font-minus:before { |
|
135 |
+ content: '\f01c'; |
|
136 |
+} |
|
137 |
+ |
|
138 |
+.simditor-icon-markdown:before { |
|
139 |
+ content: '\f01d'; |
|
140 |
+} |
|
141 |
+ |
|
142 |
+.simditor-icon-checklist:before { |
|
143 |
+ content: '\f01e'; |
|
144 |
+} |
|
145 |
+ |
|
146 |
+.simditor { |
|
147 |
+ position: relative; |
|
148 |
+ border: 1px solid #c9d8db; |
|
149 |
+} |
|
150 |
+.simditor .simditor-wrapper { |
|
151 |
+ position: relative; |
|
152 |
+ background: #ffffff; |
|
153 |
+} |
|
154 |
+.simditor .simditor-wrapper > textarea { |
|
155 |
+ display: none !important; |
|
156 |
+ width: 100%; |
|
157 |
+ box-sizing: border-box; |
|
158 |
+ font-family: monaco; |
|
159 |
+ font-size: 16px; |
|
160 |
+ line-height: 1.6; |
|
161 |
+ border: none; |
|
162 |
+ padding: 22px 15px 40px; |
|
163 |
+ min-height: 300px; |
|
164 |
+ outline: none; |
|
165 |
+ background: transparent; |
|
166 |
+ resize: none; |
|
167 |
+} |
|
168 |
+.simditor .simditor-wrapper .simditor-placeholder { |
|
169 |
+ display: none; |
|
170 |
+ position: absolute; |
|
171 |
+ left: 0; |
|
172 |
+ z-index: 0; |
|
173 |
+ padding: 22px 15px; |
|
174 |
+ font-size: 16px; |
|
175 |
+ font-family: arial, sans-serif; |
|
176 |
+ line-height: 1.5; |
|
177 |
+ color: #999999; |
|
178 |
+ background: transparent; |
|
179 |
+} |
|
180 |
+.simditor .simditor-wrapper.toolbar-floating .simditor-toolbar { |
|
181 |
+ position: fixed; |
|
182 |
+ top: 0; |
|
183 |
+ z-index: 10; |
|
184 |
+ box-shadow: 0 0 6px rgba(0, 0, 0, 0.1); |
|
185 |
+} |
|
186 |
+.simditor .simditor-wrapper .simditor-image-loading { |
|
187 |
+ width: 100%; |
|
188 |
+ height: 100%; |
|
189 |
+ position: absolute; |
|
190 |
+ top: 0; |
|
191 |
+ left: 0; |
|
192 |
+ z-index: 2; |
|
193 |
+} |
|
194 |
+.simditor .simditor-wrapper .simditor-image-loading .progress { |
|
195 |
+ width: 100%; |
|
196 |
+ height: 100%; |
|
197 |
+ background: rgba(0, 0, 0, 0.4); |
|
198 |
+ position: absolute; |
|
199 |
+ bottom: 0; |
|
200 |
+ left: 0; |
|
201 |
+} |
|
202 |
+.simditor .simditor-body { |
|
203 |
+ padding: 22px 15px 40px; |
|
204 |
+ min-height: 300px; |
|
205 |
+ outline: none; |
|
206 |
+ cursor: text; |
|
207 |
+ position: relative; |
|
208 |
+ z-index: 1; |
|
209 |
+ background: transparent; |
|
210 |
+} |
|
211 |
+.simditor .simditor-body a.selected { |
|
212 |
+ background: #b3d4fd; |
|
213 |
+} |
|
214 |
+.simditor .simditor-body a.simditor-mention { |
|
215 |
+ cursor: pointer; |
|
216 |
+} |
|
217 |
+.simditor .simditor-body .simditor-table { |
|
218 |
+ position: relative; |
|
219 |
+} |
|
220 |
+.simditor .simditor-body .simditor-table.resizing { |
|
221 |
+ cursor: col-resize; |
|
222 |
+} |
|
223 |
+.simditor .simditor-body .simditor-table .simditor-resize-handle { |
|
224 |
+ position: absolute; |
|
225 |
+ left: 0; |
|
226 |
+ top: 0; |
|
227 |
+ width: 10px; |
|
228 |
+ height: 100%; |
|
229 |
+ cursor: col-resize; |
|
230 |
+} |
|
231 |
+.simditor .simditor-body pre { |
|
232 |
+ /*min-height: 28px;*/ |
|
233 |
+ box-sizing: border-box; |
|
234 |
+ -moz-box-sizing: border-box; |
|
235 |
+ word-wrap: break-word !important; |
|
236 |
+ white-space: pre-wrap !important; |
|
237 |
+} |
|
238 |
+.simditor .simditor-body img { |
|
239 |
+ cursor: pointer; |
|
240 |
+} |
|
241 |
+.simditor .simditor-body img.selected { |
|
242 |
+ box-shadow: 0 0 0 4px #cccccc; |
|
243 |
+} |
|
244 |
+.simditor .simditor-paste-bin { |
|
245 |
+ position: fixed; |
|
246 |
+ bottom: 10px; |
|
247 |
+ right: 10px; |
|
248 |
+ width: 1px; |
|
249 |
+ height: 20px; |
|
250 |
+ font-size: 1px; |
|
251 |
+ line-height: 1px; |
|
252 |
+ overflow: hidden; |
|
253 |
+ padding: 0; |
|
254 |
+ margin: 0; |
|
255 |
+ opacity: 0; |
|
256 |
+ -webkit-user-select: text; |
|
257 |
+} |
|
258 |
+.simditor .simditor-toolbar { |
|
259 |
+ border-bottom: 1px solid #eeeeee; |
|
260 |
+ background: #ffffff; |
|
261 |
+ width: 100%; |
|
262 |
+} |
|
263 |
+.simditor .simditor-toolbar > ul { |
|
264 |
+ margin: 0; |
|
265 |
+ padding: 0 0 0 6px; |
|
266 |
+ list-style: none; |
|
267 |
+} |
|
268 |
+.simditor .simditor-toolbar > ul > li { |
|
269 |
+ position: relative; |
|
270 |
+ display: inline-block; |
|
271 |
+ font-size: 0; |
|
272 |
+} |
|
273 |
+.simditor .simditor-toolbar > ul > li > span.separator { |
|
274 |
+ display: inline-block; |
|
275 |
+ background: #cfcfcf; |
|
276 |
+ width: 1px; |
|
277 |
+ height: 18px; |
|
278 |
+ margin: 11px 15px; |
|
279 |
+ vertical-align: middle; |
|
280 |
+} |
|
281 |
+.simditor .simditor-toolbar > ul > li > .toolbar-item { |
|
282 |
+ display: inline-block; |
|
283 |
+ width: 46px; |
|
284 |
+ height: 40px; |
|
285 |
+ outline: none; |
|
286 |
+ color: #333333; |
|
287 |
+ font-size: 15px; |
|
288 |
+ line-height: 40px; |
|
289 |
+ vertical-align: middle; |
|
290 |
+ text-align: center; |
|
291 |
+ text-decoration: none; |
|
292 |
+} |
|
293 |
+.simditor .simditor-toolbar > ul > li > .toolbar-item span { |
|
294 |
+ opacity: 0.6; |
|
295 |
+} |
|
296 |
+.simditor .simditor-toolbar > ul > li > .toolbar-item span.simditor-icon { |
|
297 |
+ display: inline; |
|
298 |
+ line-height: normal; |
|
299 |
+} |
|
300 |
+.simditor .simditor-toolbar > ul > li > .toolbar-item:hover span { |
|
301 |
+ opacity: 1; |
|
302 |
+} |
|
303 |
+.simditor .simditor-toolbar > ul > li > .toolbar-item.active { |
|
304 |
+ background: #eeeeee; |
|
305 |
+} |
|
306 |
+.simditor .simditor-toolbar > ul > li > .toolbar-item.active span { |
|
307 |
+ opacity: 1; |
|
308 |
+} |
|
309 |
+.simditor .simditor-toolbar > ul > li > .toolbar-item.disabled { |
|
310 |
+ cursor: default; |
|
311 |
+} |
|
312 |
+.simditor .simditor-toolbar > ul > li > .toolbar-item.disabled span { |
|
313 |
+ opacity: 0.3; |
|
314 |
+} |
|
315 |
+.simditor .simditor-toolbar > ul > li > .toolbar-item.toolbar-item-title span:before { |
|
316 |
+ content: "H"; |
|
317 |
+ font-size: 19px; |
|
318 |
+ font-weight: bold; |
|
319 |
+ font-family: 'Times New Roman'; |
|
320 |
+} |
|
321 |
+.simditor .simditor-toolbar > ul > li > .toolbar-item.toolbar-item-title.active-h1 span:before { |
|
322 |
+ content: 'H1'; |
|
323 |
+ font-size: 18px; |
|
324 |
+} |
|
325 |
+.simditor .simditor-toolbar > ul > li > .toolbar-item.toolbar-item-title.active-h2 span:before { |
|
326 |
+ content: 'H2'; |
|
327 |
+ font-size: 18px; |
|
328 |
+} |
|
329 |
+.simditor .simditor-toolbar > ul > li > .toolbar-item.toolbar-item-title.active-h3 span:before { |
|
330 |
+ content: 'H3'; |
|
331 |
+ font-size: 18px; |
|
332 |
+} |
|
333 |
+.simditor .simditor-toolbar > ul > li > .toolbar-item.toolbar-item-image { |
|
334 |
+ position: relative; |
|
335 |
+ overflow: hidden; |
|
336 |
+} |
|
337 |
+.simditor .simditor-toolbar > ul > li > .toolbar-item.toolbar-item-image > input[type=file] { |
|
338 |
+ position: absolute; |
|
339 |
+ right: 0px; |
|
340 |
+ top: 0px; |
|
341 |
+ opacity: 0; |
|
342 |
+ font-size: 100px; |
|
343 |
+ cursor: pointer; |
|
344 |
+} |
|
345 |
+.simditor .simditor-toolbar > ul > li.menu-on .toolbar-item { |
|
346 |
+ position: relative; |
|
347 |
+ z-index: 20; |
|
348 |
+ background: #ffffff; |
|
349 |
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); |
|
350 |
+} |
|
351 |
+.simditor .simditor-toolbar > ul > li.menu-on .toolbar-item span { |
|
352 |
+ opacity: 1; |
|
353 |
+} |
|
354 |
+.simditor .simditor-toolbar > ul > li.menu-on .toolbar-menu { |
|
355 |
+ display: block; |
|
356 |
+} |
|
357 |
+.simditor .simditor-toolbar .toolbar-menu { |
|
358 |
+ display: none; |
|
359 |
+ position: absolute; |
|
360 |
+ top: 40px; |
|
361 |
+ left: 0; |
|
362 |
+ z-index: 21; |
|
363 |
+ background: #ffffff; |
|
364 |
+ text-align: left; |
|
365 |
+ box-shadow: 0 0 4px rgba(0, 0, 0, 0.3); |
|
366 |
+} |
|
367 |
+.simditor .simditor-toolbar .toolbar-menu:before { |
|
368 |
+ content: ''; |
|
369 |
+ display: block; |
|
370 |
+ width: 46px; |
|
371 |
+ height: 4px; |
|
372 |
+ background: #ffffff; |
|
373 |
+ position: absolute; |
|
374 |
+ top: -3px; |
|
375 |
+ left: 0; |
|
376 |
+} |
|
377 |
+.simditor .simditor-toolbar .toolbar-menu ul { |
|
378 |
+ min-width: 160px; |
|
379 |
+ list-style: none; |
|
380 |
+ margin: 0; |
|
381 |
+ padding: 10px 1px; |
|
382 |
+} |
|
383 |
+.simditor .simditor-toolbar .toolbar-menu ul > li .menu-item { |
|
384 |
+ display: block; |
|
385 |
+ font-size: 16px; |
|
386 |
+ line-height: 2em; |
|
387 |
+ padding: 0 10px; |
|
388 |
+ text-decoration: none; |
|
389 |
+ color: #666666; |
|
390 |
+} |
|
391 |
+.simditor .simditor-toolbar .toolbar-menu ul > li .menu-item:hover { |
|
392 |
+ background: #f6f6f6; |
|
393 |
+} |
|
394 |
+.simditor .simditor-toolbar .toolbar-menu ul > li .menu-item.menu-item-h1 { |
|
395 |
+ font-size: 24px; |
|
396 |
+ color: #333333; |
|
397 |
+} |
|
398 |
+.simditor .simditor-toolbar .toolbar-menu ul > li .menu-item.menu-item-h2 { |
|
399 |
+ font-size: 22px; |
|
400 |
+ color: #333333; |
|
401 |
+} |
|
402 |
+.simditor .simditor-toolbar .toolbar-menu ul > li .menu-item.menu-item-h3 { |
|
403 |
+ font-size: 20px; |
|
404 |
+ color: #333333; |
|
405 |
+} |
|
406 |
+.simditor .simditor-toolbar .toolbar-menu ul > li .menu-item.menu-item-h4 { |
|
407 |
+ font-size: 18px; |
|
408 |
+ color: #333333; |
|
409 |
+} |
|
410 |
+.simditor .simditor-toolbar .toolbar-menu ul > li .menu-item.menu-item-h5 { |
|
411 |
+ font-size: 16px; |
|
412 |
+ color: #333333; |
|
413 |
+} |
|
414 |
+.simditor .simditor-toolbar .toolbar-menu ul > li .separator { |
|
415 |
+ display: block; |
|
416 |
+ border-top: 1px solid #cccccc; |
|
417 |
+ height: 0; |
|
418 |
+ line-height: 0; |
|
419 |
+ font-size: 0; |
|
420 |
+ margin: 6px 0; |
|
421 |
+} |
|
422 |
+.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color { |
|
423 |
+ width: 96px; |
|
424 |
+} |
|
425 |
+.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list { |
|
426 |
+ height: 40px; |
|
427 |
+ margin: 10px 6px 6px 10px; |
|
428 |
+ padding: 0; |
|
429 |
+ min-width: 0; |
|
430 |
+} |
|
431 |
+.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li { |
|
432 |
+ float: left; |
|
433 |
+ margin: 0 4px 4px 0; |
|
434 |
+} |
|
435 |
+.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color { |
|
436 |
+ display: block; |
|
437 |
+ width: 16px; |
|
438 |
+ height: 16px; |
|
439 |
+ background: #dfdfdf; |
|
440 |
+ border-radius: 2px; |
|
441 |
+} |
|
442 |
+.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color:hover { |
|
443 |
+ opacity: 0.8; |
|
444 |
+} |
|
445 |
+.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color.font-color-default { |
|
446 |
+ background: #333333; |
|
447 |
+} |
|
448 |
+.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color-1 { |
|
449 |
+ background: #E33737; |
|
450 |
+} |
|
451 |
+.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color-2 { |
|
452 |
+ background: #e28b41; |
|
453 |
+} |
|
454 |
+.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color-3 { |
|
455 |
+ background: #c8a732; |
|
456 |
+} |
|
457 |
+.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color-4 { |
|
458 |
+ background: #209361; |
|
459 |
+} |
|
460 |
+.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color-5 { |
|
461 |
+ background: #418caf; |
|
462 |
+} |
|
463 |
+.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color-6 { |
|
464 |
+ background: #aa8773; |
|
465 |
+} |
|
466 |
+.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color-7 { |
|
467 |
+ background: #999999; |
|
468 |
+} |
|
469 |
+.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-table .menu-create-table { |
|
470 |
+ background: #ffffff; |
|
471 |
+ padding: 1px; |
|
472 |
+} |
|
473 |
+.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-table .menu-create-table table { |
|
474 |
+ border: none; |
|
475 |
+ border-collapse: collapse; |
|
476 |
+ border-spacing: 0; |
|
477 |
+ table-layout: fixed; |
|
478 |
+} |
|
479 |
+.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-table .menu-create-table table td { |
|
480 |
+ padding: 0; |
|
481 |
+ cursor: pointer; |
|
482 |
+} |
|
483 |
+.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-table .menu-create-table table td:before { |
|
484 |
+ width: 16px; |
|
485 |
+ height: 16px; |
|
486 |
+ border: 1px solid #ffffff; |
|
487 |
+ background: #f3f3f3; |
|
488 |
+ display: block; |
|
489 |
+ content: ""; |
|
490 |
+} |
|
491 |
+.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-table .menu-create-table table td.selected:before { |
|
492 |
+ background: #cfcfcf; |
|
493 |
+} |
|
494 |
+.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-table .menu-edit-table { |
|
495 |
+ display: none; |
|
496 |
+} |
|
497 |
+.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-table .menu-edit-table ul li { |
|
498 |
+ white-space: nowrap; |
|
499 |
+} |
|
500 |
+.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-image .menu-item-upload-image { |
|
501 |
+ position: relative; |
|
502 |
+ overflow: hidden; |
|
503 |
+} |
|
504 |
+.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-image .menu-item-upload-image input[type=file] { |
|
505 |
+ position: absolute; |
|
506 |
+ right: 0px; |
|
507 |
+ top: 0px; |
|
508 |
+ opacity: 0; |
|
509 |
+ font-size: 100px; |
|
510 |
+ cursor: pointer; |
|
511 |
+} |
|
512 |
+.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-alignment { |
|
513 |
+ width: 100%; |
|
514 |
+} |
|
515 |
+.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-alignment ul { |
|
516 |
+ min-width: 100%; |
|
517 |
+} |
|
518 |
+.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-alignment .menu-item { |
|
519 |
+ text-align: center; |
|
520 |
+} |
|
521 |
+.simditor .simditor-popover { |
|
522 |
+ display: none; |
|
523 |
+ padding: 5px 8px 0; |
|
524 |
+ background: #ffffff; |
|
525 |
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); |
|
526 |
+ border-radius: 2px; |
|
527 |
+ position: absolute; |
|
528 |
+ z-index: 2; |
|
529 |
+} |
|
530 |
+.simditor .simditor-popover .settings-field { |
|
531 |
+ margin: 0 0 5px 0; |
|
532 |
+ font-size: 12px; |
|
533 |
+ height: 25px; |
|
534 |
+ line-height: 25px; |
|
535 |
+} |
|
536 |
+.simditor .simditor-popover .settings-field label { |
|
537 |
+ display: inline-block; |
|
538 |
+ margin: 0 5px 0 0; |
|
539 |
+} |
|
540 |
+.simditor .simditor-popover .settings-field input[type=text] { |
|
541 |
+ display: inline-block; |
|
542 |
+ width: 200px; |
|
543 |
+ box-sizing: border-box; |
|
544 |
+ font-size: 12px; |
|
545 |
+} |
|
546 |
+.simditor .simditor-popover .settings-field input[type=text].image-size { |
|
547 |
+ width: 83px; |
|
548 |
+} |
|
549 |
+.simditor .simditor-popover .settings-field .times { |
|
550 |
+ display: inline-block; |
|
551 |
+ width: 26px; |
|
552 |
+ font-size: 12px; |
|
553 |
+ text-align: center; |
|
554 |
+} |
|
555 |
+.simditor .simditor-popover.link-popover .btn-unlink, .simditor .simditor-popover.image-popover .btn-upload, .simditor .simditor-popover.image-popover .btn-restore { |
|
556 |
+ display: inline-block; |
|
557 |
+ margin: 0 0 0 5px; |
|
558 |
+ color: #333333; |
|
559 |
+ font-size: 14px; |
|
560 |
+ outline: 0; |
|
561 |
+} |
|
562 |
+.simditor .simditor-popover.link-popover .btn-unlink span, .simditor .simditor-popover.image-popover .btn-upload span, .simditor .simditor-popover.image-popover .btn-restore span { |
|
563 |
+ opacity: 0.6; |
|
564 |
+} |
|
565 |
+.simditor .simditor-popover.link-popover .btn-unlink:hover span, .simditor .simditor-popover.image-popover .btn-upload:hover span, .simditor .simditor-popover.image-popover .btn-restore:hover span { |
|
566 |
+ opacity: 1; |
|
567 |
+} |
|
568 |
+.simditor .simditor-popover.image-popover .btn-upload { |
|
569 |
+ position: relative; |
|
570 |
+ display: inline-block; |
|
571 |
+ overflow: hidden; |
|
572 |
+ vertical-align: middle; |
|
573 |
+} |
|
574 |
+.simditor .simditor-popover.image-popover .btn-upload input[type=file] { |
|
575 |
+ position: absolute; |
|
576 |
+ right: 0px; |
|
577 |
+ top: 0px; |
|
578 |
+ opacity: 0; |
|
579 |
+ height: 100%; |
|
580 |
+ width: 28px; |
|
581 |
+} |
|
582 |
+.simditor.simditor-mobile .simditor-wrapper.toolbar-floating .simditor-toolbar { |
|
583 |
+ position: absolute; |
|
584 |
+ top: 0; |
|
585 |
+ z-index: 10; |
|
586 |
+ box-shadow: 0 0 6px rgba(0, 0, 0, 0.1); |
|
587 |
+} |
|
588 |
+ |
|
589 |
+.simditor .simditor-body, .editor-style { |
|
590 |
+ font-size: 16px; |
|
591 |
+ font-family: arial, sans-serif; |
|
592 |
+ line-height: 1.6; |
|
593 |
+ color: #333; |
|
594 |
+ outline: none; |
|
595 |
+ word-wrap: break-word; |
|
596 |
+} |
|
597 |
+.simditor .simditor-body > :first-child, .editor-style > :first-child { |
|
598 |
+ margin-top: 0 !important; |
|
599 |
+} |
|
600 |
+.simditor .simditor-body a, .editor-style a { |
|
601 |
+ color: #4298BA; |
|
602 |
+ text-decoration: none; |
|
603 |
+ word-break: break-all; |
|
604 |
+} |
|
605 |
+.simditor .simditor-body a:visited, .editor-style a:visited { |
|
606 |
+ color: #4298BA; |
|
607 |
+} |
|
608 |
+.simditor .simditor-body a:hover, .editor-style a:hover { |
|
609 |
+ color: #0F769F; |
|
610 |
+} |
|
611 |
+.simditor .simditor-body a:active, .editor-style a:active { |
|
612 |
+ color: #9E792E; |
|
613 |
+} |
|
614 |
+.simditor .simditor-body a:hover, .simditor .simditor-body a:active, .editor-style a:hover, .editor-style a:active { |
|
615 |
+ outline: 0; |
|
616 |
+} |
|
617 |
+.simditor .simditor-body h1, .simditor .simditor-body h2, .simditor .simditor-body h3, .simditor .simditor-body h4, .simditor .simditor-body h5, .simditor .simditor-body h6, .editor-style h1, .editor-style h2, .editor-style h3, .editor-style h4, .editor-style h5, .editor-style h6 { |
|
618 |
+ font-weight: normal; |
|
619 |
+ margin: 40px 0 20px; |
|
620 |
+ color: #000000; |
|
621 |
+} |
|
622 |
+.simditor .simditor-body h1, .editor-style h1 { |
|
623 |
+ font-size: 24px; |
|
624 |
+} |
|
625 |
+.simditor .simditor-body h2, .editor-style h2 { |
|
626 |
+ font-size: 22px; |
|
627 |
+} |
|
628 |
+.simditor .simditor-body h3, .editor-style h3 { |
|
629 |
+ font-size: 20px; |
|
630 |
+} |
|
631 |
+.simditor .simditor-body h4, .editor-style h4 { |
|
632 |
+ font-size: 18px; |
|
633 |
+} |
|
634 |
+.simditor .simditor-body h5, .editor-style h5 { |
|
635 |
+ font-size: 16px; |
|
636 |
+} |
|
637 |
+.simditor .simditor-body h6, .editor-style h6 { |
|
638 |
+ font-size: 16px; |
|
639 |
+} |
|
640 |
+.simditor .simditor-body p, .simditor .simditor-body div, .editor-style p, .editor-style div { |
|
641 |
+ word-wrap: break-word; |
|
642 |
+ margin: 0 0 15px 0; |
|
643 |
+ color: #333; |
|
644 |
+ word-wrap: break-word; |
|
645 |
+} |
|
646 |
+.simditor .simditor-body b, .simditor .simditor-body strong, .editor-style b, .editor-style strong { |
|
647 |
+ font-weight: bold; |
|
648 |
+} |
|
649 |
+.simditor .simditor-body i, .simditor .simditor-body em, .editor-style i, .editor-style em { |
|
650 |
+ font-style: italic; |
|
651 |
+} |
|
652 |
+.simditor .simditor-body u, .editor-style u { |
|
653 |
+ text-decoration: underline; |
|
654 |
+} |
|
655 |
+.simditor .simditor-body strike, .simditor .simditor-body del, .editor-style strike, .editor-style del { |
|
656 |
+ text-decoration: line-through; |
|
657 |
+} |
|
658 |
+.simditor .simditor-body ul, .simditor .simditor-body ol, .editor-style ul, .editor-style ol { |
|
659 |
+ list-style: disc outside none; |
|
660 |
+ margin: 15px 0; |
|
661 |
+ padding: 0 0 0 40px; |
|
662 |
+ line-height: 1.6; |
|
663 |
+} |
|
664 |
+.simditor .simditor-body ul ul, .simditor .simditor-body ul ol, .simditor .simditor-body ol ul, .simditor .simditor-body ol ol, .editor-style ul ul, .editor-style ul ol, .editor-style ol ul, .editor-style ol ol { |
|
665 |
+ padding-left: 30px; |
|
666 |
+} |
|
667 |
+.simditor .simditor-body ul ul, .simditor .simditor-body ol ul, .editor-style ul ul, .editor-style ol ul { |
|
668 |
+ list-style: circle outside none; |
|
669 |
+} |
|
670 |
+.simditor .simditor-body ul ul ul, .simditor .simditor-body ol ul ul, .editor-style ul ul ul, .editor-style ol ul ul { |
|
671 |
+ list-style: square outside none; |
|
672 |
+} |
|
673 |
+.simditor .simditor-body ol, .editor-style ol { |
|
674 |
+ list-style: decimal; |
|
675 |
+} |
|
676 |
+.simditor .simditor-body blockquote, .editor-style blockquote { |
|
677 |
+ border-left: 6px solid #ddd; |
|
678 |
+ padding: 5px 0 5px 10px; |
|
679 |
+ margin: 15px 0 15px 15px; |
|
680 |
+} |
|
681 |
+.simditor .simditor-body blockquote > :first-child, .editor-style blockquote > :first-child { |
|
682 |
+ margin-top: 0; |
|
683 |
+} |
|
684 |
+.simditor .simditor-body code, .editor-style code { |
|
685 |
+ display: inline-block; |
|
686 |
+ padding: 0 4px; |
|
687 |
+ margin: 0 5px; |
|
688 |
+ background: #eeeeee; |
|
689 |
+ border-radius: 3px; |
|
690 |
+ font-size: 13px; |
|
691 |
+ font-family: 'monaco', 'Consolas', "Liberation Mono", Courier, monospace; |
|
692 |
+} |
|
693 |
+.simditor .simditor-body pre, .editor-style pre { |
|
694 |
+ padding: 10px 5px 10px 10px; |
|
695 |
+ margin: 15px 0; |
|
696 |
+ display: block; |
|
697 |
+ line-height: 18px; |
|
698 |
+ background: #F0F0F0; |
|
699 |
+ border-radius: 3px; |
|
700 |
+ font-size: 13px; |
|
701 |
+ font-family: 'monaco', 'Consolas', "Liberation Mono", Courier, monospace; |
|
702 |
+ white-space: pre; |
|
703 |
+ word-wrap: normal; |
|
704 |
+ overflow-x: auto; |
|
705 |
+} |
|
706 |
+.simditor .simditor-body pre code, .editor-style pre code { |
|
707 |
+ display: block; |
|
708 |
+ padding: 0; |
|
709 |
+ margin: 0; |
|
710 |
+ background: none; |
|
711 |
+ border-radius: 0; |
|
712 |
+} |
|
713 |
+.simditor .simditor-body hr, .editor-style hr { |
|
714 |
+ display: block; |
|
715 |
+ height: 0px; |
|
716 |
+ border: 0; |
|
717 |
+ border-top: 1px solid #ccc; |
|
718 |
+ margin: 15px 0; |
|
719 |
+ padding: 0; |
|
720 |
+} |
|
721 |
+.simditor .simditor-body table, .editor-style table { |
|
722 |
+ width: 100%; |
|
723 |
+ table-layout: fixed; |
|
724 |
+ border-collapse: collapse; |
|
725 |
+ border-spacing: 0; |
|
726 |
+ margin: 15px 0; |
|
727 |
+} |
|
728 |
+.simditor .simditor-body table thead, .editor-style table thead { |
|
729 |
+ background-color: #f9f9f9; |
|
730 |
+} |
|
731 |
+.simditor .simditor-body table td, .simditor .simditor-body table th, .editor-style table td, .editor-style table th { |
|
732 |
+ min-width: 40px; |
|
733 |
+ height: 30px; |
|
734 |
+ border: 1px solid #ccc; |
|
735 |
+ vertical-align: top; |
|
736 |
+ padding: 2px 4px; |
|
737 |
+ text-align: left; |
|
738 |
+ box-sizing: border-box; |
|
739 |
+} |
|
740 |
+.simditor .simditor-body table td.active, .simditor .simditor-body table th.active, .editor-style table td.active, .editor-style table th.active { |
|
741 |
+ background-color: #ffffee; |
|
742 |
+} |
|
743 |
+.simditor .simditor-body img, .editor-style img { |
|
744 |
+ margin: 0 5px; |
|
745 |
+ vertical-align: middle; |
|
746 |
+} |
@@ -0,0 +1,8 @@ |
||
1 |
+/*! |
|
2 |
+* Simditor v2.3.6 |
|
3 |
+* http://simditor.tower.im/ |
|
4 |
+* 2015-12-21 |
|
5 |
+*/@font-face{font-family:'Simditor';src:url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAABp8AA4AAAAAKmwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAaYAAAABoAAAAcdO8GE09TLzIAAAG0AAAARQAAAGAQ+ZFXY21hcAAAAkgAAABRAAABWuA2Gx9jdnQgAAAEgAAAAAoAAAAKAwQAxGZwZ20AAAKcAAABsQAAAmUPtC+nZ2x5ZgAABNgAABPeAAAgZG/p6QxoZWFkAAABRAAAADAAAAA2BvuCgGhoZWEAAAF0AAAAHgAAACQH9QTlaG10eAAAAfwAAABKAAAAlHv7AItsb2NhAAAEjAAAAEwAAABMi4qTXm1heHAAAAGUAAAAIAAAACABRwHNbmFtZQAAGLgAAAEFAAAB12vS/ulwb3N0AAAZwAAAAJ4AAAFsyCrvunByZXAAAARQAAAALgAAAC6w8isUeNpjYGRgYADiKAkPy3h+m68M8swfgCIMF0/IVyDo/84sFswJQC4HAxNIFAAZwAnyeNpjYGRgYE5gmMAQzWLBwPD/O5AEiqAAVQBa6wPkAAAAAQAAACUAoAAKAAAAAAACAAEAAgAWAAABAAEpAAAAAHjaY2BhnsA4gYGVgYGpn+kgAwNDL4RmfMxgxMgCFGVgZWaAAUYBBjTQwMDwQY454X8BQzRzAsMEIJcRSVaBgREAQ9oK6QAAAHjaY8xhUGQAAsYABgbmDwjMYsEgxCzBwMDkAOQnALEEgx1UjhNMr4BjTqBakDxC/wqIPsYMqJoEKIbpk0C1C4zXM3DA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jR6bxa8mk4OL7XB7OJ3aGoMLP4ddyVS7j5kK/36mLGfHnojgBj4/h49BOiPiadnfd9BGRDfJ9nKua6657hIdVGMMiWEOnOmvoYoT+C93/Vj8AAHjafY+/asMwEIc/JU6aQhsyltJBQ6eCg20IgdCt1GTwlNJsHUJijCCxwHaeqVufpM/Qta/Ri31ZOkTipO9Ov/sjYMwXhm7d8qBsGPGs3OOKd+U+j3wqB6L5UR5wY4zykJGxojTBtXj3bdaJDROelHvS91W5z5IP5UA038oD7vhVHjIxY1I8JQ2ObUs1lkz2C6S+bNzWl7XNMnHfRHNgJ2cjykoC7rBzjRdakVNwZM/m9LDKi+N+I3AunrYJhagsCVMiuRdi/0t20Vg0IXOxRJQxs26U1FdFbpNpZBf23FowTsJ5mETx7OKEa+ldyedcO9GpRzcF67yqnS9tLHUvVfgDz/ZF8gAAAHjabc25DgFhGIXh/53B2Pd9J9HPN/bSWolC4iI0OjfgxhFO6SQnT/k6z333errI/dvkc5yHh+98YsRJEJAkRZoMWXLkKVCkRJkKVWrUadCkRZsOXXr0GTBkxDh2vp5O3u4SPO63YxiG0mQkp3Im53Ihl3Il13Ijt3In9/Igjz9NfVPf1Df1TX1T39Q39U19U9/UN/VNfVPfDm8tR0peAAB42mNgYGBkAIKLcceVwfQJ+XIoXQEARe8GegAA) format("woff");font-weight:normal;font-style:normal}.simditor-icon{display:inline-block;font:normal normal normal 14px/1 'Simditor';font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;transform:translate(0,0)}.simditor-icon-code:before{content:'\f000'}.simditor-icon-bold:before{content:'\f001'}.simditor-icon-italic:before{content:'\f002'}.simditor-icon-underline:before{content:'\f003'}.simditor-icon-times:before{content:'\f004'}.simditor-icon-strikethrough:before{content:'\f005'}.simditor-icon-list-ol:before{content:'\f006'}.simditor-icon-list-ul:before{content:'\f007'}.simditor-icon-quote-left:before{content:'\f008'}.simditor-icon-table:before{content:'\f009'}.simditor-icon-link:before{content:'\f00a'}.simditor-icon-picture-o:before{content:'\f00b'}.simditor-icon-minus:before{content:'\f00c'}.simditor-icon-indent:before{content:'\f00d'}.simditor-icon-outdent:before{content:'\f00e'}.simditor-icon-unlink:before{content:'\f00f'}.simditor-icon-caret-down:before{content:'\f010'}.simditor-icon-caret-right:before{content:'\f011'}.simditor-icon-upload:before{content:'\f012'}.simditor-icon-undo:before{content:'\f013'}.simditor-icon-smile-o:before{content:'\f014'}.simditor-icon-tint:before{content:'\f015'}.simditor-icon-font:before{content:'\f016'}.simditor-icon-html5:before{content:'\f017'}.simditor-icon-mark:before{content:'\f018'}.simditor-icon-align-center:before{content:'\f019'}.simditor-icon-align-left:before{content:'\f01a'}.simditor-icon-align-right:before{content:'\f01b'}.simditor-icon-font-minus:before{content:'\f01c'}.simditor-icon-markdown:before{content:'\f01d'}.simditor-icon-checklist:before{content:'\f01e'}.simditor{position:relative;border:1px solid #c9d8db}.simditor .simditor-wrapper{position:relative;background:#fff}.simditor .simditor-wrapper>textarea{display:none!important;width:100%;box-sizing:border-box;font-family:monaco;font-size:16px;line-height:1.6;border:0;padding:22px 15px 40px;min-height:300px;outline:0;background:transparent;resize:none}.simditor .simditor-wrapper .simditor-placeholder{display:none;position:absolute;left:0;z-index:0;padding:22px 15px;font-size:16px;font-family:arial,sans-serif;line-height:1.5;color:#999;background:transparent}.simditor .simditor-wrapper.toolbar-floating .simditor-toolbar{position:fixed;top:0;z-index:10;box-shadow:0 0 6px rgba(0,0,0,0.1)}.simditor .simditor-wrapper .simditor-image-loading{width:100%;height:100%;position:absolute;top:0;left:0;z-index:2}.simditor .simditor-wrapper .simditor-image-loading .progress{width:100%;height:100%;background:rgba(0,0,0,0.4);position:absolute;bottom:0;left:0}.simditor .simditor-body{padding:22px 15px 40px;min-height:300px;outline:0;cursor:text;position:relative;z-index:1;background:transparent}.simditor .simditor-body a.selected{background:#b3d4fd}.simditor .simditor-body a.simditor-mention{cursor:pointer}.simditor .simditor-body .simditor-table{position:relative}.simditor .simditor-body .simditor-table.resizing{cursor:col-resize}.simditor .simditor-body .simditor-table .simditor-resize-handle{position:absolute;left:0;top:0;width:10px;height:100%;cursor:col-resize}.simditor .simditor-body pre{box-sizing:border-box;-moz-box-sizing:border-box;word-wrap:break-word!important;white-space:pre-wrap!important}.simditor .simditor-body img{cursor:pointer}.simditor .simditor-body img.selected{box-shadow:0 0 0 4px #ccc}.simditor .simditor-paste-bin{position:fixed;bottom:10px;right:10px;width:1px;height:20px;font-size:1px;line-height:1px;overflow:hidden;padding:0;margin:0;opacity:0;-webkit-user-select:text}.simditor .simditor-toolbar{border-bottom:1px solid #eee;background:#fff;width:100%}.simditor .simditor-toolbar>ul{margin:0;padding:0 0 0 6px;list-style:none}.simditor .simditor-toolbar>ul>li{position:relative;display:inline-block;font-size:0}.simditor .simditor-toolbar>ul>li>span.separator{display:inline-block;background:#cfcfcf;width:1px;height:18px;margin:11px 15px;vertical-align:middle} |
|
6 |
+.simditor .simditor-toolbar>ul>li>.toolbar-item{display:inline-block;width:46px;height:40px;outline:0;color:#333;font-size:15px;line-height:40px;vertical-align:middle;text-align:center;text-decoration:none}.simditor .simditor-toolbar>ul>li>.toolbar-item span{opacity:.6}.simditor .simditor-toolbar>ul>li>.toolbar-item span.simditor-icon{display:inline;line-height:normal}.simditor .simditor-toolbar>ul>li>.toolbar-item:hover span{opacity:1}.simditor .simditor-toolbar>ul>li>.toolbar-item.active{background:#eee}.simditor .simditor-toolbar>ul>li>.toolbar-item.active span{opacity:1}.simditor .simditor-toolbar>ul>li>.toolbar-item.disabled{cursor:default}.simditor .simditor-toolbar>ul>li>.toolbar-item.disabled span{opacity:.3}.simditor .simditor-toolbar>ul>li>.toolbar-item.toolbar-item-title span:before{content:"H";font-size:19px;font-weight:bold;font-family:'Times New Roman'}.simditor .simditor-toolbar>ul>li>.toolbar-item.toolbar-item-title.active-h1 span:before{content:'H1';font-size:18px}.simditor .simditor-toolbar>ul>li>.toolbar-item.toolbar-item-title.active-h2 span:before{content:'H2';font-size:18px}.simditor .simditor-toolbar>ul>li>.toolbar-item.toolbar-item-title.active-h3 span:before{content:'H3';font-size:18px}.simditor .simditor-toolbar>ul>li>.toolbar-item.toolbar-item-image{position:relative;overflow:hidden}.simditor .simditor-toolbar>ul>li>.toolbar-item.toolbar-item-image>input[type=file]{position:absolute;right:0;top:0;opacity:0;font-size:100px;cursor:pointer}.simditor .simditor-toolbar>ul>li.menu-on .toolbar-item{position:relative;z-index:20;background:#fff;box-shadow:0 1px 4px rgba(0,0,0,0.3)}.simditor .simditor-toolbar>ul>li.menu-on .toolbar-item span{opacity:1}.simditor .simditor-toolbar>ul>li.menu-on .toolbar-menu{display:block}.simditor .simditor-toolbar .toolbar-menu{display:none;position:absolute;top:40px;left:0;z-index:21;background:#fff;text-align:left;box-shadow:0 0 4px rgba(0,0,0,0.3)}.simditor .simditor-toolbar .toolbar-menu:before{content:'';display:block;width:46px;height:4px;background:#fff;position:absolute;top:-3px;left:0}.simditor .simditor-toolbar .toolbar-menu ul{min-width:160px;list-style:none;margin:0;padding:10px 1px}.simditor .simditor-toolbar .toolbar-menu ul>li .menu-item{display:block;font-size:16px;line-height:2em;padding:0 10px;text-decoration:none;color:#666}.simditor .simditor-toolbar .toolbar-menu ul>li .menu-item:hover{background:#f6f6f6}.simditor .simditor-toolbar .toolbar-menu ul>li .menu-item.menu-item-h1{font-size:24px;color:#333}.simditor .simditor-toolbar .toolbar-menu ul>li .menu-item.menu-item-h2{font-size:22px;color:#333}.simditor .simditor-toolbar .toolbar-menu ul>li .menu-item.menu-item-h3{font-size:20px;color:#333}.simditor .simditor-toolbar .toolbar-menu ul>li .menu-item.menu-item-h4{font-size:18px;color:#333}.simditor .simditor-toolbar .toolbar-menu ul>li .menu-item.menu-item-h5{font-size:16px;color:#333}.simditor .simditor-toolbar .toolbar-menu ul>li .separator{display:block;border-top:1px solid #ccc;height:0;line-height:0;font-size:0;margin:6px 0}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color{width:96px}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list{height:40px;margin:10px 6px 6px 10px;padding:0;min-width:0}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li{float:left;margin:0 4px 4px 0}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color{display:block;width:16px;height:16px;background:#dfdfdf;border-radius:2px}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color:hover{opacity:.8}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color.font-color-default{background:#333}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color-1{background:#e33737}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color-2{background:#e28b41}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color-3{background:#c8a732}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color-4{background:#209361}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color-5{background:#418caf}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color-6{background:#aa8773}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color-7{background:#999}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-table .menu-create-table{background:#fff;padding:1px}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-table .menu-create-table table{border:0;border-collapse:collapse;border-spacing:0;table-layout:fixed}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-table .menu-create-table table td{padding:0;cursor:pointer} |
|
7 |
+.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-table .menu-create-table table td:before{width:16px;height:16px;border:1px solid #fff;background:#f3f3f3;display:block;content:""}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-table .menu-create-table table td.selected:before{background:#cfcfcf}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-table .menu-edit-table{display:none}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-table .menu-edit-table ul li{white-space:nowrap}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-image .menu-item-upload-image{position:relative;overflow:hidden}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-image .menu-item-upload-image input[type=file]{position:absolute;right:0;top:0;opacity:0;font-size:100px;cursor:pointer}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-alignment{width:100%}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-alignment ul{min-width:100%}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-alignment .menu-item{text-align:center}.simditor .simditor-popover{display:none;padding:5px 8px 0;background:#fff;box-shadow:0 1px 4px rgba(0,0,0,0.4);border-radius:2px;position:absolute;z-index:2}.simditor .simditor-popover .settings-field{margin:0 0 5px 0;font-size:12px;height:25px;line-height:25px}.simditor .simditor-popover .settings-field label{display:inline-block;margin:0 5px 0 0}.simditor .simditor-popover .settings-field input[type=text]{display:inline-block;width:200px;box-sizing:border-box;font-size:12px}.simditor .simditor-popover .settings-field input[type=text].image-size{width:83px}.simditor .simditor-popover .settings-field .times{display:inline-block;width:26px;font-size:12px;text-align:center}.simditor .simditor-popover.link-popover .btn-unlink,.simditor .simditor-popover.image-popover .btn-upload,.simditor .simditor-popover.image-popover .btn-restore{display:inline-block;margin:0 0 0 5px;color:#333;font-size:14px;outline:0}.simditor .simditor-popover.link-popover .btn-unlink span,.simditor .simditor-popover.image-popover .btn-upload span,.simditor .simditor-popover.image-popover .btn-restore span{opacity:.6}.simditor .simditor-popover.link-popover .btn-unlink:hover span,.simditor .simditor-popover.image-popover .btn-upload:hover span,.simditor .simditor-popover.image-popover .btn-restore:hover span{opacity:1}.simditor .simditor-popover.image-popover .btn-upload{position:relative;display:inline-block;overflow:hidden;vertical-align:middle}.simditor .simditor-popover.image-popover .btn-upload input[type=file]{position:absolute;right:0;top:0;opacity:0;height:100%;width:28px}.simditor.simditor-mobile .simditor-wrapper.toolbar-floating .simditor-toolbar{position:absolute;top:0;z-index:10;box-shadow:0 0 6px rgba(0,0,0,0.1)}.simditor .simditor-body,.editor-style{font-size:16px;font-family:arial,sans-serif;line-height:1.6;color:#333;outline:0;word-wrap:break-word}.simditor .simditor-body>:first-child,.editor-style>:first-child{margin-top:0!important}.simditor .simditor-body a,.editor-style a{color:#4298ba;text-decoration:none;word-break:break-all}.simditor .simditor-body a:visited,.editor-style a:visited{color:#4298ba}.simditor .simditor-body a:hover,.editor-style a:hover{color:#0f769f}.simditor .simditor-body a:active,.editor-style a:active{color:#9e792e}.simditor .simditor-body a:hover,.simditor .simditor-body a:active,.editor-style a:hover,.editor-style a:active{outline:0}.simditor .simditor-body h1,.simditor .simditor-body h2,.simditor .simditor-body h3,.simditor .simditor-body h4,.simditor .simditor-body h5,.simditor .simditor-body h6,.editor-style h1,.editor-style h2,.editor-style h3,.editor-style h4,.editor-style h5,.editor-style h6{font-weight:normal;margin:40px 0 20px;color:#000}.simditor .simditor-body h1,.editor-style h1{font-size:24px}.simditor .simditor-body h2,.editor-style h2{font-size:22px}.simditor .simditor-body h3,.editor-style h3{font-size:20px}.simditor .simditor-body h4,.editor-style h4{font-size:18px}.simditor .simditor-body h5,.editor-style h5{font-size:16px}.simditor .simditor-body h6,.editor-style h6{font-size:16px}.simditor .simditor-body p,.simditor .simditor-body div,.editor-style p,.editor-style div{word-wrap:break-word;margin:0 0 15px 0;color:#333;word-wrap:break-word}.simditor .simditor-body b,.simditor .simditor-body strong,.editor-style b,.editor-style strong{font-weight:bold}.simditor .simditor-body i,.simditor .simditor-body em,.editor-style i,.editor-style em{font-style:italic}.simditor .simditor-body u,.editor-style u{text-decoration:underline}.simditor .simditor-body strike,.simditor .simditor-body del,.editor-style strike,.editor-style del{text-decoration:line-through}.simditor .simditor-body ul,.simditor .simditor-body ol,.editor-style ul,.editor-style ol{list-style:disc outside none;margin:15px 0;padding:0 0 0 40px;line-height:1.6}.simditor .simditor-body ul ul,.simditor .simditor-body ul ol,.simditor .simditor-body ol ul,.simditor .simditor-body ol ol,.editor-style ul ul,.editor-style ul ol,.editor-style ol ul,.editor-style ol ol{padding-left:30px} |
|
8 |
+.simditor .simditor-body ul ul,.simditor .simditor-body ol ul,.editor-style ul ul,.editor-style ol ul{list-style:circle outside none}.simditor .simditor-body ul ul ul,.simditor .simditor-body ol ul ul,.editor-style ul ul ul,.editor-style ol ul ul{list-style:square outside none}.simditor .simditor-body ol,.editor-style ol{list-style:decimal}.simditor .simditor-body blockquote,.editor-style blockquote{border-left:6px solid #ddd;padding:5px 0 5px 10px;margin:15px 0 15px 15px}.simditor .simditor-body blockquote>:first-child,.editor-style blockquote>:first-child{margin-top:0}.simditor .simditor-body code,.editor-style code{display:inline-block;padding:0 4px;margin:0 5px;background:#eee;border-radius:3px;font-size:13px;font-family:'monaco','Consolas',"Liberation Mono",Courier,monospace}.simditor .simditor-body pre,.editor-style pre{padding:10px 5px 10px 10px;margin:15px 0;display:block;line-height:18px;background:#f0f0f0;border-radius:3px;font-size:13px;font-family:'monaco','Consolas',"Liberation Mono",Courier,monospace;white-space:pre;word-wrap:normal;overflow-x:auto}.simditor .simditor-body pre code,.editor-style pre code{display:block;padding:0;margin:0;background:0;border-radius:0}.simditor .simditor-body hr,.editor-style hr{display:block;height:0;border:0;border-top:1px solid #ccc;margin:15px 0;padding:0}.simditor .simditor-body table,.editor-style table{width:100%;table-layout:fixed;border-collapse:collapse;border-spacing:0;margin:15px 0}.simditor .simditor-body table thead,.editor-style table thead{background-color:#f9f9f9}.simditor .simditor-body table td,.simditor .simditor-body table th,.editor-style table td,.editor-style table th{min-width:40px;height:30px;border:1px solid #ccc;vertical-align:top;padding:2px 4px;text-align:left;box-sizing:border-box}.simditor .simditor-body table td.active,.simditor .simditor-body table th.active,.editor-style table td.active,.editor-style table th.active{background-color:#ffe}.simditor .simditor-body img,.editor-style img{margin:0 5px;vertical-align:middle}.simditor .markdown-editor{display:none}.simditor .markdown-editor textarea{display:block;width:100%;min-height:200px;box-sizing:border-box;padding:22px 15px 40px;border:0;border-bottom:1px solid #dfdfdf;resize:none;outline:0;font-size:16px}.simditor.simditor-markdown .markdown-editor{display:block}.simditor.simditor-markdown .simditor-body{min-height:100px;background:#f3f3f3}.simditor.simditor-markdown .simditor-placeholder{display:none!important}.simditor .simditor-toolbar .toolbar-item.toolbar-item-markdown .simditor-icon{font-size:18px}.simditor .simditor-body .simditor-checklist{margin:15px 0;padding:0 0 0 40px;line-height:1.6;list-style-type:none}.simditor .simditor-body .simditor-checklist>li{margin:0;pointer-events:none}.simditor .simditor-body .simditor-checklist>li::before{content:'';pointer-events:all;display:inline-block;margin:0 5px 0 -25px;width:20px;height:20px;cursor:default;vertical-align:middle;background-image:url("data:image/gif;base64,R0lGODlhFAAUAPUAAP///9nZ2XV1dWNjY3Z2dv7+/mpqasbGxsPDw21tbfv7+2RkZM/Pz/X19crKymdnZ+/v725ubsvLy/Hx8XBwcO7u7nd3d83Nzezs7Hp6eoCAgNfX14SEhIqKitLS0uDg4I2NjZSUlNTU1Ojo6NXV1ZaWlp6entjY2J+fn6WlpeXl5ebm5qmpqY6OjvPz85CQkP39/Xt7e/Ly8t3d3dzc3P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAAA1ACwAAAAAFAAUAAAG/8BarVar1Wq1Wq1Wq9VqtVqtVqvVarVarVar1Wq1Wq1Wq9VqtVqtVqvVarVarVar1Wq1Wq1Wq9WAtVpAMBgMBoPBYEAI1Gq1Wq1WKxgOAAAAAAAAAIhEoVar1Wo1xYLRaDQajUaj4XgoarVarVaDACOSyWQymUwmEwkFUqvVarVaxXLBYDAYDAaDuWQqtVqtVqtVNIzNZrPZbDYbBqdSq9VqtVql4wF+Pp/P5/P5eECVWq1Wq9UqIdFoNBqNRqMRqVSp1Wq1Wq1i2kwmk8lkMpmcUJVarVar1SopFQAABAAAAABgxarUarVaraZoOVwul8vlcrkuL0WtVqvVajBHTGYgEAgEAoEg5oDVarVarVaDyWY0Gg1Io9FmMlitVqvVarVarVYoFAqFQqFQq9VqtVqtVqvVarVarVar1Wq1Wq1Wq9VqtVqtVqvVarUasFar1Wq1Wq1Wq9VqtVqtVqvVarVarVar1YIAOw==")}.simditor .simditor-body .simditor-checklist>li[checked]::before{background-image:url("data:image/gif;base64,R0lGODlhFAAUAPYAAAAAAHeHkD9QYB8wSOjo6Haw6C1huLbn8MfY8Ja42I630Ia48NjY2IefoJbH6Ja44H648D9CkCVZsE9XWFWY2D5wqI+foH6gwE9fYHeIoF93iPj4+J7P+J7A4IegyE54sPDw8I+nuB5BmAAHCEdXWC9BiFaAuFdveF2g4F9veB5JoA8PD12Y4GWg4CZRqKbI6GWo4BcoOK7Q8Cc4SDVwwAcPEEdQYA8YIDc/QBYykC1pwD9IWGaY0C8/SE2Q0B84UF6QyFWY4E2Q2D5omAcIGA8gMEZoiEZvkC5ZsE9ZmP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAABKACwAAAAAFAAUAAAH/4BKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKEys4SkpKSkpKSkpKSkpKSkpKShYAIyBKSkpKSkpKIUkRERERERERNwA2SkpKSkpKShslHggICAgICAEANyUbSkpKSkpKGzkoMjIyMjIdKwAVORtKSkpKSkogIhSAOz0ZMjI2ADZBIiBKSkpKSkogKkEaACsJFwArHUEqIEpKSkpKSiAuQSgxAD8xAEMoQS4gSkpKSkpKIEgoMDw1AAADMDAoSCBKSkpKSkogBigFBUcANTwFBS0GIEpKSkpKSiA0MAsLCzNHCwsLLTQgSkpKSkpKICYLHBwcDhwcgJYcHAsmIEpKSkpKShspCgcHBwcHBwcHCikbSkpKSkpKGxYYGBgYGBgYGBgYFhtKSkpKSkpKGyAMDAwMDAwMDCAbSkpKSkpKSkpKShsbGxsbGxsbSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkpKSkqASkpKSkpKSkpKSkpKSkpKSkpKSkpKSoEAOw==")}@font-face{font-family:'icomoon';src:url("../fonts/icomoon.eot?4vkjot");src:url("../fonts/icomoon.eot?#iefix4vkjot") format("embedded-opentype"),url("../fonts/icomoon.ttf?4vkjot") format("truetype"),url("../fonts/icomoon.woff?4vkjot") format("woff"),url("../fonts/icomoon.svg?4vkjot#icomoon") format("svg");font-weight:normal;font-style:normal}[class^="icon-"],[class*=" icon-"]{font-family:'icomoon';speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-fullscreen:before{content:"\e600"}.simditor-fullscreen{overflow:hidden}.simditor-fullscreen .simditor{position:fixed;top:0;left:0;z-index:9999;width:100%}.simditor-fullscreen .simditor .simditor-body{overflow:auto} |
@@ -0,0 +1,8 @@ |
||
1 |
+/*! |
|
2 |
+* Simditor v2.3.6 |
|
3 |
+* http://simditor.tower.im/ |
|
4 |
+* 2015-12-21 |
|
5 |
+*/@font-face{font-family:'Simditor';src:url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAABp8AA4AAAAAKmwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAaYAAAABoAAAAcdO8GE09TLzIAAAG0AAAARQAAAGAQ+ZFXY21hcAAAAkgAAABRAAABWuA2Gx9jdnQgAAAEgAAAAAoAAAAKAwQAxGZwZ20AAAKcAAABsQAAAmUPtC+nZ2x5ZgAABNgAABPeAAAgZG/p6QxoZWFkAAABRAAAADAAAAA2BvuCgGhoZWEAAAF0AAAAHgAAACQH9QTlaG10eAA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u4SPO63YxiG0mQkp3Im53Ihl3Il13Ijt3In9/Igjz9NfVPf1Df1TX1T39Q39U19U9/UN/VNfVPfDm8tR0peAAB42mNgYGBkAIKLcceVwfQJ+XIoXQEARe8GegAA) format("woff");font-weight:normal;font-style:normal}.simditor-icon{display:inline-block;font:normal normal normal 14px/1 'Simditor';font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;transform:translate(0,0)}.simditor-icon-code:before{content:'\f000'}.simditor-icon-bold:before{content:'\f001'}.simditor-icon-italic:before{content:'\f002'}.simditor-icon-underline:before{content:'\f003'}.simditor-icon-times:before{content:'\f004'}.simditor-icon-strikethrough:before{content:'\f005'}.simditor-icon-list-ol:before{content:'\f006'}.simditor-icon-list-ul:before{content:'\f007'}.simditor-icon-quote-left:before{content:'\f008'}.simditor-icon-table:before{content:'\f009'}.simditor-icon-link:before{content:'\f00a'}.simditor-icon-picture-o:before{content:'\f00b'}.simditor-icon-minus:before{content:'\f00c'}.simditor-icon-indent:before{content:'\f00d'}.simditor-icon-outdent:before{content:'\f00e'}.simditor-icon-unlink:before{content:'\f00f'}.simditor-icon-caret-down:before{content:'\f010'}.simditor-icon-caret-right:before{content:'\f011'}.simditor-icon-upload:before{content:'\f012'}.simditor-icon-undo:before{content:'\f013'}.simditor-icon-smile-o:before{content:'\f014'}.simditor-icon-tint:before{content:'\f015'}.simditor-icon-font:before{content:'\f016'}.simditor-icon-html5:before{content:'\f017'}.simditor-icon-mark:before{content:'\f018'}.simditor-icon-align-center:before{content:'\f019'}.simditor-icon-align-left:before{content:'\f01a'}.simditor-icon-align-right:before{content:'\f01b'}.simditor-icon-font-minus:before{content:'\f01c'}.simditor-icon-markdown:before{content:'\f01d'}.simditor-icon-checklist:before{content:'\f01e'}.simditor{position:relative;border:1px solid #c9d8db}.simditor .simditor-wrapper{position:relative;background:#fff}.simditor .simditor-wrapper>textarea{display:none!important;width:100%;box-sizing:border-box;font-family:monaco;font-size:16px;line-height:1.6;border:0;padding:22px 15px 40px;min-height:300px;outline:0;background:transparent;resize:none}.simditor .simditor-wrapper .simditor-placeholder{display:none;position:absolute;left:0;z-index:0;padding:22px 15px;font-size:16px;font-family:arial,sans-serif;line-height:1.5;color:#999;background:transparent}.simditor .simditor-wrapper.toolbar-floating .simditor-toolbar{position:fixed;top:0;z-index:10;box-shadow:0 0 6px rgba(0,0,0,0.1)}.simditor .simditor-wrapper .simditor-image-loading{width:100%;height:100%;position:absolute;top:0;left:0;z-index:2}.simditor .simditor-wrapper .simditor-image-loading .progress{width:100%;height:100%;background:rgba(0,0,0,0.4);position:absolute;bottom:0;left:0}.simditor .simditor-body{padding:22px 15px 40px;min-height:300px;outline:0;cursor:text;position:relative;z-index:1;background:transparent}.simditor .simditor-body a.selected{background:#b3d4fd}.simditor .simditor-body a.simditor-mention{cursor:pointer}.simditor .simditor-body .simditor-table{position:relative}.simditor .simditor-body .simditor-table.resizing{cursor:col-resize}.simditor .simditor-body .simditor-table .simditor-resize-handle{position:absolute;left:0;top:0;width:10px;height:100%;cursor:col-resize}.simditor .simditor-body pre{box-sizing:border-box;-moz-box-sizing:border-box;word-wrap:break-word!important;white-space:pre-wrap!important}.simditor .simditor-body img{cursor:pointer}.simditor .simditor-body img.selected{box-shadow:0 0 0 4px #ccc}.simditor .simditor-paste-bin{position:fixed;bottom:10px;right:10px;width:1px;height:20px;font-size:1px;line-height:1px;overflow:hidden;padding:0;margin:0;opacity:0;-webkit-user-select:text}.simditor .simditor-toolbar{border-bottom:1px solid #eee;background:#fff;width:100%}.simditor .simditor-toolbar>ul{margin:0;padding:0 0 0 6px;list-style:none}.simditor .simditor-toolbar>ul>li{position:relative;display:inline-block;font-size:0}.simditor .simditor-toolbar>ul>li>span.separator{display:inline-block;background:#cfcfcf;width:1px;height:18px;margin:11px 15px;vertical-align:middle} |
|
6 |
+.simditor .simditor-toolbar>ul>li>.toolbar-item{display:inline-block;width:46px;height:40px;outline:0;color:#333;font-size:15px;line-height:40px;vertical-align:middle;text-align:center;text-decoration:none}.simditor .simditor-toolbar>ul>li>.toolbar-item span{opacity:.6}.simditor .simditor-toolbar>ul>li>.toolbar-item span.simditor-icon{display:inline;line-height:normal}.simditor .simditor-toolbar>ul>li>.toolbar-item:hover span{opacity:1}.simditor .simditor-toolbar>ul>li>.toolbar-item.active{background:#eee}.simditor .simditor-toolbar>ul>li>.toolbar-item.active span{opacity:1}.simditor .simditor-toolbar>ul>li>.toolbar-item.disabled{cursor:default}.simditor .simditor-toolbar>ul>li>.toolbar-item.disabled span{opacity:.3}.simditor .simditor-toolbar>ul>li>.toolbar-item.toolbar-item-title span:before{content:"H";font-size:19px;font-weight:bold;font-family:'Times New Roman'}.simditor .simditor-toolbar>ul>li>.toolbar-item.toolbar-item-title.active-h1 span:before{content:'H1';font-size:18px}.simditor .simditor-toolbar>ul>li>.toolbar-item.toolbar-item-title.active-h2 span:before{content:'H2';font-size:18px}.simditor .simditor-toolbar>ul>li>.toolbar-item.toolbar-item-title.active-h3 span:before{content:'H3';font-size:18px}.simditor .simditor-toolbar>ul>li>.toolbar-item.toolbar-item-image{position:relative;overflow:hidden}.simditor .simditor-toolbar>ul>li>.toolbar-item.toolbar-item-image>input[type=file]{position:absolute;right:0;top:0;opacity:0;font-size:100px;cursor:pointer}.simditor .simditor-toolbar>ul>li.menu-on .toolbar-item{position:relative;z-index:20;background:#fff;box-shadow:0 1px 4px rgba(0,0,0,0.3)}.simditor .simditor-toolbar>ul>li.menu-on .toolbar-item span{opacity:1}.simditor .simditor-toolbar>ul>li.menu-on .toolbar-menu{display:block}.simditor .simditor-toolbar .toolbar-menu{display:none;position:absolute;top:40px;left:0;z-index:21;background:#fff;text-align:left;box-shadow:0 0 4px rgba(0,0,0,0.3)}.simditor .simditor-toolbar .toolbar-menu:before{content:'';display:block;width:46px;height:4px;background:#fff;position:absolute;top:-3px;left:0}.simditor .simditor-toolbar .toolbar-menu ul{min-width:160px;list-style:none;margin:0;padding:10px 1px}.simditor .simditor-toolbar .toolbar-menu ul>li .menu-item{display:block;font-size:16px;line-height:2em;padding:0 10px;text-decoration:none;color:#666}.simditor .simditor-toolbar .toolbar-menu ul>li .menu-item:hover{background:#f6f6f6}.simditor .simditor-toolbar .toolbar-menu ul>li .menu-item.menu-item-h1{font-size:24px;color:#333}.simditor .simditor-toolbar .toolbar-menu ul>li .menu-item.menu-item-h2{font-size:22px;color:#333}.simditor .simditor-toolbar .toolbar-menu ul>li .menu-item.menu-item-h3{font-size:20px;color:#333}.simditor .simditor-toolbar .toolbar-menu ul>li .menu-item.menu-item-h4{font-size:18px;color:#333}.simditor .simditor-toolbar .toolbar-menu ul>li .menu-item.menu-item-h5{font-size:16px;color:#333}.simditor .simditor-toolbar .toolbar-menu ul>li .separator{display:block;border-top:1px solid #ccc;height:0;line-height:0;font-size:0;margin:6px 0}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color{width:96px}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list{height:40px;margin:10px 6px 6px 10px;padding:0;min-width:0}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li{float:left;margin:0 4px 4px 0}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color{display:block;width:16px;height:16px;background:#dfdfdf;border-radius:2px}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color:hover{opacity:.8}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color.font-color-default{background:#333}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color-1{background:#e33737}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color-2{background:#e28b41}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color-3{background:#c8a732}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color-4{background:#209361}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color-5{background:#418caf}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color-6{background:#aa8773}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color-7{background:#999}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-table .menu-create-table{background:#fff;padding:1px}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-table .menu-create-table table{border:0;border-collapse:collapse;border-spacing:0;table-layout:fixed}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-table .menu-create-table table td{padding:0;cursor:pointer} |
|
7 |
+.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-table .menu-create-table table td:before{width:16px;height:16px;border:1px solid #fff;background:#f3f3f3;display:block;content:""}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-table .menu-create-table table td.selected:before{background:#cfcfcf}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-table .menu-edit-table{display:none}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-table .menu-edit-table ul li{white-space:nowrap}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-image .menu-item-upload-image{position:relative;overflow:hidden}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-image .menu-item-upload-image input[type=file]{position:absolute;right:0;top:0;opacity:0;font-size:100px;cursor:pointer}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-alignment{width:100%}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-alignment ul{min-width:100%}.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-alignment .menu-item{text-align:center}.simditor .simditor-popover{display:none;padding:5px 8px 0;background:#fff;box-shadow:0 1px 4px rgba(0,0,0,0.4);border-radius:2px;position:absolute;z-index:2}.simditor .simditor-popover .settings-field{margin:0 0 5px 0;font-size:12px;height:25px;line-height:25px}.simditor .simditor-popover .settings-field label{display:inline-block;margin:0 5px 0 0}.simditor .simditor-popover .settings-field input[type=text]{display:inline-block;width:200px;box-sizing:border-box;font-size:12px}.simditor .simditor-popover .settings-field input[type=text].image-size{width:83px}.simditor .simditor-popover .settings-field .times{display:inline-block;width:26px;font-size:12px;text-align:center}.simditor .simditor-popover.link-popover .btn-unlink,.simditor .simditor-popover.image-popover .btn-upload,.simditor .simditor-popover.image-popover .btn-restore{display:inline-block;margin:0 0 0 5px;color:#333;font-size:14px;outline:0}.simditor .simditor-popover.link-popover .btn-unlink span,.simditor .simditor-popover.image-popover .btn-upload span,.simditor .simditor-popover.image-popover .btn-restore span{opacity:.6}.simditor .simditor-popover.link-popover .btn-unlink:hover span,.simditor .simditor-popover.image-popover .btn-upload:hover span,.simditor .simditor-popover.image-popover .btn-restore:hover span{opacity:1}.simditor .simditor-popover.image-popover .btn-upload{position:relative;display:inline-block;overflow:hidden;vertical-align:middle}.simditor .simditor-popover.image-popover .btn-upload input[type=file]{position:absolute;right:0;top:0;opacity:0;height:100%;width:28px}.simditor.simditor-mobile .simditor-wrapper.toolbar-floating .simditor-toolbar{position:absolute;top:0;z-index:10;box-shadow:0 0 6px rgba(0,0,0,0.1)}.simditor .simditor-body,.editor-style{font-size:16px;font-family:arial,sans-serif;line-height:1.6;color:#333;outline:0;word-wrap:break-word}.simditor .simditor-body>:first-child,.editor-style>:first-child{margin-top:0!important}.simditor .simditor-body a,.editor-style a{color:#4298ba;text-decoration:none;word-break:break-all}.simditor .simditor-body a:visited,.editor-style a:visited{color:#4298ba}.simditor .simditor-body a:hover,.editor-style a:hover{color:#0f769f}.simditor .simditor-body a:active,.editor-style a:active{color:#9e792e}.simditor .simditor-body a:hover,.simditor .simditor-body a:active,.editor-style a:hover,.editor-style a:active{outline:0}.simditor .simditor-body h1,.simditor .simditor-body h2,.simditor .simditor-body h3,.simditor .simditor-body h4,.simditor .simditor-body h5,.simditor .simditor-body h6,.editor-style h1,.editor-style h2,.editor-style h3,.editor-style h4,.editor-style h5,.editor-style h6{font-weight:normal;margin:40px 0 20px;color:#000}.simditor .simditor-body h1,.editor-style h1{font-size:24px}.simditor .simditor-body h2,.editor-style h2{font-size:22px}.simditor .simditor-body h3,.editor-style h3{font-size:20px}.simditor .simditor-body h4,.editor-style h4{font-size:18px}.simditor .simditor-body h5,.editor-style h5{font-size:16px}.simditor .simditor-body h6,.editor-style h6{font-size:16px}.simditor .simditor-body p,.simditor .simditor-body div,.editor-style p,.editor-style div{word-wrap:break-word;margin:0 0 15px 0;color:#333;word-wrap:break-word}.simditor .simditor-body b,.simditor .simditor-body strong,.editor-style b,.editor-style strong{font-weight:bold}.simditor .simditor-body i,.simditor .simditor-body em,.editor-style i,.editor-style em{font-style:italic}.simditor .simditor-body u,.editor-style u{text-decoration:underline}.simditor .simditor-body strike,.simditor .simditor-body del,.editor-style strike,.editor-style del{text-decoration:line-through}.simditor .simditor-body ul,.simditor .simditor-body ol,.editor-style ul,.editor-style ol{list-style:disc outside none;margin:15px 0;padding:0 0 0 40px;line-height:1.6}.simditor .simditor-body ul ul,.simditor .simditor-body ul ol,.simditor .simditor-body ol ul,.simditor .simditor-body ol ol,.editor-style ul ul,.editor-style ul ol,.editor-style ol ul,.editor-style ol ol{padding-left:30px} |
|
8 |
+.simditor .simditor-body ul ul,.simditor .simditor-body ol ul,.editor-style ul ul,.editor-style ol ul{list-style:circle outside none}.simditor .simditor-body ul ul ul,.simditor .simditor-body ol ul ul,.editor-style ul ul ul,.editor-style ol ul ul{list-style:square outside none}.simditor .simditor-body ol,.editor-style ol{list-style:decimal}.simditor .simditor-body blockquote,.editor-style blockquote{border-left:6px solid #ddd;padding:5px 0 5px 10px;margin:15px 0 15px 15px}.simditor .simditor-body blockquote>:first-child,.editor-style blockquote>:first-child{margin-top:0}.simditor .simditor-body code,.editor-style code{display:inline-block;padding:0 4px;margin:0 5px;background:#eee;border-radius:3px;font-size:13px;font-family:'monaco','Consolas',"Liberation Mono",Courier,monospace}.simditor .simditor-body pre,.editor-style pre{padding:10px 5px 10px 10px;margin:15px 0;display:block;line-height:18px;background:#f0f0f0;border-radius:3px;font-size:13px;font-family:'monaco','Consolas',"Liberation Mono",Courier,monospace;white-space:pre;word-wrap:normal;overflow-x:auto}.simditor .simditor-body pre code,.editor-style pre code{display:block;padding:0;margin:0;background:0;border-radius:0}.simditor .simditor-body hr,.editor-style hr{display:block;height:0;border:0;border-top:1px solid #ccc;margin:15px 0;padding:0}.simditor .simditor-body table,.editor-style table{width:100%;table-layout:fixed;border-collapse:collapse;border-spacing:0;margin:15px 0}.simditor .simditor-body table thead,.editor-style table thead{background-color:#f9f9f9}.simditor .simditor-body table td,.simditor .simditor-body table th,.editor-style table td,.editor-style table th{min-width:40px;height:30px;border:1px solid #ccc;vertical-align:top;padding:2px 4px;text-align:left;box-sizing:border-box}.simditor .simditor-body table td.active,.simditor .simditor-body table th.active,.editor-style table td.active,.editor-style table th.active{background-color:#ffe}.simditor .simditor-body img,.editor-style img{margin:0 5px;vertical-align:middle} |
@@ -0,0 +1,4 @@ |
||
1 |
+@charset "UTF-8"; |
|
2 |
+ |
|
3 |
+@import 'fonticon'; |
|
4 |
+@import 'editor'; |
@@ -0,0 +1,3 @@ |
||
1 |
+<div class="django-simditor-widget" data-field-id="{{id}}" style="display: inline-block;"> |
|
2 |
+ <textarea{{ final_attrs|safe }} data-processed="0" data-config='{{config|safe}}' data-id="{{id}}" data-type="simditortype">{{ value }}</textarea> |
|
3 |
+</div> |
@@ -0,0 +1,39 @@ |
||
1 |
+"""simditor urls.""" |
|
2 |
+from __future__ import absolute_import |
|
3 |
+ |
|
4 |
+import django |
|
5 |
+ |
|
6 |
+from django.conf import settings |
|
7 |
+from django.conf.urls import url, static |
|
8 |
+from django.contrib.admin.views.decorators import staff_member_required |
|
9 |
+ |
|
10 |
+from . import views |
|
11 |
+ |
|
12 |
+if django.VERSION >= (2, 0): |
|
13 |
+ # pylint disable=C0103 |
|
14 |
+ from django.urls import path |
|
15 |
+ urlpatterns = [ |
|
16 |
+ path('upload/', staff_member_required(views.UPLOAD), |
|
17 |
+ name='simditor_upload'), |
|
18 |
+ ] |
|
19 |
+elif django.VERSION >= (1, 8): |
|
20 |
+ # pylint disable=C0103 |
|
21 |
+ urlpatterns = [ |
|
22 |
+ url(r'^upload/', staff_member_required(views.UPLOAD), |
|
23 |
+ name='simditor_upload'), |
|
24 |
+ ] |
|
25 |
+else: |
|
26 |
+ from django.conf.urls import patterns # pylint disable=C0411 |
|
27 |
+ |
|
28 |
+ # pylint disable=C0103 |
|
29 |
+ urlpatterns = patterns( |
|
30 |
+ '', |
|
31 |
+ url(r'^upload/', staff_member_required(views.UPLOAD), |
|
32 |
+ name='simditor_upload'), |
|
33 |
+ ) |
|
34 |
+ |
|
35 |
+if settings.DEBUG: |
|
36 |
+ urlpatterns += static.static(settings.MEDIA_URL, |
|
37 |
+ document_root=settings.MEDIA_ROOT) |
|
38 |
+ urlpatterns += static.static(settings.STATIC_URL, |
|
39 |
+ document_root=settings.STATIC_ROOT) |
@@ -0,0 +1,46 @@ |
||
1 |
+"""simditor utils.""" |
|
2 |
+from __future__ import absolute_import |
|
3 |
+ |
|
4 |
+import os.path |
|
5 |
+import random |
|
6 |
+ |
|
7 |
+import string |
|
8 |
+ |
|
9 |
+from django.core.files.storage import default_storage |
|
10 |
+from django.template.defaultfilters import slugify |
|
11 |
+ |
|
12 |
+ |
|
13 |
+class NotAnImageException(Exception): |
|
14 |
+ pass |
|
15 |
+ |
|
16 |
+ |
|
17 |
+def get_random_string(): |
|
18 |
+ """Get random string.""" |
|
19 |
+ return ''.join(random.sample(string.ascii_lowercase * 6, 6)) |
|
20 |
+ |
|
21 |
+ |
|
22 |
+def get_slugified_name(filename): |
|
23 |
+ """get_slugified_name.""" |
|
24 |
+ slugified = slugify(filename) |
|
25 |
+ return slugified or get_random_string() |
|
26 |
+ |
|
27 |
+ |
|
28 |
+def slugify_filename(filename): |
|
29 |
+ """ Slugify filename """ |
|
30 |
+ name, ext = os.path.splitext(filename) |
|
31 |
+ slugified = get_slugified_name(name) |
|
32 |
+ return slugified + ext |
|
33 |
+ |
|
34 |
+ |
|
35 |
+def get_media_url(path): |
|
36 |
+ """ |
|
37 |
+ Determine system file's media URL. |
|
38 |
+ """ |
|
39 |
+ return default_storage.url(path) |
|
40 |
+ |
|
41 |
+ |
|
42 |
+def is_valid_image_extension(file_path): |
|
43 |
+ """is_valid_image_extension.""" |
|
44 |
+ valid_extensions = ['.jpeg', '.jpg', '.gif', '.png'] |
|
45 |
+ _, extension = os.path.splitext(file_path) |
|
46 |
+ return extension.lower() in valid_extensions |
@@ -0,0 +1,84 @@ |
||
1 |
+"""simditor views.""" |
|
2 |
+from __future__ import absolute_import |
|
3 |
+ |
|
4 |
+import os |
|
5 |
+from datetime import datetime |
|
6 |
+ |
|
7 |
+from django.conf import settings |
|
8 |
+from django.core.files.storage import default_storage |
|
9 |
+ |
|
10 |
+from django.http import JsonResponse |
|
11 |
+ |
|
12 |
+from django.views import generic |
|
13 |
+from django.views.decorators.csrf import csrf_exempt |
|
14 |
+ |
|
15 |
+from . import utils, image_processing |
|
16 |
+ |
|
17 |
+ |
|
18 |
+def get_upload_filename(upload_name): |
|
19 |
+ # Generate date based path to put uploaded file. |
|
20 |
+ date_path = datetime.now().strftime('%Y/%m/%d') |
|
21 |
+ |
|
22 |
+ # Complete upload path (upload_path + date_path). |
|
23 |
+ upload_path = os.path.join(settings.SIMDITOR_UPLOAD_PATH, date_path) |
|
24 |
+ |
|
25 |
+ if getattr(settings, 'SIMDITOR_UPLOAD_SLUGIFY_FILENAME', True): |
|
26 |
+ upload_name = utils.slugify_filename(upload_name) |
|
27 |
+ |
|
28 |
+ return default_storage.get_available_name(os.path.join(upload_path, upload_name)) |
|
29 |
+ |
|
30 |
+ |
|
31 |
+def upload_handler(request): |
|
32 |
+ files = request.FILES |
|
33 |
+ |
|
34 |
+ upload_config = settings.SIMDITOR_CONFIGS.get( |
|
35 |
+ 'upload', {'fileKey': 'upload'}) |
|
36 |
+ filekey = upload_config.get('fileKey', 'upload') |
|
37 |
+ |
|
38 |
+ uploaded_file = files.get(filekey) |
|
39 |
+ |
|
40 |
+ if not uploaded_file: |
|
41 |
+ retdata = {'file_path': '', 'success': False, |
|
42 |
+ 'msg': '图片上传失败,无法获取到图片对象!'} |
|
43 |
+ return JsonResponse(retdata) |
|
44 |
+ |
|
45 |
+ image_size = upload_config.get('image_size') |
|
46 |
+ if image_size and uploaded_file.size > image_size: |
|
47 |
+ retdata = {'file_path': '', 'success': False, |
|
48 |
+ 'msg': '上传失败,已超出图片最大限制!'} |
|
49 |
+ return JsonResponse(retdata) |
|
50 |
+ |
|
51 |
+ backend = image_processing.get_backend() |
|
52 |
+ |
|
53 |
+ if not getattr(settings, 'SIMDITOR_ALLOW_NONIMAGE_FILES', True): |
|
54 |
+ try: |
|
55 |
+ backend.image_verify(uploaded_file) |
|
56 |
+ except utils.NotAnImageException: |
|
57 |
+ retdata = {'file_path': '', 'success': False, |
|
58 |
+ 'msg': '图片格式错误!'} |
|
59 |
+ return JsonResponse(retdata) |
|
60 |
+ |
|
61 |
+ filename = get_upload_filename(uploaded_file.name) |
|
62 |
+ saved_path = default_storage.save(filename, uploaded_file) |
|
63 |
+ |
|
64 |
+ url = utils.get_media_url(saved_path) |
|
65 |
+ |
|
66 |
+ is_api = settings.SIMDITOR_CONFIGS.get('is_api', False) |
|
67 |
+ url = request.META.get('HTTP_ORIGIN') + url if is_api else url |
|
68 |
+ |
|
69 |
+ retdata = {'file_path': url, 'success': True, 'msg': '上传成功!'} |
|
70 |
+ |
|
71 |
+ return JsonResponse(retdata) |
|
72 |
+ |
|
73 |
+ |
|
74 |
+class ImageUploadView(generic.View): |
|
75 |
+ """ImageUploadView.""" |
|
76 |
+ |
|
77 |
+ http_method_names = ['post'] |
|
78 |
+ |
|
79 |
+ def post(self, request, **kwargs): |
|
80 |
+ """Post.""" |
|
81 |
+ return upload_handler(request) |
|
82 |
+ |
|
83 |
+ |
|
84 |
+UPLOAD = csrf_exempt(ImageUploadView.as_view()) |
@@ -0,0 +1,170 @@ |
||
1 |
+"""simditor widgets.""" |
|
2 |
+from __future__ import absolute_import |
|
3 |
+ |
|
4 |
+from django import forms |
|
5 |
+from django.conf import settings |
|
6 |
+from django.core.exceptions import ImproperlyConfigured |
|
7 |
+from django.core.serializers.json import DjangoJSONEncoder |
|
8 |
+ |
|
9 |
+from django.template.loader import render_to_string |
|
10 |
+from django.utils.encoding import force_text |
|
11 |
+from django.utils.safestring import mark_safe |
|
12 |
+from django.utils.html import conditional_escape |
|
13 |
+from django.utils.functional import Promise |
|
14 |
+ |
|
15 |
+try: |
|
16 |
+ # Django >=2.1 |
|
17 |
+ from django.forms.widgets import get_default_renderer |
|
18 |
+ IS_NEW_WIDGET = True |
|
19 |
+except ImportError: |
|
20 |
+ IS_NEW_WIDGET = False |
|
21 |
+ |
|
22 |
+try: |
|
23 |
+ # Django >=1.7 |
|
24 |
+ from django.forms.utils import flatatt |
|
25 |
+except ImportError: |
|
26 |
+ # Django <1.7 |
|
27 |
+ from django.forms.util import flatatt # pylint disable=E0611, E0401 |
|
28 |
+ |
|
29 |
+ |
|
30 |
+class LazyEncoder(DjangoJSONEncoder): |
|
31 |
+ """LazyEncoder.""" |
|
32 |
+ |
|
33 |
+ # pylint disable=E0202 |
|
34 |
+ def default(self, obj): |
|
35 |
+ if isinstance(obj, Promise): |
|
36 |
+ return force_text(obj) |
|
37 |
+ return super(LazyEncoder, self).default(obj) |
|
38 |
+ |
|
39 |
+ |
|
40 |
+JSON_ENCODE = LazyEncoder().encode |
|
41 |
+ |
|
42 |
+ |
|
43 |
+FULL_TOOLBAR = [ |
|
44 |
+ 'title', 'bold', 'italic', 'underline', 'strikethrough', 'fontScale', |
|
45 |
+ 'color', '|', 'ol', 'ul', 'blockquote', 'code', 'table', '|', 'link', |
|
46 |
+ 'image', 'hr', '|', 'indent', 'outdent', 'alignment', 'checklist', |
|
47 |
+ 'markdown', 'fullscreen' |
|
48 |
+] |
|
49 |
+ |
|
50 |
+DEFAULT_TOOLBAR = [ |
|
51 |
+ 'title', 'bold', 'italic', 'underline', 'strikethrough', 'fontScale', |
|
52 |
+ 'color', '|', 'ol', 'ul', 'blockquote', 'table', '|', 'link', |
|
53 |
+ 'image', 'hr', '|', 'indent', 'outdent', 'alignment' |
|
54 |
+] |
|
55 |
+ |
|
56 |
+DEFAULT_CONFIG = { |
|
57 |
+ 'toolbar': DEFAULT_TOOLBAR, |
|
58 |
+ 'cleanPaste': True, |
|
59 |
+ 'tabIndent': True, |
|
60 |
+ 'pasteImage': True, |
|
61 |
+ 'upload': { |
|
62 |
+ 'url': '/', |
|
63 |
+ 'fileKey': 'file' |
|
64 |
+ } |
|
65 |
+} |
|
66 |
+ |
|
67 |
+ |
|
68 |
+class SimditorWidget(forms.Textarea): |
|
69 |
+ """ |
|
70 |
+ Widget providing Simditor for Rich Text Editing.abs |
|
71 |
+ Supports direct image uploads and embed. |
|
72 |
+ """ |
|
73 |
+ class Media: |
|
74 |
+ """Media.""" |
|
75 |
+ |
|
76 |
+ css_list = [ |
|
77 |
+ 'simditor/styles/simditor.min.css' |
|
78 |
+ ] |
|
79 |
+ |
|
80 |
+ if 'emoji' in settings.SIMDITOR_TOOLBAR: |
|
81 |
+ css_list.append('simditor/styles/simditor-emoji.css') |
|
82 |
+ |
|
83 |
+ if 'fullscreen' in settings.SIMDITOR_TOOLBAR: |
|
84 |
+ css_list.append('simditor/styles/simditor-fullscreen.min.css') |
|
85 |
+ |
|
86 |
+ if 'checklist' in settings.SIMDITOR_TOOLBAR: |
|
87 |
+ css_list.append('simditor/styles/simditor-checklist.min.css') |
|
88 |
+ |
|
89 |
+ if 'markdown' in settings.SIMDITOR_TOOLBAR: |
|
90 |
+ css_list.append('simditor/styles/simditor-markdown.min.css') |
|
91 |
+ |
|
92 |
+ css = {'all': tuple(settings.STATIC_URL + url for url in css_list)} |
|
93 |
+ |
|
94 |
+ jquery_list = ['simditor/scripts/jquery.min.js', |
|
95 |
+ 'simditor/scripts/module.min.js', |
|
96 |
+ 'simditor/scripts/hotkeys.min.js', |
|
97 |
+ 'simditor/scripts/uploader.min.js', |
|
98 |
+ 'simditor/scripts/simditor.min.js'] |
|
99 |
+ |
|
100 |
+ if 'fullscreen' in settings.SIMDITOR_TOOLBAR: |
|
101 |
+ jquery_list.append('simditor/scripts/simditor-fullscreen.min.js') |
|
102 |
+ |
|
103 |
+ if 'checklist' in settings.SIMDITOR_TOOLBAR: |
|
104 |
+ jquery_list.append('simditor/scripts/simditor-checklist.min.js') |
|
105 |
+ |
|
106 |
+ if 'markdown' in settings.SIMDITOR_TOOLBAR: |
|
107 |
+ jquery_list.append('simditor/scripts/marked.min.js') |
|
108 |
+ jquery_list.append('simditor/scripts/to-markdown.min.js') |
|
109 |
+ jquery_list.append('simditor/scripts/simditor-markdown.min.js') |
|
110 |
+ |
|
111 |
+ if 'image' in settings.SIMDITOR_TOOLBAR: |
|
112 |
+ jquery_list.append('simditor/scripts/simditor-dropzone.min.js') |
|
113 |
+ |
|
114 |
+ if 'emoji' in settings.SIMDITOR_TOOLBAR: |
|
115 |
+ jquery_list.append('simditor/scripts/simditor-emoji.js') |
|
116 |
+ |
|
117 |
+ js = tuple(settings.STATIC_URL + url for url in jquery_list) |
|
118 |
+ |
|
119 |
+ try: |
|
120 |
+ |
|
121 |
+ js += (settings.STATIC_URL + 'simditor/simditor-init.js',) |
|
122 |
+ except AttributeError: |
|
123 |
+ raise ImproperlyConfigured("django-simditor requires \ |
|
124 |
+ SIMDITOR_MEDIA_PREFIX setting. This setting specifies a \ |
|
125 |
+ URL prefix to the ckeditor JS and CSS media (not \ |
|
126 |
+ uploaded media). Make sure to use a trailing slash: \ |
|
127 |
+ SIMDITOR_MEDIA_PREFIX = '/media/simditor/'") |
|
128 |
+ |
|
129 |
+ def __init__(self, *args, **kwargs): |
|
130 |
+ super(SimditorWidget, self).__init__(*args, **kwargs) |
|
131 |
+ # Setup config from defaults. |
|
132 |
+ self.config = DEFAULT_CONFIG.copy() |
|
133 |
+ |
|
134 |
+ # Try to get valid config from settings. |
|
135 |
+ configs = getattr(settings, 'SIMDITOR_CONFIGS', None) |
|
136 |
+ if configs: |
|
137 |
+ if isinstance(configs, dict): |
|
138 |
+ self.config.update(configs) |
|
139 |
+ else: |
|
140 |
+ raise ImproperlyConfigured( |
|
141 |
+ 'SIMDITOR_CONFIGS setting must be a dictionary type.') |
|
142 |
+ |
|
143 |
+ def build_attrs(self, base_attrs, extra_attrs=None, **kwargs): |
|
144 |
+ """ |
|
145 |
+ Helper function for building an attribute dictionary. |
|
146 |
+ This is combination of the same method from Django<=1.10 and Django1.11 |
|
147 |
+ """ |
|
148 |
+ attrs = dict(base_attrs, **kwargs) |
|
149 |
+ if extra_attrs: |
|
150 |
+ attrs.update(extra_attrs) |
|
151 |
+ return attrs |
|
152 |
+ |
|
153 |
+ def render(self, name, value, attrs=None, renderer=None): |
|
154 |
+ if value is None: |
|
155 |
+ value = '' |
|
156 |
+ final_attrs = self.build_attrs(self.attrs, attrs, name=name) |
|
157 |
+ |
|
158 |
+ params = ('simditor/widget.html', { |
|
159 |
+ 'final_attrs': flatatt(final_attrs), |
|
160 |
+ 'value': conditional_escape(force_text(value)), |
|
161 |
+ 'id': final_attrs['id'], |
|
162 |
+ 'config': JSON_ENCODE(self.config) |
|
163 |
+ }) |
|
164 |
+ |
|
165 |
+ if renderer is None and IS_NEW_WIDGET: |
|
166 |
+ renderer = get_default_renderer() |
|
167 |
+ |
|
168 |
+ data = renderer.render(*params) if IS_NEW_WIDGET else render_to_string(*params) |
|
169 |
+ |
|
170 |
+ return mark_safe(data) |