Skip to content
Snippets Groups Projects
Commit 6eaa5775 authored by chris's avatar chris Committed by Yannis Barlas
Browse files

comment overlay position plus resolved comment

parent 1f3e632c
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
}
}
......
......@@ -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)
})
/*
......
......@@ -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)
})
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment