diff --git a/app/components/SimpleEditor/elements/note/NoteCommand.js b/app/components/SimpleEditor/elements/note/NoteCommand.js index 617ff10147aca81cb1ebaab896bd30041c3279f4..88f7bd9bbd9232ee0f266078212f737f1c5ae3b3 100644 --- a/app/components/SimpleEditor/elements/note/NoteCommand.js +++ b/app/components/SimpleEditor/elements/note/NoteCommand.js @@ -2,57 +2,38 @@ import { InsertInlineNodeCommand, documentHelpers } from 'substance' class NoteCommand extends InsertInlineNodeCommand { createNodeData () { - // console.log('hello from create Node Data') return { type: 'note' } } execute (params) { - // console.log('params in execute', params) let editorSession = params.editorSession let nodeData = this.createNodeData() - - // let newNote = {} + editorSession.transaction((tx) => { return tx.insertInlineNode(nodeData) }) + let selection = editorSession.getSelection() let selectionBefore = selection._clone() selectionBefore.start.offset -= 1 let note = this.getCreatedNote(selectionBefore, editorSession) const notesProvider = this.getNotesProvider(params) notesProvider.createIsolatedNote(note) - - // console.log('before', selectionBefore.getNodeId()) - // editorSession.setSelection(selectionBefore) - - // console.log('newNote', newNote) - // console.log('selection', editorSession.getSelection()) - // console.log('params in execute after', params) } getCreatedNote (selection, editorSession) { - // console.log('this', this) - // const session = this.context.editorSession const note = documentHelpers.getPropertyAnnotationsForSelection( editorSession.getDocument(), selection, { type: 'note' } ) return note[0] - // console.log('note', note) } getNotesProvider (params) { - console.log('params', params) return params.surface.context.notesProvider } - - - // getCommandState (params) { - // console.log('params in getCommandState', params) - // return commandState - // } } NoteCommand.type = 'note' diff --git a/app/components/SimpleEditor/elements/note/NoteComponent.js b/app/components/SimpleEditor/elements/note/NoteComponent.js index 4b188e9681648c427d560db2cd2494c553637664..6fd0b8e3a3485c2b110e2dc3385534638ee5721b 100644 --- a/app/components/SimpleEditor/elements/note/NoteComponent.js +++ b/app/components/SimpleEditor/elements/note/NoteComponent.js @@ -20,7 +20,6 @@ class NoteComponent extends Component { showNote () { const selected = this.getSelection() if (!selected.node) return - console.log('in note component', selected.node) const provider = this.getProvider() this.disableTools(selected) provider.showNote(selected.node) diff --git a/app/components/SimpleEditor/miniEditor/config.js b/app/components/SimpleEditor/miniEditor/config.js index 94b702f6d41b21d1c8e9cc317f00a632035e1dce..9db582758811096a8458837ab1a6d37ac05ab48d 100644 --- a/app/components/SimpleEditor/miniEditor/config.js +++ b/app/components/SimpleEditor/miniEditor/config.js @@ -31,7 +31,8 @@ let config = { config.import(SpellCheckPackage) config.import(CommentPackage) config.import(IsolatedNote) - config.import(PersistencePackage) + // config.import(PersistencePackage) + config.import(TrackChangePackage) } } diff --git a/app/components/SimpleEditor/panes/Notes/Notes.js b/app/components/SimpleEditor/panes/Notes/Notes.js index 6f38008eefb8a636bff5ed4df0b0ea54ba453720..a9ecff77debcb266d340fc72d5180a602d1184e2 100644 --- a/app/components/SimpleEditor/panes/Notes/Notes.js +++ b/app/components/SimpleEditor/panes/Notes/Notes.js @@ -25,7 +25,7 @@ class Notes extends Component { provider.createIsolatedNote(notes.main[i]) } - // provider.config.miniEditorSession.onUpdate('document', this.saveNotes, this) + provider.config.miniEditorSession.onUpdate('document', this.saveNotes, this) } initResize (e) { @@ -97,7 +97,6 @@ class Notes extends Component { forEach(notes.main, function (mainNote) { forEach(notes.mini, function (miniNote) { if (miniNote.parentNoteId === mainNote.id) { - console.log('miniNote', miniNote) self.context.editorSession.transaction(function (tx, args) { const path = [mainNote.id, 'note-content'] tx.set(path, miniNote.content) diff --git a/app/components/SimpleEditor/panes/Notes/NotesProvider.js b/app/components/SimpleEditor/panes/Notes/NotesProvider.js index e643654ff9ada19ff768132e7f3ad8cd0e4b5756..19b693bde58e999149850278af8c7a1dd4ad1aca 100644 --- a/app/components/SimpleEditor/panes/Notes/NotesProvider.js +++ b/app/components/SimpleEditor/panes/Notes/NotesProvider.js @@ -82,11 +82,9 @@ class NotesProvider extends TOCProvider { } showNote (note) { - console.log('start') const notes = this.computeEntries() const miniNote = _.find(notes.mini, ['parentNoteId', note.id]) - console.log('miniNote', miniNote) - this.config.miniEditorContext.editor.emit('noteSelected', miniNote.id) + if (miniNote) this.config.miniEditorContext.editor.emit('noteSelected', miniNote.id) } createNodeData (note) {