From bb8d5215ea52b74b3ee3a141fd95fd5420cfe1c4 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sat, 22 Feb 2025 10:51:11 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/14162 --- app/src/protyle/util/insertHTML.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/protyle/util/insertHTML.ts b/app/src/protyle/util/insertHTML.ts index 72b1aa0ab..ad013c53f 100644 --- a/app/src/protyle/util/insertHTML.ts +++ b/app/src/protyle/util/insertHTML.ts @@ -288,10 +288,10 @@ export const insertHTML = (html: string, protyle: IProtyle, isBlock = false, } const range = useProtyleRange ? protyle.toolbar.range : getEditorRange(protyle.wysiwyg.element); fixTableRange(range); - let tableInlineHTML; + let unSpinHTML; if (hasClosestByAttribute(range.startContainer, "data-type", "NodeTable") && !isBlock) { if (hasClosestByTag(range.startContainer, "TABLE")) { - tableInlineHTML = protyle.lute.BlockDOM2InlineBlockDOM(html); + unSpinHTML = protyle.lute.BlockDOM2InlineBlockDOM(html); } else { // https://github.com/siyuan-note/siyuan/issues/9411 isBlock = true; @@ -381,7 +381,12 @@ export const insertHTML = (html: string, protyle: IProtyle, isBlock = false, } const tempElement = document.createElement("template"); - let innerHTML = tableInlineHTML || // 在 table 中插入需要使用转换好的行内元素 https://github.com/siyuan-note/siyuan/issues/9358 + // https://github.com/siyuan-note/siyuan/issues/14162 + if (html.startsWith(">") && editableElement.textContent.replace(Constants.ZWSP, "") !== "" ) { + unSpinHTML = html; + } + + let innerHTML = unSpinHTML || // 在 table 中插入需要使用转换好的行内元素 https://github.com/siyuan-note/siyuan/issues/9358 protyle.lute.SpinBlockDOM(html) || // 需要再 spin 一次 https://github.com/siyuan-note/siyuan/issues/7118 html; // 空格会被 Spin 不再,需要使用原文 // 粘贴纯文本时会进行内部转义,这里需要进行反转义 https://github.com/siyuan-note/siyuan/issues/10620