File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -119,6 +119,19 @@ export const OperationViewer: ComponentType<{
119
119
} )
120
120
const operation = data ?. data
121
121
122
+ useEffect ( ( ) => {
123
+ // on finished loading, scroll to #fragment if any
124
+ if ( operation ) {
125
+ const fragment = window . location . hash
126
+ if ( fragment ) {
127
+ const el = document . querySelector ( fragment )
128
+ if ( el ) {
129
+ el . scrollIntoView ( { behavior : 'smooth' } )
130
+ }
131
+ }
132
+ }
133
+ } , [ operation ] )
134
+
122
135
const levels = useLevels ( ) ?. data ?. data || [ ]
123
136
124
137
const [ auth ] = useAtom ( authAtom )
@@ -354,7 +367,9 @@ function OperationViewerInner({
354
367
355
368
< div className = "mb-6" >
356
369
< div >
357
- < H4 className = "mb-4" > 评论 ({ operation . commentsCount } )</ H4 >
370
+ < H4 className = "mb-4" id = "comment" >
371
+ 评论 ({ operation . commentsCount } )
372
+ </ H4 >
358
373
< CommentArea operationId = { operation . id } />
359
374
</ div >
360
375
</ div >
You can’t perform that action at this time.
0 commit comments