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 c5e83b2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,16 @@ export async function register(options: Options) {
_container = options.container;

if (options.initialUrl) {
_input.value = options.initialUrl;
try {
const initialUrl = new URL(options.initialUrl);
_input.value = initialUrl.origin;
} catch {}
}

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

_input.onpaste = _input.onchange = () => {
Expand Down

0 comments on commit c5e83b2

Please sign in to comment.