fix: 'Plain text' language toolbar showing on code block in position 0

This commit is contained in:
Tom Moor
2023-07-17 22:33:47 -04:00
parent 70113be9af
commit 5206beaf19

View File

@@ -49,8 +49,9 @@ function useIsActive(state: EditorState) {
return true;
}
if (
isNodeActive(state.schema.nodes.code_block)(state) ||
isNodeActive(state.schema.nodes.code_fence)(state)
(isNodeActive(state.schema.nodes.code_block)(state) ||
isNodeActive(state.schema.nodes.code_fence)(state)) &&
selection.from > 0
) {
return true;
}