Skip to content

Commit 08ea89f

Browse files
committed
fix(web): keep Shift+Enter inside a fence as a newline
The fence branch of the key handler skipped Shift+Enter, so it fell through to the generic paragraph split, which cut the code block into two fences. Inside a fence Shift+Enter now makes a line at the current indent like Enter, and on a bare opening-fence line it opens the block. Cmd/Ctrl+Enter still sends.
1 parent a3a952a commit 08ea89f

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

‎apps/web/src/components/ComposerPromptEditorTiptap.tsx‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,14 +1184,15 @@ function ComposerPromptEditorTiptapInner(props: ComposerPromptEditorProps) {
11841184
view.dispatch(tr),
11851185
);
11861186
}
1187-
// A fence is multi-line by definition, so Enter belongs to the code
1188-
// rather than to sending: inside a block it makes a line, and on a
1189-
// line that is only an opening fence it opens the block. Sending
1190-
// from inside a fence is still Cmd/Ctrl+Enter, which falls through.
1187+
// A fence is multi-line by definition, so Enter and Shift+Enter
1188+
// belong to the code rather than to sending or splitting: inside a
1189+
// block they make a line (a generic split would cut the fence in
1190+
// two), and on a line that is only an opening fence they open the
1191+
// block. Sending from inside a fence is still Cmd/Ctrl+Enter, which
1192+
// falls through.
11911193
if (
11921194
event.key === "Enter" &&
11931195
richText &&
1194-
!event.shiftKey &&
11951196
!event.metaKey &&
11961197
!event.ctrlKey &&
11971198
!event.isComposing

0 commit comments

Comments
 (0)