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')
|
const $popup = $('#link-complete')
|
||||||
if (event.key === 'Escape') {
|
if (event.key === 'Escape') {
|
||||||
$popup.fadeOut()
|
$popup.fadeOut()
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.key === 'Enter') {
|
if (event.key === 'Enter') {
|
||||||
|
@ -100,8 +100,13 @@ if (holder) {
|
||||||
if (prev.length) {
|
if (prev.length) {
|
||||||
prev.addClass('selected')
|
prev.addClass('selected')
|
||||||
selected.removeClass('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') {
|
if (event.key === 'ArrowDown') {
|
||||||
|
@ -110,6 +115,7 @@ if (holder) {
|
||||||
if (next.length) {
|
if (next.length) {
|
||||||
next.addClass('selected')
|
next.addClass('selected')
|
||||||
selected.removeClass('selected')
|
selected.removeClass('selected')
|
||||||
|
next[0].scrollIntoView()
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -134,13 +140,17 @@ if (holder) {
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
$lc.on('popup:leave', function (event) {
|
||||||
|
input.focus()
|
||||||
|
})
|
||||||
|
|
||||||
$(input).on('keydown', function (event) {
|
$(input).on('keydown', function (event) {
|
||||||
const isVisible = $('#link-complete:visible').length > 0;
|
const isVisible = $('#link-complete:visible').length > 0;
|
||||||
|
|
||||||
const $lc = $('#link-complete')
|
const $lc = $('#link-complete')
|
||||||
if (event.key === 'Escape' && isVisible) {
|
if (event.key === 'Escape' && isVisible) {
|
||||||
$lc.fadeOut()
|
$lc.fadeOut()
|
||||||
return true
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.key === 'ArrowDown' && isVisible) {
|
if (event.key === 'ArrowDown' && isVisible) {
|
||||||
|
@ -159,7 +169,7 @@ if (holder) {
|
||||||
if (start < linkEnd) {
|
if (start < linkEnd) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let query = value.substring(start, end);
|
let query = value.substring(start+2, end);
|
||||||
let results = search.search(query)
|
let results = search.search(query)
|
||||||
|
|
||||||
let pos = getCaretCoordinates(input, value.selectionEnd, {})
|
let pos = getCaretCoordinates(input, value.selectionEnd, {})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user