From 0caa148a9bf02fe30abd3b647a5c94fc66e722a6 Mon Sep 17 00:00:00 2001 From: Alan Richardson Date: Wed, 7 May 2025 17:47:29 +0100 Subject: [PATCH 1/2] use current options --- js/gui_components/import-export-controls.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/js/gui_components/import-export-controls.js b/js/gui_components/import-export-controls.js index 19e8abc..e9a8601 100644 --- a/js/gui_components/import-export-controls.js +++ b/js/gui_components/import-export-controls.js @@ -66,6 +66,7 @@ class ImportExportControls { const typeToImport = document.querySelector("li.active-type a").getAttribute("data-type"); const textToImport = document.getElementById("markdownarea").value; + this.setCurrentTypeOptions(); this.importer.importText(typeToImport, textToImport); } @@ -74,7 +75,7 @@ class ImportExportControls { } loadFile() { - let type = document.querySelector("li.active-type a").getAttribute("data-type"); + let type = document.querySelector("li.active-type a").getAttribute("data-type"); this.readFile(this.fileInputElement.files[0]); } @@ -194,14 +195,20 @@ class ImportExportControls { if(optionsPanel){ optionsPanel.addToGui(); optionsPanel.setFromOptions(this.exporter.getOptionsForType(type)); - optionsPanel.setApplyCallback(this.setCurrentTypeOptions.bind(this)); + optionsPanel.setApplyCallback(this.applyCurrentTypeOptions.bind(this)); window.updateHelpHints(); } optionsparent.style.display = "block"; } - setCurrentTypeOptions(options){ + setCurrentTypeOptions(){ + const type = document.querySelector("li.active-type a").getAttribute("data-type"); + this.importer.setOptionsForType(type,this.optionsPanels[type].getOptionsFromGui()); + this.exporter.setOptionsForType(type,this.optionsPanels[type].getOptionsFromGui()); + } + + applyCurrentTypeOptions(options){ const type = document.querySelector("li.active-type a").getAttribute("data-type"); this.importer.setOptionsForType(type,options); this.exporter.setOptionsForType(type,options); From 1691935aad3d766797ad6032426a997e663d7daf Mon Sep 17 00:00:00 2001 From: Alan Richardson Date: Wed, 7 May 2025 18:00:03 +0100 Subject: [PATCH 2/2] add on load text as well --- js/gui_components/import-export-controls.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/gui_components/import-export-controls.js b/js/gui_components/import-export-controls.js index e9a8601..dfb0bd3 100644 --- a/js/gui_components/import-export-controls.js +++ b/js/gui_components/import-export-controls.js @@ -75,7 +75,8 @@ class ImportExportControls { } loadFile() { - let type = document.querySelector("li.active-type a").getAttribute("data-type"); + let type = document.querySelector("li.active-type a").getAttribute("data-type"); + this.setCurrentTypeOptions(); this.readFile(this.fileInputElement.files[0]); }