Skip to content

Commit

Permalink
Merge pull request #361 from FormidableLabs/fix/editor-end-new-line
Browse files Browse the repository at this point in the history
Fix ability to insert a new line at the end of the editor.
  • Loading branch information
carloskelly13 authored May 23, 2023
2 parents a678f36 + c316281 commit c3d5d00
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/fair-glasses-protect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"react-live": patch
---

Fix ability to insert a new line at the end of the editor.
2 changes: 1 addition & 1 deletion packages/react-live/src/components/Editor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const CodeEditor = (props: Props) => {
setCode(props.code);
}, [props.code]);

useEditable(editorRef, (text) => setCode(text.trimEnd()), {
useEditable(editorRef, (text) => setCode(text.slice(0, -1)), {
disabled: props.disabled,
indentation: props.tabMode === "indentation" ? 2 : undefined,
});
Expand Down

1 comment on commit c3d5d00

@vercel
Copy link

@vercel vercel bot commented on c3d5d00 May 23, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.