diff options
| author | Melissa Zhang <mzhang19096@gmail.com> | 2020-07-23 13:20:12 -0700 | 
|---|---|---|
| committer | Melissa Zhang <mzhang19096@gmail.com> | 2020-07-23 13:20:12 -0700 | 
| commit | 86a8751ca5a66fd42d7b2b3dee56210f2ef2b62d (patch) | |
| tree | 694620d8360d60d883ac651869fb3b09ffe05a90 /src/client/apis/hypothesis | |
| parent | 90d5abaf3c32b53f34f6bd89e854c57c250937b0 (diff) | |
adjustments to link following/editing behavior
Diffstat (limited to 'src/client/apis/hypothesis')
| -rw-r--r-- | src/client/apis/hypothesis/HypothesisApiUtils.ts | 22 | 
1 files changed, 21 insertions, 1 deletions
| diff --git a/src/client/apis/hypothesis/HypothesisApiUtils.ts b/src/client/apis/hypothesis/HypothesisApiUtils.ts index 2bffdb530..4c9fef45c 100644 --- a/src/client/apis/hypothesis/HypothesisApiUtils.ts +++ b/src/client/apis/hypothesis/HypothesisApiUtils.ts @@ -1,5 +1,9 @@ -import { StrCast } from "../../../fields/Types"; +import { StrCast, Cast } from "../../../fields/Types";  import HypothesisAuthenticationManager from "../HypothesisAuthenticationManager"; +import { SearchUtil } from "../../util/SearchUtil"; +import { action } from "mobx"; +import { Doc } from "../../../fields/Doc"; +import { DocumentType } from "../../documents/DocumentTypes";  export namespace Hypothesis { @@ -94,4 +98,20 @@ export namespace Hypothesis {          const regex = new RegExp('(?<=\:)(.*?)(?=\@)/');          return regex.exec(userid)![0];      }; + +    // Return corres +    export const getWebDocs = async (uri: string) => { +        const results: Doc[] = []; +        await SearchUtil.Search(uri, true).then(action(async (res: SearchUtil.DocSearchResult) => { +            const docs = await Promise.all(res.docs.map(async doc => (await Cast(doc.extendsDoc, Doc)) || doc)); +            const filteredDocs = docs.filter(doc => doc.type === DocumentType.WEB && doc.data); + +            console.log("docs", docs); +            console.log("FILTEREDDOCS: ", filteredDocs); +            filteredDocs.forEach(doc => { +                results.push(doc); +            }); +        })); +        return results; +    };  }
\ No newline at end of file | 
