mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-04 15:58:49 +01:00
This commit is contained in:
parent
167b0fda6f
commit
433bb1d226
1 changed files with 3 additions and 2 deletions
|
|
@ -377,7 +377,7 @@ export const globalShortcut = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (switchDialog && event.ctrlKey && !event.metaKey && event.key.startsWith("Arrow")) {
|
if (switchDialog && event.ctrlKey && !event.metaKey && event.key.startsWith("Arrow")) {
|
||||||
const currentLiElement = switchDialog.element.querySelector(".b3-list-item--focus");
|
let currentLiElement = switchDialog.element.querySelector(".b3-list-item--focus");
|
||||||
if (currentLiElement) {
|
if (currentLiElement) {
|
||||||
currentLiElement.classList.remove("b3-list-item--focus");
|
currentLiElement.classList.remove("b3-list-item--focus");
|
||||||
if (event.key === "ArrowUp") {
|
if (event.key === "ArrowUp") {
|
||||||
|
|
@ -396,7 +396,8 @@ export const globalShortcut = () => {
|
||||||
const sideElement = currentLiElement.parentElement.previousElementSibling || currentLiElement.parentElement.nextElementSibling;
|
const sideElement = currentLiElement.parentElement.previousElementSibling || currentLiElement.parentElement.nextElementSibling;
|
||||||
(sideElement.querySelector(`[data-index="${currentLiElement.getAttribute("data-index")}"]`) || sideElement.lastElementChild).classList.add("b3-list-item--focus");
|
(sideElement.querySelector(`[data-index="${currentLiElement.getAttribute("data-index")}"]`) || sideElement.lastElementChild).classList.add("b3-list-item--focus");
|
||||||
}
|
}
|
||||||
const currentRect = switchDialog.element.querySelector(".b3-list-item--focus").getBoundingClientRect();
|
currentLiElement = switchDialog.element.querySelector(".b3-list-item--focus")
|
||||||
|
const currentRect = currentLiElement.getBoundingClientRect();
|
||||||
const currentParentRect = currentLiElement.parentElement.getBoundingClientRect();
|
const currentParentRect = currentLiElement.parentElement.getBoundingClientRect();
|
||||||
if (currentRect.top < currentParentRect.top) {
|
if (currentRect.top < currentParentRect.top) {
|
||||||
currentLiElement.scrollIntoView(true);
|
currentLiElement.scrollIntoView(true);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue