Skip to content

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

:art: https://ld246.com/article/1698932173040

Vanessadc7f76305456
diff --git a/app/src/protyle/render/mathRender.ts b/app/src/protyle/render/mathRender.ts
index d8ccd34542..5b66b4277d 100644
--- a/app/src/protyle/render/mathRender.ts
+++ b/app/src/protyle/render/mathRender.ts
@@ -47,7 +47,8 @@ export const mathRender = (element: Element, cdn = Constants.PROTYLE_CDN, maxWid
if (mathElement.tagName === "DIV") {
renderElement.firstElementChild.setAttribute("contenteditable", "false");
if (renderElement.childElementCount < 2) {
- renderElement.insertAdjacentHTML("beforeend", `<span contenteditable="false" style="position: absolute">${Constants.ZWSP}</span>`);
+ // 不能使用 contenteditable="false",否则光标无法移动到该块
+ renderElement.insertAdjacentHTML("beforeend", `<span style="position: absolute;right: 0;top: 0;">${Constants.ZWSP}</span>`);
}
// https://github.com/siyuan-note/siyuan/issues/3541
const baseElements = renderElement.querySelectorAll(".base");
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index 32cfbca269..eda424ccb3 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -1477,6 +1477,12 @@ export class WYSIWYG {
event.stopPropagation();
return;
}
+ const blockElement = hasClosestBlock(event.target)
+ if (blockElement && !getContenteditableElement(blockElement)) {
+ event.stopPropagation();
+ event.preventDefault();
+ return;
+ }
paste(protyle, event);
});