Load when enter is pressed in project URL input

This commit is contained in:
Thomas Weber committed 2021-07-06 17:00:56 -05:00
1 parent cb08cf7ebf
commit 7e8f77fe34
1 file changed
+3 -3
+3 -3
View File
@@ -130,7 +130,7 @@
const getDisplayedProjectURL = () => `https://scratch.mit.edu/projects/${$projectId}`;
const handleKeyPress = (e) => {
const submitOnEnter = (e) => {
if (e.key === 'Enter') {
e.target.blur();
load();
@@ -169,7 +169,7 @@
{$_('select.id')}
</label>
{#if $type === "id"}
<input type="text" value={getDisplayedProjectURL()} spellcheck="false" on:keypress={handleKeyPress} on:input={handleInput} on:focus={handleFocus}>
<input type="text" value={getDisplayedProjectURL()} spellcheck="false" on:keypress={submitOnEnter} on:input={handleInput} on:focus={handleFocus}>
{/if}
</div>
<div class="option">
@@ -187,7 +187,7 @@
{$_('select.url')}
</label>
{#if $type === "url"}
<input type="text" bind:value={$projectUrl} spellcheck="false">
<input type="text" bind:value={$projectUrl} spellcheck="false" on:keypress={submitOnEnter} >
{/if}
</div>