File tree Expand file tree Collapse file tree 3 files changed +13
-7
lines changed Expand file tree Collapse file tree 3 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -856,9 +856,11 @@ var CodeOceanEditor = {
856856 selected . instance . deselect_all ( ) ;
857857 const downloadPath = selected . node . original . download_path ;
858858 if ( downloadPath ) {
859- $ ( window ) . off ( " beforeunload" ) ;
859+ $ ( window ) . off ( ' beforeunload' ) ;
860860 window . location = downloadPath ;
861- $ ( window ) . one ( "beforeunload" , this . unloadEverything . bind ( this , App . synchronized_editor ) ) ;
861+ setTimeout ( ( ) => {
862+ $ ( window ) . one ( 'beforeunload' , this . unloadEverything . bind ( this , App . synchronized_editor ) ) ;
863+ } , 250 ) ;
862864 }
863865 } . bind ( this ) ) ;
864866 $ ( '#download-files' ) . removeClass ( 'd-none' ) ;
Original file line number Diff line number Diff line change @@ -102,11 +102,13 @@ CodeOceanEditorSubmissions = {
102102 const submission = await this . createSubmission ( '#download' , null ) . catch ( this . ajaxError . bind ( this ) ) ;
103103 if ( ! submission ) return ;
104104
105- $ ( window ) . off ( " beforeunload" ) ;
105+ $ ( window ) . off ( ' beforeunload' ) ;
106106 // to download just a single file, use the following url
107107 // window.location = Routes.download_file_submission_url(submission.id, CodeOceanEditor.active_file.filename);
108108 window . location = Routes . download_submission_url ( submission . id ) ;
109- $ ( window ) . one ( "beforeunload" , this . unloadEverything . bind ( this , App . synchronized_editor ) ) ;
109+ setTimeout ( ( ) => {
110+ $ ( window ) . one ( "beforeunload" , this . unloadEverything . bind ( this , App . synchronized_editor ) ) ;
111+ } , 250 ) ;
110112 } ,
111113
112114 resetCode : function ( initiator , onlyActiveFile = false ) {
Original file line number Diff line number Diff line change @@ -132,9 +132,11 @@ $(document).on('turbo-migration:load', function () {
132132 } else {
133133 $ ( window ) . off ( 'beforeunload' ) ;
134134 window . location = downloadPath ;
135- $ ( window ) . one ( 'beforeunload' , function ( ) {
136- CodeOceanEditor . removeFileTreeEventHandlers ( fileTree ) ;
137- } )
135+ setTimeout ( ( ) => {
136+ $ ( window ) . one ( 'beforeunload' , function ( ) {
137+ CodeOceanEditor . removeFileTreeEventHandlers ( fileTree ) ;
138+ } )
139+ } , 250 ) ;
138140 }
139141 } . bind ( this ) ) ;
140142 CodeOceanEditor . installFileTreeEventHandlers ( fileTree ) ;
You can’t perform that action at this time.
0 commit comments