diff --git a/app/components/SimpleEditor/elements/comment/CommentBubble.js b/app/components/SimpleEditor/elements/comment/CommentBubble.js index 47f99ca05dbd6707410f732515e582784b0c7de7..5c79d60fd28b04a05adbc54dc4042ac789d60591 100644 --- a/app/components/SimpleEditor/elements/comment/CommentBubble.js +++ b/app/components/SimpleEditor/elements/comment/CommentBubble.js @@ -59,19 +59,13 @@ class CommentBubble extends Tool { const overlayContainerLeft = overlayContainer.offsetLeft const left = documentElementWidth - overlayContainerLeft - 15 - // const selection = this.getSelection() - // const container = surface.getContainer() - // const position = container.getPosition(surface.getDocument().get(selection.getNodeId())) - // unhide it first, as the bubble has no height otherwise this.el.removeClass('sc-overlay-bubble-hidden') - // TODO getBoundingRectangleForSelection() doesn't exist anymore - // const hints = surface.getBoundingRectangleForSelection() - // const selectionHeight = hints.height - - const selectionHeight = 20 - + let wsel = window.getSelection() + let wrange = wsel.getRangeAt(0) + const hints = wrange.getBoundingClientRect() + const selectionHeight = hints.height const bubbleHeight = this.el.getHeight() const cheat = 3 const moveUp = (selectionHeight / 2) + (bubbleHeight / 2) + cheat