Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

Commit

Permalink
fix handling of initial url
Browse files Browse the repository at this point in the history
  • Loading branch information
iliazeus committed Jun 12, 2023
1 parent 44dd616 commit 3d252ca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ export async function register(options: Options) {
}

if (_input.value) {
updateEmojiInContainer().catch((e) => console.log(e));
updateEmojiInContainer().catch(() => {
_input.value = "";
});
}

_input.onpaste = _input.onchange = () => {
Expand Down
5 changes: 4 additions & 1 deletion www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
EmojiPicker.register({
input: document.getElementById("url-input"),
container: document.getElementById("emojis-container"),
initialUrl: document.referrer,
initialUrl: location.hash.slice(1),
});

history.replaceState("", "", location.pathname + location.search);
window.onhashchange = () => window.location.reload();
};
</script>
</head>
Expand Down

0 comments on commit 3d252ca

Please sign in to comment.