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
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 27
27
" nullable|integer|min:1|max:100"
28
28
]
29
29
},
30
- "doc_block" : " #Hello markdown\n ## Documentation for /my route\n " ,
30
+ "doc_block" : " #Hello markdown\n ## Documentation for /my route\n " ,
31
31
"responses" : [
32
32
" 200" ,
33
33
" 400" ,
69
69
" nullable|integer|min:1|max:100"
70
70
]
71
71
},
72
- "doc_block" : " #Hello markdown\n ## Documentation for /my route\n " ,
72
+ "doc_block" : " #Hello markdown\n ## Documentation for /my route\n " ,
73
73
"responses" : [
74
74
" 200" ,
75
75
" 400" ,
111
111
" nullable|integer|min:1|max:100"
112
112
]
113
113
},
114
- "doc_block" : " #Hello markdown\n ## Documentation for /my route\n " ,
114
+ "doc_block" : " #Hello markdown\n ## Documentation for /my route\n " ,
115
115
"responses" : [
116
116
" 200" ,
117
117
" 400" ,
153
153
" nullable|integer|min:1|max:100"
154
154
]
155
155
},
156
- "doc_block" : " #Hello markdown\n ## Documentation for /my route\n " ,
156
+ "doc_block" : " #Hello markdown\n ## Documentation for /my route\n " ,
157
157
"responses" : [
158
158
" 200" ,
159
159
" 400" ,
Original file line number Diff line number Diff line change @@ -145,6 +145,8 @@ export default function ApiAction(props: Props) {
145
145
// do nothing
146
146
}
147
147
148
+ const wasDataWrapped = ( data && data . _lrd )
149
+
148
150
if ( data && data . _lrd && data . _lrd . queries ) {
149
151
const sqlQueries = data . _lrd . queries . map ( ( query : any ) => {
150
152
return "Connection: "
@@ -174,12 +176,12 @@ export default function ApiAction(props: Props) {
174
176
} )
175
177
}
176
178
if ( isJson ) {
177
- if ( data ?. data ) {
179
+ if ( wasDataWrapped && data ?. data ) {
178
180
setResponseData ( JSON . stringify ( data ?. data , null , 2 ) )
179
181
} else {
180
182
setResponseData ( JSON . stringify ( data , null , 2 ) )
181
183
}
182
-
184
+
183
185
} else {
184
186
setResponseData ( dataString )
185
187
}
Original file line number Diff line number Diff line change @@ -59,6 +59,18 @@ 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
+ if ( element ) {
69
+ element . scrollIntoView ( ) ;
70
+ }
71
+ }
72
+ }
73
+
62
74
const generateDocs = ( url : string ) => {
63
75
setSendingRequest ( true )
64
76
const response = fetch ( url ) ;
@@ -75,6 +87,9 @@ export default function App() {
75
87
setLrdDocsJson ( lrdDocsJson )
76
88
setLrdDocsJsonCopy ( lrdDocsJson )
77
89
setSendingRequest ( false )
90
+ setTimeout ( ( ) => {
91
+ scrollToAnchorOnHistory ( )
92
+ } , 10 ) // greater than 1 is fine
78
93
} ) . catch ( ( error ) => {
79
94
setError ( error . message )
80
95
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