Skip to content

Commit

Permalink
(fix) avoid automatic newline when renaming/creating a file (#508)
Browse files Browse the repository at this point in the history
  • Loading branch information
paoloricciuti authored Jun 29, 2023
1 parent 1f2e7b1 commit 8770812
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/fresh-days-know.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/repl': patch
---

(fix) avoid automatic newline when renaming/creating a file
10 changes: 8 additions & 2 deletions packages/repl/src/lib/Input/ComponentSelector.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,14 @@
bind:value={input_value}
on:focus={select_input}
on:blur={close_edit}
on:keydown={(e) =>
e.key === 'Enter' && !is_file_name_used(editing_file) && e.currentTarget.blur()}
on:keydown={(e) => {
if (e.key === 'Enter') {
e.preventDefault();
if (!is_file_name_used(editing_file)) {
e.currentTarget.blur();
}
}
}}
class:duplicate={is_file_name_used(editing_file)}
/>
{/if}
Expand Down

1 comment on commit 8770812

@vercel
Copy link

@vercel vercel bot commented on 8770812 Jun 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

hn – ./

sites-zeta.vercel.app
hn.svelte.dev
hn-svelte.vercel.app
hn-git-master-svelte.vercel.app

Please sign in to comment.