diff --git a/app/components/SimpleEditor/Editor.js b/app/components/SimpleEditor/Editor.js index a927983904d349edb5becd4d4967fec490f3ab29..39e440bfd00c13da9fc43fbf71bbc0fc7b25620d 100644 --- a/app/components/SimpleEditor/Editor.js +++ b/app/components/SimpleEditor/Editor.js @@ -44,7 +44,7 @@ class Editor extends ProseEditor { didMount () { console.log(this.editorSession) - this.editorSession.onUpdate('document', this.rerender, this, {}) + // this.editorSession.onUpdate('document', this.rerender, this, {}) // this.documentSession.on('didUpdate', this.documentSessionUpdated, this) // this.documentSession.on('fileUploadTrigger', this.handleUpload, this) this.extendState({ editorReady: true }) diff --git a/app/components/SimpleEditor/panes/Comments/CommentBox.js b/app/components/SimpleEditor/panes/Comments/CommentBox.js index 3728ab05a46f4a0f9618e5204ec4ab9044e75c65..89fe6f3f2ff22a5a12236d16d101f346adb6a5de 100644 --- a/app/components/SimpleEditor/panes/Comments/CommentBox.js +++ b/app/components/SimpleEditor/panes/Comments/CommentBox.js @@ -8,16 +8,14 @@ import { import CommentList from './CommentList' class CommentBox extends Component { - constructor (props) { - super(props) + constructor (props, args) { + super(props, args) this.inputHeight = 0 } // TODO -- fix class names render ($$) { - console.log('in comment box') - const active = this.props.active - const entry = this.props.entry + const {active, entry} = this.props let comments = this.props.comments.data @@ -85,7 +83,7 @@ class CommentBox extends Component { textAreaAdjust (event) { const value = this.refs.commentReply.getValue() let replyBtn = this.refs.commentReplyButton - + console.log('replyBn', replyBtn) if (value.trim().length > 0) { replyBtn.removeAttr('disabled') } else { diff --git a/app/components/SimpleEditor/panes/Comments/CommentBoxList.js b/app/components/SimpleEditor/panes/Comments/CommentBoxList.js index 49a9dcefd1412e83cc2a70f111671c21d701f8e0..e7aacbe3977ebb87567734d807c3488ed3dca038 100644 --- a/app/components/SimpleEditor/panes/Comments/CommentBoxList.js +++ b/app/components/SimpleEditor/panes/Comments/CommentBoxList.js @@ -28,15 +28,16 @@ class CommentBoxList extends Component { // const entries = provider.getEntries() const entries = provider.computeEntries() const activeEntry = provider.activeEntry + const { comments, user } = self.props const listItems = entries.map(function (entry, i) { const active = (entry.id === activeEntry) return $$(CommentBox, { active: active, - comments: self.props.comments[entry.id] || { data: [] }, + comments: comments[entry.id] || { data: [] }, entry: entry, parent: self, - user: self.props.user + user: user }) }) @@ -115,6 +116,7 @@ class CommentBoxList extends Component { // if active, move as many boxes above as needed to bring it to the annotation's height if (isActive) { + console.log('isActive', isActive) entry.endHeight = annotationTop + boxHeight + 2 result[pos] = annotationTop diff --git a/app/components/SimpleEditor/panes/Comments/CommentsProvider.js b/app/components/SimpleEditor/panes/Comments/CommentsProvider.js index 10c5be7e869c0db35e80156fcc5ac20e985caf5b..dc053729dda2b6bd0923b1853ffd29d157d47b0b 100644 --- a/app/components/SimpleEditor/panes/Comments/CommentsProvider.js +++ b/app/components/SimpleEditor/panes/Comments/CommentsProvider.js @@ -7,7 +7,7 @@ class CommentsProvider extends TocProvider { super(document, props) this.activeEntry = null const editorSession = props.editorSession - editorSession.onUpdate('document', this.updateActiveEntry, this) + editorSession.onUpdate('', this.updateActiveEntry, this) const doc = editorSession.getDocument() doc.on('document:changed', this.update, this) @@ -252,11 +252,11 @@ class CommentsProvider extends TocProvider { const comments = this.getSelectionComments() if (comments.length === 0) return - const minComment = _.minBy(comments, 'startOffset') - const maxComment = _.maxBy(comments, 'endOffset') + const minComment = _.minBy(comments, 'start.offset') + const maxComment = _.maxBy(comments, 'end.offset') - const min = minComment.startOffset - const max = maxComment.endOffset + const min = minComment.start.offset + const max = maxComment.end.offset return { start: min, @@ -281,8 +281,8 @@ class CommentsProvider extends TocProvider { const selection = this.getSelection() if ( - selection.startOffset < commentBorders.start || - selection.endOffset > commentBorders.end + selection.start.offset < commentBorders.start || + selection.end.offset > commentBorders.end ) return true return false @@ -376,7 +376,7 @@ class CommentsProvider extends TocProvider { comments = _.map(comments, function (comment) { const blockId = comment.path[0] const blockPosition = container.getPosition(blockId) - const nodePosition = comment.startOffset + const nodePosition = comment.start.offset return { id: comment.id,