From: Alexander Ebert Date: Thu, 30 Oct 2014 16:53:34 +0000 (+0100) Subject: Fixed a few issues related to quotes and caret position X-Git-Tag: 2.1.0_Alpha_1~129 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7e547f62c1305b8d87e0705d836f345c351de4de;p=GitHub%2FWoltLab%2FWCF.git Fixed a few issues related to quotes and caret position --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js index 0780038e9b..4c513f73b3 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js @@ -347,13 +347,17 @@ RedactorPlugins.wutil = function() { * Sets the selection after the last direct children of the editor. */ selectionEndOfEditor: function() { + this.focus.setEnd(); + var $lastChild = this.$editor.children(':last')[0]; if ($lastChild.tagName === 'P') { // sometimes the last

is just empty, causing the method to fail if ($lastChild.innerHTML === '') { - $lastChild = $($lastChild).replaceWith($(this.opts.emptyHtml)); - this.caret.setEnd($lastChild[0]); + $lastChild.remove(); + $lastChild = $(this.opts.emptyHtml).appendTo(this.$editor); } + + this.caret.setEnd($lastChild[0]); } else { this.wutil.setCaretAfter($lastChild); diff --git a/wcfsetup/install/files/js/WCF.Message.js b/wcfsetup/install/files/js/WCF.Message.js index 61b16e3a8c..f79ce501b2 100644 --- a/wcfsetup/install/files/js/WCF.Message.js +++ b/wcfsetup/install/files/js/WCF.Message.js @@ -896,7 +896,7 @@ WCF.Message.QuickReply = Class.extend({ this._messageField.redactor('focus.setEnd'); this._messageField.redactor('wutil.insertDynamic', $html, data.returnValues.template); - this._messageField.redactor('focus.setEnd'); + this._messageField.redactor('wutil.selectionEndOfEditor'); this._messageField.redactor('wbbcode._observeQuotes'); } else {