From 2fb5e284425b6d9751af18f776cf6dd18cad442d Mon Sep 17 00:00:00 2001 From: Vanessa Date: Fri, 8 Mar 2024 16:45:00 +0800 Subject: [PATCH] =?UTF-8?q?:iphone:=20=E7=A7=BB=E5=8A=A8=E7=AB=AF=20.proty?= =?UTF-8?q?le-wysiwyg=20=E4=B8=8A=20contenteditable=20=E4=B8=BA=20false?= =?UTF-8?q?=EF=BC=8C=E5=9B=A0=E6=AD=A4=E6=97=A0=E6=B3=95=E7=94=A8=E6=AD=A4?= =?UTF-8?q?=E5=8C=BA=E5=88=86=E6=A0=B7=E5=BC=8F=EF=BC=8C=E5=8F=AA=E8=83=BD?= =?UTF-8?q?=E6=96=B0=E5=8A=A0=E4=B8=80=E4=B8=AA=20data-readonly=20?= =?UTF-8?q?=E7=94=A8=E6=9D=A5=E5=8C=BA=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/assets/scss/protyle/_wysiwyg.scss | 6 +++--- app/src/protyle/util/onGet.ts | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/assets/scss/protyle/_wysiwyg.scss b/app/src/assets/scss/protyle/_wysiwyg.scss index f83466ecd..163495e02 100644 --- a/app/src/assets/scss/protyle/_wysiwyg.scss +++ b/app/src/assets/scss/protyle/_wysiwyg.scss @@ -572,7 +572,7 @@ .protyle .protyle-wysiwyg { .li[data-subtype="o"] > .protyle-action, .li[data-subtype="u"] > .protyle-action, - &[contenteditable="true"] .li[data-subtype="t"] > .protyle-action { + &[data-readonly="true"] .li[data-subtype="t"] > .protyle-action { cursor: pointer; &:hover { @@ -586,7 +586,7 @@ } // 导出 html 不需要编辑样式 -.protyle-wysiwyg[contenteditable="true"] { +.protyle-wysiwyg[data-readonly="false"] { span[data-type~="inline-math"], span[data-type~="tag"], span[data-type~="block-ref"], @@ -632,7 +632,7 @@ } .protyle-wysiwyg:not([contenteditable]), -.protyle-wysiwyg[contenteditable="false"] { +.protyle-wysiwyg[data-readonly="true"] { .img:hover .protyle-icons { display: none; } diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.ts index d06015b77..0a789f426 100644 --- a/app/src/protyle/util/onGet.ts +++ b/app/src/protyle/util/onGet.ts @@ -304,6 +304,8 @@ export const disabledProtyle = (protyle: IProtyle) => { }); protyle.wysiwyg.element.style.userSelect = "text"; protyle.wysiwyg.element.setAttribute("contenteditable", "false"); + // 用于区分移动端样式 + protyle.wysiwyg.element.setAttribute("data-readonly", "true"); protyle.wysiwyg.element.querySelectorAll('[contenteditable="true"][spellcheck]').forEach(item => { item.setAttribute("contenteditable", "false"); }); @@ -345,6 +347,8 @@ export const enableProtyle = (protyle: IProtyle) => { protyle.wysiwyg.element.setAttribute("contenteditable", "true"); protyle.wysiwyg.element.style.userSelect = ""; } + // 用于区分移动端样式 + protyle.wysiwyg.element.setAttribute("data-readonly", "false"); if (protyle.title) { const titleElement = protyle.title.element.querySelector(".protyle-title__input") as HTMLElement; titleElement.setAttribute("contenteditable", "true");