diff options
author | anika-ahluwalia <anika.ahluwalia@gmail.com> | 2020-06-21 19:45:30 -0500 |
---|---|---|
committer | anika-ahluwalia <anika.ahluwalia@gmail.com> | 2020-06-21 19:45:30 -0500 |
commit | ebef44ab26ea28e59f1106bef9d64729e791509a (patch) | |
tree | 41dfbe37a2c237c8a9ccd4169b42cab43ad6b062 /src/client/util/SelectionManager.ts | |
parent | 635c52d89ef1a8002f898b1329c0d3f830f1b4b7 (diff) | |
parent | 9786144f5930492e8d96978d3b0a85088c28623c (diff) |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into anika_schema_view
Diffstat (limited to 'src/client/util/SelectionManager.ts')
-rw-r--r-- | src/client/util/SelectionManager.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/client/util/SelectionManager.ts b/src/client/util/SelectionManager.ts index 05515e502..eb905d237 100644 --- a/src/client/util/SelectionManager.ts +++ b/src/client/util/SelectionManager.ts @@ -10,13 +10,17 @@ export namespace SelectionManager { @observable IsDragging: boolean = false; SelectedDocuments: ObservableMap<DocumentView, boolean> = new ObservableMap(); - + clearSelection() { + if (window.getSelection) { window.getSelection()?.removeAllRanges(); } + else if (document.getSelection()) { document.getSelection()?.empty(); } + } @action SelectDoc(docView: DocumentView, ctrlPressed: boolean): void { // if doc is not in SelectedDocuments, add it if (!manager.SelectedDocuments.get(docView)) { if (!ctrlPressed) { this.DeselectAll(); + this.clearSelection(); } manager.SelectedDocuments.set(docView, true); |