import BasicWidget from "../basic_widget.js"; import { Modal } from "bootstrap"; import utils from "../../services/utils.js"; import { t } from "../../services/i18n.js"; const TPL = /*html*/` `; export default class RosettaWarningDialog extends BasicWidget { private modal!: Modal; private $downloadButton!: JQuery; private $continueButton!: JQuery; doRender() { this.$widget = $(TPL); this.modal = Modal.getOrCreateInstance(this.$widget[0]); this.$downloadButton = this.$widget.find(".download-correct-version-button"); this.$continueButton = this.$widget.find(".continue-anyway-button"); this.$downloadButton.on("click", () => { // Open the releases page where users can download the correct version if (utils.isElectron()) { const { shell } = utils.dynamicRequire("electron"); shell.openExternal("https://github.com/TriliumNext/Notes/releases/latest"); } else { window.open("https://github.com/TriliumNext/Notes/releases/latest", "_blank"); } }); // Auto-focus the download button when shown this.$widget.on("shown.bs.modal", () => { this.$downloadButton.trigger("focus"); }); } showRosettaWarningEvent() { this.modal.show(); } }