diff options
author | Andy Rickert <andrew_rickert@brown.edu> | 2020-06-17 16:25:30 -0400 |
---|---|---|
committer | Andy Rickert <andrew_rickert@brown.edu> | 2020-06-17 16:25:30 -0400 |
commit | 0e0f65e53d4660aeb959b142e77b49094a3c173c (patch) | |
tree | 52f3761dcbfb4b81295e79af13640ac8834fc257 /src | |
parent | 80383a3705fdf330a41b8c4d9cc43a49f9e19f22 (diff) |
web doc in search
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/search/SearchBox.tsx | 22 | ||||
-rw-r--r-- | src/client/views/search/SearchItem.tsx | 25 |
2 files changed, 38 insertions, 9 deletions
diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx index dd9789a45..8ca3c8e95 100644 --- a/src/client/views/search/SearchBox.tsx +++ b/src/client/views/search/SearchBox.tsx @@ -460,6 +460,20 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc this.buckets!.push(secondbucket); this.bucketcount[2]=0; } + + let webbucket = Docs.Create.StackingDocument([],{ _viewType:CollectionViewType.Stacking,title: this.secondstring }); + webbucket._height=185; + webbucket._viewType === CollectionViewType.Stacking; + webbucket.bucketfield = "webs"; + webbucket.isBucket=true; + const textDoc = Docs.Create.WebDocument(`https://bing.com/search?q=${this.layoutDoc._searchString}`, { + _width: 200, _nativeHeight: 962, _nativeWidth: 800, isAnnotating: false, + title: "bing", UseCors: true + }); + Doc.AddDocToList(this.dataDoc, this.props.fieldKey, webbucket); + Doc.AddDocToList(webbucket, this.props.fieldKey, textDoc); + + } @observable buckets:Doc[]|undefined; @@ -574,7 +588,7 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc basicWordStatus: this._basicWordStatus, icons: this._icons, } - return Docs.Create.SearchDocument({ _autoHeight: true, title: StrCast(this.layoutDoc._searchString), filterQuery: filter, searchQuery: StrCast(this.layoutDoc._searchString) }); + return Docs.Create.SearchDocument({ _autoHeight: true, _viewType: CollectionViewType.Stacking , title: StrCast(this.layoutDoc._searchString), filterQuery: filter, searchQuery: StrCast(this.layoutDoc._searchString) }); } @action.bound @@ -730,6 +744,7 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc result[0].highlighting=highlights.join(", "); Doc.AddDocToList(this.dataDoc, this.props.fieldKey, result[0]); } + this._isSorted[i]="sorted"; } } @@ -744,10 +759,6 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc if (this.buckets![2]){ this.buckets![2]._height = this.bucketcount[2]*55 + 25; } - - // if (this.bucketcount[0]===0){ - // Doc.RemoveDocFromList(this.dataDoc, this.props.fieldKey, this.buckets![0]); - // } } else { @@ -836,6 +847,7 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc if (this._filterOpen) { this.expandSection(`filterhead${this.props.Document[Id]}`); document.getElementById(`filterhead${this.props.Document[Id]}`)!.style.padding = "5"; + console.log(this.props.Document[Id]) } else { this.collapseSection(`filterhead${this.props.Document[Id]}`); diff --git a/src/client/views/search/SearchItem.tsx b/src/client/views/search/SearchItem.tsx index 425e53510..8bbc3180c 100644 --- a/src/client/views/search/SearchItem.tsx +++ b/src/client/views/search/SearchItem.tsx @@ -148,8 +148,7 @@ export class SearchItem extends ViewBoxBaseComponent<FieldViewProps, SearchSchem constructor(props:any){ super(props); - this.rootDoc._viewType= CollectionViewType.Stacking; - this.rootDoc._viewType = CollectionViewType.Stacking; + //this.rootDoc._viewType= CollectionViewType.Stacking; this.props.Document._height=46; if (!this.searchItemTemplate) { // create exactly one presElmentBox template to use by any and all presentations. Doc.UserDoc().searchItemTemplate = new PrefetchProxy(Docs.Create.SearchItemBoxDocument({ title: "search item template", backgroundColor: "transparent", _xMargin: 5, _height: 46, isTemplateDoc: true, isTemplateForField: "data" })); @@ -483,6 +482,24 @@ export class SearchItem extends ViewBoxBaseComponent<FieldViewProps, SearchSchem render() { const doc1 = Cast(this.rootDoc!.anchor1, Doc); const doc2 = Cast(this.rootDoc!.anchor2, Doc); + if (StrCast(this.rootDoc.bucketfield)==="webs"){ + this.props.Document._viewType=CollectionViewType.Stacking; + this.props.Document._chromeStatus='disabled'; + this.props.Document._height=this.rootDoc._height; + return <div> + <CollectionView {...this.props} + Document={this.props.Document} + PanelHeight={this.panelHeight} + whenActiveChanged={emptyFunction} + onClick={undefined} + moveDocument={returnFalse} + childLayoutTemplate={undefined} + addDocument={undefined} + removeDocument={returnFalse} + focus={this.selectElement} + ScreenToLocalTransform={this.getTransform} /> + </div> + } if (this.rootDoc.isBucket === true){ this.props.Document._viewType=CollectionViewType.Stacking; this.props.Document._chromeStatus='disabled'; @@ -532,10 +549,10 @@ export class SearchItem extends ViewBoxBaseComponent<FieldViewProps, SearchSchem <div className="searchItem-type" title="Click to Preview" onPointerDown={this.onPointerDown}>{this.DocumentIcon()}</div> </div> </div> - <div className="searchItem-context" title="Drag as document"> + {/* <div className="searchItem-context" title="Drag as document"> {(doc1 instanceof Doc && doc2 instanceof Doc) && this.rootDoc!.type === DocumentType.LINK ? <LinkContextMenu doc1={doc1} doc2={doc2} /> : this.contextButton} - </div> + </div> */} </div> </div>; } |