Use scrollintoView after using shortcut navigation for finding a next/previous mistake #4
This commit is contained in:
parent
1163b3c47e
commit
04cd5f2e7d
@ -336,8 +336,6 @@ class BesService {
|
|||||||
* @param {Event} e
|
* @param {Event} e
|
||||||
*/
|
*/
|
||||||
onShortcutNavigation(e) {
|
onShortcutNavigation(e) {
|
||||||
//TODO: If no highlightElement is selected? find the first mistake that comes after cursor and move to it.
|
|
||||||
if (!this.highlightElements.length) return
|
|
||||||
switch (e.code) {
|
switch (e.code) {
|
||||||
case 'BracketLeft':
|
case 'BracketLeft':
|
||||||
if (e.ctrlKey) {
|
if (e.ctrlKey) {
|
||||||
@ -1195,7 +1193,9 @@ class BesService {
|
|||||||
this.activeMatchIndex = next
|
this.activeMatchIndex = next
|
||||||
const { el, match } = this.sortedMatches[next]
|
const { el, match } = this.sortedMatches[next]
|
||||||
|
|
||||||
// TODO: find out why scrollintoview does not work well
|
// Not the cleanest solution, but it is good enough for now
|
||||||
|
el.scrollIntoView({ behavior: 'instant' })
|
||||||
|
setTimeout(() => {
|
||||||
this.dismissPopup()
|
this.dismissPopup()
|
||||||
const popup = document.querySelector('bes-popup-el')
|
const popup = document.querySelector('bes-popup-el')
|
||||||
BesPopup.clearReplacements()
|
BesPopup.clearReplacements()
|
||||||
@ -1205,6 +1205,7 @@ class BesService {
|
|||||||
const clientY = `${el.y + 150}`
|
const clientY = `${el.y + 150}`
|
||||||
popup.show(el.x, clientY, this)
|
popup.show(el.x, clientY, this)
|
||||||
})
|
})
|
||||||
|
}, 150)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user