From 0dc0bb27b422441a149178fe83784b1aade9c8f8 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 17 Sep 2014 15:28:44 +0200 Subject: [PATCH] Fixed scrolling when setting the editor text programatically --- wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js index 0ab965bee3..bc5612dacc 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js @@ -445,6 +445,7 @@ RedactorPlugins.wutil = { */ replaceText: function(value) { var $wasInWysiwygMode = false; + var $offsetTop = $(document).scrollTop(); if (this.inWysiwygMode()) { this.toggle(); $wasInWysiwygMode = true; @@ -454,6 +455,9 @@ RedactorPlugins.wutil = { if ($wasInWysiwygMode) { this.toggle(); + + // restore scrolling since editor receives the focus + $(document).scrollTop($offsetTop); } } }; -- 2.20.1