'use strict'; oml.ui.annotation = function(data, $iframe) { var $quote = Ox.Element().addClass('OxSelectable OMLQuote').css({ color: 'black', fontFamily: 'Georgia, Palatino, DejaVu Serif, Book Antiqua, Palatino Linotype, Times New Roman, serif', fontSize: '14px', lineHeight: '21px', padding: '8px' }).html(Ox.encodeHTMLEntities(data.text).replace(/\n/g, '
')).on({ click: function(event) { that.select() $iframe.postMessage('selectAnnotation', { id: data.id }) } }) var $note = Ox.Editable({ editing: true, type: 'textarea' }).css({ margin: '2px', minHeight: '12px' }); var that = Ox.Element().attr({ id: 'a-' + data.id }).addClass( 'OxSelectable OMLAnnotation' ).css({ borderBottom: '1px solid rgb(208, 208, 208)', }).append($quote).append($note); that.annotate = function() { var item = { id: 'note', value: '', editable: true } } that.deselect = function() { that.removeClass('selected') } that.select = function () { let selected = document.querySelector('.OMLAnnotation.selected') selected && selected.classList.remove('selected') that.addClass('selected') } return that; };