fix enter event
This commit is contained in:
parent
dad9b53b54
commit
131a6a3215
1 changed files with 10 additions and 8 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue