Skip to content

Commit c3d5d00

Browse files
Merge pull request #361 from FormidableLabs/fix/editor-end-new-line
Fix ability to insert a new line at the end of the editor.
2 parents a678f36 + c316281 commit c3d5d00

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

.changeset/fair-glasses-protect.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"react-live": patch
3+
---
4+
5+
Fix ability to insert a new line at the end of the editor.

packages/react-live/src/components/Editor/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const CodeEditor = (props: Props) => {
2323
setCode(props.code);
2424
}, [props.code]);
2525

26-
useEditable(editorRef, (text) => setCode(text.trimEnd()), {
26+
useEditable(editorRef, (text) => setCode(text.slice(0, -1)), {
2727
disabled: props.disabled,
2828
indentation: props.tabMode === "indentation" ? 2 : undefined,
2929
});

0 commit comments

Comments
 (0)