diff --git a/app/src/protyle/util/paste.ts b/app/src/protyle/util/paste.ts index c22001791..bfccf4856 100644 --- a/app/src/protyle/util/paste.ts +++ b/app/src/protyle/util/paste.ts @@ -50,7 +50,10 @@ export const pasteAsPlainText = async (protyle:IProtyle) => { uploadLocalFiles(localFiles, protyle, false); writeText(""); } else { - insertHTML(protyle.lute.BlockDOM2Content(protyle.lute.InlineMd2BlockDOM(clipboard.readText())), protyle, false); + protyle.lute.SetHTMLTag2TextMark(true); // 临时设置 Lute 解析参数,行级元素键盘和下划线无法粘贴为纯文本 https://github.com/siyuan-note/siyuan/issues/6220 + const dom = protyle.lute.InlineMd2BlockDOM(clipboard.readText()) + protyle.lute.SetHTMLTag2TextMark(false); + insertHTML(protyle.lute.BlockDOM2Content(dom), protyle, false); } /// #endif }; diff --git a/app/src/types/protyle.d.ts b/app/src/types/protyle.d.ts index f5db501b4..f4aa67a6a 100644 --- a/app/src/types/protyle.d.ts +++ b/app/src/types/protyle.d.ts @@ -215,6 +215,8 @@ declare class Lute { public SetProtyleWYSIWYG(wysiwyg: boolean): void; + public SetHTMLTag2TextMark(enable: boolean): void; + public MarkdownStr(name: string, md: string): string; public IsValidLinkDest(text: string): boolean; diff --git a/kernel/go.mod b/kernel/go.mod index 57ca79026..9948dacf7 100644 --- a/kernel/go.mod +++ b/kernel/go.mod @@ -6,7 +6,7 @@ require ( github.com/88250/clipboard v0.1.5 github.com/88250/css v0.1.2 github.com/88250/gulu v1.2.3-0.20221007162906-ded80d955178 - github.com/88250/lute v1.7.5-0.20221016085051-6aa1872a112b + github.com/88250/lute v1.7.5-0.20221016091231-5b3f92fac78a github.com/88250/pdfcpu v0.3.13 github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 github.com/ConradIrwin/font v0.0.0-20210318200717-ce8d41cc0732 diff --git a/kernel/go.sum b/kernel/go.sum index ad0bbc41f..0b42c09f9 100644 --- a/kernel/go.sum +++ b/kernel/go.sum @@ -23,6 +23,8 @@ github.com/88250/lute v1.7.5-0.20221016061849-db5f26667c4f h1:D2cCQIpNBWc6jE+OCe github.com/88250/lute v1.7.5-0.20221016061849-db5f26667c4f/go.mod h1:cEoBGi0zArPqAsp0MdG9SKinvH/xxZZWXU7sRx8vHSA= github.com/88250/lute v1.7.5-0.20221016085051-6aa1872a112b h1:FUlWKJ9eK5XY6NBpEnAyc3Sb5Xp62wCQyM/K3KJpzZQ= github.com/88250/lute v1.7.5-0.20221016085051-6aa1872a112b/go.mod h1:cEoBGi0zArPqAsp0MdG9SKinvH/xxZZWXU7sRx8vHSA= +github.com/88250/lute v1.7.5-0.20221016091231-5b3f92fac78a h1:KUtNpX01Dx2GOv9Da6IS2i2cX58ZK6RdFMn+XeQdfzs= +github.com/88250/lute v1.7.5-0.20221016091231-5b3f92fac78a/go.mod h1:cEoBGi0zArPqAsp0MdG9SKinvH/xxZZWXU7sRx8vHSA= github.com/88250/pdfcpu v0.3.13 h1:touMWMZkCGalMIbEg9bxYp7rETM+zwb9hXjwhqi4I7Q= github.com/88250/pdfcpu v0.3.13/go.mod h1:S5YT38L/GCjVjmB4PB84PymA1qfopjEhfhTNQilLpv4= github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=