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/18874

Vanessaee64223a76ef
diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.ts
index 93612adf34..719601031f 100644
--- a/app/src/protyle/util/onGet.ts
+++ b/app/src/protyle/util/onGet.ts
@@ -32,6 +32,7 @@ import {getEmbeddedDocInfoResponse} from "./docInfo";
import {updateWidgetCacheVersion} from "./widgetCache";
import {normalizeHTMLAssetIFrameSources} from "../../asset/html";
import {hasFocusOffsets} from "./focusRestore";
+import {isIPhone} from "./compatibility";
/// #if MOBILE
import {updateMobileTitleReadonly} from "./setEditMode";
/// #endif
@@ -496,7 +497,7 @@ export const enableProtyle = (protyle: IProtyle) => {
updateMobileTitleReadonly(protyle);
/// #endif
}
- protyle.wysiwyg.element.setAttribute("contenteditable", "true");
+ protyle.wysiwyg.element.setAttribute("contenteditable", isIPhone() ? "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 3b0f021186..e339a0524c 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -95,6 +95,7 @@ import {
getTextSiyuanFromTextHTML,
isInAndroid,
isInIOS,
+ isIPhone,
isMac,
isOnlyMeta,
readClipboard,
@@ -453,7 +454,8 @@ export class WYSIWYG {
this.element = document.createElement("div");
this.element.className = "protyle-wysiwyg";
this.element.setAttribute("spellcheck", "false");
- this.element.setAttribute("contenteditable", "true");
+ // iPhone 根编辑宿主会绕过区块结构生成富文本 DOM,具体内容节点仍保持可编辑。
+ this.element.setAttribute("contenteditable", isIPhone() ? "false" : "true");
if (window.siyuan.config.editor.displayBookmarkIcon) {
this.element.classList.add("protyle-wysiwyg--attr");
}