Skip to content

Commit 767eaac

Browse files
authored
Embed selected rule in the url when sharing. (#65)
* Embed selected rule in the url when sharing. * fix: check for undefined
1 parent 391d5e5 commit 767eaac

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

static/scripts/shareButton.ts

+4
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ function tryLoadFromShareLink(codeMirror) {
4545
"textarea.editor-input-text",
4646
)!;
4747
inputEditor.value = decoded["input"];
48+
if (decoded["selectedRule"]) {
49+
localStorage.setItem("last-selected-rule", decoded["selectedRule"]);
50+
}
4851
}
4952
}
5053

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

0 commit comments

Comments
 (0)