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
295295 }
296296 if ($ counter == 1 && !Str::contains ($ comment , '@lrd ' )) {
297297 if (Str::startsWith ($ comment , '* ' )) {
298- $ comment = trim ( substr ($ comment , 1 ) );
298+ $ comment = substr ($ comment , 1 );
299299 }
300300 // remove first character from string
301301 $ lrdComment .= $ comment . "\n" ;
Original file line number Diff line number Diff line change @@ -59,6 +59,19 @@ export default function App() {
5959 generateDocs ( api )
6060 } , [ ] )
6161
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+
6275 const generateDocs = ( url : string ) => {
6376 setSendingRequest ( true )
6477 const response = fetch ( url ) ;
@@ -75,6 +88,9 @@ export default function App() {
7588 setLrdDocsJson ( lrdDocsJson )
7689 setLrdDocsJsonCopy ( lrdDocsJson )
7790 setSendingRequest ( false )
91+ setTimeout ( ( ) => {
92+ scrollToAnchorOnHistory ( )
93+ } , 10 ) // greater than 1 is fine
7894 } ) . catch ( ( error ) => {
7995 setError ( error . message )
8096 setSendingRequest ( false )
Original file line number Diff line number Diff line change @@ -28,7 +28,11 @@ export default function Sidebar(props: Props) {
2828 </ li >
2929 ) }
3030 < 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" >
3236 < span className = { `method-${ lrdDocsItem . http_method } uppercase text-xs w-12 p-0 flex flex-row-reverse` } >
3337 { lrdDocsItem . http_method }
3438 </ span >
You can’t perform that action at this time.
0 commit comments