diff options
-rw-r--r-- | src/client/views/collections/collectionSchema/CollectionSchemaView.tsx | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx index d92ccc344..839a5f911 100644 --- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx +++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx @@ -631,13 +631,20 @@ export class CollectionSchemaView extends CollectionSubView() { }; @action - closeFilterMenu = () => { + closeFilterMenu = (setValue: boolean) => { + if (setValue) { + if (this._filterValue !== '') { + Doc.setDocFilter(this.Document, this.columnKeys[this._filterColumnIndex!], this._filterValue, 'check', false, undefined, false); + } else { + this.removeFieldFilters(this.columnKeys[this._filterColumnIndex!]); + } + } this._filterColumnIndex = undefined; }; openContextMenu = (x: number, y: number, index: number) => { this.closeColumnMenu(); - this.closeFilterMenu(); + this.closeFilterMenu(false); ContextMenu.Instance.clearItems(); ContextMenu.Instance.addItem({ description: 'Change field', @@ -682,15 +689,10 @@ export class CollectionSchemaView extends CollectionSubView() { onFilterKeyDown = (e: React.KeyboardEvent) => { switch (e.key) { case 'Enter': - if (this._filterValue !== '') { - Doc.setDocFilter(this.Document, this.columnKeys[this._filterColumnIndex!], this._filterValue, 'check', false, undefined, false); - } else { - this.removeFieldFilters(this.columnKeys[this._filterColumnIndex!]); - } - this.closeFilterMenu(); + this.closeFilterMenu(true); break; case 'Escape': - this.closeFilterMenu(); + this.closeFilterMenu(false); break; } }; @@ -863,7 +865,7 @@ export class CollectionSchemaView extends CollectionSubView() { className="schema-column-menu-button" onPointerDown={action(e => { e.stopPropagation(); - this.closeFilterMenu(); + this.closeFilterMenu(true); })}> done </div> |