+
diff --git a/src/web/waiters/BindingsWaiter.mjs b/src/web/waiters/BindingsWaiter.mjs
index 967272ed..1a03b648 100755
--- a/src/web/waiters/BindingsWaiter.mjs
+++ b/src/web/waiters/BindingsWaiter.mjs
@@ -270,23 +270,36 @@ class BindingsWaiter {
* Shows contextual help message based on where the mouse pointer is
*/
contextualHelp() {
- const hoveredHelpEls = document.querySelectorAll(":hover[data-help]");
+ const hoveredHelpEls = document.querySelectorAll(":hover[data-help],:hover[data-help-proxy]");
+ if (!hoveredHelpEls.length) return;
- if (hoveredHelpEls.length) {
- const helpEl = hoveredHelpEls[hoveredHelpEls.length - 1],
- helpText = helpEl.getAttribute("data-help");
- let helpTitle = helpEl.getAttribute("data-help-title");
-
- if (helpTitle)
- helpTitle = "Help topic: " + helpTitle;
- else
- helpTitle = "Help topic";
-
- document.querySelector("#help-modal .modal-body").innerHTML = helpText;
- document.querySelector("#help-modal #help-title").innerHTML = helpTitle;
-
- $("#help-modal").modal();
+ let helpEl = hoveredHelpEls[hoveredHelpEls.length - 1];
+ const helpElSelector = helpEl.getAttribute("data-help-proxy");
+ if (helpElSelector) {
+ // A hovered element is directing us to another element for its help text
+ helpEl = document.querySelector(helpElSelector);
}
+ this.displayHelp(helpEl);
+ }
+
+ /**
+ * Displays the help pane populated with help text associated with the given element
+ *
+ * @param {Element} el
+ */
+ displayHelp(el) {
+ const helpText = el.getAttribute("data-help");
+ let helpTitle = el.getAttribute("data-help-title");
+
+ if (helpTitle)
+ helpTitle = "Help topic: " + helpTitle;
+ else
+ helpTitle = "Help topic";
+
+ document.querySelector("#help-modal .modal-body").innerHTML = helpText;
+ document.querySelector("#help-modal #help-title").innerHTML = helpTitle;
+
+ $("#help-modal").modal();
}
}
diff --git a/src/web/waiters/OutputWaiter.mjs b/src/web/waiters/OutputWaiter.mjs
index 1d0ff3d8..dae27f3e 100755
--- a/src/web/waiters/OutputWaiter.mjs
+++ b/src/web/waiters/OutputWaiter.mjs
@@ -7,6 +7,7 @@
import Utils, {debounce} from "../../core/Utils.mjs";
import Dish from "../../core/Dish.mjs";
+import {detectFileType} from "../../core/lib/FileType.mjs";
import FileSaver from "file-saver";
import ZipWorker from "worker-loader?inline=no-fallback!../workers/ZipWorker.mjs";
@@ -765,13 +766,22 @@ class OutputWaiter {
this.app.alert("Could not find any output data to download. Has this output been baked?", 3000);
return;
}
- const fileName = window.prompt("Please enter a filename: ", "download.dat");
+
+ const data = await dish.get(Dish.ARRAY_BUFFER);
+ let ext = ".dat";
+
+ // Detect file type automatically
+ const types = detectFileType(data);
+ if (types.length) {
+ ext = `.${types[0].extension.split(",", 1)[0]}`;
+ }
+
+ const fileName = window.prompt("Please enter a filename: ", `download${ext}`);
// Assume if the user clicks cancel they don't want to download
if (fileName === null) return;
- const data = await dish.get(Dish.ARRAY_BUFFER),
- file = new File([data], fileName);
+ const file = new File([data], fileName);
FileSaver.saveAs(file, fileName, {autoBom: false});
}