diff --git a/app/src/assets/scss/_dialog.scss b/app/src/assets/scss/_dialog.scss index a02e17e6c..50b33e98e 100644 --- a/app/src/assets/scss/_dialog.scss +++ b/app/src/assets/scss/_dialog.scss @@ -84,6 +84,7 @@ &--switch { max-height: 70vh; + max-width: 520px; .b3-list:last-child { border-left: 1px solid var(--b3-border-color); @@ -91,5 +92,16 @@ max-width: 360px; min-width: 200px; } + + .dialog__path { + padding: 4px 8px; + border-top: 1px solid var(--b3-border-color); + color: var(--b3-theme-on-surface); + font-size: 12px; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + line-height: 18px; + } } } diff --git a/app/src/util/globalShortcut.ts b/app/src/util/globalShortcut.ts index cc79d929d..b33c32e77 100644 --- a/app/src/util/globalShortcut.ts +++ b/app/src/util/globalShortcut.ts @@ -195,7 +195,7 @@ export const globalShortcut = () => { window.siyuan.altIsPressed = false; if (switchDialog && switchDialog.element.parentElement) { if (event.key === "Tab") { - const currentLiElement = switchDialog.element.querySelector(".b3-list-item--focus"); + let currentLiElement = switchDialog.element.querySelector(".b3-list-item--focus"); currentLiElement.classList.remove("b3-list-item--focus"); if (event.shiftKey) { if (currentLiElement.previousElementSibling) { @@ -204,7 +204,11 @@ export const globalShortcut = () => { currentLiElement.parentElement.lastElementChild.classList.add("b3-list-item--focus"); currentLiElement.removeAttribute("data-original"); } else if (currentLiElement.parentElement.nextElementSibling) { - currentLiElement.parentElement.nextElementSibling.lastElementChild.classList.add("b3-list-item--focus"); + if (currentLiElement.parentElement.nextElementSibling.lastElementChild) { + currentLiElement.parentElement.nextElementSibling.lastElementChild.classList.add("b3-list-item--focus"); + } else { + currentLiElement.parentElement.lastElementChild.classList.add("b3-list-item--focus"); + } } else if (currentLiElement.parentElement.previousElementSibling) { currentLiElement.parentElement.previousElementSibling.lastElementChild.classList.add("b3-list-item--focus"); } @@ -215,11 +219,28 @@ export const globalShortcut = () => { currentLiElement.parentElement.firstElementChild.classList.add("b3-list-item--focus"); currentLiElement.removeAttribute("data-original"); } else if (currentLiElement.parentElement.nextElementSibling) { - currentLiElement.parentElement.nextElementSibling.firstElementChild.classList.add("b3-list-item--focus"); + if (currentLiElement.parentElement.nextElementSibling.firstElementChild) { + currentLiElement.parentElement.nextElementSibling.firstElementChild.classList.add("b3-list-item--focus"); + } else { + currentLiElement.parentElement.firstElementChild.classList.add("b3-list-item--focus"); + } } else if (currentLiElement.parentElement.previousElementSibling) { currentLiElement.parentElement.previousElementSibling.firstElementChild.classList.add("b3-list-item--focus"); } } + currentLiElement = switchDialog.element.querySelector(".b3-list-item--focus"); + if (currentLiElement) { + const rootId = currentLiElement.getAttribute("data-node-id"); + if (rootId) { + fetchPost("/api/filetree/getFullHPathByID", { + id: rootId + }, (response) => { + currentLiElement.parentElement.parentElement.nextElementSibling.innerHTML = escapeHtml(response.data); + }); + } else { + currentLiElement.parentElement.parentElement.nextElementSibling.innerHTML = currentLiElement.querySelector(".b3-list-item__text").innerHTML; + } + } } else if (event.key === "Control") { let currentLiElement = switchDialog.element.querySelector(".b3-list-item--focus"); // 快速切换时,不触发 Tab @@ -304,15 +325,7 @@ export const globalShortcut = () => { if (switchDialog && switchDialog.element.parentElement) { return; } - let dockHtml = ""; let tabHtml = ""; - getAllDocks().forEach(item => { - dockHtml += `