File tree Expand file tree Collapse file tree 5 files changed +29
-8
lines changed Expand file tree Collapse file tree 5 files changed +29
-8
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 2727 " nullable|integer|min:1|max:100"
2828 ]
2929 },
30- "doc_block" : " #Hello markdown\n ## Documentation for /my route\n " ,
30+ "doc_block" : " #Hello markdown\n ## Documentation for /my route\n " ,
3131 "responses" : [
3232 " 200" ,
3333 " 400" ,
6969 " nullable|integer|min:1|max:100"
7070 ]
7171 },
72- "doc_block" : " #Hello markdown\n ## Documentation for /my route\n " ,
72+ "doc_block" : " #Hello markdown\n ## Documentation for /my route\n " ,
7373 "responses" : [
7474 " 200" ,
7575 " 400" ,
111111 " nullable|integer|min:1|max:100"
112112 ]
113113 },
114- "doc_block" : " #Hello markdown\n ## Documentation for /my route\n " ,
114+ "doc_block" : " #Hello markdown\n ## Documentation for /my route\n " ,
115115 "responses" : [
116116 " 200" ,
117117 " 400" ,
153153 " nullable|integer|min:1|max:100"
154154 ]
155155 },
156- "doc_block" : " #Hello markdown\n ## Documentation for /my route\n " ,
156+ "doc_block" : " #Hello markdown\n ## Documentation for /my route\n " ,
157157 "responses" : [
158158 " 200" ,
159159 " 400" ,
Original file line number Diff line number Diff line change @@ -145,6 +145,8 @@ export default function ApiAction(props: Props) {
145145 // do nothing
146146 }
147147
148+ const wasDataWrapped = ( data && data . _lrd )
149+
148150 if ( data && data . _lrd && data . _lrd . queries ) {
149151 const sqlQueries = data . _lrd . queries . map ( ( query : any ) => {
150152 return "Connection: "
@@ -174,12 +176,12 @@ export default function ApiAction(props: Props) {
174176 } )
175177 }
176178 if ( isJson ) {
177- if ( data ?. data ) {
179+ if ( wasDataWrapped && data ?. data ) {
178180 setResponseData ( JSON . stringify ( data ?. data , null , 2 ) )
179181 } else {
180182 setResponseData ( JSON . stringify ( data , null , 2 ) )
181183 }
182-
184+
183185 } else {
184186 setResponseData ( dataString )
185187 }
Original file line number Diff line number Diff line change @@ -59,6 +59,18 @@ 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+ if ( element ) {
69+ element . scrollIntoView ( ) ;
70+ }
71+ }
72+ }
73+
6274 const generateDocs = ( url : string ) => {
6375 setSendingRequest ( true )
6476 const response = fetch ( url ) ;
@@ -75,6 +87,9 @@ export default function App() {
7587 setLrdDocsJson ( lrdDocsJson )
7688 setLrdDocsJsonCopy ( lrdDocsJson )
7789 setSendingRequest ( false )
90+ setTimeout ( ( ) => {
91+ scrollToAnchorOnHistory ( )
92+ } , 10 ) // greater than 1 is fine
7893 } ) . catch ( ( error ) => {
7994 setError ( error . message )
8095 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