mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-17 20:51:20 +02:00
Keep marks after splitting a block (#1273)
If you have, for example, a bold mark, and you hit "Enter", the new block won't carry over the formatting. Instead, it should (at least if you start typing right away). Fixes #1269.
This commit is contained in:
committed by
Ian Storm Taylor
parent
33bfeb8cda
commit
6f676d6771
@@ -474,9 +474,15 @@ function AfterPlugin(options = {}) {
|
||||
const { state } = change
|
||||
|
||||
if (HOTKEYS.SPLIT_BLOCK(event)) {
|
||||
return state.isInVoid
|
||||
? change.collapseToStartOfNextText()
|
||||
: change.splitBlock()
|
||||
if (state.isInVoid) {
|
||||
return change.collapseToStartOfNextText()
|
||||
} else {
|
||||
change = change.splitBlock()
|
||||
state.activeMarks.forEach((mark) => {
|
||||
change = change.addMark(mark)
|
||||
})
|
||||
return change
|
||||
}
|
||||
}
|
||||
|
||||
if (HOTKEYS.DELETE_CHAR_BACKWARD(event)) {
|
||||
|
Reference in New Issue
Block a user