From 2011f1b56278fea6a6cdcd8fba439cea56f4c404 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sat, 28 Sep 2013 13:52:23 +0200 Subject: [PATCH] getBoundingClientRect() seem to provide better dimensions --- wcfsetup/install/files/js/WCF.Message.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/wcfsetup/install/files/js/WCF.Message.js b/wcfsetup/install/files/js/WCF.Message.js index 9320f66606..dca2528a84 100644 --- a/wcfsetup/install/files/js/WCF.Message.js +++ b/wcfsetup/install/files/js/WCF.Message.js @@ -1879,6 +1879,9 @@ WCF.Message.Quote.Handler = Class.extend({ // the coordinates returned by getBoundingClientRect() is relative to the window, not the document! //var $rect = selection.getRangeAt(0).getBoundingClientRect(); var $rects = selection.getRangeAt(0).getClientRects(); + var $rect = selection.getRangeAt(0).getBoundingClientRect(); + + /* var $rect = { }; if (!$.browser.mozilla && $rects.length > 1) { // save current selection to restore it later @@ -1890,9 +1893,9 @@ WCF.Message.Quote.Handler = Class.extend({ var $position2 = this._getOffset($range, false); $rect = { - left: ($position1.left > $position2.left) ? $position2.left : $position1.left, - right: ($position1.left > $position2.left) ? $position1.left : $position2.left, - top: ($position1.top > $position2.top) ? $position2.top : $position1.top + left: Math.min($position1.left, $position2.left), + right: Math.max($position1.left, $position2.left), + top: Math.max($position1.top, $position2.top) }; // restore selection @@ -1901,6 +1904,7 @@ WCF.Message.Quote.Handler = Class.extend({ else { $rect = selection.getRangeAt(0).getBoundingClientRect(); } + */ var $document = $(document); var $offsetTop = $document.scrollTop(); -- 2.20.1