From f1bb3cf3c79a56171eb6c4bc7d7424a97839fa82 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Thu, 13 Oct 2022 16:03:02 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/6177 --- app/src/protyle/util/onGet.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.ts index 53c616673..2cee87145 100644 --- a/app/src/protyle/util/onGet.ts +++ b/app/src/protyle/util/onGet.ts @@ -279,8 +279,11 @@ export const disabledProtyle = (protyle: IProtyle) => { hideElements(["gutter", "toolbar", "select", "hint", "util"], protyle); protyle.disabled = true; if (protyle.title) { - protyle.title.element.querySelector(".protyle-title__input").setAttribute("contenteditable", "false"); + const titleElement = protyle.title.element.querySelector(".protyle-title__input") as HTMLElement + titleElement.setAttribute("contenteditable", "false"); + titleElement.style.userSelect = "text"; } + protyle.wysiwyg.element.style.userSelect = "text"; protyle.wysiwyg.element.setAttribute("contenteditable", "false"); protyle.wysiwyg.element.querySelectorAll('[contenteditable="true"][spellcheck="false"]').forEach(item => { item.setAttribute("contenteditable", "false"); @@ -294,9 +297,12 @@ export const enableProtyle = (protyle: IProtyle) => { // iPhone,iPad 端输入 contenteditable 为 true 时会在块中间插入 span } else { if (protyle.title) { - protyle.title.element.querySelector(".protyle-title__input").setAttribute("contenteditable", "true"); + const titleElement = protyle.title.element.querySelector(".protyle-title__input") as HTMLElement + titleElement.setAttribute("contenteditable", "true"); + titleElement.style.userSelect = ""; } protyle.wysiwyg.element.setAttribute("contenteditable", "true"); + protyle.wysiwyg.element.style.userSelect = ""; } protyle.wysiwyg.element.querySelectorAll('[contenteditable="false"][spellcheck="false"]').forEach(item => { if (!hasClosestByClassName(item, "protyle-wysiwyg__embed")) {