From f07da8f50a07121674efc5f0ba1b8f82f53f6c3a Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Wed, 12 Apr 2017 11:49:00 +0300 Subject: [PATCH] comment Bubble correct position for both panes --- .../elements/comment/CommentBubble.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/app/components/SimpleEditor/elements/comment/CommentBubble.js b/app/components/SimpleEditor/elements/comment/CommentBubble.js index 5c79d60..1fcec91 100644 --- a/app/components/SimpleEditor/elements/comment/CommentBubble.js +++ b/app/components/SimpleEditor/elements/comment/CommentBubble.js @@ -51,13 +51,22 @@ class CommentBubble extends Tool { const surface = this.getSurface() if (!surface) return - const documentElement = document.querySelector('.se-content') - const overlayContainer = document.querySelector('.sc-overlay') - setTimeout(() => { // read comment below + let documentElement = document.querySelector('.se-content') + let overlayContainer = document.querySelector('.sc-overlay') + let fix = 15 + if (parseInt(overlayContainer.offsetLeft) === 0) { + const minEditorContentPanelChildren = document.getElementById('mini-editor-content-panel').children + const temp = minEditorContentPanelChildren[0].children + documentElement = temp[0] + const children = temp[0].children + overlayContainer = children[1] + fix = 357 + } + console.log(fix) const documentElementWidth = documentElement.offsetWidth const overlayContainerLeft = overlayContainer.offsetLeft - const left = documentElementWidth - overlayContainerLeft - 15 + const left = documentElementWidth - overlayContainerLeft - fix // unhide it first, as the bubble has no height otherwise this.el.removeClass('sc-overlay-bubble-hidden') @@ -70,7 +79,7 @@ class CommentBubble extends Tool { const cheat = 3 const moveUp = (selectionHeight / 2) + (bubbleHeight / 2) + cheat const top = '-' + moveUp + 'px' - + console.log('left', left) this.el.css('left', left) this.el.css('top', top) }) -- GitLab