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: https://github.com/siyuan-note/siyuan/issues/174
Vanessabab9a27cacc1
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.tsindex 15f119122e..539ec43254 100644--- a/app/src/protyle/toolbar/index.ts+++ b/app/src/protyle/toolbar/index.ts@@ -234,6 +234,10 @@ export class Toolbar {}public setInlineMark(protyle: IProtyle, type: string, action: "range" | "toolbar", textObj?: ITextOption) {+ if (["text", "a", "block-ref", "inline-math", "inline-memo"].includes(type)) {+ protyle.toolbar.element.querySelector(`[data-type="${type}"]`).dispatchEvent(new CustomEvent("block-ref" === type ? getEventName() : "click"));+ return;+ }const nodeElement = hasClosestBlock(this.range.startContainer);if (!nodeElement) {return;diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.tsindex f4612ef3c5..42be15bc87 100644--- a/app/src/protyle/wysiwyg/index.ts+++ b/app/src/protyle/wysiwyg/index.ts@@ -112,11 +112,12 @@ export class WYSIWYG {const inputData = event.data;protyle.toolbar.range = range;const inlineElement = range.startContainer.parentElement;- const currentTypes = protyle.toolbar.getCurrentType();+ const currentTypes = protyle.toolbar.getCurrentType();if (// 表格行内公式之前无法插入文字 https://github.com/siyuan-note/siyuan/issues/3908- inlineElement.tagName==="SPAN" &&+ inlineElement.tagName === "SPAN" &&+ inlineElement.textContent.replace(Constants.ZWSP, "") !== inputData &&range.toString() === "" && range.startContainer.nodeType === 3 &&- (currentTypes.includes("inline-memo") || currentTypes.includes("text") || currentTypes.includes("block-ref")|| currentTypes.includes("file-annotation-ref")|| currentTypes.includes("a")) &&+ (currentTypes.includes("inline-memo") || currentTypes.includes("text") || currentTypes.includes("block-ref") || currentTypes.includes("file-annotation-ref") || currentTypes.includes("a")) &&!hasNextSibling(range.startContainer) && range.startContainer.textContent.length === range.startOffset &&inlineElement.textContent.replace(Constants.ZWSP, "").length >= inputData.length // 为空的时候需要等于) {diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.tsindex d812e0310a..0cf3d2b12a 100644--- a/app/src/protyle/wysiwyg/keydown.ts+++ b/app/src/protyle/wysiwyg/keydown.ts@@ -1183,11 +1183,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {}if (matchHotKey(menuItem.hotkey, event)) {protyle.toolbar.range = getEditorRange(protyle.wysiwyg.element);- if (["text", "a", "block-ref", "inline-math", "inline-memo"].includes(menuItem.name)) {- protyle.toolbar.element.querySelector(`[data-type="${menuItem.name}"]`).dispatchEvent(new CustomEvent("block-ref" === menuItem.name ? getEventName() : "click"));- } else {- protyle.toolbar.setInlineMark(protyle, menuItem.name, "range");- }+ protyle.toolbar.setInlineMark(protyle, menuItem.name, "range");return true;}});