1
0
Fork 0

Add typing to CopyableModal.ts.

This commit is contained in:
Kitteh 2021-05-08 00:30:44 +01:00
parent 73cc78125f
commit 3bfba4d3fc
3 changed files with 5 additions and 5 deletions

View file

@ -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);
}
}),

View file

@ -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";

View file

@ -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";