diff --git a/ts/WoltLabSuite/Core/Form/Builder/Field/Controller/FileProcessor.ts b/ts/WoltLabSuite/Core/Form/Builder/Field/Controller/FileProcessor.ts index e317778672..82da241d97 100644 --- a/ts/WoltLabSuite/Core/Form/Builder/Field/Controller/FileProcessor.ts +++ b/ts/WoltLabSuite/Core/Form/Builder/Field/Controller/FileProcessor.ts @@ -17,6 +17,7 @@ import { } from "WoltLabSuite/Core/Component/File/Helper"; import { clearPreviousErrors } from "WoltLabSuite/Core/Component/File/Upload"; import { innerError } from "WoltLabSuite/Core/Dom/Util"; +import { confirmationFactory } from "WoltLabSuite/Core/Component/Confirmation"; type FileId = string; const fileProcessors = new Map(); @@ -130,6 +131,10 @@ export class FileProcessor { deleteButton.classList.add("button", "small"); deleteButton.textContent = getPhrase("wcf.global.button.delete"); deleteButton.addEventListener("click", async () => { + if (!(await confirmationFactory().delete())) { + return; + } + const result = await deleteFile(element.fileId!); if (result.ok) { this.#unregisterFile(element); diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Controller/FileProcessor.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Controller/FileProcessor.js index 9732fb6df6..540ddb3ac5 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Controller/FileProcessor.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Controller/FileProcessor.js @@ -4,7 +4,7 @@ * @license GNU Lesser General Public License * @since 6.1 */ -define(["require", "exports", "tslib", "WoltLabSuite/Core/Language", "WoltLabSuite/Core/Api/Files/DeleteFile", "WoltLabSuite/Core/Dom/Change/Listener", "WoltLabSuite/Core/Component/File/Helper", "WoltLabSuite/Core/Component/File/Upload", "WoltLabSuite/Core/Dom/Util"], function (require, exports, tslib_1, Language_1, DeleteFile_1, Listener_1, Helper_1, Upload_1, Util_1) { +define(["require", "exports", "tslib", "WoltLabSuite/Core/Language", "WoltLabSuite/Core/Api/Files/DeleteFile", "WoltLabSuite/Core/Dom/Change/Listener", "WoltLabSuite/Core/Component/File/Helper", "WoltLabSuite/Core/Component/File/Upload", "WoltLabSuite/Core/Dom/Util", "WoltLabSuite/Core/Component/Confirmation"], function (require, exports, tslib_1, Language_1, DeleteFile_1, Listener_1, Helper_1, Upload_1, Util_1, Confirmation_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FileProcessor = void 0; @@ -92,6 +92,9 @@ define(["require", "exports", "tslib", "WoltLabSuite/Core/Language", "WoltLabSui deleteButton.classList.add("button", "small"); deleteButton.textContent = (0, Language_1.getPhrase)("wcf.global.button.delete"); deleteButton.addEventListener("click", async () => { + if (!(await (0, Confirmation_1.confirmationFactory)().delete())) { + return; + } const result = await (0, DeleteFile_1.deleteFile)(element.fileId); if (result.ok) { this.#unregisterFile(element);