Skip to content

Commit

Permalink
Refresh export configuration when opening the import/export settings …
Browse files Browse the repository at this point in the history
…page

Signed-off-by: Philipp <[email protected]>
  • Loading branch information
Kiuryy committed Aug 7, 2024
1 parent 5ddc02b commit 47fe9ac
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/js/settings/importExport.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,20 @@
* @returns {Promise}
*/
const initExport = async () => {
$(document).on($.opts.events.pageChanged, (e) => {
if (e.detail.path && e.detail.path[0] === "export") {
updateExportDataHref();
}
});
updateExportDataHref();
};

/**
* Set a data:text/json href to the export button with the current configuration
*/
const updateExportDataHref = () => {
const config = JSON.stringify(this.getExportConfig(), null, 2);
console.log("LOAD")
s.elm.buttons["export"].attr({
href: "data:text/json;charset=utf-8," + encodeURIComponent(config),
download: getExportFilename()
Expand Down

0 comments on commit 47fe9ac

Please sign in to comment.