File tree Expand file tree Collapse file tree 3 files changed +22
-2
lines changed Expand file tree Collapse file tree 3 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -295,7 +295,7 @@ public function lrdDocComment(string $docComment): string
295
295
}
296
296
if ($ counter == 1 && !Str::contains ($ comment , '@lrd ' )) {
297
297
if (Str::startsWith ($ comment , '* ' )) {
298
- $ comment = trim ( substr ($ comment , 1 ) );
298
+ $ comment = substr ($ comment , 1 );
299
299
}
300
300
// remove first character from string
301
301
$ lrdComment .= $ comment . "\n" ;
Original file line number Diff line number Diff line change @@ -59,6 +59,19 @@ export default function App() {
59
59
generateDocs ( api )
60
60
} , [ ] )
61
61
62
+ const scrollToAnchorOnHistory = ( ) => {
63
+ // get the anchor link and scroll to it
64
+ const anchor = window . location . hash ;
65
+ if ( anchor ) {
66
+ const anchorId = anchor . replace ( '#' , '' ) ;
67
+ const element = document . getElementById ( anchorId ) ;
68
+ console . log ( element )
69
+ if ( element ) {
70
+ element . scrollIntoView ( ) ;
71
+ }
72
+ }
73
+ }
74
+
62
75
const generateDocs = ( url : string ) => {
63
76
setSendingRequest ( true )
64
77
const response = fetch ( url ) ;
@@ -75,6 +88,9 @@ export default function App() {
75
88
setLrdDocsJson ( lrdDocsJson )
76
89
setLrdDocsJsonCopy ( lrdDocsJson )
77
90
setSendingRequest ( false )
91
+ setTimeout ( ( ) => {
92
+ scrollToAnchorOnHistory ( )
93
+ } , 10 ) // greater than 1 is fine
78
94
} ) . catch ( ( error ) => {
79
95
setError ( error . message )
80
96
setSendingRequest ( false )
Original file line number Diff line number Diff line change @@ -28,7 +28,11 @@ export default function Sidebar(props: Props) {
28
28
</ li >
29
29
) }
30
30
< li >
31
- < AnchorLink href = { '#' + lrdDocsItem . http_method + lrdDocsItem . uri } className = "flex flex-row px-0 py-1" >
31
+ < AnchorLink href = { '#' + lrdDocsItem . http_method + lrdDocsItem . uri }
32
+ onClick = { ( ) => {
33
+ window . history . pushState ( { } , '' , '#' + lrdDocsItem . http_method + lrdDocsItem . uri ) ;
34
+ } }
35
+ className = "flex flex-row px-0 py-1" >
32
36
< span className = { `method-${ lrdDocsItem . http_method } uppercase text-xs w-12 p-0 flex flex-row-reverse` } >
33
37
{ lrdDocsItem . http_method }
34
38
</ span >
You can’t perform that action at this time.
0 commit comments