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/5793
Vanessa629eaf53f16f
diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.tsindex aa1c58c8d7..a0a86fb4b7 100644--- a/app/src/protyle/wysiwyg/transaction.ts+++ b/app/src/protyle/wysiwyg/transaction.ts@@ -565,11 +565,14 @@ export const turnsIntoTransaction = (options: {nodeElement?: Element,type: string,level?: number | string,- isContinue?: boolean+ isContinue?: boolean,}) => {let selectsElement: Element[] = options.selectsElement;+ let range: Range// 通过快捷键触发if (options.nodeElement) {+ range = getSelection().getRangeAt(0);+ range.insertNode(document.createElement("wbr"))selectsElement = Array.from(options.protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"));if (selectsElement.length === 0) {selectsElement = [options.nodeElement];@@ -648,7 +651,11 @@ export const turnsIntoTransaction = (options: {processRender(options.protyle.wysiwyg.element);highlightRender(options.protyle.wysiwyg.element);blockRender(options.protyle, options.protyle.wysiwyg.element);- focusBlock(options.protyle.wysiwyg.element.querySelector(`[data-node-id="${selectsElement[0].getAttribute("data-node-id")}"]`));+ if (range) {+ focusByWbr(options.protyle.wysiwyg.element, range);+ } else {+ focusBlock(options.protyle.wysiwyg.element.querySelector(`[data-node-id="${selectsElement[0].getAttribute("data-node-id")}"]`));+ }hideElements(["gutter"], options.protyle);};