From e5559a112daedf2e15cdb62a71c0a28d3c9fe40b Mon Sep 17 00:00:00 2001
From: Alexandros Georgantas <alexgeorg86@gmail.com>
Date: Tue, 25 Apr 2017 15:08:57 +0300
Subject: [PATCH] Track changes view toggle in notes editor fixed

---
 .../elements/track_change/TrackChangeComponent.js         | 1 -
 app/components/SimpleEditor/notesEditor/NotesEditor.js    | 7 +++++++
 app/components/SimpleEditor/panes/Notes/Notes.js          | 8 +++++++-
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/app/components/SimpleEditor/elements/track_change/TrackChangeComponent.js b/app/components/SimpleEditor/elements/track_change/TrackChangeComponent.js
index 4ec60e7..2abef42 100644
--- a/app/components/SimpleEditor/elements/track_change/TrackChangeComponent.js
+++ b/app/components/SimpleEditor/elements/track_change/TrackChangeComponent.js
@@ -44,7 +44,6 @@ class TrackChangeComponent extends AnnotationComponent {
     el.addClass('sc-track-change-' + status)
 
     if (viewMode === false) {
-      console.log('status', status)
       if (status === 'delete') el.addClass('sc-track-delete-hide')
       if (status === 'add') el.addClass('sc-track-add-show')
     }
diff --git a/app/components/SimpleEditor/notesEditor/NotesEditor.js b/app/components/SimpleEditor/notesEditor/NotesEditor.js
index bc979a3..d7dab2e 100644
--- a/app/components/SimpleEditor/notesEditor/NotesEditor.js
+++ b/app/components/SimpleEditor/notesEditor/NotesEditor.js
@@ -21,6 +21,12 @@ class NotesEditor extends ProseEditor {
     this.on('notes:deleted', this.removeNote, this)
   }
 
+  getInitialState () {
+    return {
+      trackChangesView: this.props.trackChangesView
+    }
+  }
+
   render ($$) {
     const el = $$('div').addClass('sc-notes-editor')
     let toolbar = this._renderNotesToolbar($$)
@@ -80,6 +86,7 @@ class NotesEditor extends ProseEditor {
       fragment: this.props.fragment,
       spellcheck: 'native',
       trackChanges: this.props.trackChanges,
+      trackChangesView: this.props.trackChangesView,
       user: this.props.user
     }).ref('notes_body')
   }
diff --git a/app/components/SimpleEditor/panes/Notes/Notes.js b/app/components/SimpleEditor/panes/Notes/Notes.js
index 7acbdd5..baf2b43 100644
--- a/app/components/SimpleEditor/panes/Notes/Notes.js
+++ b/app/components/SimpleEditor/panes/Notes/Notes.js
@@ -37,6 +37,7 @@ class Notes extends Component {
       disabled: notesEditorProps.disabled,
       fragment: notesEditorProps.fragment,
       trackChanges: notesEditorProps.trackChanges,
+      trackChangesView: notesEditorProps.trackChangesView,
       update: notesEditorProps.update,
       user: notesEditorProps.user
     }))
@@ -123,6 +124,10 @@ class Notes extends Component {
   getParentProps () {
     const editor = this.context.editor
     const commentsProvider = this.context.commentsProvider
+    let trackChangesView = ''
+    if (editor.refs.toolbar) {
+      trackChangesView = editor.refs.toolbar.props.trackChangesView
+    }
 
     return {
       comments: commentsProvider.config.comments,
@@ -132,7 +137,8 @@ class Notes extends Component {
       history: editor.props.history,
       trackChanges: editor.props.trackChanges,
       update: editor.props.update,
-      user: editor.props.user
+      user: editor.props.user,
+      trackChangesView: trackChangesView
     }
   }
 
-- 
GitLab