From: Tim Düsterhus Date: Tue, 5 Jan 2021 15:53:49 +0000 (+0100) Subject: Use async function for event listener in `Core/Bbcode/Code` X-Git-Tag: 5.4.0_Alpha_1~480^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e0b94a372a7d67430802f11bb58880de4a5c7f94;p=GitHub%2FWoltLab%2FWCF.git Use async function for event listener in `Core/Bbcode/Code` --- diff --git a/.eslintrc.js b/.eslintrc.js index 70cc12846f..95884323e7 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -32,6 +32,11 @@ module.exports = { "error", { "argsIgnorePattern": "^_" } + ], + "@typescript-eslint/no-misused-promises": [ + "error", { + "checksVoidReturn": false + } ] } }; diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Bbcode/Code.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Bbcode/Code.js index c2c881189d..daae7e54b5 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Bbcode/Code.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Bbcode/Code.js @@ -50,10 +50,9 @@ define(["require", "exports", "tslib", "../Language", "../Clipboard", "../Ui/Not const button = document.createElement("span"); button.className = "icon icon24 fa-files-o pointer jsTooltip"; button.setAttribute("title", Language.get("wcf.message.bbcode.code.copy")); - button.addEventListener("click", () => { - void Clipboard.copyElementTextToClipboard(this.codeContainer).then(() => { - UiNotification.show(Language.get("wcf.message.bbcode.code.copy.success")); - }); + button.addEventListener("click", async () => { + await Clipboard.copyElementTextToClipboard(this.codeContainer); + UiNotification.show(Language.get("wcf.message.bbcode.code.copy.success")); }); header.appendChild(button); } diff --git a/wcfsetup/install/files/ts/WoltLabSuite/Core/Bbcode/Code.ts b/wcfsetup/install/files/ts/WoltLabSuite/Core/Bbcode/Code.ts index a05d4a2d85..65c73a6a8c 100644 --- a/wcfsetup/install/files/ts/WoltLabSuite/Core/Bbcode/Code.ts +++ b/wcfsetup/install/files/ts/WoltLabSuite/Core/Bbcode/Code.ts @@ -64,10 +64,10 @@ class Code { const button = document.createElement("span"); button.className = "icon icon24 fa-files-o pointer jsTooltip"; button.setAttribute("title", Language.get("wcf.message.bbcode.code.copy")); - button.addEventListener("click", () => { - void Clipboard.copyElementTextToClipboard(this.codeContainer).then(() => { - UiNotification.show(Language.get("wcf.message.bbcode.code.copy.success")); - }); + button.addEventListener("click", async () => { + await Clipboard.copyElementTextToClipboard(this.codeContainer); + + UiNotification.show(Language.get("wcf.message.bbcode.code.copy.success")); }); header.appendChild(button);