Skip to content
Snippets Groups Projects
Commit c6e5c1ff authored by Yannis Barlas's avatar Yannis Barlas Committed by john
Browse files

mark todos for note component

parent 7d693c6d
No related branches found
No related tags found
No related merge requests found
......@@ -7,15 +7,14 @@ class NoteComponent extends Component {
didMount () {
// TODO -- this disables the toolbar
// TODO -- unload listener on dispose
// TODO -- this gets registered once for each note -- fix
// TODO -- this gets registered once for each note -- to fix use didUpdate
// this should only call disableTools
this.context.editorSession.onUpdate('', this.noteSelected, this)
}
render ($$) {
const noteContent = this.props.node['note-content']
// TODO -- why note???
// const el = $$('note')
const el = $$('span')
.attr('note-content', noteContent)
.addClass('sc-note')
......@@ -26,9 +25,13 @@ class NoteComponent extends Component {
// TODO -- should this maybe be the provider's job?
noteSelected () {
// TODO -- we already have the note id in the props
const selected = this.getSelection()
if (get(selected, 'node.type') !== 'note') return
// this shouldn't be here
// it should just be called when the selection updates
// not on click of the note component
this.disableTools(selected)
const provider = this.getProvider()
......@@ -41,11 +44,14 @@ class NoteComponent extends Component {
disableTools () {
const commandStates = this.getCommandStates()
// TODO -- this uses the same code as the fn in container editor
// use the fn from there
each(keys(commandStates), (key) => {
const allowed = ['comment', 'redo', 'save', 'switch-text-type', 'undo', 'note']
const allowed = ['comment', 'redo', 'save', 'switch-text-type', 'undo']
if (!includes(allowed, key)) commandStates[key].disabled = true
})
// TODO -- do we need the rerender here??
this.rerender()
}
......@@ -62,6 +68,8 @@ class NoteComponent extends Component {
sel,
{ type: 'note' }
)
// TODO -- scrap all below
const note = notes[0]
let show = false
if (typeof note !== 'undefined') {
......
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