diff --git a/app/components/SimpleEditor/panes/Comments/CommentBoxList.js b/app/components/SimpleEditor/panes/Comments/CommentBoxList.js index 164b313c03462649bb2eca7f70a0c2d62d6e7af8..26e62aa0785ab3458268b087782b742af7d5cfcc 100644 --- a/app/components/SimpleEditor/panes/Comments/CommentBoxList.js +++ b/app/components/SimpleEditor/panes/Comments/CommentBoxList.js @@ -77,11 +77,15 @@ class CommentBoxList extends Component { this.calculateTops(entries, activeEntry) } + // TODO move to helper section?? + hasCssClass (element, className) { + return element.className && new RegExp('(^|\\s)' + className + '(\\s|$)').test(element.className) + } calculateTops (entries, active) { let result = [] let boxes = [] - + let self = this _.each(entries, function (entry, pos) { // initialize annotationTop and boxHeight, as there is a chance that // annotation and box elements are not found by the selector @@ -96,7 +100,10 @@ class CommentBoxList extends Component { // get position of annotation in editor const annotationEl = document.querySelector('span[data-id="' + entry.id + '"]') - if (annotationEl) annotationTop = parseInt(annotationEl.offsetTop) + if (annotationEl) { + annotationTop = (self.hasCssClass(annotationEl.offsetParent, 'sc-isolated-node')) + ? annotationEl.offsetParent.offsetTop + annotationEl.offsetTop : annotationEl.offsetTop + } // get height of this comment box const boxEl = document.querySelector('li[data-comment="' + entry.id + '"]') diff --git a/app/components/SimpleEditor/panes/Notes/NotesProvider.js b/app/components/SimpleEditor/panes/Notes/NotesProvider.js index 67ad0c32e381bf583075fc3579b93e499763caf1..dd0f5c3c286d909b51eeb2dc583eaaf2f17b681c 100644 --- a/app/components/SimpleEditor/panes/Notes/NotesProvider.js +++ b/app/components/SimpleEditor/panes/Notes/NotesProvider.js @@ -100,7 +100,6 @@ class NotesProvider extends TOCProvider { if (notes.mini && notes.mini.length > 0) { let findIndex = _.findIndex(notes.main, ['id', note.id]) - console.log('index', findIndex) let surface = this.config.miniEditorContext.surfaceManager.getSurface('body') let container = surface.getContainer() // let nodePos = container.getPosition(lastNote.id, 'strict')