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: fix https://github.com/siyuan-note/siyuan/issues/10933
Vanessa59ebc59190bc
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.tsindex 806e5bdd23..a737b1cbef 100644--- a/app/src/protyle/toolbar/index.ts+++ b/app/src/protyle/toolbar/index.ts@@ -456,6 +456,11 @@ export class Toolbar {}inlineElement.setAttribute("data-type", [...new Set(rangeTypes)].join(" "));inlineElement.textContent = Constants.ZWSP;+ // 在 a 元素中 ctrl+m 需继承其链接,也许不需要?没有用户反馈之前先保持现装+ // if (type !== "a" && rangeTypes.includes("a") && nextElement.dataset.type.split(" ").includes("a") &&+ // nextElement.isSameNode(previousElement)) {+ // inlineElement.setAttribute("data-href", nextElement.getAttribute("data-href"));+ // }setFontStyle(inlineElement, textObj);newNodes.push(inlineElement);} else {@@ -1478,7 +1483,7 @@ export class Toolbar {k: inputElement.value,}, (response) => {let searchHTML = "";- response.data.blocks.forEach((item: { path: string, content: string,name:string }, index: number) => {+ response.data.blocks.forEach((item: { path: string, content: string, name: string }, index: number) => {searchHTML += `<div data-value="${item.path}" data-content="${item.content}" class="b3-list-item${index === 0 ? " b3-list-item--focus" : ""}">${item.name}<span class="b3-list-item__meta">${item.content}</span>diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.tsindex f94782d3fe..52a8238f0c 100644--- a/app/src/protyle/wysiwyg/index.ts+++ b/app/src/protyle/wysiwyg/index.ts@@ -1998,7 +1998,7 @@ export class WYSIWYG {const blockRefElement = hasClosestByAttribute(event.target, "data-type", "block-ref");const aElement = hasClosestByAttribute(event.target, "data-type", "a") ||hasClosestByClassName(event.target, "av__celltext--url"); // 数据库中资源文件、链接、电话、邮箱单元格- let aLink = aElement ? aElement.getAttribute("data-href") : "";+ let aLink = aElement ? (aElement.getAttribute("data-href") || "") : "";if (aElement && !aLink && aElement.classList.contains("av__celltext--url")) {aLink = aElement.textContent.trim();if (aElement.dataset.type === "phone") {@@ -2121,7 +2121,8 @@ export class WYSIWYG {return;}- if (aElement && range.toString() === "") {+ // 如果aLink 为空时,当 data-type="a inline-math" 可继续后续操作+ if (aElement && range.toString() === "" && aLink) {event.stopPropagation();event.preventDefault();let linkAddress = Lute.UnEscapeHTMLStr(aLink);diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.tsindex 5c16332d39..afb94f83a4 100644--- a/app/src/protyle/wysiwyg/keydown.ts+++ b/app/src/protyle/wysiwyg/keydown.ts@@ -171,6 +171,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {nodeElement.querySelector("wbr").remove();// 光标位于引用结尾后 ctrl+b 偶尔会失效range = cloneRange;+ // 会导致 protyle.toolbar.range 和 range 不一致,先在有问题的地方重置一下 https://github.com/siyuan-note/siyuan/issues/10933}if (!window.siyuan.menus.menu.element.classList.contains("fn__none") &&@@ -594,6 +595,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {return;}const selectText = range.toString();+// 上下左右光标移动if (!event.altKey && !event.shiftKey && isNotCtrl(event) && !event.isComposing && (event.key.indexOf("Arrow") > -1)) {// 需使用 editabled,否则代码块会把语言字数算入@@ -1242,7 +1244,8 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {return false;}if (matchHotKey(menuItem.hotkey, event)) {- protyle.toolbar.range = getEditorRange(protyle.wysiwyg.element);+ // 设置 lastHTMLs 会导致 protyle.toolbar.range 和 range 不一致,需重置一下 https://github.com/siyuan-note/siyuan/issues/10933+ protyle.toolbar.range = range;if (["block-ref"].includes(menuItem.name) && protyle.toolbar.range.toString() === "") {return true;}