From 7e547f62c1305b8d87e0705d836f345c351de4de Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 30 Oct 2014 17:53:34 +0100 Subject: [PATCH] Fixed a few issues related to quotes and caret position --- .../install/files/js/3rdParty/redactor/plugins/wutil.js | 8 ++++++-- wcfsetup/install/files/js/WCF.Message.js | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) 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 { -- 2.20.1