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

find blockposition for comments in notes editor so they render correclty

parent a2f4e146
No related branches found
No related tags found
No related merge requests found
...@@ -272,6 +272,7 @@ class Editor extends ProseEditor { ...@@ -272,6 +272,7 @@ class Editor extends ProseEditor {
containerId: this.props.containerId, containerId: this.props.containerId,
controller: this, controller: this,
editorSession: this.editorSession, editorSession: this.editorSession,
notesProvider: notesProvider,
fragment: this.props.fragment, fragment: this.props.fragment,
surfaceManager: this.surfaceManager, surfaceManager: this.surfaceManager,
toggleCommentsArea: this.toggleCommentsArea, toggleCommentsArea: this.toggleCommentsArea,
......
...@@ -74,7 +74,7 @@ class CommentBoxList extends Component { ...@@ -74,7 +74,7 @@ class CommentBoxList extends Component {
const entries = provider.computeEntries() const entries = provider.computeEntries()
const activeEntry = provider.activeEntry const activeEntry = provider.activeEntry
console.log(entries)
this.calculateTops(entries, activeEntry) this.calculateTops(entries, activeEntry)
} }
// TODO move to helper section?? // TODO move to helper section??
......
...@@ -282,6 +282,10 @@ class CommentsProvider extends TocProvider { ...@@ -282,6 +282,10 @@ class CommentsProvider extends TocProvider {
return surfaceManager.getSurface(containerId) return surfaceManager.getSurface(containerId)
} }
getMiniDocument () {
return this.config.controller.context.notesProvider.config.miniEditorSession.document
}
isSelectionLargerThanComments () { isSelectionLargerThanComments () {
const commentBorders = this.getCommentBorders() const commentBorders = this.getCommentBorders()
if (!commentBorders) return false if (!commentBorders) return false
...@@ -377,12 +381,21 @@ class CommentsProvider extends TocProvider { ...@@ -377,12 +381,21 @@ class CommentsProvider extends TocProvider {
var doc = this.getDocument() var doc = this.getDocument()
var container = doc.get('body') 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 // sort notes by
// the index of the containing block // the index of the containing block
// their position within that block // their position within that block
comments = _.map(comments, function (comment) { comments = _.map(comments, function (comment) {
const blockId = comment.path[0] 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 const nodePosition = comment.start.offset
return { return {
......
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