aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/util/CurrentUserUtils.ts2
-rw-r--r--src/client/views/search/SearchBox.scss2
-rw-r--r--src/client/views/search/SearchBox.tsx64
-rw-r--r--src/client/views/search/SearchItem.scss10
-rw-r--r--src/client/views/search/SearchItem.tsx20
-rw-r--r--src/server/websocket.ts5
6 files changed, 47 insertions, 56 deletions
diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts
index 40e5a3451..abbcd9352 100644
--- a/src/client/util/CurrentUserUtils.ts
+++ b/src/client/util/CurrentUserUtils.ts
@@ -560,7 +560,7 @@ export class CurrentUserUtils {
doc["tabs-button-search"] = new PrefetchProxy(Docs.Create.ButtonDocument({
_width: 50, _height: 25, title: "Search", _fontSize: 10,
letterSpacing: "0px", textTransform: "unset", borderRounding: "5px 5px 0px 0px", boxShadow: "3px 3px 0px rgb(34, 34, 34)",
- sourcePanel: new PrefetchProxy(Docs.Create.SearchDocument({ title: "search stack", })) as any as Doc,
+ sourcePanel: new PrefetchProxy(Docs.Create.SearchDocument({ title: "sidebar search stack", })) as any as Doc,
searchFileTypes: new List<string>([DocumentType.RTF, DocumentType.IMG, DocumentType.PDF, DocumentType.VID, DocumentType.WEB, DocumentType.SCRIPTING]),
targetContainer: new PrefetchProxy(sidebarContainer) as any as Doc,
lockedPosition: true,
diff --git a/src/client/views/search/SearchBox.scss b/src/client/views/search/SearchBox.scss
index 1e71f8cb0..cd64d71ff 100644
--- a/src/client/views/search/SearchBox.scss
+++ b/src/client/views/search/SearchBox.scss
@@ -83,8 +83,6 @@
.no-result {
width: 500px;
background: $light-color-secondary;
- border-color: $intermediate-color;
- border-bottom-style: solid;
padding: 10px;
height: 50px;
text-transform: uppercase;
diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx
index 1d03e78a9..30d4fd5aa 100644
--- a/src/client/views/search/SearchBox.tsx
+++ b/src/client/views/search/SearchBox.tsx
@@ -45,12 +45,9 @@ library.add(faTimes);
export const searchSchema = createSchema({
id: "string",
Document: Doc,
- sideBar: "boolean",
searchQuery: "string",
});
-//add back filterquery
-
export enum Keys {
TITLE = "title",
AUTHOR = "author",
@@ -190,7 +187,9 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
enter = (e: React.KeyboardEvent) => {
if (e.key === "Enter") {
+ if (this._icons!==this._allIcons){
runInAction(()=>{this.expandedBucket=false});
+ }
this.submitSearch();
}
}
@@ -651,7 +650,7 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
this.getResults(StrCast(this.layoutDoc._searchString));
if (i < this._results.length) result = this._results[i];
if (result) {
- if (StrCast(result[0].type)!=="search"){
+ if (!this.blockedTypes.includes(StrCast(result[0].type))){
if(this.new_buckets[StrCast(result[0].type)]===undefined){
this.new_buckets[StrCast(result[0].type)]=1;
@@ -660,13 +659,9 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
this.new_buckets[StrCast(result[0].type)]=this.new_buckets[StrCast(result[0].type)]+1;
}
const highlights = Array.from([...Array.from(new Set(result[1]).values())]);
-
- result[0].query=StrCast(this.layoutDoc._searchString);
- //Make alias
let lines = new List<string>(result[2]);
result[0].lines=lines
result[0].highlighting=highlights.join(", ");
-
this._visibleDocuments[i] = result[0];
result[0].targetDoc=result[0];
@@ -678,7 +673,7 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
else {
result = this._results[i];
if (result) {
- if (StrCast(result[0].type)!=="search"){
+ if (!this.blockedTypes.includes(StrCast(result[0].type))){
if(this.new_buckets[StrCast(result[0].type)]===undefined){
this.new_buckets[StrCast(result[0].type)]=1;
}
@@ -686,7 +681,6 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
this.new_buckets[StrCast(result[0].type)]=this.new_buckets[StrCast(result[0].type)]+1;
}
const highlights = Array.from([...Array.from(new Set(result[1]).values())]);
- result[0].query=StrCast(this.layoutDoc._searchString);
result[0].lines=new List<string>(result[2]);
result[0].highlighting=highlights.join(", ");
if(i<this._visibleDocuments.length){
@@ -703,22 +697,24 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
if (this._numTotalResults>3 && this.expandedBucket===false){
this.makenewbuckets();
for (let i = 0; i < this._numTotalResults; i++) {
- console.log(this._isSearch[i],this._isSorted[i]);
+ let result = this._results[i];
+ if (!this.blockedTypes.includes(StrCast(result[0].type))){
if (this._isSearch[i] === "search" && (this._isSorted[i]===undefined ||this._isSorted[i]==="placeholder" )) {
- let result = this._results[i];
+ console.log(StrCast(result[0].type));
if (StrCast(result[0].type)=== this.firststring && this.bucketcount[1]<3){
Doc.AddDocToList(this.buckets![1], this.props.fieldKey, result[0]);
this.bucketcount[1]+=1;
+ console.log("1 count")
}
- else if (StrCast(result[0].type)=== this.secondstring && this.bucketcount[1]<3){
+ else if (StrCast(result[0].type)=== this.secondstring && this.bucketcount[2]<3){
Doc.AddDocToList(this.buckets![2], this.props.fieldKey, result[0]);
this.bucketcount[2]+=1;
+ console.log("2 count")
}
else if (this.bucketcount[0]<3){
//Doc.AddDocToList(this.buckets![0], this.props.fieldKey, result[0]);
//this.bucketcount[0]+=1;
const highlights = Array.from([...Array.from(new Set(result[1]).values())]);
- result[0].query=StrCast(this.layoutDoc._searchString);
result[0].lines=new List<string>(result[2]);
result[0].highlighting=highlights.join(", ");
result[0].targetDoc=result[0];
@@ -727,17 +723,18 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
this._isSorted[i]="sorted";
}
}
+ }
console.log(this.bucketcount[0]);
console.log(this.bucketcount[1]);
console.log(this.bucketcount[2]);
if (this.buckets![0]){
- this.buckets![0]._height = this.bucketcount[0]*53 + 21;
+ this.buckets![0]._height = this.bucketcount[0]*55 + 25;
}
if (this.buckets![1]){
- this.buckets![1]._height = this.bucketcount[1]*53 + 21;
+ this.buckets![1]._height = this.bucketcount[1]*55 + 25;
}
if (this.buckets![2]){
- this.buckets![2]._height = this.bucketcount[2]*53 + 21;
+ this.buckets![2]._height = this.bucketcount[2]*55 + 25;
}
// if (this.bucketcount[0]===0){
@@ -749,14 +746,16 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
for (let i = 0; i < this._numTotalResults; i++) {
if ((this._isSorted[i]===undefined ||this._isSorted[i]==="placeholder" )) {
let result = this._results[i];
+ if (!this.blockedTypes.includes(StrCast(result[0].type))){
+
const highlights = Array.from([...Array.from(new Set(result[1]).values())]);
- result[0].query=StrCast(this.layoutDoc._searchString);
result[0].lines=new List<string>(result[2]);
result[0].highlighting=highlights.join(", ");
result[0].targetDoc=result[0];
Doc.AddDocToList(this.dataDoc, this.props.fieldKey, result[0]);
}
}
+ }
}
if (this._maxSearchIndex >= this._numTotalResults) {
@@ -766,6 +765,9 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
}
}
+
+ blockedTypes:string[]= ["preselement","docholder","collection","search","searchitem", "script", "fonticonbox", "button", "label"];
+ blockedFields: string[]= ["layout"];
@computed
get resFull() { return this._numTotalResults <= 8; }
@@ -900,9 +902,10 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
@computed get docButtons() {
const nodeBtns = this.props.Document.nodeButtons;
let width = () => NumCast(this.props.Document._width);
- if (this.rootDoc.sideBar===true){
+ // if (StrCast(this.props.Document.title)==="sidebar search stack"){
width = MainView.Instance.flyoutWidthFunc;
- }
+
+ // }
if (nodeBtns instanceof Doc) {
return <div id="hi" style={{height:"100px",}}>
<DocumentView
@@ -938,9 +941,9 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
@computed get keyButtons() {
const nodeBtns = this.props.Document.keyButtons;
let width = () => NumCast(this.props.Document._width);
- if (this.rootDoc.sideBar===true){
+ // if (StrCast(this.props.Document.title)==="sidebar search stack"){
width = MainView.Instance.flyoutWidthFunc;
- }
+ // }
if (nodeBtns instanceof Doc) {
return <div id="hi" style={{height:"35px",}}>
<DocumentView
@@ -976,9 +979,9 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
@computed get defaultButtons() {
const defBtns = this.props.Document.defaultButtons;
let width = () => NumCast(this.props.Document._width);
- if (this.rootDoc.sideBar===true){
+ // if (StrCast(this.props.Document.title)==="sidebar search stack"){
width = MainView.Instance.flyoutWidthFunc;
- }
+ // }
if (defBtns instanceof Doc) {
return <div id="hi" style={{height:"35px",}}>
<DocumentView
@@ -1122,13 +1125,16 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
}
addDocument = (doc: Doc) => {
- const newPinDoc = Doc.MakeAlias(doc);
- newPinDoc.presentationTargetDoc = doc;
- return Doc.AddDocToList(this.dataDoc, this.fieldKey, newPinDoc);
+ return null;
}
//Make id layour document
render() {
- this.props.Document._gridGap=5;
+ if (this.expandedBucket === true){
+ this.props.Document._gridGap=5;
+ }
+ else {
+ this.props.Document._gridGap=10;
+ }
this.props.Document._searchDoc=true;
return (
@@ -1160,7 +1166,7 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
moveDocument={returnFalse}
NativeHeight={()=>400}
childLayoutTemplate={this.childLayoutTemplate}
- addDocument={this.addDocument}
+ addDocument={undefined}
removeDocument={returnFalse}
focus={this.selectElement}
ScreenToLocalTransform={Transform.Identity} />
diff --git a/src/client/views/search/SearchItem.scss b/src/client/views/search/SearchItem.scss
index 9996e0a50..5ce022d41 100644
--- a/src/client/views/search/SearchItem.scss
+++ b/src/client/views/search/SearchItem.scss
@@ -11,15 +11,15 @@
.searchItem-overview .searchItem {
width: 100%;
background: $light-color-secondary;
- border-color: $intermediate-color;
- border-bottom-style: solid;
- padding: 10px;
- min-height: 50px;
+ padding: 8px;
+ min-height: 46px;
+ height:46px;
max-height: 150px;
height: auto;
z-index: 0;
display: flex;
overflow: visible;
+ box-shadow: rgb(156, 147, 150) 0.2vw 0.2vw 0.8vw;
.searchItem-body {
display: flex;
@@ -146,7 +146,7 @@
}
.searchBox-placeholder {
- min-height: 50px;
+ min-height: 46px;
margin-left: 150px;
width: calc(100% - 150px);
text-transform: uppercase;
diff --git a/src/client/views/search/SearchItem.tsx b/src/client/views/search/SearchItem.tsx
index 97ca0ee69..9d5d64dca 100644
--- a/src/client/views/search/SearchItem.tsx
+++ b/src/client/views/search/SearchItem.tsx
@@ -336,12 +336,6 @@ export class SearchItem extends ViewBoxBaseComponent<FieldViewProps, SearchSchem
//this.gotoDocument(this.childDocs.indexOf(doc), NumCast(this.layoutDoc._itemIndex));
}
- addDocument = (doc: Doc) => {
- const newPinDoc = Doc.MakeAlias(doc);
- newPinDoc.presentationTargetDoc = doc;
- return Doc.AddDocToList(this.dataDoc, this.fieldKey, newPinDoc);
- }
-
newsearch(){
runInAction(()=>{
if (StrCast(this.rootDoc.bucketfield)!=="results"){
@@ -362,9 +356,6 @@ export class SearchItem extends ViewBoxBaseComponent<FieldViewProps, SearchSchem
this.props.Document._height=this.targetDoc._height;
return <div>
- <div className="bucket-title">
- {StrCast(this.rootDoc.bucketfield)==="results"? null:StrCast(this.rootDoc.bucketfield)}
- </div>
<CollectionView {...this.props}
Document={this.props.Document}
PanelHeight={this.panelHeight}
@@ -372,11 +363,11 @@ export class SearchItem extends ViewBoxBaseComponent<FieldViewProps, SearchSchem
onClick={undefined}
moveDocument={returnFalse}
childLayoutTemplate={this.childLayoutTemplate}
- addDocument={this.addDocument}
+ addDocument={undefined}
removeDocument={returnFalse}
focus={this.selectElement}
ScreenToLocalTransform={this.getTransform} />
- <button onClick={()=>this.newsearch()}className="bucket-expand" style={{transform:"none", fontSize:"100%",textTransform:"none", background: "lightgray",color: "black", bottom: 8, fontFamily:"Arial, sans-serif"}}>See all {StrCast(this.rootDoc.bucketfield)}...
+ <button onClick={()=>this.newsearch()}className="bucket-expand" style={{transform:"none", fontSize:"100%",textTransform:"none", background: "lightgray",color: "black", bottom: 8, marginBottom:-2, paddingTop:2,fontFamily:"Arial, sans-serif"}}>See all {StrCast(this.rootDoc.bucketfield)}...
</button>
</div>
}
@@ -385,9 +376,10 @@ export class SearchItem extends ViewBoxBaseComponent<FieldViewProps, SearchSchem
<div className="searchItem" onPointerDown={this.nextHighlight} onPointerEnter={this.highlightDoc} onPointerLeave={this.unHighlightDoc}>
<div className="searchItem-body" onClick={this.onClick}>
<div className="searchItem-title-container">
- <div className="searchItem-title">{StrCast(this.targetDoc.title)}</div>
- <div className="searchItem-highlighting">{StrCast(this.targetDoc.highlighting).length ? "Matched fields:" + StrCast(this.targetDoc.highlighting) : Cast(this.targetDoc.lines, listSpec("string"))!.length ? Cast(this.targetDoc.lines, listSpec("string"))![0] : ""}</div>
- {Cast(this.targetDoc.lines, listSpec("string"))!.filter((m, i) => i).map((l, i) => <div id={i.toString()} className="searchItem-highlighting">{l}</div>)}
+ <div className="searchItem-title" style={{height:"10px", overflow:"hidden", textOverflow:"ellipsis"}}>{StrCast(this.targetDoc.title)}</div>
+ <div className="searchItem-highlighting">
+ {StrCast(this.targetDoc.highlighting).length ? "Matched fields:" + StrCast(this.targetDoc.highlighting) : Cast(this.targetDoc.lines, listSpec("string"))!.length ? Cast(this.targetDoc.lines, listSpec("string"))![0] : ""}</div>
+ {/* {Cast(this.targetDoc.lines, listSpec("string"))!.filter((m, i) => i).map((l, i) => <div id={i.toString()} className="searchItem-highlighting">{l}</div>)} */}
</div>
</div>
<div className="searchItem-info" style={{ width: this._useIcons ? "30px" : "100%" }}>
diff --git a/src/server/websocket.ts b/src/server/websocket.ts
index 87af5fa06..19c98454c 100644
--- a/src/server/websocket.ts
+++ b/src/server/websocket.ts
@@ -236,7 +236,6 @@ export namespace WebSocket {
};
function ToSearchTerm(val: any): { suffix: string, value: any } | undefined {
- // console.log(val);
if (val === null || val === undefined) {
return;
@@ -258,7 +257,6 @@ export namespace WebSocket {
suffix = suffix[0];
}
- // console.log(suffix);
return { suffix, value: val };
}
@@ -273,9 +271,7 @@ export namespace WebSocket {
if (!docfield) {
return;
}
- //console.log(diff);
const update: any = { id: diff.id };
- console.log(update);
let dynfield = false;
for (let key in docfield) {
if (!key.startsWith("fields.")) continue;
@@ -295,7 +291,6 @@ export namespace WebSocket {
update[key] = { set: value };
}
update[key + suffix] = { set: value };
- console.log(update);
}
}
if (dynfield) {