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/12317
Vanessad4f94b9b1b5e
diff --git a/app/src/protyle/util/paste.ts b/app/src/protyle/util/paste.tsindex 307fd540b6..1b4eab2970 100644--- a/app/src/protyle/util/paste.ts+++ b/app/src/protyle/util/paste.ts@@ -343,13 +343,6 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEvenconst range = getEditorRange(protyle.wysiwyg.element);if (nodeElement.getAttribute("data-type") === "NodeCodeBlock" ||protyle.toolbar.getCurrentType(range).includes("code")) {- // 粘贴在代码位置- // https://github.com/siyuan-note/siyuan/issues/9142- // https://github.com/siyuan-note/siyuan/issues/9323- // 需排除行内代码 https://github.com/siyuan-note/siyuan/issues/9369- if (nodeElement.querySelector(".protyle-action")?.contains(range.startContainer)) {- range.setStart(nodeElement.querySelector(".hljs").firstChild, 0);- }insertHTML(textPlain, protyle);return;} else if (siyuanHTML) {diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.tsindex da6eb6c62b..fbfe55303f 100644--- a/app/src/protyle/wysiwyg/index.ts+++ b/app/src/protyle/wysiwyg/index.ts@@ -2080,6 +2080,12 @@ export class WYSIWYG {protyle.breadcrumb.render(protyle, false, hasClosestBlock(event.target));}const range = getEditorRange(this.element);+ // https://github.com/siyuan-note/siyuan/issues/12317+ if (range.startContainer.nodeType !== 3 &&+ (range.startContainer as Element).classList.contains("protyle-action") &&+ range.startContainer.parentElement.classList.contains("code-block")) {+ setFirstNodeRange(range.startContainer.parentElement.querySelector(".hljs").lastElementChild, range);+ }// 需放在嵌入块之前,否则嵌入块内的引用、链接、pdf 双链无法点击打开 https://ld246.com/article/1630479789513const aElement = hasClosestByAttribute(event.target, "data-type", "a") ||hasClosestByClassName(event.target, "av__celltext--url"); // 数据库中资源文件、链接、电话、邮箱单元格diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.tsindex f711c21d3b..f8a4906907 100644--- a/app/src/protyle/wysiwyg/keydown.ts+++ b/app/src/protyle/wysiwyg/keydown.ts@@ -1570,10 +1570,6 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {const tabSpace = window.siyuan.config.editor.codeTabSpaces === 0 ? "\t" : "".padStart(window.siyuan.config.editor.codeTabSpaces, " ");if (nodeElement.getAttribute("data-type") === "NodeCodeBlock" && selectText !== "") {const wbrElement = document.createElement("wbr");- // https://github.com/siyuan-note/siyuan/issues/8911- if (range.startContainer.nodeType !== 3 && (range.startContainer as Element).classList.contains("protyle-action")) {- range.setStart(nodeElement.querySelector(".hljs").firstChild, 0);- }range.insertNode(wbrElement);range.setStartAfter(wbrElement);const oldHTML = nodeElement.outerHTML;@@ -1601,7 +1597,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {}).value + "<br>");range.setStart(wbrElement.nextSibling, 0);const brElement = wbrElement.parentElement.querySelector("br");- range.setEnd(brElement.previousSibling, brElement.previousSibling.textContent.length);+ setLastNodeRange(brElement.previousSibling as Element, range, false);brElement.remove();updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, oldHTML);wbrElement.remove();