aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorljungster <parkerljung@gmail.com>2022-08-05 08:30:35 -0500
committerljungster <parkerljung@gmail.com>2022-08-05 08:30:35 -0500
commit1638527259a072dfc2ab286bd27bbb1751e8434e (patch)
tree41e814ebef46cd62654a6851fce52f3dcc7a5d24
parentbb02d3a052efdbf25d1069059a92b7a9d9cc1708 (diff)
stashing to look at master
-rw-r--r--src/client/views/collections/CollectionNoteTakingView.tsx27
-rw-r--r--src/client/views/collections/CollectionNoteTakingViewColumn.tsx4
2 files changed, 29 insertions, 2 deletions
diff --git a/src/client/views/collections/CollectionNoteTakingView.tsx b/src/client/views/collections/CollectionNoteTakingView.tsx
index 9519e9aaa..3e2b8b762 100644
--- a/src/client/views/collections/CollectionNoteTakingView.tsx
+++ b/src/client/views/collections/CollectionNoteTakingView.tsx
@@ -74,7 +74,8 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti
this.layoutDoc._columnHeaders = new List<SchemaHeaderField>([new SchemaHeaderField('New Column')]);
this.columnStartXCoords = [0]
// add all of the docs that have not been added to a column to this new column
- } else {
+ }
+ else {
const numHeaders = this.columnHeaders.length
this.resizeColumns(numHeaders)
}
@@ -457,6 +458,27 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti
return true;
}
+ // Used in CollectionNoteTakingView to delete a column when the user clicks the delete button
+ // @action
+ // @undoBatch
+ // deleteColumn = (headingObject: SchemaHeaderField | undefined, docList: Doc[]) => {
+ // if (!this.columnHeaders) {
+ // return
+ // }
+ // if (headingObject) {
+ // const index = this.columnHeaders.indexOf(headingObject);
+ // const newIndex = index == 0 ? 1 : index - 1
+ // const newHeader = this.columnHeaders[newIndex];
+ // docList.forEach(d => d[this.pivotField] = newHeader.heading.toString())
+ // // this.props.columnHeaders.splice(index, 1);
+ // const newHeaders = this.columnHeaders;
+ // newHeaders.splice(index, 1);
+ // const test = this.layoutDoc._columnHeaders;
+ // this.columnHeaders = newHeaders;
+ // this.resizeColumns(newHeaders.length)
+ // }
+ // }
+
// when dropping outside of the current noteTaking context (like a new tab, freeform view, etc...)
@undoBatch
@action
@@ -554,12 +576,13 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti
// called when adding a new columnHeader
@action
+ @undoBatch
addGroup = (value: string) => {
if (value && this.columnHeaders) {
- this.resizeColumns(this.columnHeaders.length + 1)
const schemaHdrField = new SchemaHeaderField(value);
this.columnHeaders.push(schemaHdrField);
DocUtils.addFieldEnumerations(undefined, this.pivotField, [{ title: value, _backgroundColor: "schemaHdrField.color" }]);
+ this.resizeColumns(this.columnHeaders.length + 1)
return true;
}
return false;
diff --git a/src/client/views/collections/CollectionNoteTakingViewColumn.tsx b/src/client/views/collections/CollectionNoteTakingViewColumn.tsx
index bdcb9c399..0ee5985bb 100644
--- a/src/client/views/collections/CollectionNoteTakingViewColumn.tsx
+++ b/src/client/views/collections/CollectionNoteTakingViewColumn.tsx
@@ -144,6 +144,7 @@ export class CollectionNoteTakingViewColumn extends React.Component<CSVFieldColu
}
@action
+ @undoBatch
deleteColumn = () => {
if (!this.props.columnHeaders) {
return
@@ -154,6 +155,9 @@ export class CollectionNoteTakingViewColumn extends React.Component<CSVFieldColu
const newHeader = this.props.columnHeaders[newIndex];
this.props.docList.forEach(d => d[this.props.pivotField] = newHeader.heading.toString())
this.props.columnHeaders.splice(index, 1);
+ // const newHeaders = this.props.columnHeaders;
+ // newHeaders.splice(index, 1);
+ // this.props.columnHeaders = newHeaders;
this.props.resizeColumns(this.props.columnHeaders.length)
}
}