Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/14827

Vanessafca8e62c050e
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts
index bba2fb749a..016cd20fec 100644
--- a/app/src/protyle/toolbar/index.ts
+++ b/app/src/protyle/toolbar/index.ts
@@ -604,11 +604,16 @@ export class Toolbar {
for (let i = newNodes.length - 1; i > -1; i--) {
this.range.insertNode(newNodes[i]);
}
- // 不选中后,ctrl+g 光标重置
if (newNodes.length === 1 && newNodes[0].textContent === Constants.ZWSP) {
this.range.setStart(newNodes[0], 1);
this.range.collapse(true);
- keepZWPS = false;
+ if (newNodes[0].nodeType !== 3) {
+ // 不选中后,ctrl+g 光标重置
+ const currentType = ((newNodes[0] as HTMLElement).getAttribute("data-type") || "").split(" ");
+ if (currentType.includes("code") || currentType.includes("tag") || currentType.includes("kbd")) {
+ keepZWPS = false;
+ }
+ }
}
if (!keepZWPS) {
// 合并元素