Skip to content
Snippets Groups Projects
Commit 3c8aa0ff authored by chris's avatar chris Committed by john
Browse files

Comments are saved in the isolated note

parent 6975abe0
No related branches found
No related tags found
No related merge requests found
......@@ -10,7 +10,7 @@ class CommentComponent extends AnnotationComponent {
const { node } = this.props
const active = node.active
var el = $$('span')
var el = $$('comment')
.attr('data-id', this.props.node.id)
.addClass(this.getClassNames())
......
......@@ -17,13 +17,6 @@ class Notes extends Component {
didMount () {
const provider = this.getProvider()
this.context.editorSession.onUpdate('document', this.onNotesUpdated, this)
const notes = provider.computeEntries()
for (var i = 0; i < notes.main.length; i++) {
provider.createIsolatedNote(notes.main[i])
}
provider.config.miniEditorSession.onUpdate('document', this.saveNotes, this)
}
......@@ -78,7 +71,16 @@ class Notes extends Component {
const importer = configurator.createImporter('html')
const doc = importer.importDocument('')
const provider = this.getProvider()
const notes = provider.computeEntries()
let noteContent = ''
for (var i = 0; i < notes.main.length; i++) {
noteContent += notes.main[i]['note-content']
}
const doc = importer.importDocument(noteContent)
const editorSession = new EditorSession(doc, {
configurator: configurator
......
......@@ -62,23 +62,17 @@ class NotesProvider extends TOCProvider {
let notes = _.clone(nodes)
if (this.config.miniEditorSession === '') return
// const doc = this.config.miniEditorSession.document
notes = _.map(notes, function (note) {
// const blockId = note.path[0]
// const blockPosition = container.getPosition(blockId)
// const nodePosition = note.start.offset
const element = document.querySelector('p[data-path="' + note.id + '.content"]')
const noteContent = '<isolated-note data-id="' + note.id + '" data-type="isolated-note">' + element.innerHTML + '</isolated-note>'
return {
id: note.id,
content: note.content,
content: noteContent,
parentNoteId: note.parentNoteId
// blockPosition: blockPosition,
// nodePosition: nodePosition,
// node: note
}
})
return notes
// return _.sortBy(notes, ['blockPosition', 'nodePosition'])
}
showNote (note) {
......
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