From 3bfba4d3fc45f490a8f3a724a01c588f67fc4269 Mon Sep 17 00:00:00 2001 From: Kitteh Date: Sat, 8 May 2021 00:30:44 +0100 Subject: [PATCH] Add typing to CopyableModal.ts. --- src/elements/{CopyableModal.js => CopyableModal.ts} | 6 +++--- src/pages/Transit/TransitDecrypt.js | 2 +- src/pages/Transit/TransitEncrypt.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) rename src/elements/{CopyableModal.js => CopyableModal.ts} (91%) diff --git a/src/elements/CopyableModal.js b/src/elements/CopyableModal.ts similarity index 91% rename from src/elements/CopyableModal.js rename to src/elements/CopyableModal.ts index 224360b..ba86db6 100644 --- a/src/elements/CopyableModal.js +++ b/src/elements/CopyableModal.ts @@ -4,7 +4,7 @@ import ClipboardJS from "clipboard"; import FileSaver from 'file-saver'; import i18next from 'i18next'; -export function CopyableModal(name, contentString) { +export function CopyableModal(name: string, contentString: string): Element { return makeElement({ tag: "div", class: "modal-sections", @@ -54,7 +54,7 @@ export function CopyableModal(name, contentString) { }, text: i18next.t("copy_modal_download_btn"), onclick: _ => { - var blob = new Blob([contentString], {type: "text/plain;charset=utf-8"}); + const blob = new Blob([contentString], {type: "text/plain;charset=utf-8"}); FileSaver.saveAs(blob, "result.txt"); } }), @@ -67,7 +67,7 @@ export function CopyableModal(name, contentString) { }, text: i18next.t("copy_modal_copy_btn"), thenRun: (e) => { - let clipboard = new ClipboardJS(e); + const clipboard = new ClipboardJS(e); addClipboardNotifications(clipboard); } }), diff --git a/src/pages/Transit/TransitDecrypt.js b/src/pages/Transit/TransitDecrypt.js index c4f8e50..24a1b56 100644 --- a/src/pages/Transit/TransitDecrypt.js +++ b/src/pages/Transit/TransitDecrypt.js @@ -1,4 +1,4 @@ -import { CopyableModal } from "../../elements/CopyableModal.js"; +import { CopyableModal } from "../../elements/CopyableModal"; import { Margin } from "../../elements/Margin.js"; import { Page } from "../../types/Page"; import { changePage, setErrorText, setPageContent, setTitleElement } from "../../pageUtils"; diff --git a/src/pages/Transit/TransitEncrypt.js b/src/pages/Transit/TransitEncrypt.js index b148136..76a1915 100644 --- a/src/pages/Transit/TransitEncrypt.js +++ b/src/pages/Transit/TransitEncrypt.js @@ -1,4 +1,4 @@ -import { CopyableModal } from "../../elements/CopyableModal.js"; +import { CopyableModal } from "../../elements/CopyableModal"; import { Margin } from "../../elements/Margin.js"; import { Page } from "../../types/Page"; import { changePage, setErrorText, setPageContent, setTitleElement } from "../../pageUtils";