Type Editor / @type-editor/commands / newline-in-code
newline-in-code
Variables
| Variable | Description |
|---|---|
Inserts a newline character when inside a code block. This command allows inserting literal newline characters ("\n") within code blocks, as opposed to the default Enter key behavior which typically creates new block nodes. This is essential for maintaining proper code formatting where newlines are part of the content rather than structural elements. The command only works when:
This is typically bound to the Enter key for code blocks, allowing users to naturally add new lines within their code. Param The current editor state Param Optional dispatch function to execute the transaction Example typescript |