Add typing to CopyableModal.ts.
This commit is contained in:
parent
73cc78125f
commit
3bfba4d3fc
|
@ -4,7 +4,7 @@ import ClipboardJS from "clipboard";
|
||||||
import FileSaver from 'file-saver';
|
import FileSaver from 'file-saver';
|
||||||
import i18next from 'i18next';
|
import i18next from 'i18next';
|
||||||
|
|
||||||
export function CopyableModal(name, contentString) {
|
export function CopyableModal(name: string, contentString: string): Element {
|
||||||
return makeElement({
|
return makeElement({
|
||||||
tag: "div",
|
tag: "div",
|
||||||
class: "modal-sections",
|
class: "modal-sections",
|
||||||
|
@ -54,7 +54,7 @@ export function CopyableModal(name, contentString) {
|
||||||
},
|
},
|
||||||
text: i18next.t("copy_modal_download_btn"),
|
text: i18next.t("copy_modal_download_btn"),
|
||||||
onclick: _ => {
|
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");
|
FileSaver.saveAs(blob, "result.txt");
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
@ -67,7 +67,7 @@ export function CopyableModal(name, contentString) {
|
||||||
},
|
},
|
||||||
text: i18next.t("copy_modal_copy_btn"),
|
text: i18next.t("copy_modal_copy_btn"),
|
||||||
thenRun: (e) => {
|
thenRun: (e) => {
|
||||||
let clipboard = new ClipboardJS(e);
|
const clipboard = new ClipboardJS(e);
|
||||||
addClipboardNotifications(clipboard);
|
addClipboardNotifications(clipboard);
|
||||||
}
|
}
|
||||||
}),
|
}),
|
|
@ -1,4 +1,4 @@
|
||||||
import { CopyableModal } from "../../elements/CopyableModal.js";
|
import { CopyableModal } from "../../elements/CopyableModal";
|
||||||
import { Margin } from "../../elements/Margin.js";
|
import { Margin } from "../../elements/Margin.js";
|
||||||
import { Page } from "../../types/Page";
|
import { Page } from "../../types/Page";
|
||||||
import { changePage, setErrorText, setPageContent, setTitleElement } from "../../pageUtils";
|
import { changePage, setErrorText, setPageContent, setTitleElement } from "../../pageUtils";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { CopyableModal } from "../../elements/CopyableModal.js";
|
import { CopyableModal } from "../../elements/CopyableModal";
|
||||||
import { Margin } from "../../elements/Margin.js";
|
import { Margin } from "../../elements/Margin.js";
|
||||||
import { Page } from "../../types/Page";
|
import { Page } from "../../types/Page";
|
||||||
import { changePage, setErrorText, setPageContent, setTitleElement } from "../../pageUtils";
|
import { changePage, setErrorText, setPageContent, setTitleElement } from "../../pageUtils";
|
||||||
|
|
Loading…
Reference in a new issue