Scroll into view and move back to input
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
b08e93a46c
commit
2bb0c01914
|
@ -84,7 +84,7 @@ if (holder) {
|
|||
const $popup = $('#link-complete')
|
||||
if (event.key === 'Escape') {
|
||||
$popup.fadeOut()
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
|
||||
if (event.key === 'Enter') {
|
||||
|
@ -100,8 +100,13 @@ if (holder) {
|
|||
if (prev.length) {
|
||||
prev.addClass('selected')
|
||||
selected.removeClass('selected')
|
||||
prev[0].scrollIntoView()
|
||||
} else {
|
||||
// move back from dropdown to input
|
||||
$popup.trigger('popup:leave')
|
||||
selected.removeClass('selected')
|
||||
}
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
|
||||
if (event.key === 'ArrowDown') {
|
||||
|
@ -110,6 +115,7 @@ if (holder) {
|
|||
if (next.length) {
|
||||
next.addClass('selected')
|
||||
selected.removeClass('selected')
|
||||
next[0].scrollIntoView()
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
@ -134,13 +140,17 @@ if (holder) {
|
|||
return true
|
||||
})
|
||||
|
||||
$lc.on('popup:leave', function (event) {
|
||||
input.focus()
|
||||
})
|
||||
|
||||
$(input).on('keydown', function (event) {
|
||||
const isVisible = $('#link-complete:visible').length > 0;
|
||||
|
||||
const $lc = $('#link-complete')
|
||||
if (event.key === 'Escape' && isVisible) {
|
||||
$lc.fadeOut()
|
||||
return true
|
||||
return false
|
||||
}
|
||||
|
||||
if (event.key === 'ArrowDown' && isVisible) {
|
||||
|
@ -159,7 +169,7 @@ if (holder) {
|
|||
if (start < linkEnd) {
|
||||
return
|
||||
}
|
||||
let query = value.substring(start, end);
|
||||
let query = value.substring(start+2, end);
|
||||
let results = search.search(query)
|
||||
|
||||
let pos = getCaretCoordinates(input, value.selectionEnd, {})
|
||||
|
|
Loading…
Reference in New Issue
Block a user