update annotation & panel
This commit is contained in:
parent
abc53d2d06
commit
059e25a000
2 changed files with 41 additions and 23 deletions
|
@ -1,41 +1,46 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
oml.ui.annotation = function(data, $iframe) {
|
oml.ui.annotation = function(data, $iframe) {
|
||||||
var $arrayEditable = Ox.ArrayEditable({
|
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, '<br/>')).on({
|
||||||
|
click: function(event) {
|
||||||
|
that.select()
|
||||||
|
$iframe.postMessage('selectAnnotation', {
|
||||||
|
id: data.id
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
var $note = Ox.Editable({
|
||||||
editing: true,
|
editing: true,
|
||||||
type: 'textarea'
|
type: 'textarea'
|
||||||
}).css({
|
}).css({
|
||||||
minHeight: '16px'
|
margin: '2px',
|
||||||
|
minHeight: '12px'
|
||||||
});
|
});
|
||||||
var that = Ox.Element().attr({
|
var that = Ox.Element().attr({
|
||||||
id: 'a-' + data.id
|
id: 'a-' + data.id
|
||||||
}).addClass(
|
}).addClass(
|
||||||
'OxSelectable'
|
'OxSelectable OMLAnnotation'
|
||||||
).css({
|
).css({
|
||||||
borderBottom: '1px solid rgb(208, 208, 208)',
|
borderBottom: '1px solid rgb(208, 208, 208)',
|
||||||
}).append(
|
}).append($quote).append($note);
|
||||||
Ox.Element().addClass('OxSelectable').css({
|
|
||||||
backgroundColor: 'white',
|
|
||||||
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, '<br/>')).on({
|
|
||||||
click: function(event) {
|
|
||||||
$iframe.postMessage('selectAnnotation', {
|
|
||||||
id: data.id
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
).append($arrayEditable);
|
|
||||||
that.annotate = function() {
|
that.annotate = function() {
|
||||||
var item = {
|
var item = {
|
||||||
id: 'note', value: '', editable: true
|
id: 'note', value: '', editable: true
|
||||||
}
|
}
|
||||||
$arrayEditable.addItem(0, item)
|
}
|
||||||
.options({selected: item.id})
|
that.deselect = function() {
|
||||||
.editItem();
|
that.removeClass('selected')
|
||||||
|
}
|
||||||
|
that.select = function () {
|
||||||
|
let selected = document.querySelector('.OMLAnnotation.selected')
|
||||||
|
selected && selected.classList.remove('selected')
|
||||||
|
that.addClass('selected')
|
||||||
}
|
}
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,18 +8,31 @@ oml.ui.annotationPanel = function() {
|
||||||
disabled: true,
|
disabled: true,
|
||||||
style: 'symbol',
|
style: 'symbol',
|
||||||
title: 'add',
|
title: 'add',
|
||||||
|
tooltip: Ox._('Add Quote'),
|
||||||
type: 'image'
|
type: 'image'
|
||||||
}).appendTo($bar);
|
}).appendTo($bar);
|
||||||
|
|
||||||
var $menuButton = Ox.MenuButton({
|
var $menuButton = Ox.MenuButton({
|
||||||
items: [
|
items: [
|
||||||
{id: 'sortAnnotations', title: 'Sort Annotations', disabled: true}
|
{id: 'showAnnotations', title: Ox._('Show Annotations'), disabled: true},
|
||||||
|
{group: 'sort', min: 1, max: 1, items: [
|
||||||
|
{id: 'all', title: Ox._('All Annotations'), checked: true},
|
||||||
|
{id: 'my', title: Ox._('My Annotations'), checked: false},
|
||||||
|
]},
|
||||||
|
{},
|
||||||
|
{id: 'sortAnnotations', title: Ox._('Sort Annotations'), disabled: true},
|
||||||
|
{group: 'sort', min: 1, max: 1, items: [
|
||||||
|
{id: 'position', title: Ox._('By Position'), checked: true},
|
||||||
|
{id: 'text', title: Ox._('By Note Text'), checked: false},
|
||||||
|
{id: 'date', title: Ox._('By Date Added'), checked: false}
|
||||||
|
]},
|
||||||
],
|
],
|
||||||
style: 'square',
|
style: 'square',
|
||||||
title: 'set',
|
title: 'set',
|
||||||
type: 'image',
|
type: 'image',
|
||||||
width: 16
|
width: 16
|
||||||
}).css({
|
}).css({
|
||||||
|
// borderColor: 'transparent',
|
||||||
float: 'right'
|
float: 'right'
|
||||||
}).appendTo($bar);
|
}).appendTo($bar);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue