An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:sparkles: Support auto-fitting table column widths https://github.com/siyuan-note/siyuan/issues/18766
Daniel790c1b8efd35
diff --git a/app/src/protyle/util/tableControl.ts b/app/src/protyle/util/tableControl.tsindex ad23105939..b607810afb 100644--- a/app/src/protyle/util/tableControl.ts+++ b/app/src/protyle/util/tableControl.ts@@ -1437,6 +1437,20 @@ export class TableControl {click: () => toggleTableHeader(this.protyle, this.selection.node, headerType),}).element);}+ if (this.selection.mode === "column") {+ menu.append(new MenuItem({+ id: "autoFitColWidth",+ icon: "iconWidth",+ label: window.siyuan.languages.autoFitColWidth,+ click: () => this.setSelectedColumnWidth(),+ }).element);+ menu.append(new MenuItem({+ id: "useDefaultWidth",+ icon: "iconRefresh",+ label: window.siyuan.languages.useDefaultWidth,+ click: () => this.setSelectedColumnWidth(TABLE_DEFAULT_COLUMN_WIDTH),+ }).element);+ }menu.append(new MenuItem({type: "separator"}).element);}menu.append(new MenuItem({@@ -1759,6 +1773,31 @@ export class TableControl {this.scheduleRender();}+ private setSelectedColumnWidth(minWidth?: number) {+ if (!this.selection || this.selection.mode !== "column") {+ return;+ }+ const oldHTML = this.selection.node.outerHTML;+ const columns = this.selection.table.querySelectorAll<HTMLTableColElement>(":scope > colgroup > col");+ this.selection.indexes.forEach(index => {+ const column = columns[index];+ if (!column) {+ return;+ }+ column.style.removeProperty("width");+ if (minWidth === undefined) {+ column.style.removeProperty("min-width");+ } else {+ column.style.minWidth = `${minWidth}px`;+ }+ if (!column.getAttribute("style")) {+ column.removeAttribute("style");+ }+ });+ updateTransaction(this.protyle, this.selection.node, oldHTML);+ this.scheduleRender();+ }+private clearCells() {if (!this.selection) {return;