From 0bd35a97c1a7daf26106b69f404d228ecfe1e305 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 12 Feb 2025 11:02:31 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/14035 --- app/src/protyle/util/insertHTML.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/protyle/util/insertHTML.ts b/app/src/protyle/util/insertHTML.ts index aa7df722a..e5f606f2e 100644 --- a/app/src/protyle/util/insertHTML.ts +++ b/app/src/protyle/util/insertHTML.ts @@ -208,7 +208,7 @@ const processAV = (range: Range, html: string, protyle: IProtyle, blockElement: if (textJSON.length === 1 && textJSON[0].length === 1) { updateCellsValue(protyle, blockElement as HTMLElement, text, cellElements, columns, html); } else { - let currentRowElement:Element; + let currentRowElement: Element; const firstColIndex = cellElements[0].getAttribute("data-col-id"); textJSON.forEach((rowValue, rowIndex) => { if (!currentRowElement) { @@ -354,10 +354,13 @@ export const insertHTML = (html: string, protyle: IProtyle, isBlock = false, // 表格内选中数学公式 https://ld246.com/article/1631708573504 inlineMathElement.remove(); } else if (range.startContainer.nodeType === 3 && range.startContainer.parentElement.getAttribute("data-type")?.indexOf("block-ref") > -1) { - // ref 选中处理 https://ld246.com/article/1629214377537 - range.startContainer.parentElement.remove(); // 选中 ref**bbb** 后 alt+[ range.deleteContents(); + // https://github.com/siyuan-note/siyuan/issues/14035 + if (range.startContainer.nodeType !== 3 && range.startContainer.textContent === "") { + // ref 选中处理 https://ld246.com/article/1629214377537 + (range.startContainer as HTMLElement).remove(); + } } else { range.deleteContents(); }