Skip to content
Snippets Groups Projects
Commit 7507309e authored by chris's avatar chris Committed by Yannis Barlas
Browse files

rerender comments on change

parent 6eaa5775
No related branches found
No related tags found
No related merge requests found
......@@ -43,16 +43,11 @@ class Editor extends ProseEditor {
willUpdateState () {}
didMount () {
this.editorSession.onRender('document', this.editorContentUpdated, this)
// this.documentSession.on('didUpdate', this.documentSessionUpdated, this)
// this.documentSession.on('fileUploadTrigger', this.handleUpload, this)
this.extendState({ editorReady: true })
}
editorContentUpdated () {
this.emit('ui:updated')
}
handleUpload (file, callback) {
const { fileUpload } = this.props
......
......@@ -4,6 +4,8 @@ class CommentComponent extends AnnotationComponent {
constructor (parent, props) {
super(parent, props)
this.active = props.node.active
// this.context.editorSession.onUpdate('', this.rerender, this)
}
render ($$) {
......@@ -39,6 +41,7 @@ class CommentComponent extends AnnotationComponent {
// put here all conditions for the node to change
hasNodeChanged () {
const { node } = this.props
console.log(node)
if (this.active !== node.active) return true
return false
}
......
import _ from 'lodash'
import { createAnnotation, TOCProvider as TocProvider } from 'substance'
import { TOCProvider as TocProvider } from 'substance'
class CommentsProvider extends TocProvider {
// TODO -- works if I rename to doc
......@@ -9,15 +9,13 @@ class CommentsProvider extends TocProvider {
const editorSession = props.editorSession
editorSession.onUpdate('', this.updateActiveEntry, this)
editorSession.onRender('document', this.update, this)
// TODO is this needed?
// TODO is this needed anymore?
// const doc = editorSession.getDocument()
// doc.on('document:changed', this.update, this)
const editor = props.controller
editor.on('ui:updated', this.onUiUpdate, this)
// const editor = props.controller
// editor.on('ui:updated', this.onUiUpdate, this)
}
//
......
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