diff --git a/app/components/SimpleEditor/elements/comment/CommentComponent.js b/app/components/SimpleEditor/elements/comment/CommentComponent.js index ebae78e94c8918e1c2f9413789f8a677c07d5277..93a16e095446b4815d995ed958751e546ba67a33 100644 --- a/app/components/SimpleEditor/elements/comment/CommentComponent.js +++ b/app/components/SimpleEditor/elements/comment/CommentComponent.js @@ -10,7 +10,7 @@ class CommentComponent extends AnnotationComponent { const { node } = this.props const active = node.active - var el = $$('comment') + var el = $$('span') .attr('data-id', this.props.node.id) .addClass(this.getClassNames()) diff --git a/app/components/SimpleEditor/elements/isolatedNote/IsolatedNoteHTMLConverter.js b/app/components/SimpleEditor/elements/isolatedNote/IsolatedNoteHTMLConverter.js index 3f093589c64ed44d4731f6cb628ad1f56e026150..590f37d0b350d01d884d4c9103228cb53fa01ae4 100644 --- a/app/components/SimpleEditor/elements/isolatedNote/IsolatedNoteHTMLConverter.js +++ b/app/components/SimpleEditor/elements/isolatedNote/IsolatedNoteHTMLConverter.js @@ -3,7 +3,7 @@ export default { tagName: 'isolated-note', import: function (el, node, converter) { + console.log('imported nodes', node) node.content = converter.annotatedText(el, [node.id, 'content']) - node.parentNoteId = el.attr('parent-id') } } diff --git a/app/components/SimpleEditor/elements/track_change/TrackChangeComponent.js b/app/components/SimpleEditor/elements/track_change/TrackChangeComponent.js index 13053847f1f69e5f26ce68f3e9ab6db6473f4faa..4ec60e75a7010fb4e67ee75c6400968441868949 100644 --- a/app/components/SimpleEditor/elements/track_change/TrackChangeComponent.js +++ b/app/components/SimpleEditor/elements/track_change/TrackChangeComponent.js @@ -33,17 +33,9 @@ class TrackChangeComponent extends AnnotationComponent { container.addClass('sc-accept-reject-container-hide') } - // roles, status,username,user-id only exist because - // on the second editor we do not have an exporter but everything is pushed to - // the note-content property of the callout. So cause we use olny the importer - // those attr did not exist - let el = $$('track-change') + let el = $$('span') .attr('data-id', id) .attr('title', user.username) - .attr('roles', user.roles[0]) - .attr('status', status) - .attr('username', user.username) - .attr('user-id', user.id) .addClass(this.getClassNames()) .append(this.props.children) diff --git a/app/components/SimpleEditor/panes/Notes/Notes.js b/app/components/SimpleEditor/panes/Notes/Notes.js index 2bd2fc51b151812f96594fee85ffd85becdba213..829a4f6094e867b6f686ed154c2d78850242b3e1 100644 --- a/app/components/SimpleEditor/panes/Notes/Notes.js +++ b/app/components/SimpleEditor/panes/Notes/Notes.js @@ -3,6 +3,7 @@ import { Component, EditorSession, import MiniEditor from '../../miniEditor/miniEditor' import config from '../../miniEditor/config' import Importer from '../../miniEditor/MiniEditorImporter' +import SimpleExporter from '../../SimpleEditorExporter' import {forEach} from 'lodash' class Notes extends Component { @@ -67,7 +68,6 @@ class Notes extends Component { _initMiniEditor () { const configurator = new Configurator().import(config) configurator.addImporter('html', Importer) - const importer = configurator.createImporter('html') const provider = this.getProvider() @@ -97,13 +97,19 @@ class Notes extends Component { // so we rerender the Surface surface.rerender() const notes = provider.computeEntries() + const configurator = new Configurator().import(config) + const exporter = new SimpleExporter(configurator.config) forEach(notes.main, function (mainNote) { forEach(notes.mini, function (miniNote) { if (miniNote.parentNoteId === mainNote.id) { + console.log(exporter.createElement(miniNote)) + // console.log(exportedNode) + // const exportedNode = exporter.convertNode(miniNote) + // console.log('sdlkfjslfkjsfdlkj', exporter.annotatedText(exportedNode.getTextPath())) this.context.editorSession.transaction(function (tx, args) { const path = [mainNote.id, 'note-content'] - tx.set(path, miniNote.content) + tx.set(path, 'exportedNode.outerHTML') }) } }.bind(this)) diff --git a/app/components/SimpleEditor/panes/Notes/NotesProvider.js b/app/components/SimpleEditor/panes/Notes/NotesProvider.js index 5cb58dff524417776865a2f8b5ffcc88f7b24226..7f04639f470822d3f0cc7ddd3aec434fb6cf1d7e 100644 --- a/app/components/SimpleEditor/panes/Notes/NotesProvider.js +++ b/app/components/SimpleEditor/panes/Notes/NotesProvider.js @@ -69,14 +69,15 @@ class NotesProvider extends TOCProvider { let rootEl = this.config.miniEditorContext.editor.el notes = _.map(notes, function (note) { + console.log('noteeee', note) const element = Component.unwrap(rootEl.find('p[data-path="' + note.id + '.content"]')) // removes a <br> insterted at the end by inline node - const text = element.innerHTML.slice(0, -4) - let noteContent = '<isolated-note data-id="' + note.id + '" parent-id="' + note.parentNoteId + '" data-type="isolated-note">' + text + '</isolated-note>' + // const text = element.innerHTML.slice(0, -4) + // let noteContent = '<isolated-note data-id="' + note.id + '" parent-id="' + note.parentNoteId + '" data-type="isolated-note">' + text + '</isolated-note>' return { id: note.id, - content: noteContent, + content: element.innerHTML, parentNoteId: note.parentNoteId } })