Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.

Commit 5d86104

Browse files
committed
Fix changing the current block type
1 parent 460a2d8 commit 5d86104

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/modifiers/changeCurrentBlockType.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,10 @@ const changeCurrentBlockType = (
1212
const blockMap = currentContent.getBlockMap();
1313
const block = blockMap.get(key);
1414
const data = block.getData().merge(blockMetadata);
15-
const newBlock = block.merge({ type, data, text: text || "" });
16-
const newSelection = selection.merge({
17-
anchorOffset: 0,
18-
focusOffset: 0,
19-
});
15+
const newBlock = block.merge({ type, data, text: text });
2016
const newContentState = currentContent.merge({
2117
blockMap: blockMap.set(key, newBlock),
22-
selectionAfter: newSelection,
18+
selectionAfter: selection,
2319
});
2420
return EditorState.push(editorState, newContentState, "change-block-type");
2521
};

0 commit comments

Comments
 (0)