An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: 手速太快,无法切换页签
Vanessac5371760fd79
diff --git a/app/src/layout/Wnd.ts b/app/src/layout/Wnd.tsindex 188d674b89..f9411a4c8d 100644--- a/app/src/layout/Wnd.ts+++ b/app/src/layout/Wnd.ts@@ -548,7 +548,10 @@ export class Wnd {public moveTab(tab: Tab, nextId?: string) {this.element.querySelector(".layout-tab-container").append(tab.panelElement);-+ if (tab.model instanceof Editor) {+ // DOM 移动后 range 会变化,因此置空+ tab.model.editor.protyle.toolbar.range = null;+ }if (nextId) {// 只能用 find https://github.com/siyuan-note/siyuan/issues/3455this.children.find((item, index) => {diff --git a/app/src/util/globalShortcut.ts b/app/src/util/globalShortcut.tsindex d8da23090d..e687708117 100644--- a/app/src/util/globalShortcut.ts+++ b/app/src/util/globalShortcut.ts@@ -37,6 +37,7 @@ import {needSubscribe} from "./needSubscribe";import {Dialog} from "../dialog";import {unicode2Emoji} from "../emoji";import {deleteFile} from "../editor/deleteFile";+import {escapeHtml} from "./escape";const getRightBlock = (element: HTMLElement, x: number, y: number) => {let index = 1;@@ -220,7 +221,27 @@ export const globalShortcut = () => {}}} else if (event.key === "Control") {- const currentLiElement = switchDialog.element.querySelector(".b3-list-item--focus");+ let currentLiElement = switchDialog.element.querySelector(".b3-list-item--focus");+ // 快速切换时,不触发 Tab+ if (currentLiElement.getAttribute("data-original")) {+ currentLiElement.classList.remove("b3-list-item--focus");+ if (event.shiftKey) {+ if (currentLiElement.previousElementSibling) {+ currentLiElement.previousElementSibling.classList.add("b3-list-item--focus");+ } else {+ currentLiElement.parentElement.lastElementChild.classList.add("b3-list-item--focus");+ currentLiElement.removeAttribute("data-original");+ }+ } else {+ if (currentLiElement.nextElementSibling) {+ currentLiElement.nextElementSibling.classList.add("b3-list-item--focus");+ } else {+ currentLiElement.parentElement.firstElementChild.classList.add("b3-list-item--focus");+ }+ }+ currentLiElement.removeAttribute("data-original");+ currentLiElement = switchDialog.element.querySelector(".b3-list-item--focus");+ }const currentType = currentLiElement.getAttribute("data-type") as TDockType;if (currentType) {getDockByType(currentType).toggleModel(currentType, true);@@ -305,7 +326,7 @@ export const globalShortcut = () => {if (item.model instanceof Editor) {icon = `<span class="b3-list-item__graphic">${unicode2Emoji(item.docIcon || Constants.SIYUAN_IMAGE_FILE)}</span>`;}- tabHtml += `<li data-id="${item.id}" class="b3-list-item${currentId === item.id ? " b3-list-item--focus" : ""}"${currentId === item.id ? ' data-original="true"' : ""}>${icon}<span class="b3-list-item__text">${item.title}</span></li>`;+ tabHtml += `<li data-id="${item.id}" class="b3-list-item${currentId === item.id ? " b3-list-item--focus" : ""}"${currentId === item.id ? ' data-original="true"' : ""}>${icon}<span class="b3-list-item__text">${escapeHtml(item.title)}</span></li>`;});}switchDialog = new Dialog({