diff --git a/static/js/annotation.js b/static/js/annotation.js index bf69252..64d42de 100644 --- a/static/js/annotation.js +++ b/static/js/annotation.js @@ -14,21 +14,28 @@ oml.ui.annotation = function(annotation, $iframe) { var notes = annotation.notes.length ? annotation.notes.map(function(note) { note.editable = !note.user return note - }) : [{ - id: 'A', - placeholder: 'Add Note', - value: '', - editable: true - }]; + }) : [] console.log(annotation.notes) - var $note = Ox.ArrayEditable({ + var $notes = Ox.ArrayEditable({ editing: true, items: notes, + placeholder: 'Add note', type: 'textarea' }).css({ margin: '2px', minHeight: '12px' }).bindEvent({ + doubleclick: function(data) { + if (!$notes.options('items').length) { + $notes.addItem(0, { + id: 'A', + value: '', + editable: true + }).options({ + selected: 'A' + }).editItem() + } + }, submit: function(data) { var note = Ox.getObjectById(annotation.notes, data.id) if (note) { @@ -58,7 +65,7 @@ oml.ui.annotation = function(annotation, $iframe) { id: annotation.id }) } - }).append($quote).append($note); + }).append($quote).append($notes); that.annotate = function() { var item = {