Skip to content

Commit 8909bbc

Browse files
committed
Avoid changeCurrentBlockType for sharp if a blockType is 'code-block'
1 parent 53b91a0 commit 8909bbc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/modifiers/handleBlockType.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const handleBlockType = (editorState, character) => {
2828
const line = [text.slice(0, position), character, text.slice(position)].join('');
2929
const blockType = RichUtils.getCurrentBlockType(editorState);
3030
for (let i = 1; i <= 6; i += 1) {
31-
if (line.indexOf(`${sharps(i)} `) === 0) {
31+
if (line.indexOf(`${sharps(i)} `) === 0 && blockType !== 'code-block') {
3232
return changeCurrentBlockType(editorState, blockTypes[i], line.replace(/^#+\s/, ''));
3333
}
3434
}

0 commit comments

Comments
 (0)