Skip to content
Snippets Groups Projects
Commit a9786e13 authored by Alexandros Georgantas's avatar Alexandros Georgantas Committed by Yannis Barlas
Browse files

Live update functionality of track changes fixed

parent b402e004
No related branches found
No related tags found
No related merge requests found
import { AnnotationComponent } from 'substance'
class TrackChangeComponent extends AnnotationComponent {
didMount () {
this.context.editorSession.onUpdate('document', this.onTrackChangesUpdated, this)
}
render ($$) {
const { id, status, user } = this.props.node
const canAct = this.canAct()
......@@ -64,7 +69,6 @@ class TrackChangeComponent extends AnnotationComponent {
resolve (action) {
const annotation = this.props.node
const provider = this.getProvider()
console.log('provider', provider)
provider.resolve(annotation, action)
}
......@@ -88,7 +92,6 @@ class TrackChangeComponent extends AnnotationComponent {
const annotation = this.props.node
const annotationSelection = annotation.getSelection()
console.log('context', this.context)
const surface = this.context.surface
const selection = surface.editorSession.getSelection()
......@@ -101,6 +104,12 @@ class TrackChangeComponent extends AnnotationComponent {
if (overlaps && !contains) return true
return false
}
onTrackChangesUpdated (change) {
const trackChangesProvider = this.getProvider()
trackChangesProvider.handleDocumentChange(change)
this.rerender()
}
}
export default TrackChangeComponent
......@@ -25,9 +25,6 @@ class TrackChangesProvider extends TOCProvider {
constructor (document, config) {
super(document, config)
// config.documentSession.on('didUpdate', this.handleUndoRedo, this)
console.log('this track provider', this)
// HACK -- use TOCProvider's event to capture new / deleted changes
this.on('toc:updated', this.reComputeEntries, this)
// handle button actions
const editor = this.config.controller
......@@ -553,8 +550,6 @@ class TrackChangesProvider extends TOCProvider {
const selection = annotation.getSelection()
const status = annotation.status
console.log('resolve', this)
this.removeTrackAnnotation(annotation)
if (
......@@ -576,7 +571,6 @@ class TrackChangesProvider extends TOCProvider {
})
const entries = this.sortNodes(changes)
console.log('entries', entries)
return entries
}
......
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