aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortschicke-brown <tyler_schicke@brown.edu>2019-05-21 18:36:55 -0400
committerGitHub <noreply@github.com>2019-05-21 18:36:55 -0400
commitf16a5c689fb075ad232e2c076a47030f6080d1c0 (patch)
tree7d55626e1cd78722c9ec297f9efce8de0f6c7265 /src
parent3020cfcf20d187c976a7f386a95bec0c41cba06b (diff)
parentd8e75e672f1384dc68af1f63aabd68d8b6820adb (diff)
Merge pull request #147 from browngraphicslab/cont_menu_ui
Fixes to search bar
Diffstat (limited to 'src')
-rw-r--r--src/client/util/DocumentManager.ts19
-rw-r--r--src/client/views/MainView.tsx20
-rw-r--r--src/client/views/SearchBox.tsx4
-rw-r--r--src/server/index.ts1
4 files changed, 37 insertions, 7 deletions
diff --git a/src/client/util/DocumentManager.ts b/src/client/util/DocumentManager.ts
index fefd3a972..cf470a015 100644
--- a/src/client/util/DocumentManager.ts
+++ b/src/client/util/DocumentManager.ts
@@ -125,12 +125,23 @@ export class DocumentManager {
}
let docView = DocumentManager.Instance.getDocumentView(doc);
if (docView) {
- docView.props.Document.libraryBrush = true;
- docView.props.focus(docView.props.Document);
+ console.log("navigating to linked doc...");
+ // using makecopy as a flag for splitting linked to doc to the right...can change later if needed
+ if (makeCopy) {
+ if (!contextDoc) {
+ const actualDoc = Doc.MakeAlias(docDelegate);
+ actualDoc.libraryBrush = true;
+ (dockFunc || CollectionDockingView.Instance.AddRightSplit)(actualDoc);
+ }
+ }
+ else {
+ docView.props.Document.libraryBrush = true;
+ docView.props.focus(docView.props.Document);
+ }
} else {
if (!contextDoc) {
- const actualDoc = docDelegate ? (makeCopy ? Doc.MakeCopy(docDelegate) : docDelegate) : Doc.MakeDelegate(doc);
- actualDoc.libraryBrush = true;
+ const actualDoc = Doc.MakeAlias(docDelegate);
+
(dockFunc || CollectionDockingView.Instance.AddRightSplit)(actualDoc);
} else {
let contextView = DocumentManager.Instance.getDocumentView(contextDoc);
diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx
index 6169466bc..aa34a12ed 100644
--- a/src/client/views/MainView.tsx
+++ b/src/client/views/MainView.tsx
@@ -40,6 +40,7 @@ export class MainView extends React.Component {
@observable private _workspacesShown: boolean = false;
@observable public pwidth: number = 0;
@observable public pheight: number = 0;
+ private searchbox: React.RefObject<HTMLDivElement>;
@computed private get mainContainer(): Opt<Doc> {
return FieldValue(Cast(CurrentUserUtils.UserDocument.activeWorkspace, Doc));
@@ -56,6 +57,7 @@ export class MainView extends React.Component {
constructor(props: Readonly<{}>) {
super(props);
MainView.Instance = this;
+ this.searchbox = React.createRef();
// causes errors to be generated when modifying an observable outside of an action
configure({ enforceActions: "observed" });
if (window.location.search.includes("readonly")) {
@@ -260,17 +262,33 @@ export class MainView extends React.Component {
return [
<button className="clear-db-button" key="clear-db" onClick={e => e.shiftKey && e.altKey && DocServer.DeleteDatabase()}>Clear Database</button>,
<div id="toolbar" key="toolbar">
+ <button className="toolbar-button round-button" title="Search" onClick={this.toggleSearch}><FontAwesomeIcon icon="search" size="sm" /></button>
<button className="toolbar-button round-button" title="Undo" onClick={() => UndoManager.Undo()}><FontAwesomeIcon icon="undo-alt" size="sm" /></button>
<button className="toolbar-button round-button" title="Redo" onClick={() => UndoManager.Redo()}><FontAwesomeIcon icon="redo-alt" size="sm" /></button>
<button className="toolbar-button round-button" title="Ink" onClick={() => InkingControl.Instance.toggleDisplay()}><FontAwesomeIcon icon="pen-nib" size="sm" /></button>
</div >,
- <div className="main-searchDiv" key="search" style={{ top: '34px', right: '1px', position: 'absolute' }} > <SearchBox /> </div>,
+ <div ref={this.searchbox} className="main-searchDiv" key="search" style={{ top: '34px', right: '1px', position: 'absolute' }} > <SearchBox /> </div>,
<div className="main-buttonDiv" key="logout" style={{ bottom: '0px', right: '1px', position: 'absolute' }} ref={logoutRef}>
<button onClick={() => request.get(DocServer.prepend(RouteStore.logout), emptyFunction)}>Log Out</button></div>
];
}
+ @action
+ toggleSearch = () => {
+ const sb = this.searchbox.current;
+ if (sb !== null) {
+ console.log("toggle search")
+ if (sb.style.display === "none") {
+ sb.style.display = "block";
+ }
+ else {
+ sb.style.display = "none";
+ }
+ }
+
+ }
+
render() {
return (
<div id="main-div">
diff --git a/src/client/views/SearchBox.tsx b/src/client/views/SearchBox.tsx
index 0ec1a6758..911fc8d9c 100644
--- a/src/client/views/SearchBox.tsx
+++ b/src/client/views/SearchBox.tsx
@@ -171,8 +171,8 @@ export class SearchBox extends React.Component {
<input value={this.searchString} onChange={this.onChange} type="text" placeholder="Search..."
className="searchBox-barChild searchBox-input" onKeyPress={this.enter}
style={{ width: this._resultsOpen ? "500px" : undefined }} />
- <button className="searchBox-barChild searchBox-filter" onClick={this.toggleFilterDisplay}>Filter</button>
- <FontAwesomeIcon icon="search" size="lg" className="searchBox-barChild searchBox-submit" />
+ {/* <button className="searchBox-barChild searchBox-filter" onClick={this.toggleFilterDisplay}>Filter</button> */}
+ {/* <FontAwesomeIcon icon="search" size="lg" className="searchBox-barChild searchBox-submit" /> */}
</div>
{this._resultsOpen ? (
<div className="searchBox-results">
diff --git a/src/server/index.ts b/src/server/index.ts
index 5a534afae..deb3c1bd6 100644
--- a/src/server/index.ts
+++ b/src/server/index.ts
@@ -350,6 +350,7 @@ function setField(socket: Socket, newValue: Transferable) {
if (newValue.type === Types.Text) {
Search.Instance.updateDocument({ id: newValue.id, data: (newValue as any).data });
console.log("set field");
+ console.log("checking in");
}
}