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

comments work in miniEditor

parent 5ba2416e
No related branches found
No related tags found
No related merge requests found
......@@ -32,10 +32,9 @@ class MiniEditor extends ProseEditor {
// TEMP
// const commentsPane = $$('ul').addClass('sc-comment-pane-list').addClass('sc-comments-pane').append('notes Editor Comments')
var commentsPane = $$(Comments, {
// TODO -- should probably remove the || {}
// comments: this.props.fragment.comments || {},
comments: this.props.comments || {},
fragment: this.props.fragment,
update: this.props.update,
user: this.props.user
......@@ -77,7 +76,10 @@ class MiniEditor extends ProseEditor {
return $$(ContainerEditor, {
editorSession: this.editorSession,
containerId: 'body',
spellcheck: 'native'
spellcheck: 'native',
user: this.props.user,
comments: this.props.comments,
fragment: this.props.fragment
}).ref('mini_body')
}
......
......@@ -101,6 +101,7 @@ class CommentBox extends Component {
const comments = this.props.comments
const id = this.props.entry.id
const provider = this.getProvider()
console.log('this props', this.props)
const user = this.props.user.username
let textarea = this.refs.commentReply
......
......@@ -41,8 +41,16 @@ class Notes extends Component {
const el = $$('div')
.addClass('notes-container').append(resizer)
const comments = this.getComments()
const fragment = this.getFragment()
const user = this.getUser()
const update = this.getUpdate()
el.append($$(MiniEditor, {
editorSession: miniEditorSession
editorSession: miniEditorSession,
comments: comments,
fragment: fragment,
user: user,
update: update
}))
resizer.addEventListener('mousedown', this.initResize, false)
......@@ -58,13 +66,13 @@ class Notes extends Component {
const provider = this.getProvider()
const notes = provider.computeEntries()
let nontesContent = ''
let notesContent = ''
for (var i = 0; i < notes.length; i++) {
nontesContent += notes[i].content
notesContent += notes[i].content
}
const doc = importer.importDocument(nontesContent)
const doc = importer.importDocument(notesContent)
const editorSession = new EditorSession(doc, {
configurator: configurator
......@@ -77,6 +85,22 @@ class Notes extends Component {
return this.context.notesProvider
}
getComments () {
return this.context.commentsProvider.config.comments
}
getUser () {
return this.context.editor.props.user
}
getFragment () {
return this.context.editor.props.fragment
}
getUpdate () {
return this.context.editor.props.update
}
onNotesUpdated (change) {
const notesProvider = this.getProvider()
notesProvider.handleDocumentChange(change)
......
......@@ -10,7 +10,7 @@ class NotesProvider extends TOCProvider {
const docMini = this.config.miniEditorSession.document
let nodesMini = ''
if (docMini) nodesMini = docMini.getNodes()
if(docMini)console.log('paragraphs', nodesMini)
// if(docMini)console.log('paragraphs', nodesMini)
// get all notes from the document
const notesMain = _.pickBy(nodesMain, function (value, key) {
return value.type === 'note'
......@@ -21,7 +21,7 @@ class NotesProvider extends TOCProvider {
const entries = this.sortNodes(notesMain)
const entriesMini = this.sortNodesMini(notesMini)
console.log(entries, entriesMini)
// console.log(entries, entriesMini)
return entries
}
......@@ -58,7 +58,7 @@ class NotesProvider extends TOCProvider {
const doc = this.config.miniEditorSession.document
const container = doc.get('body')
console.log(notes)
// console.log(notes)
notes = _.map(notes, function (note) {
// const blockId = note.path[0]
// const blockPosition = container.getPosition(blockId)
......
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