File tree Expand file tree Collapse file tree
packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/Request Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -223,22 +223,24 @@ async function makeRequest(
223223 }
224224
225225 if ( fileExtension ) {
226- return response . blob ( ) . then ( ( blob : any ) => {
226+ return response . blob ( ) . then ( ( blob : Blob ) => {
227227 const url = window . URL . createObjectURL ( blob ) ;
228228
229229 const link = document . createElement ( "a" ) ;
230230 link . href = url ;
231231 // Now the file name includes the extension
232232 link . setAttribute ( "download" , `file${ fileExtension } ` ) ;
233233
234- // These two lines are necessary to make the link click in Firefox
235- link . style . display = "none" ;
236- document . body . appendChild ( link ) ;
234+ // These lines are necessary to make the link click in Firefox
235+ const hiddenContainer = document . createElement ( "div" ) ;
236+ hiddenContainer . style . display = "none" ;
237+ hiddenContainer . appendChild ( link ) ;
238+ document . body . appendChild ( hiddenContainer ) ;
237239
238240 link . click ( ) ;
239241
240242 // After link is clicked, it's safe to remove it.
241- setTimeout ( ( ) => document . body . removeChild ( link ) , 0 ) ;
243+ setTimeout ( ( ) => document . body . removeChild ( hiddenContainer ) , 0 ) ;
242244
243245 return response ;
244246 } ) ;
You can’t perform that action at this time.
0 commit comments