An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: Fix table menus after pasting copied cells https://github.com/siyuan-note/siyuan/issues/18397
Daniel272df0ffb11e
diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.tsindex afc5135459..5a6ae198b8 100644--- a/app/src/menus/protyle.ts+++ b/app/src/menus/protyle.ts@@ -2220,7 +2220,7 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:});}const thMatchElement = nodeElement.querySelectorAll("col")[colIndex];- if (thMatchElement.style.width || thMatchElement.style.minWidth !== "60px") {+ if (thMatchElement && (thMatchElement.style.width || thMatchElement.style.minWidth !== "60px")) {otherMenus.push({id: "useDefaultWidth",label: window.siyuan.languages.useDefaultWidth,diff --git a/app/src/protyle/util/table.ts b/app/src/protyle/util/table.tsindex 7142dbcf5b..d6a10e3a93 100644--- a/app/src/protyle/util/table.ts+++ b/app/src/protyle/util/table.ts@@ -1119,7 +1119,12 @@ export const getTableRangeHTML = (tableElement: HTMLElement, startCell: HTMLElemoutputCell.innerHTML = cell.innerHTML;return outputCell.outerHTML;};- let html = "<table>";+ const sourceColElements = Array.from(tableElement.children).find(item => item.tagName === "COLGROUP")?.children;+ let html = "<table><colgroup>";+ for (let c = selColStart; c <= selColEnd; c++) {+ html += sourceColElements?.[c]?.outerHTML || "<col style='min-width: 60px;'>";+ }+ html += "</colgroup>";let curSection = "";for (let r = 0; r <= maxOutRow; r++) {const section = getOutputSection(r);