An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: fix https://github.com/siyuan-note/siyuan/issues/7999
Vanessad44f47e9b537
diff --git a/app/src/block/popover.ts b/app/src/block/popover.tsindex 3a75b6afa0..33d50a2197 100644--- a/app/src/block/popover.ts+++ b/app/src/block/popover.ts@@ -39,7 +39,7 @@ export const initBlockPopover = () => {} else if (!aElement) {hideTooltip();}- if (window.siyuan.config.editor.floatWindowMode === 1) {+ if (window.siyuan.config.editor.floatWindowMode === 1 || window.siyuan.shiftIsPressed) {clearTimeout(timeoutHide);timeoutHide = window.setTimeout(() => {hidePopover(event);@@ -51,6 +51,9 @@ export const initBlockPopover = () => {if (window.siyuan.ctrlIsPressed) {clearTimeout(timeoutHide);showPopover();+ } else if (window.siyuan.shiftIsPressed) {+ clearTimeout(timeoutHide);+ showPopover(true);}return;}@@ -65,7 +68,7 @@ export const initBlockPopover = () => {clearTimeout(timeout);}}, 200);- timeout = window.setTimeout(async () => {+ timeout = window.setTimeout(() => {if (!getTarget(event, aElement)) {return;}@@ -159,7 +162,7 @@ const getTarget = (event: MouseEvent & { target: HTMLElement }, aElement: falseaElement.getAttribute("prevent-popover") !== "true") {popoverTargetElement = aElement;}- if (!popoverTargetElement || window.siyuan.altIsPressed || window.siyuan.shiftIsPressed ||+ if (!popoverTargetElement || window.siyuan.altIsPressed ||(window.siyuan.config.editor.floatWindowMode === 0 && window.siyuan.ctrlIsPressed) ||(popoverTargetElement && popoverTargetElement.getAttribute("prevent-popover") === "true")) {return false;@@ -174,7 +177,7 @@ const getTarget = (event: MouseEvent & { target: HTMLElement }, aElement: falsereturn true;};-export const showPopover = async () => {+export const showPopover = async (showRef = false) => {if (!popoverTargetElement) {return;}@@ -183,12 +186,18 @@ export const showPopover = async () => {const dataId = popoverTargetElement.getAttribute("data-id");if (dataId) {// backlink/util/hint/正文标题 上的弹层- if (dataId.startsWith("[")) {- ids = JSON.parse(dataId);+ if (showRef) {+ const postResponse = await fetchSyncPost("/api/block/getRefIDs", {id: dataId});+ ids = postResponse.data.refIDs;+ defIds = postResponse.data.defIDs;} else {- ids = [dataId];+ if (dataId.startsWith("[")) {+ ids = JSON.parse(dataId);+ } else {+ ids = [dataId];+ }+ defIds = JSON.parse(popoverTargetElement.getAttribute("data-defids") || "[]");}- defIds = JSON.parse(popoverTargetElement.getAttribute("data-defids") || "[]");} else if (popoverTargetElement.getAttribute("data-type")?.indexOf("virtual-block-ref") > -1) {const nodeElement = hasClosestBlock(popoverTargetElement);if (nodeElement) {@@ -237,5 +246,5 @@ export const showPopover = async () => {defIds,}));}- popoverTargetElement = undefined;+ // 不能清除,否则ctrl 后 shift 就 无效 popoverTargetElement = undefined;};diff --git a/app/src/boot/globalShortcut.ts b/app/src/boot/globalShortcut.tsindex 83289bb7ff..1a70e65c67 100644--- a/app/src/boot/globalShortcut.ts+++ b/app/src/boot/globalShortcut.ts@@ -435,6 +435,9 @@ export const globalShortcut = (app: App) => {if (!event.altKey && event.shiftKey && !isCtrl(event)) {if (event.key === "Shift") {window.siyuan.shiftIsPressed = true;+ if (!event.repeat) {+ showPopover(true);+ }} else {window.siyuan.shiftIsPressed = false;}