diff --git a/app/components/SimpleEditor/SimpleEditor.scss b/app/components/SimpleEditor/SimpleEditor.scss index 026ef0c52e13de668b4bd32c3efb3925f37c612d..a5376e9c00b6b012cd69b98c13a55c081f09facf 100644 --- a/app/components/SimpleEditor/SimpleEditor.scss +++ b/app/components/SimpleEditor/SimpleEditor.scss @@ -54,6 +54,9 @@ $active-blue: #4a90e2; .sc-comment-pane-list li .comment-list .single-comment-row { padding: 3px 12px; } + .sc-overlay .se-active-tools .sc-overlay-bubble .sc-comment-icon { + top: 0; + } } } diff --git a/app/components/SimpleEditor/elements/comment/CommentBubble.js b/app/components/SimpleEditor/elements/comment/CommentBubble.js index ab7e1a01fafd155af37db09bc5277e202c9a6f06..47f99ca05dbd6707410f732515e582784b0c7de7 100644 --- a/app/components/SimpleEditor/elements/comment/CommentBubble.js +++ b/app/components/SimpleEditor/elements/comment/CommentBubble.js @@ -28,6 +28,7 @@ class CommentBubble extends Tool { // calculated relative to the overlay container, which gets positioned // wrong on resize (substance bug -- TODO) didMount () { + this.context.editorSession.onUpdate('', this.position, this) this.position() DefaultDOMElement.getBrowserWindow().on('resize', this.didUpdate, this) } @@ -57,21 +58,27 @@ class CommentBubble extends Tool { const documentElementWidth = documentElement.offsetWidth const overlayContainerLeft = overlayContainer.offsetLeft const left = documentElementWidth - overlayContainerLeft - 15 - const selection = this.getSelection() - const container = surface.getContainer() - const position = container.getPosition(selection.end.path[0]) + + // 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') - console.log('positionposition', position) + + // TODO getBoundingRectangleForSelection() doesn't exist anymore // const hints = surface.getBoundingRectangleForSelection() // const selectionHeight = hints.height - // const bubbleHeight = this.el.getHeight() - // const cheat = 3 - // const moveUp = (selectionHeight / 2) + (bubbleHeight / 2) + cheat - // const top = '-' + moveUp + 'px' + + const selectionHeight = 20 + + const bubbleHeight = this.el.getHeight() + const cheat = 3 + const moveUp = (selectionHeight / 2) + (bubbleHeight / 2) + cheat + const top = '-' + moveUp + 'px' this.el.css('left', left) - // this.el.css('top', top) + this.el.css('top', top) }) /* diff --git a/app/components/SimpleEditor/panes/Comments/CommentsProvider.js b/app/components/SimpleEditor/panes/Comments/CommentsProvider.js index 0240fff6ef0fe72a21625951ba3d5c346a620a1d..24cbcb4cf631c00e0d7546bae80f44d3b424d010 100644 --- a/app/components/SimpleEditor/panes/Comments/CommentsProvider.js +++ b/app/components/SimpleEditor/panes/Comments/CommentsProvider.js @@ -104,7 +104,7 @@ class CommentsProvider extends TocProvider { resolveComment (id) { const self = this - const ds = this.config.documentSession + const ds = this.config.editorSession const doc = ds.getDocument() const commentNode = doc.get(id) @@ -116,14 +116,17 @@ class CommentsProvider extends TocProvider { const resolvedNodeData = { selection: sel, - node: { type: 'resolved-comment' } + type: 'resolved-comment', + path: sel.path, + start: sel.start, + end: sel.end } // create resolved comment annotation on the same selection the // comment was on and remove existing comment ds.transaction(function (tx, args) { - const annotation = createAnnotation(doc, resolvedNodeData) - const resolvedCommentId = annotation.node.id + const annotation = tx.create(resolvedNodeData) + const resolvedCommentId = annotation.id self.markCommentAsResolved(id, resolvedCommentId) })