aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/views/collections/collectionSchema/CollectionSchemaView.tsx20
-rw-r--r--src/client/views/collections/collectionSchema/SchemaTableCell.tsx5
2 files changed, 15 insertions, 10 deletions
diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
index 96d7627a3..f59d562dd 100644
--- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
+++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
@@ -232,14 +232,14 @@ export class CollectionSchemaView extends CollectionSubView() {
break;
case 'ArrowRight':
if (this._selectedCells) {
- ++this._selectedCol;
+ this._selectedCol = Math.min(this._colEles.length - 1, this._selectedCol + 1);
} else if (this._selectedDocs.length > 0) {
this.selectCell(this._selectedDocs[0], 0, false, false);
}
break;
case 'ArrowLeft':
if (this._selectedCells) {
- --this._selectedCol;
+ this._selectedCol = Math.max(0, this._selectedCol - 1);
} else if (this._selectedDocs.length > 0) {
this.selectCell(this._selectedDocs[0], 0, false, false);
}
@@ -436,7 +436,6 @@ export class CollectionSchemaView extends CollectionSubView() {
this.deselectAllCells();
};
- //This method is called in SchemaRowBox.select, which is never called anywhere
selectRows = (doc: Doc, lastSelected: Doc) => {
const index = this.rowIndex(doc);
const lastSelectedRow = this.rowIndex(lastSelected);
@@ -451,24 +450,27 @@ export class CollectionSchemaView extends CollectionSubView() {
@action
selectCell = (doc: Doc, index: number, shiftKey: boolean, ctrlKey: boolean) => {
- console.log(ctrlKey);
(!shiftKey && !ctrlKey) && this.clearSelection();
!this._selectedCells && (this._selectedCells = []);
this._selectedCells.push(doc);
- this._selectedCol = index;
if (!this) return;
const lastSelected = Array.from(this._selectedDocs).lastElement();
- if (shiftKey && lastSelected) this.selectRows(doc, lastSelected);
+ if (shiftKey && lastSelected && !this._selectedDocs.includes(doc)) this.selectRows(doc, lastSelected);
+ else if (ctrlKey && lastSelected && this._selectedDocs.includes(doc)) {
+ console.log("removed");
+ SelectionManager.DeselectView(DocumentManager.Instance.getFirstDocumentView(doc))
+ this.deselectCell(doc);
+ }
else if (ctrlKey) {this.addDocToSelection(doc, true, this.rowIndex(doc)); console.log("2")}
else this.addDocToSelection(doc, false, this.rowIndex(doc));
-
+
+ this._selectedCol = index;
};
@action
deselectCell = (doc: Doc) => {
- if (this._selectedCells)
- this._selectedCells = this._selectedCells.filter(d => d !== doc);
+ this._selectedCells && (this._selectedCells = this._selectedCells.filter(d => d !== doc));
};
@action
diff --git a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx
index 775a8ce05..6a75ad6c5 100644
--- a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx
+++ b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx
@@ -185,7 +185,10 @@ export class SchemaTableCell extends ObservableReactComponent<SchemaTableCellPro
onPointerDown={action(e => {
const shift: boolean = e.shiftKey;
const ctrl: boolean = e.ctrlKey;
- !this.selected && this._props.selectCell(this._props.Document, this._props.col, shift, ctrl)}
+ if (this.selected && ctrl) {
+ this._props.selectCell(this._props.Document, this._props.col, shift, ctrl);
+ e.stopPropagation();
+ } else !this.selected && this._props.selectCell(this._props.Document, this._props.col, shift, ctrl)}
)}
style={{ padding: this._props.padding, maxWidth: this._props.maxWidth?.(), width: this._props.columnWidth() || undefined, border: this.selected ? `solid 2px ${Colors.MEDIUM_BLUE}` : undefined }}>
{this.content}