fix enter event

This commit is contained in:
j 2019-02-09 23:40:14 +05:30
parent dad9b53b54
commit 131a6a3215

View file

@ -47,6 +47,7 @@ window.addEventListener('keydown', function(event) {
removeAnnotation(selected.dataset.id)
}
} else if (event.key == 'n' || event.keyCode == 13) {
if (event.target.nodeName != 'INPUT') {
var selected = document.querySelector('.oml-annotation.selected')
if (!window.getSelection().isCollapsed) {
createAnnotation()
@ -56,6 +57,7 @@ window.addEventListener('keydown', function(event) {
event.stopPropagation()
event.preventDefault()
}
}
})
window.addEventListener('mouseup', function(event) {
var selection = window.getSelection()
@ -91,7 +93,7 @@ function getHighlight() {
viewport.convertToPdfPoint(r.right - pageRect.x, r.bottom - pageRect.y));
});
var text = selection.toString();
var position = [pageNumber].concat(Ox.sort(selected.coords.map(function(c) { return [c[1], c[0]]}))[0]);
var position = [pageNumber].concat(Ox.sort(selected.map(function(c) { return [c[1], c[0]]}))[0]);
return {
page: pageNumber,
position: position,