An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:sparkles: fix https://github.com/siyuan-note/siyuan/issues/6017
Vanessa4ed5d8c98703
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.tsindex 3a07e90d69..f5cc505560 100644--- a/app/src/protyle/wysiwyg/index.ts+++ b/app/src/protyle/wysiwyg/index.ts@@ -1098,25 +1098,27 @@ export class WYSIWYG {});let beforeContextmenuRange: Range;- this.element.addEventListener("contextmenu", (event) => {+ this.element.addEventListener("contextmenu", (event: MouseEvent & { detail: any }) => {event.stopPropagation();event.preventDefault();+ const x = event.clientX || event.detail.x+ const y = event.clientY || event.detail.yconst selectElements = protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select");if (selectElements.length > 1) {// 多选块hideElements(["util"], protyle);protyle.gutter.renderMenu(protyle, selectElements[0]);- window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY});+ window.siyuan.menus.menu.popup({x, y});return;}- const target = event.target as HTMLElement;+ const target = event.detail.target || event.target as HTMLElementconst embedElement = hasClosestByAttribute(target, "data-type", "NodeBlockQueryEmbed");if (embedElement) {if (getSelection().rangeCount === 0) {focusSideBlock(embedElement);}protyle.gutter.renderMenu(protyle, embedElement);- window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY});+ window.siyuan.menus.menu.popup({x, y});return false;}if (protyle.disabled) {@@ -1154,8 +1156,8 @@ export class WYSIWYG {}if (target.tagName === "IMG" && hasClosestByClassName(target, "img")) {imgMenu(protyle, protyle.toolbar.range, target.parentElement.parentElement, {- clientX: event.clientX + 4,- clientY: event.clientY+ clientX: x + 4,+ clientY: y});return false;}@@ -1167,7 +1169,7 @@ export class WYSIWYG {(isMobile() || beforeContextmenuRange && nodeElement.contains(beforeContextmenuRange.startContainer))) {if (!isMobile() || protyle.toolbar?.element.classList.contains("fn__none")) {contentMenu(protyle, nodeElement);- window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY + 13, h: 26});+ window.siyuan.menus.menu.popup({x, y: y + 13, h: 26});protyle.toolbar?.element.classList.add("fn__none");if (nodeElement.classList.contains("table")) {nodeElement.querySelector("table").classList.remove("select");@@ -1179,7 +1181,7 @@ export class WYSIWYG {if (protyle.gutter) {protyle.gutter.renderMenu(protyle, nodeElement);}- window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY});+ window.siyuan.menus.menu.popup({x, y});protyle.toolbar?.element.classList.add("fn__none");}});diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.tsindex 72f9f3b70d..c50585fc02 100644--- a/app/src/protyle/wysiwyg/keydown.ts+++ b/app/src/protyle/wysiwyg/keydown.ts@@ -5,7 +5,7 @@ import {focusByRange,focusByWbr,getEditorRange,- getSelectionOffset,+ getSelectionOffset, getSelectionPosition,selectAll,setFirstNodeRange,setLastNodeRange@@ -1628,6 +1628,20 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {}}+ if (event.key === "ContextMenu") {+ const rangePosition = getSelectionPosition(nodeElement, range);+ protyle.wysiwyg.element.dispatchEvent(new CustomEvent("contextmenu", {+ detail: {+ target: nodeElement,+ y: rangePosition.top + 8,+ x: rangePosition.left+ }+ }));+ event.preventDefault();+ event.stopPropagation();+ return;+ }+/// #if !MOBILEconst refElement = hasClosestByAttribute(range.startContainer, "data-type", "block-ref");if (refElement) {