@@ -22,7 +22,6 @@ import {
2222import { useComponentsContext } from "../../../editor/ComponentsContext.js" ;
2323import { useBlockNoteEditor } from "../../../hooks/useBlockNoteEditor.js" ;
2424import { useEditorState } from "../../../hooks/useEditorState.js" ;
25- import { useExtension } from "../../../hooks/useExtension.js" ;
2625import { useDictionary } from "../../../i18n/dictionary.js" ;
2726
2827type TextAlignment = DefaultProps [ "textAlignment" ] ;
@@ -44,8 +43,6 @@ export const TextAlignButton = (props: { textAlignment: TextAlignment }) => {
4443 StyleSchema
4544 > ( ) ;
4645
47- const tableHandles = useExtension ( TableHandlesExtension ) ;
48-
4946 const state = useEditorState ( {
5047 editor,
5148 selector : ( { editor } ) => {
@@ -74,7 +71,10 @@ export const TextAlignButton = (props: { textAlignment: TextAlignment }) => {
7471 selectedBlocks . length === 1 &&
7572 blockHasType ( firstBlock , editor , "table" )
7673 ) {
77- const cellSelection = tableHandles . getCellSelection ( ) ;
74+ const cellSelection = editor
75+ . getExtension ( TableHandlesExtension )
76+ ?. getCellSelection ( ) ;
77+
7878 if ( ! cellSelection ) {
7979 return undefined ;
8080 }
@@ -112,7 +112,9 @@ export const TextAlignButton = (props: { textAlignment: TextAlignment }) => {
112112 props : { textAlignment : textAlignment } ,
113113 } ) ;
114114 } else if ( block . type === "table" ) {
115- const cellSelection = tableHandles . getCellSelection ( ) ;
115+ const cellSelection = editor
116+ . getExtension ( TableHandlesExtension )
117+ ?. getCellSelection ( ) ;
116118 if ( ! cellSelection ) {
117119 continue ;
118120 }
@@ -148,7 +150,7 @@ export const TextAlignButton = (props: { textAlignment: TextAlignment }) => {
148150 }
149151 }
150152 } ,
151- [ editor , state , tableHandles ] ,
153+ [ editor , state ] ,
152154 ) ;
153155
154156 if ( state === undefined ) {
0 commit comments