mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-18 13:11:17 +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
|
const { state } = change
|
||||||
|
|
||||||
if (HOTKEYS.SPLIT_BLOCK(event)) {
|
if (HOTKEYS.SPLIT_BLOCK(event)) {
|
||||||
return state.isInVoid
|
if (state.isInVoid) {
|
||||||
? change.collapseToStartOfNextText()
|
return change.collapseToStartOfNextText()
|
||||||
: change.splitBlock()
|
} else {
|
||||||
|
change = change.splitBlock()
|
||||||
|
state.activeMarks.forEach((mark) => {
|
||||||
|
change = change.addMark(mark)
|
||||||
|
})
|
||||||
|
return change
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HOTKEYS.DELETE_CHAR_BACKWARD(event)) {
|
if (HOTKEYS.DELETE_CHAR_BACKWARD(event)) {
|
||||||
|
Reference in New Issue
Block a user