FIX: Quote reply button not taking into scrolling offset.

This commit is contained in:
Guo Xiang Tan 2016-07-08 15:43:04 +08:00
parent 2484b8eb91
commit c6a6d6e1d6
1 changed files with 5 additions and 1 deletions

View File

@ -72,7 +72,9 @@ export default Ember.Controller.extend({
range.insertNode(markerElement);
// retrieve the position of the marker
const markerOffset = $(markerElement).offset(),
const $markerElement = $(markerElement)
markerOffset = $markerElement.offset(),
parentScrollLeft = $markerElement.parent().scrollLeft(),
$quoteButton = $('.quote-button');
// remove the marker
@ -88,6 +90,8 @@ export default Ember.Controller.extend({
let topOff = markerOffset.top;
let leftOff = markerOffset.left;
if (parentScrollLeft > 0) leftOff += parentScrollLeft;
if (isMobileDevice || isIOS || isAndroid) {
topOff = topOff + 20;
leftOff = Math.min(leftOff + 10, $(window).width() - $quoteButton.outerWidth());