diff options
| author | Melissa Zhang <mzhang19096@gmail.com> | 2020-08-04 19:44:14 -0700 |
|---|---|---|
| committer | Melissa Zhang <mzhang19096@gmail.com> | 2020-08-04 19:44:14 -0700 |
| commit | 8d7eef677e03846397e49177d9821f5cdc3df6b2 (patch) | |
| tree | 9e32b75c520c78d77c78be5d2cd4cda386916c2b /src/client/apis/hypothesis | |
| parent | 6fe4cfc95f061928a7040878ae90cd1df5f181e9 (diff) | |
stop clicking on invisible WebDoc in MainView.tsx after editSuccess
Diffstat (limited to 'src/client/apis/hypothesis')
| -rw-r--r-- | src/client/apis/hypothesis/HypothesisUtils.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/client/apis/hypothesis/HypothesisUtils.ts b/src/client/apis/hypothesis/HypothesisUtils.ts index 16f132e97..8d941cac6 100644 --- a/src/client/apis/hypothesis/HypothesisUtils.ts +++ b/src/client/apis/hypothesis/HypothesisUtils.ts @@ -50,16 +50,16 @@ export namespace Hypothesis { var success = false; const onSuccess = action(() => { - console.log("EDITSUCCESS"); + console.log("EDIT SUCCESS"); + success = true; clearTimeout(interval); DocumentLinksButton.invisibleWebDoc = undefined; document.removeEventListener("editSuccess", onSuccess); - success = true; }); - console.log("SEND addLink"); + console.log("send addLink"); const newHyperlink = `[${title}\n](${url})`; - const interval = setInterval(() => // keep trying to scroll every 250ms until annotations have loaded and editing is successful + const interval = setInterval(() => // keep trying to edit until annotations have loaded and editing is successful !success && document.dispatchEvent(new CustomEvent<{ newHyperlink: string, id: string }>("addLink", { detail: { newHyperlink: newHyperlink, id: annotationId }, bubbles: true @@ -70,7 +70,7 @@ export namespace Hypothesis { clearInterval(interval); DocumentLinksButton.invisibleWebDoc = undefined; } - }), 15000); // give up if no success after 15s + }), 12000); // give up if no success after 12s document.addEventListener("editSuccess", onSuccess); }; |
