Skip to content

Commit bb37347

Browse files
committed
Don't handleInlineStyle in code-block
1 parent d63df3b commit bb37347

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,18 @@ import { replaceText } from './utils';
2121

2222
function checkCharacterForState(editorState, character) {
2323
let newEditorState = handleBlockType(editorState, character);
24+
const contentState = editorState.getCurrentContent();
25+
const selection = editorState.getSelection();
26+
const key = selection.getStartKey();
27+
const currentBlock = contentState.getBlockForKey(key);
28+
const type = currentBlock.getType();
2429
if (editorState === newEditorState) {
2530
newEditorState = handleImage(editorState, character);
2631
}
2732
if (editorState === newEditorState) {
2833
newEditorState = handleLink(editorState, character);
2934
}
30-
if (editorState === newEditorState) {
35+
if (editorState === newEditorState && type !== 'code-block') {
3136
newEditorState = handleInlineStyle(editorState, character);
3237
}
3338
return newEditorState;

0 commit comments

Comments
 (0)