Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
client/text editor/tables: tweak context menu
Adorian Doran8839bb51310d
diff --git a/apps/client/src/menus/table_context_menu.spec.ts b/apps/client/src/menus/table_context_menu.spec.tsindex 3d7062d3f2..9bdf8bdd9c 100644--- a/apps/client/src/menus/table_context_menu.spec.ts+++ b/apps/client/src/menus/table_context_menu.spec.ts@@ -22,7 +22,6 @@ const MAIN_TITLES = ["table_context_menu.insert_columns_right","---","table_context_menu.set_header_row",- "---","table_context_menu.merge_cells","table_context_menu.split_cells","table_context_menu.distribute_columns"@@ -161,10 +160,9 @@ describe("buildTableMenuSections", () => {run(laterRow.main, LATER_ROW_TITLE);expect(laterRow.executed).toEqual([LATER_ROW]);- // Several rows below the first take neither item, nor the separator that follows it.- const index = MAIN_TITLES.indexOf(FIRST_ROWS_TITLE);+ // Several rows below the first take neither item.expect(titles(build([FIRST_ROWS, LATER_ROW]).main))- .toEqual([...MAIN_TITLES.slice(0, index), ...MAIN_TITLES.slice(index + 2)]);+ .toEqual(MAIN_TITLES.filter((title) => title !== FIRST_ROWS_TITLE));});it("enables the split submenu while any of its rows is enabled", () => {diff --git a/apps/client/src/menus/table_context_menu.ts b/apps/client/src/menus/table_context_menu.tsindex efae01adfc..82a0625d17 100644--- a/apps/client/src/menus/table_context_menu.ts+++ b/apps/client/src/menus/table_context_menu.ts@@ -57,9 +57,6 @@ export function buildTableMenuSections(toggleItem(t("table_context_menu.set_header_up_to_row"), "bx bx-arrow-to-top","triliumSetTableHeaderUpToRow")].find((item) => item.enabled);- const headerGroup: MenuItem<CommandNames>[] = headerItem- ? [headerItem, { kind: "separator" }]- : [];const splitItems = [commandItem(t("table_context_menu.split_vertically"), "bx bx-reflect-vertical","splitTableCellVertically"),@@ -93,7 +90,7 @@ export function buildTableMenuSections(commandItem(t("table_context_menu.insert_columns_right"),"bx bx-horizontal-right", "triliumInsertTableColumnsRight"),{ kind: "separator" },- ...headerGroup,+ ...(headerItem ? [headerItem] : []),commandItem(t("table_context_menu.merge_cells"), "bx bx-border-outer","mergeTableCells"),{diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex 8b454a9b34..cc20f79b60 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -3523,7 +3523,7 @@"select_row": "Row","select_column": "Column","select_table": "Table",- "set_header_row": "Set as header row",+ "set_header_row": "Set as header","set_header_up_to_row": "Set header up to this row"},"board_view": {diff --git a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/Text/Tables.html b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/Text/Tables.htmlindex 87f65ac8bb..68f3c456b6 100644--- a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/Text/Tables.html+++ b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/Text/Tables.html@@ -32,12 +32,12 @@ src="3_Tables_image.png" width="384" height="100">rows, the same number of rows is inserted.</li><li><em>Insert column to the left</em> and <em>Insert column to the right</em> workthe same way for columns.</li>- <li>Since v0.107.0, <em>Set as header row</em> or <em>Set header up to this row</em>,+ <li>Since v0.107.0, <em>Set as header</em> or <em>Set header up to this row</em>,depending on the selection, turns rows into header rows, which always startat the top of the table:<ul>- <li><em>Set as header row</em> shows when the selection starts at the first- row, and makes every selected row a header row.</li>+ <li><em>Set as header</em> shows when the selection starts at the first row,+ and makes every selected row a header row.</li><li><em>Set header up to this row</em> shows when the selection is in a singlerow below the first, and makes that row and every row above it header rows.</li><li>Neither shows when the selection spans several rows below the first.</li>diff --git a/docs/User Guide/User Guide/Note Types/Text/Tables.md b/docs/User Guide/User Guide/Note Types/Text/Tables.mdindex fd0deabf0e..f9407a9e6b 100644--- a/docs/User Guide/User Guide/Note Types/Text/Tables.md+++ b/docs/User Guide/User Guide/Note Types/Text/Tables.md@@ -25,8 +25,8 @@ Since v0.106.0, right-clicking anywhere inside a table opens a context menu with* _Insert row above_ and _Insert row below_ insert a blank row next to the row of the current cell. When the selection spans multiple rows, the same number of rows is inserted.* _Insert column to the left_ and _Insert column to the right_ work the same way for columns.-* Since v0.107.0, _Set as header row_ or _Set header up to this row_, depending on the selection, turns rows into header rows, which always start at the top of the table:- * _Set as header row_ shows when the selection starts at the first row, and makes every selected row a header row.+* Since v0.107.0, _Set as header_ or _Set header up to this row_, depending on the selection, turns rows into header rows, which always start at the top of the table:+ * _Set as header_ shows when the selection starts at the first row, and makes every selected row a header row.* _Set header up to this row_ shows when the selection is in a single row below the first, and makes that row and every row above it header rows.* Neither shows when the selection spans several rows below the first.* A check mark shows that the rows are already header rows. Choosing the item again turns them, and every header row below them, back into regular rows. For example, in a table with five header rows, choosing _Set header up to this row_ on the third row leaves only the first two as header rows.