Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(fix) avoid automatic newline when renaming/creating a file #508

Merged
merged 1 commit into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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