From 89d9d16a0657e4694dc33fca44df49b91c82bcf4 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Thu, 24 Apr 2025 17:01:52 +0800 Subject: [PATCH] :art: Ignore editor Markdown settings when copying and pasting inline elements https://github.com/siyuan-note/siyuan/issues/14690 --- app/src/protyle/wysiwyg/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index c78f83ab6..c8f4499ef 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -1,4 +1,4 @@ -import {getTextStar, paste} from "../util/paste"; +import {enableLuteMarkdownSyntax, getTextStar, paste, restoreLuteMarkdownSyntax} from "../util/paste"; import { hasClosestBlock, hasClosestByAttribute, @@ -442,7 +442,9 @@ export class WYSIWYG { .replace(new RegExp(Constants.ZWSP, "g"), ""); event.clipboardData.setData("text/plain", textPlain); event.clipboardData.setData("text/html", selectTableElement ? html : protyle.lute.BlockDOM2HTML(selectAVElement ? textPlain : html)); + enableLuteMarkdownSyntax(protyle); event.clipboardData.setData("text/siyuan", selectTableElement ? protyle.lute.HTML2BlockDOM(html) : html); + restoreLuteMarkdownSyntax(protyle); }); this.element.addEventListener("mousedown", (event: MouseEvent) => { @@ -1702,7 +1704,9 @@ export class WYSIWYG { textPlain = textPlain.replace(/\u00A0/g, " "); // Replace non-breaking spaces with normal spaces when copying https://github.com/siyuan-note/siyuan/issues/9382 event.clipboardData.setData("text/plain", textPlain); event.clipboardData.setData("text/html", selectTableElement ? html : protyle.lute.BlockDOM2HTML(selectAVElement ? textPlain : html)); + enableLuteMarkdownSyntax(protyle); event.clipboardData.setData("text/siyuan", selectTableElement ? protyle.lute.HTML2BlockDOM(html) : html); + restoreLuteMarkdownSyntax(protyle); }); let beforeContextmenuRange: Range;