aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx
diff options
context:
space:
mode:
authorNathan-SR <144961007+Nathan-SR@users.noreply.github.com>2024-05-14 16:25:36 -0400
committerNathan-SR <144961007+Nathan-SR@users.noreply.github.com>2024-05-14 16:25:36 -0400
commit04b650dee835be1a4446a2499b8acd525b92daf9 (patch)
tree68a13507d13b45c5059120663e78127c7a45c2b7 /src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx
parentb27056fc67c654dea72338f928cd69026a501c0f (diff)
removed logs; added some comments; added safeguard against duplicate fields
Diffstat (limited to 'src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx')
-rw-r--r--src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx b/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx
index 794d5d8ac..58ac4e45d 100644
--- a/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx
+++ b/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx
@@ -25,8 +25,6 @@ import { FInfo } from '../../../documents/Documents';
export interface SchemaColumnHeaderProps {
Document: Doc;
autoFocus?: boolean;
- oneLine?: boolean; // whether all input should fit on one line vs allowing textare multiline inputs
- allowCRs?: boolean; // allow carriage returns in text input (othewrise CR ends the edit)
columnKeys: string[];
columnWidths: number[];
columnIndex: number;
@@ -123,20 +121,20 @@ export class SchemaColumnHeader extends ObservableReactComponent<SchemaColumnHea
}}>
<EditableView
ref={r => this._props.autoFocus && r?.setIsFocused(true)}
- oneLine={this._props.oneLine}
- allowCRs={this._props.allowCRs}
+ oneLine={true}
+ allowCRs={false}
contents={undefined}
fieldContents={fieldProps}
editing={undefined}
- isColHeader={true}
+ isColHeader={true} // tells the EditableView to display the fieldKey itself, and not its value
GetValue={() => {console.log(this.fieldKey); return this.fieldKey}}
SetValue={undoable((value: string, shiftKey?: boolean, enterKey?: boolean) => {
- if (shiftKey && enterKey) {
+ if (shiftKey && enterKey) { // if shift & enter, set value of each cell in column
this.setColumnValues(value, value);
this._props.finishEdit?.();
return true;
}
- this._props.finishEdit?.();
+ this._props.finishEdit?.(); // else save new value to header field
return true;
}, 'edit column header')}
/>