File tree Expand file tree Collapse file tree 3 files changed +14
-18
lines changed Expand file tree Collapse file tree 3 files changed +14
-18
lines changed Original file line number Diff line number Diff line change @@ -275,7 +275,7 @@ export class CommentsPlugin extends BlockNoteExtension {
275275 } ) [ 0 ] ?. mark ;
276276
277277 const threadId = commentMark ?. attrs . threadId as string | undefined ;
278- self . selectThread ( threadId , false ) ;
278+ self . selectThread ( threadId ) ;
279279 } ,
280280 } ,
281281 } ) ,
@@ -298,7 +298,7 @@ export class CommentsPlugin extends BlockNoteExtension {
298298 /**
299299 * Set the selected thread
300300 */
301- public selectThread ( threadId : string | undefined , scrollToThread = true ) {
301+ public selectThread ( threadId : string | undefined ) {
302302 if ( this . selectedThreadId === threadId ) {
303303 return ;
304304 }
@@ -310,7 +310,7 @@ export class CommentsPlugin extends BlockNoteExtension {
310310 } ) ,
311311 ) ;
312312
313- if ( threadId && scrollToThread ) {
313+ if ( threadId ) {
314314 const selectedThreadPosition = this . threadPositions . get ( threadId ) ;
315315
316316 if ( ! selectedThreadPosition ) {
Original file line number Diff line number Diff line change 11import { assertEmpty , mergeCSSClasses } from "@blocknote/core" ;
2- import { ComponentProps , mergeRefs } from "@blocknote/react" ;
2+ import { ComponentProps } from "@blocknote/react" ;
33import {
44 Card as MantineCard ,
55 Divider as MantineDivider ,
66 Text as MantineText ,
77} from "@mantine/core" ;
8- import { forwardRef , useEffect , useRef } from "react" ;
8+ import { forwardRef } from "react" ;
99
1010export const Card = forwardRef <
1111 HTMLDivElement ,
@@ -24,24 +24,13 @@ export const Card = forwardRef<
2424
2525 assertEmpty ( rest , false ) ;
2626
27- // Makes the card scroll into view when selected.
28- const scrollRef = useRef < HTMLDivElement > ( null ) ;
29- useEffect ( ( ) => {
30- if ( selected ) {
31- scrollRef . current ?. scrollIntoView ( {
32- behavior : "smooth" ,
33- block : "center" ,
34- } ) ;
35- }
36- } , [ selected ] ) ;
37-
3827 return (
3928 < MantineCard
4029 className = { mergeCSSClasses ( className , selected ? "selected" : "" ) }
4130 onFocus = { onFocus }
4231 onBlur = { onBlur }
4332 tabIndex = { tabIndex }
44- ref = { mergeRefs ( [ ref , scrollRef ] ) }
33+ ref = { ref }
4534 >
4635 { headerText && (
4736 < MantineText className = { "bn-header-text" } > { headerText } </ MantineText >
Original file line number Diff line number Diff line change @@ -6,7 +6,13 @@ import {
66 InlineContentSchema ,
77 StyleSchema ,
88} from "@blocknote/core" ;
9- import { UseFloatingOptions , flip , offset , shift } from "@floating-ui/react" ;
9+ import {
10+ UseFloatingOptions ,
11+ autoUpdate ,
12+ flip ,
13+ offset ,
14+ shift ,
15+ } from "@floating-ui/react" ;
1016import {
1117 ComponentProps ,
1218 FC ,
@@ -55,6 +61,7 @@ export const FloatingThreadController = <
5561 editor . focus ( ) ;
5662 }
5763 } ,
64+ whileElementsMounted : autoUpdate ,
5865 ...props . floatingOptions ,
5966 } ) ;
6067
You can’t perform that action at this time.
0 commit comments