From 166dd4a1c372e06b9b64cd4d10c753dbe9164852 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sun, 15 Oct 2023 22:55:29 +0800 Subject: [PATCH] :bug: fix https://github.com/siyuan-note/siyuan/issues/9411 --- app/src/protyle/util/insertHTML.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/protyle/util/insertHTML.ts b/app/src/protyle/util/insertHTML.ts index 2c81d1d89d3..fcf3f3134da 100644 --- a/app/src/protyle/util/insertHTML.ts +++ b/app/src/protyle/util/insertHTML.ts @@ -1,4 +1,4 @@ -import {hasClosestBlock, hasClosestByAttribute, hasClosestByClassName} from "./hasClosest"; +import {hasClosestBlock, hasClosestByAttribute, hasClosestByClassName, hasClosestByMatchTag} from "./hasClosest"; import * as dayjs from "dayjs"; import {transaction, updateTransaction} from "../wysiwyg/transaction"; import {getContenteditableElement, hasNextSibling, hasPreviousSibling} from "../wysiwyg/getBlock"; @@ -20,7 +20,12 @@ export const insertHTML = (html: string, protyle: IProtyle, isBlock = false, fixTableRange(range); let tableInlineHTML; if (hasClosestByAttribute(range.startContainer, "data-type", "NodeTable") && !isBlock) { - tableInlineHTML = protyle.lute.BlockDOM2InlineBlockDOM(html); + if (hasClosestByMatchTag(range.startContainer, "table")) { + tableInlineHTML = protyle.lute.BlockDOM2InlineBlockDOM(html); + } else { + // https://github.com/siyuan-note/siyuan/issues/9411 + isBlock = true; + } } let blockElement = hasClosestBlock(range.startContainer) as Element; if (!blockElement) {