diff --git a/app/components/SimpleEditor/Editor.js b/app/components/SimpleEditor/Editor.js index 25460f162fea3d71f003e2e6e666beb3f95589fc..87d1d9125c4648d8022fbacc39b63c2eb518eb39 100644 --- a/app/components/SimpleEditor/Editor.js +++ b/app/components/SimpleEditor/Editor.js @@ -272,6 +272,7 @@ class Editor extends ProseEditor { containerId: this.props.containerId, controller: this, editorSession: this.editorSession, + notesProvider: notesProvider, fragment: this.props.fragment, surfaceManager: this.surfaceManager, toggleCommentsArea: this.toggleCommentsArea, diff --git a/app/components/SimpleEditor/panes/Comments/CommentBoxList.js b/app/components/SimpleEditor/panes/Comments/CommentBoxList.js index 90f1ca8b7a4db6a04eb968d9c4a7f7dd38101671..1cc71991f39ab98eba80794b00afbcaa428dbdac 100644 --- a/app/components/SimpleEditor/panes/Comments/CommentBoxList.js +++ b/app/components/SimpleEditor/panes/Comments/CommentBoxList.js @@ -74,7 +74,7 @@ class CommentBoxList extends Component { const entries = provider.computeEntries() const activeEntry = provider.activeEntry - + console.log(entries) this.calculateTops(entries, activeEntry) } // TODO move to helper section?? diff --git a/app/components/SimpleEditor/panes/Comments/CommentsProvider.js b/app/components/SimpleEditor/panes/Comments/CommentsProvider.js index 9767f19f756e03e129eeddba717498b310e1e510..ba9052201435b31312cb8deee1a5cc7cf3d8f279 100644 --- a/app/components/SimpleEditor/panes/Comments/CommentsProvider.js +++ b/app/components/SimpleEditor/panes/Comments/CommentsProvider.js @@ -282,6 +282,10 @@ class CommentsProvider extends TocProvider { return surfaceManager.getSurface(containerId) } + getMiniDocument () { + return this.config.controller.context.notesProvider.config.miniEditorSession.document + } + isSelectionLargerThanComments () { const commentBorders = this.getCommentBorders() if (!commentBorders) return false @@ -377,12 +381,21 @@ class CommentsProvider extends TocProvider { var doc = this.getDocument() var container = doc.get('body') + let docMini = '' + let containerMini = '' + + if (this.config.controller.context.notesProvider) { + docMini = this.getMiniDocument() + } + if (docMini) containerMini = docMini.get('mini') + // sort notes by // the index of the containing block // their position within that block comments = _.map(comments, function (comment) { const blockId = comment.path[0] - const blockPosition = container.getPosition(blockId) + let blockPosition = container.getPosition(blockId) + if (blockPosition === -1) blockPosition = containerMini.getPosition(blockId) const nodePosition = comment.start.offset return {