aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionNoteTakingView.tsx
diff options
context:
space:
mode:
authorljungster <parkerljung@gmail.com>2022-08-22 11:03:31 -0400
committerljungster <parkerljung@gmail.com>2022-08-22 11:03:31 -0400
commit3cf60a6118a5994e43c8ac9d00092992d6c83700 (patch)
tree84175cf351fb583c6c741c772e8223965ce8dfd5 /src/client/views/collections/CollectionNoteTakingView.tsx
parentb7c2e1081e4efe7167a86fb1d9f641bea8b93bba (diff)
can't add column if name in use
Diffstat (limited to 'src/client/views/collections/CollectionNoteTakingView.tsx')
-rw-r--r--src/client/views/collections/CollectionNoteTakingView.tsx9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/client/views/collections/CollectionNoteTakingView.tsx b/src/client/views/collections/CollectionNoteTakingView.tsx
index 9e40356d6..16fefc55a 100644
--- a/src/client/views/collections/CollectionNoteTakingView.tsx
+++ b/src/client/views/collections/CollectionNoteTakingView.tsx
@@ -587,10 +587,15 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti
// addGroup is called when adding a new columnHeader, adding a SchemaHeaderField to our list of
// columnHeaders and resizing the existing columns to make room for our new one.
- @undoBatch
@action
@undoBatch
addGroup = (value: string) => {
+ for (const header of this.columnHeaders) {
+ if (header.heading == value) {
+ alert('You cannot use an existing column name. Please try a new column name');
+ return value;
+ }
+ }
const columnHeaders = Cast(this.props.Document.columnHeaders, listSpec(SchemaHeaderField), null);
const newColWidth = 1 / (this.numGroupColumns + 1);
return value && columnHeaders?.push(new SchemaHeaderField(value, undefined, undefined, newColWidth)) && this.resizeColumns(true, newColWidth, this.columnHeaders.length - 1) ? true : false;
@@ -607,7 +612,7 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti
}
};
- // setColumnStartXCoords is used to update column sizes when using the drag handlers between columns
+ // setColumnStartXCoords is used to update column widths when using the drag handlers between columns
@action
setColumnStartXCoords = (movementXScreen: number, colIndex: number) => {
const movementX = this.props.ScreenToLocalTransform().transformDirection(movementXScreen, 0)[0];