From d5c20934266d724fc3c6653b037ad30640470160 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Fri, 10 Jun 2022 16:35:08 +0800 Subject: [PATCH] :bug: fix https://github.com/siyuan-note/siyuan/issues/5153 --- app/src/menus/protyle.ts | 6 ++++-- app/src/protyle/util/table.ts | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts index 795780879..8731ae6bc 100644 --- a/app/src/menus/protyle.ts +++ b/app/src/menus/protyle.ts @@ -1033,12 +1033,14 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement: } }); } - if (!hasNone || (hasNone && !hasRowSpan && hasColSpan) || colIsPure) { + if ((cellElement.parentElement.parentElement.tagName !== "THEAD" && + ((!hasNone && !hasRowSpan) || (hasNone && !hasRowSpan && hasColSpan))) || colIsPure) { menus.push({ type: "separator" }); } - if ((!hasNone && !hasRowSpan) || (hasNone && !hasRowSpan && hasColSpan)) { + if (cellElement.parentElement.parentElement.tagName !== "THEAD" && + ((!hasNone && !hasRowSpan) || (hasNone && !hasRowSpan && hasColSpan))) { menus.push({ icon: "iconDeleteRow", label: window.siyuan.languages["delete-row"], diff --git a/app/src/protyle/util/table.ts b/app/src/protyle/util/table.ts index e7a53b6c2..d71b1daca 100644 --- a/app/src/protyle/util/table.ts +++ b/app/src/protyle/util/table.ts @@ -148,7 +148,7 @@ export const insertColumn = (protyle: IProtyle, nodeElement: Element, cellElemen }; export const deleteRow = (protyle: IProtyle, range: Range, cellElement: HTMLElement, nodeElement: Element) => { - if (cellElement.tagName === "TD") { + if (cellElement.parentElement.parentElement.tagName !== "THEAD") { range.insertNode(document.createElement("wbr")); const html = nodeElement.outerHTML;