1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-11 09:43:58 +02:00

Add soft break as a separate overridable editor method (#4873)

add changeset
This commit is contained in:
Bryan Haakman
2022-03-20 12:30:08 +01:00
committed by GitHub
parent 07669dca4b
commit 20acca4bc8
9 changed files with 44 additions and 1 deletions

View File

@@ -0,0 +1,8 @@
---
'slate': minor
'slate-react': minor
---
A different behavior for inserting a soft break with shift+enter is quite common in rich text editors. Right now you have to do this in onKeyDown which is not so nice. This adds a separate insertSoftBreak method on the editor instance that gets called when a soft break is inserted. This maintains the current default behavior for backwards compatibility (it just splits the block). But at least you can easily overwrite it now.
If you rely on overwriting editor.insertBreak for extra behavior for soft breaks this might be a breaking change for you and you should overwrite editor.insertSoftBreak instead.