aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/search
diff options
context:
space:
mode:
authorTyler Schicke <tyler_schicke@brown.edu>2019-07-03 17:29:31 -0400
committerTyler Schicke <tyler_schicke@brown.edu>2019-07-03 17:29:31 -0400
commitcdac71db46488a868b67572af5351eac2fde3665 (patch)
treec7e7011336de6932b5efacbc8c6cc718f5dff2c1 /src/client/views/search
parent93c1fa1d81ac8df5dd338342801ff9ac2aaaf410 (diff)
Debug commit
Diffstat (limited to 'src/client/views/search')
-rw-r--r--src/client/views/search/FilterBox.tsx2
-rw-r--r--src/client/views/search/SearchItem.tsx19
2 files changed, 17 insertions, 4 deletions
diff --git a/src/client/views/search/FilterBox.tsx b/src/client/views/search/FilterBox.tsx
index 23a1b31d8..02789fb27 100644
--- a/src/client/views/search/FilterBox.tsx
+++ b/src/client/views/search/FilterBox.tsx
@@ -58,7 +58,7 @@ export class FilterBox extends React.Component {
componentDidMount = () => {
document.addEventListener("pointerdown", (e) => {
if (!e.defaultPrevented && e.timeStamp !== this._pointerTime) {
- SearchBox.Instance.closeSearch();
+ // SearchBox.Instance.closeSearch();
}
});
}
diff --git a/src/client/views/search/SearchItem.tsx b/src/client/views/search/SearchItem.tsx
index 129d71b3b..7d45f9dfb 100644
--- a/src/client/views/search/SearchItem.tsx
+++ b/src/client/views/search/SearchItem.tsx
@@ -7,7 +7,7 @@ import { observer } from "mobx-react";
import { Doc, DocListCast, HeightSym, WidthSym } from "../../../new_fields/Doc";
import { Id } from "../../../new_fields/FieldSymbols";
import { Cast, NumCast, StrCast } from "../../../new_fields/Types";
-import { emptyFunction, returnFalse, returnOne } from "../../../Utils";
+import { emptyFunction, returnFalse, returnOne, Utils } from "../../../Utils";
import { DocTypes } from "../../documents/Documents";
import { DocumentManager } from "../../util/DocumentManager";
import { SetupDrag } from "../../util/DragManager";
@@ -21,6 +21,7 @@ import { DocumentView } from "../nodes/DocumentView";
import { SearchBox } from "./SearchBox";
import "./SearchItem.scss";
import "./SelectorContextMenu.scss";
+import { ContextMenu } from "../ContextMenu";
export interface SearchItemProps {
doc: Doc;
@@ -178,7 +179,7 @@ export class SearchItem extends React.Component<SearchItemProps> {
}
@action
- pointerDown = (e: React.PointerEvent) => SearchBox.Instance.openSearch(e)
+ pointerDown = (e: React.PointerEvent) => { e.preventDefault; e.button === 0 && SearchBox.Instance.openSearch(e); }
highlightDoc = (e: React.PointerEvent) => {
if (this.props.doc.type === DocTypes.LINK) {
@@ -214,9 +215,21 @@ export class SearchItem extends React.Component<SearchItemProps> {
}
}
+ onContextMenu = (e: React.MouseEvent) => {
+ e.preventDefault();
+ e.stopPropagation();
+ ContextMenu.Instance.clearItems();
+ ContextMenu.Instance.addItem({
+ description: "Copy ID", event: () => {
+ Utils.CopyText(this.props.doc[Id]);
+ }
+ });
+ ContextMenu.Instance.displayMenu(e.clientX, e.clientY);
+ }
+
render() {
return (
- <div className="search-overview" onPointerDown={this.pointerDown}>
+ <div className="search-overview" onPointerDown={this.pointerDown} onContextMenu={this.onContextMenu}>
<div className="search-item" onPointerEnter={this.highlightDoc} onPointerLeave={this.unHighlightDoc} ref={this.collectionRef} id="result"
onClick={this.onClick} onPointerDown={this.pointerDown} >
<div className="main-search-info">