Skip to content

Commit

Permalink
Embed selected rule in the url when sharing. (#65)
Browse files Browse the repository at this point in the history
* Embed selected rule in the url when sharing.

* fix: check for undefined
  • Loading branch information
omer-biz authored Sep 12, 2024
1 parent 391d5e5 commit 767eaac
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions static/scripts/shareButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ function tryLoadFromShareLink(codeMirror) {
"textarea.editor-input-text",
)!;
inputEditor.value = decoded["input"];
if (decoded["selectedRule"]) {
localStorage.setItem("last-selected-rule", decoded["selectedRule"]);
}
}
}

Expand All @@ -54,6 +57,7 @@ function shareData(codeMirror) {
input: document.querySelector<HTMLTextAreaElement>(
"textarea.editor-input-text",
)!.value,
selectedRule: localStorage.getItem("last-selected-rule") || "",
};
}

Expand Down

0 comments on commit 767eaac

Please sign in to comment.