Skip to content

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

:bug: Preserve Android editor content boundaries during IME deletion https://github.com/siyuan-note/siyuan/issues/19377

Daniela989f1d5ce6f
diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.ts
index 37dcc4a3ef..ed60ebebeb 100644
--- a/app/src/protyle/util/onGet.ts
+++ b/app/src/protyle/util/onGet.ts
@@ -540,7 +540,8 @@ export const enableProtyle = (protyle: IProtyle) => {
updateMobileTitleReadonly(protyle);
/// #endif
}
- protyle.wysiwyg.element.setAttribute("contenteditable", isIPhone() ? "false" : "true");
+ // 解除只读时保留 Android 和 iPhone 的正文编辑边界,结构容器保持不可编辑。
+ protyle.wysiwyg.element.setAttribute("contenteditable", (isIPhone() || /Android/i.test(navigator.userAgent)) ? "false" : "true");
protyle.wysiwyg.element.style.userSelect = "";
// 用于区分移动端样式
protyle.wysiwyg.element.setAttribute("data-readonly", "false");
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index 78c9302978..64503a959a 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -489,8 +489,8 @@ export class WYSIWYG {
this.element = document.createElement("div");
this.element.className = "protyle-wysiwyg";
this.element.setAttribute("spellcheck", "false");
- // iPhone 根编辑宿主会绕过区块结构生成富文本 DOM,具体内容节点仍保持可编辑。
- this.element.setAttribute("contenteditable", isIPhone() ? "false" : "true");
+ // Android 和 iPhone 的原生编辑限于正文节点,避免输入法修改列表等结构容器。
+ this.element.setAttribute("contenteditable", (isIPhone() || /Android/i.test(navigator.userAgent)) ? "false" : "true");
if (window.siyuan.config.editor.displayBookmarkIcon) {
this.element.classList.add("protyle-wysiwyg--attr");
}