aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2020-06-21 11:51:40 -0400
committerBob Zeleznik <zzzman@gmail.com>2020-06-21 11:51:40 -0400
commit9786144f5930492e8d96978d3b0a85088c28623c (patch)
tree2202ae7c0c2fc7a936246de574ed3410b01317be
parentbc8672634f8ec2fa0d60bca3fb01a6943132f99c (diff)
fixed pasting of selected text from one note to a new note.
-rw-r--r--src/client/util/SelectionManager.ts6
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);