Unload autosave on turbolinks page render.

We cannot use turbolinks:request-start because this will duplicate code (if a page is first requested by turbolinks and afterwards by a full page reload)
This commit is contained in:
Sebastian Serth
2021-03-10 11:03:30 +01:00
parent 265f1ba498
commit 293f7f6df7

View File

@ -889,6 +889,7 @@ var CodeOceanEditor = {
this.initializeDeadlines(); this.initializeDeadlines();
CodeOceanEditorTips.initializeEventHandlers(); CodeOceanEditorTips.initializeEventHandlers();
window.addEventListener("turbolinks:before-render", this.unloadAutoSave.bind(this));
window.addEventListener("beforeunload", this.unloadAutoSave.bind(this)); window.addEventListener("beforeunload", this.unloadAutoSave.bind(this));
// create autosave when the editor is opened the first time // create autosave when the editor is opened the first time
this.autosave(); this.autosave();