Skip to content
Snippets Groups Projects
Commit 1e3f7084 authored by chris's avatar chris Committed by john
Browse files

create overlapping comments

parent ddb5866d
No related branches found
No related tags found
No related merge requests found
......@@ -10,8 +10,10 @@ class CommentBubble extends Tool {
const mode = this.getMode()
const title = 'Create a new comment'
if (mode !== 'create') return $$('div')
// if (mode !== 'create') return $$('div')
if (mode === 'delete' || mode === 'fuse') return $$('div')
// console.log('bubble commands', commands.mode)
const icon = $$(Icon, { icon: 'fa-comment' })
.addClass('sc-comment-icon')
......@@ -120,7 +122,7 @@ class CommentBubble extends Tool {
const selection = this.getSelection()
const surface = this.getSurface()
if (mode !== 'create') return
if (mode === 'delete') return
const newNode = {
selection: selection,
......
......@@ -50,7 +50,10 @@ class CommentsProvider extends TocProvider {
// if the new selection is a comment, make it activeEntry
const activeEntry = this.getActiveEntry()
const commentState = this.getCommentState()
const onComment = commentState.active // is current selection on a comment
// TODO why on any mode except delete active is false???
if (commentState.mode === 'fuse') commentState.active = true
console.log('provider commands', commentState)
let onComment = commentState.active // is current selection on a comment
if (!onComment && !activeEntry) return
......@@ -61,6 +64,7 @@ class CommentsProvider extends TocProvider {
}
const activeComment = this.getActiveComment()
console.log('whichhhh', activeComment.id)
if (activeEntry === activeComment.id) return
this.setActiveEntry(activeComment.id)
}
......@@ -143,9 +147,11 @@ class CommentsProvider extends TocProvider {
getActiveComment () {
const selectionState = this.config.documentSession.getSelectionState()
const commentAnnotations = selectionState.getAnnotationsForType('comment')
console.log('selection', this.config.documentSession.getSelection())
const count = commentAnnotations.length - 1
console.log(count)
// TODO -- what happens with multiple comments on the same cursor position?
return commentAnnotations[0]
return commentAnnotations[count]
}
getComments () {
......
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