Destroy Annotator app before storing page into brwoser cache

If we do not destroy annotator app before storing the page at
browser cache we will unnecesarily initialize annotations twice (or
more) duplicating Annotator HTML markup and causing
unexpected  errors.

Without this commit you will find an error when restoring a page with
annotator, you can click on any annotation and you will see the annotation
comments are being loaded twice.

IMO this is an idempotency issue within Annotator JS library.
This commit is contained in:
Senén Rodero Rodríguez
2020-07-10 16:33:03 +02:00
parent da658f3d8c
commit fc0625df8b
3 changed files with 23 additions and 0 deletions

View File

@@ -172,6 +172,7 @@ var destroy_non_idempotent_modules = function() {
App.Datepicker.destroy();
App.HTMLEditor.destroy();
App.LegislationAnnotatable.destroy();
};
$(document).on("turbolinks:load", initialize_modules);