aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2020-06-28 14:13:39 -0400
committerBob Zeleznik <zzzman@gmail.com>2020-06-28 14:13:39 -0400
commit6490c93133151a08f65cce16fd2b56152539d636 (patch)
treeda26c857f791680d5be03ae64f09f48d6db97981 /src
parenta69a0c13df09d846105aec40218ddf187c231c7b (diff)
re-fixed copy/paste from one text box to a new text box by moving clearSelection() from SelectDoc to setPreviewCursor. Otherwise, clicking on an unselected text box wouldn't set the insertion point.
Diffstat (limited to 'src')
-rw-r--r--src/client/util/SelectionManager.ts5
-rw-r--r--src/client/views/collections/collectionFreeForm/MarqueeView.tsx7
2 files changed, 5 insertions, 7 deletions
diff --git a/src/client/util/SelectionManager.ts b/src/client/util/SelectionManager.ts
index 0f204bba4..024532f90 100644
--- a/src/client/util/SelectionManager.ts
+++ b/src/client/util/SelectionManager.ts
@@ -12,17 +12,12 @@ 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);
diff --git a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx
index 1bc7c6fb5..099859109 100644
--- a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx
+++ b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx
@@ -20,8 +20,6 @@ import { CollectionView } from "../CollectionView";
import MarqueeOptionsMenu from "./MarqueeOptionsMenu";
import "./MarqueeView.scss";
import React = require("react");
-import { DateField } from "../../../../fields/DateField";
-import { DocServer } from "../../../DocServer";
interface MarqueeViewProps {
getContainerTransform: () => Transform;
@@ -260,6 +258,10 @@ export class MarqueeView extends React.Component<SubCollectionViewProps & Marque
e.preventDefault();
}
}
+ clearSelection() {
+ if (window.getSelection) { window.getSelection()?.removeAllRanges(); }
+ else if (document.getSelection()) { document.getSelection()?.empty(); }
+ }
setPreviewCursor = action((x: number, y: number, drag: boolean) => {
if (drag) {
@@ -275,6 +277,7 @@ export class MarqueeView extends React.Component<SubCollectionViewProps & Marque
this._downX = x;
this._downY = y;
PreviewCursor.Show(x, y, this.onKeyPress, this.props.addLiveTextDocument, this.props.getTransform, this.props.addDocument, this.props.nudge);
+ this.clearSelection();
}
});