Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Hide unavailable table cell merge action https://github.com/siyuan-note/siyuan/issues/18489

Daniel25f97f5b0427
diff --git a/app/src/protyle/util/tableControl.ts b/app/src/protyle/util/tableControl.ts
index 40df76bfb0..c08628a089 100644
--- a/app/src/protyle/util/tableControl.ts
+++ b/app/src/protyle/util/tableControl.ts
@@ -1178,15 +1178,17 @@ export class TableControl {
checked: verticalAlign === "",
click: () => this.setCellStyle("vertical-align", ""),
}).element);
- window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
const cells = this.getSelectedCells();
const mergedCell = cells.length === 1 && (cells[0].rowSpan > 1 || cells[0].colSpan > 1);
- window.siyuan.menus.menu.append(new MenuItem({
- label: mergedCell ? window.siyuan.languages.cancelMerged : window.siyuan.languages.mergeCell,
- disabled: !mergedCell && (!rectangle || cells.length < 2 || !this.isSelectionInOneSection()),
- accelerator: !mergedCell && !rectangle ? window.siyuan.languages.tableRectangleSelectionRequired : undefined,
- click: () => mergedCell ? this.splitCell(cells[0]) : this.mergeCells(),
- }).element);
+ if (mergedCell || cells.length > 1) {
+ window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
+ window.siyuan.menus.menu.append(new MenuItem({
+ label: mergedCell ? window.siyuan.languages.cancelMerged : window.siyuan.languages.mergeCell,
+ disabled: !mergedCell && (!rectangle || !this.isSelectionInOneSection()),
+ accelerator: !mergedCell && !rectangle ? window.siyuan.languages.tableRectangleSelectionRequired : undefined,
+ click: () => mergedCell ? this.splitCell(cells[0]) : this.mergeCells(),
+ }).element);
+ }
const rowSelection = getTableFullRowSelection(this.selection.table, cells);
const columnSelection = getTableFullColumnSelection(this.selection.table, cells);
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);