vendor/assets/javascripts/simditor/simditor.js in simditor-2.2.0 vs vendor/assets/javascripts/simditor/simditor.js in simditor-2.2.2

- old
+ new

@@ -1,9 +1,9 @@ /*! -* Simditor v2.1.15 +* Simditor v2.2.2 * http://simditor.tower.im/ -* 2015-07-28 +* 2015-07-31 */ (function (root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module unless amdModuleId is set define('simditor', ["jquery","simple-module","simple-hotkeys","simple-uploader"], function ($, SimpleModule, simpleHotkeys, simpleUploader) { @@ -833,11 +833,11 @@ } } }); _this.editor.body.find('pre:empty').append(_this.editor.util.phBr); if (!_this.editor.util.support.onselectionchange && _this.focused) { - return _this.throttledValueChanged(); + 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('paste', $.proxy(this._onPaste, this)).on('drop', $.proxy(this._onDrop, this)).on('input', $.proxy(this._onInput, this)); if (this.editor.util.browser.firefox) { @@ -2165,11 +2165,11 @@ $blockEl = $(blockEl); if (!$blockEl.length) { return; } if ($blockEl.is('pre')) { - $pre = this.editor.selection.containerNode; + $pre = this.editor.selection.containerNode(); if (!($pre.is($blockEl) || $pre.closest('pre').is($blockEl))) { return; } this.indentText(range); } else if ($blockEl.is('li')) { @@ -2189,11 +2189,11 @@ } 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'); + $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')) { @@ -2230,11 +2230,11 @@ $blockEl = $(blockEl); if (!($blockEl && $blockEl.length > 0)) { return; } if ($blockEl.is('pre')) { - $pre = this.editor.selection.containerNode; + $pre = this.editor.selection.containerNode(); if (!($pre.is($blockEl) || $pre.closest('pre').is($blockEl))) { return; } this.outdentText(range); } else if ($blockEl.is('li')) { @@ -2261,11 +2261,11 @@ } 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'); + $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')) { @@ -5052,10 +5052,10 @@ } }; TableButton.prototype.command = function(param) { var $td; - $td = this.editor.selection.containerNode.closest('td, th'); + $td = this.editor.selection.containerNode().closest('td, th'); if (!($td.length > 0)) { return; } if (param === 'deleteRow') { this.deleteRow($td);