Compare commits

..

4 commits

Author SHA1 Message Date
rlx
760494dd6d merge 2019-01-29 16:12:46 +05:30
rlx
aa2b1b1fee include css 2019-01-25 15:57:01 +05:30
rlx
059e25a000 update annotation & panel 2019-01-25 15:56:45 +05:30
rlx
abc53d2d06 add oml.css 2019-01-25 15:23:31 +05:30
4 changed files with 51 additions and 23 deletions

7
static/css/oml.css Normal file
View file

@ -0,0 +1,7 @@
.OMLQuote {
background-color: rgb(255, 255, 255);
}
.OMLAnnotation.selected .OMLQuote {
background-color: rgb(128, 192, 255);
}

View file

@ -4,6 +4,7 @@
<title>Open Media Library</title>
<meta charset="UTF-8"/>
<link href="/static/png/oml.png" rel="icon" type="image/png">
<link href="/static/css/oml.css" rel="stylesheet" type="text/css">
<script src="/static/js/oml.js?1" type="text/javascript"></script>
<meta name="google" value="notranslate"/>
</head>

View file

@ -1,7 +1,22 @@
'use strict';
oml.ui.annotation = function(annotation, $iframe) {
var $arrayEditable = Ox.ArrayEditable({
var $quote = Ox.Element().addClass('OxSelectable OMLQuote').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(annotation.text).replace(/\n/g, '<br/>')).on({
click: function(event) {
that.select()
$iframe.postMessage('selectAnnotation', {
id: annotation.id
})
}
})
var $note = Ox.ArrayEditable({
editing: true,
items: (annotation.comments || []).map(function(comment) {
comment.editable = true
@ -9,7 +24,8 @@ oml.ui.annotation = function(annotation, $iframe) {
}),
type: 'textarea'
}).css({
minHeight: '16px'
margin: '2px',
minHeight: '12px'
}).bindEvent({
submit: function(data) {
var comment = Ox.getObjectById(annotation.comments, data.id)
@ -30,32 +46,23 @@ oml.ui.annotation = function(annotation, $iframe) {
var that = Ox.Element().attr({
id: 'a-' + annotation.id
}).addClass(
'OxSelectable'
'OxSelectable OMLAnnotation'
).css({
borderBottom: '1px solid rgb(208, 208, 208)',
}).append(
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(annotation.text).replace(/\n/g, '<br/>')).on({
click: function(event) {
$iframe.postMessage('selectAnnotation', {
id: annotation.id
})
}
})
).append($arrayEditable);
}).append($quote).append($note);
that.annotate = function() {
var item = {
id: 'note', value: '', editable: true
}
$arrayEditable.addItem(0, item)
.options({selected: item.id})
.editItem();
}
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;
};

View file

@ -8,18 +8,31 @@ oml.ui.annotationPanel = function() {
disabled: true,
style: 'symbol',
title: 'add',
tooltip: Ox._('Add Quote'),
type: 'image'
}).appendTo($bar);
var $menuButton = Ox.MenuButton({
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',
title: 'set',
type: 'image',
width: 16
}).css({
// borderColor: 'transparent',
float: 'right'
}).appendTo($bar);