From 5206beaf193cec14a75857342c3bf37dbc832442 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Mon, 17 Jul 2023 22:33:47 -0400 Subject: [PATCH] fix: 'Plain text' language toolbar showing on code block in position 0 --- app/editor/components/SelectionToolbar.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/editor/components/SelectionToolbar.tsx b/app/editor/components/SelectionToolbar.tsx index f9e5609b3..3b5b94b07 100644 --- a/app/editor/components/SelectionToolbar.tsx +++ b/app/editor/components/SelectionToolbar.tsx @@ -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; }