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
fix(views/table): wrong position when renaming column
Elian Doran34f1a8476985
diff --git a/apps/client/src/widgets/view_widgets/table_view/col_editing.ts b/apps/client/src/widgets/view_widgets/table_view/col_editing.tsindex 7ee141e66c..4fdc8b6ab0 100644--- a/apps/client/src/widgets/view_widgets/table_view/col_editing.ts+++ b/apps/client/src/widgets/view_widgets/table_view/col_editing.ts@@ -81,14 +81,15 @@ export default class TableColumnEditing extends Component {this.api.blockRedraw();if (this.existingAttributeToEdit && this.existingAttributeToEdit.name !== name) {- attributes.removeOwnedLabelByName(this.parentNote, this.existingAttributeToEdit.name);-const oldName = this.existingAttributeToEdit.name.split(":")[1];const newName = name.split(":")[1];await renameColumn(this.parentNote.noteId, type, oldName, newName);}attributes.setLabel(this.parentNote.noteId, name, value);+ if (this.existingAttributeToEdit) {+ attributes.removeOwnedLabelByName(this.parentNote, this.existingAttributeToEdit.name);+ }this.api.restoreRedraw();}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 75e0a82e41..951d1ba25b 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@@ -92,6 +92,7 @@ function showColumnContextMenu(_e: UIEvent, column: ColumnComponent, tabulator:uiIcon: "bx bx-edit",enabled: !!column.getField() && column.getField() !== "title",handler: () => getParentComponent(e)?.triggerCommand("addNewTableColumn", {+ referenceColumn: column,columnToEdit: column})},