@@ -19,18 +19,13 @@ export const TableContent = () => {
1919 const { t } = useTranslation ( ) ;
2020 const [ isHover , setIsHover ] = useState ( false ) ;
2121
22- // Filter headings to only show h1, h2, h3 (levels 1-3)
23- const filteredHeadings = headings ?. filter (
24- ( heading ) => heading . props . level >= 1 && heading . props . level <= 3 ,
25- ) ;
26-
2722 useEffect ( ( ) => {
2823 const handleScroll = ( ) => {
29- if ( ! filteredHeadings ) {
24+ if ( ! headings ) {
3025 return ;
3126 }
3227
33- for ( const heading of filteredHeadings ) {
28+ for ( const heading of headings ) {
3429 const elHeading = document . body . querySelector (
3530 `.bn-block-outer[data-id="${ heading . id } "] [data-content-type="heading"]:first-child` ,
3631 ) ;
@@ -74,7 +69,7 @@ export const TableContent = () => {
7469 . getElementById ( MAIN_LAYOUT_ID )
7570 ?. removeEventListener ( 'scroll' , scrollFn ) ;
7671 } ;
77- } , [ filteredHeadings , setHeadingIdHighlight ] ) ;
72+ } , [ headings , setHeadingIdHighlight ] ) ;
7873
7974 const onOpen = ( ) => {
8075 setIsHover ( true ) ;
@@ -93,13 +88,12 @@ export const TableContent = () => {
9388 setIsHover ( false ) ;
9489 } ;
9590
96- const shouldHideTableContent =
91+ if (
9792 ! editor ||
98- ! filteredHeadings ||
99- filteredHeadings . length === 0 ||
100- ( filteredHeadings . length === 1 && ! filteredHeadings [ 0 ] . contentText ) ;
101-
102- if ( shouldHideTableContent ) {
93+ ! headings ||
94+ headings . length === 0 ||
95+ ( headings . length === 1 && ! headings [ 0 ] . contentText )
96+ ) {
10397 return null ;
10498 }
10599
@@ -168,7 +162,7 @@ export const TableContent = () => {
168162 overflow-y : auto;
169163 ` }
170164 >
171- { filteredHeadings ?. map (
165+ { headings ?. map (
172166 ( heading ) =>
173167 heading . contentText && (
174168 < Heading
0 commit comments