Skip to content

Commit

Permalink
Fix line break behavior in rich-text example
Browse files Browse the repository at this point in the history
Related to ianstormtaylor#5671

Update `insertSoftBreak` to insert a line-break instead of splitting nodes

* Modify `packages/slate/src/editor/insert-soft-break.ts` to use `Transforms.insertText` to insert a line-break character instead of splitting nodes


---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/ianstormtaylor/slate/issues/5671?shareId=fcda97f9-03f1-49f6-8cbc-4fc9f4c95470).
  • Loading branch information
WindrunnerMax committed Jul 10, 2024
1 parent 5838e36 commit b1db3f2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/slate/src/editor/insert-soft-break.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import { Transforms } from '../interfaces/transforms'
import { EditorInterface } from '../interfaces/editor'

export const insertSoftBreak: EditorInterface['insertSoftBreak'] = editor => {
Transforms.splitNodes(editor, { always: true })
Transforms.insertText(editor, '\n')
}

0 comments on commit b1db3f2

Please sign in to comment.