fix enter event
This commit is contained in:
parent
dad9b53b54
commit
131a6a3215
1 changed files with 10 additions and 8 deletions
|
@ -47,14 +47,16 @@ window.addEventListener('keydown', function(event) {
|
||||||
removeAnnotation(selected.dataset.id)
|
removeAnnotation(selected.dataset.id)
|
||||||
}
|
}
|
||||||
} else if (event.key == 'n' || event.keyCode == 13) {
|
} else if (event.key == 'n' || event.keyCode == 13) {
|
||||||
var selected = document.querySelector('.oml-annotation.selected')
|
if (event.target.nodeName != 'INPUT') {
|
||||||
if (!window.getSelection().isCollapsed) {
|
var selected = document.querySelector('.oml-annotation.selected')
|
||||||
createAnnotation()
|
if (!window.getSelection().isCollapsed) {
|
||||||
} else if (selected) {
|
createAnnotation()
|
||||||
console.log('editNote?', selected.dataset.id)
|
} else if (selected) {
|
||||||
|
console.log('editNote?', selected.dataset.id)
|
||||||
|
}
|
||||||
|
event.stopPropagation()
|
||||||
|
event.preventDefault()
|
||||||
}
|
}
|
||||||
event.stopPropagation()
|
|
||||||
event.preventDefault()
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
window.addEventListener('mouseup', function(event) {
|
window.addEventListener('mouseup', function(event) {
|
||||||
|
@ -91,7 +93,7 @@ function getHighlight() {
|
||||||
viewport.convertToPdfPoint(r.right - pageRect.x, r.bottom - pageRect.y));
|
viewport.convertToPdfPoint(r.right - pageRect.x, r.bottom - pageRect.y));
|
||||||
});
|
});
|
||||||
var text = selection.toString();
|
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 {
|
return {
|
||||||
page: pageNumber,
|
page: pageNumber,
|
||||||
position: position,
|
position: position,
|
||||||
|
|
Loading…
Reference in a new issue