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
feat(views/table): update new column in context menu to support relations also
Elian Dorand487da0b2fbf
diff --git a/apps/client/src/menus/context_menu.ts b/apps/client/src/menus/context_menu.tsindex aefe7bf302..4411db9dcc 100644--- a/apps/client/src/menus/context_menu.ts+++ b/apps/client/src/menus/context_menu.ts@@ -26,6 +26,11 @@ export interface MenuCommandItem<T> {title: string;command?: T;type?: string;+ /**+ * The icon to display in the menu item.+ *+ * If not set, no icon is displayed and the item will appear shifted slightly to the left if there are other items with icons. To avoid this, use `bx bx-empty`.+ */uiIcon?: string;badges?: MenuItemBadge[];templateNoteId?: string;diff --git a/apps/client/src/widgets/view_widgets/table_view/context_menu.ts b/apps/client/src/widgets/view_widgets/table_view/context_menu.tsindex a63ab21eda..53a6364d44 100644--- a/apps/client/src/widgets/view_widgets/table_view/context_menu.ts+++ b/apps/client/src/widgets/view_widgets/table_view/context_menu.ts@@ -139,11 +139,13 @@ function showHeaderContextMenu(_e: Event, tabulator: Tabulator) {uiIcon: "bx bx-empty",items: buildColumnItems(tabulator)},+ { title: "----" },{title: t("table_view.new-column"),- uiIcon: "bx bx-columns",- handler: () => getParentComponent(e)?.triggerCommand("addNewTableColumn", {})+ uiIcon: "bx bx-empty",+ enabled: false},+ ...buildInsertSubmenu(e)],selectMenuItemHandler() {},x: e.pageX,@@ -246,7 +248,7 @@ function buildColumnItems(tabulator: Tabulator) {return items;}-function buildInsertSubmenu(e: MouseEvent, referenceColumn: ColumnComponent, direction: "before" | "after"): MenuItem<unknown>[] {+function buildInsertSubmenu(e: MouseEvent, referenceColumn?: ColumnComponent, direction?: "before" | "after"): MenuItem<unknown>[] {return [{title: t("table_view.new-column-label"),diff --git a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Basic Concepts and Features/Notes/Note List/Table View.html b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Basic Concepts and Features/Notes/Note List/Table View.htmlindex 92c9f3e7cc..629b15342a 100644--- a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Basic Concepts and Features/Notes/Note List/Table View.html+++ b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Basic Concepts and Features/Notes/Note List/Table View.html@@ -46,7 +46,8 @@<li data-list-item-id="e3bb3951707ab03fccab11c9b83d8f7a1">Press <em>Add new column</em> at the bottom of the table.</li><li data-list-item-id="e59ac48e5d7f2f1119d27db5b01eb0635">Right click on an existing column and select Add column to the left/right.</li><li- data-list-item-id="e681ba5bf3901016423216783a17f13f8">Right click on the empty space of the column header and select <em>New column</em>.</li>+ data-list-item-id="e681ba5bf3901016423216783a17f13f8">Right click on the empty space of the column header and select <em>Label</em> or <em>Relation</em> in+ the <em>New column </em>section.</li></ul><h3>Adding new rows</h3><p>Each row is actually a note that is a child of the Collection note.</p>diff --git a/docs/User Guide/User Guide/Basic Concepts and Features/Notes/Note List/Table View.md b/docs/User Guide/User Guide/Basic Concepts and Features/Notes/Note List/Table View.mdindex d2a59b3ede..9e16684b65 100644--- a/docs/User Guide/User Guide/Basic Concepts and Features/Notes/Note List/Table View.md+++ b/docs/User Guide/User Guide/Basic Concepts and Features/Notes/Note List/Table View.md@@ -35,7 +35,7 @@ To create a new column, either:* Press _Add new column_ at the bottom of the table.* Right click on an existing column and select Add column to the left/right.-* Right click on the empty space of the column header and select _New column_.+* Right click on the empty space of the column header and select _Label_ or _Relation_ in the _New column_ section.### Adding new rows