Vanessa 2025-02-22 10:51:11 +08:00
parent 65198b9a1e
commit bb8d5215ea

View file

@ -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