Move statement to the correct comment position
authorCyperghost <olaf_schmitz_1@t-online.de>
Wed, 26 Jun 2024 09:12:29 +0000 (11:12 +0200)
committerCyperghost <olaf_schmitz_1@t-online.de>
Wed, 26 Jun 2024 09:12:29 +0000 (11:12 +0200)
ts/WoltLabSuite/Core/Form/Builder/Field/Controller/FileProcessor.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Controller/FileProcessor.js

index 7f0253353cbb880cc17d9e32c988730fab5ba827..8661f6b9356c48579d1d45d7681bf5b0c73ae1d4 100644 (file)
@@ -156,7 +156,6 @@ export class FileProcessor {
     replaceButton.classList.add("button", "small");
     replaceButton.textContent = getPhrase("wcf.global.button.replace");
     replaceButton.addEventListener("click", () => {
-      this.#replaceElement = element;
       // add to context an extra attribute that the replace button is clicked.
       // after the dialog is closed or the file is selected, the context will be reset to his old value.
       // this is necessary as the serverside validation will otherwise fail.
@@ -168,6 +167,7 @@ export class FileProcessor {
       // remove the element and all buttons from the dom, but keep them stored in a variable.
       // if the user cancels the dialog or the upload fails, reinsert the old elements and show an error message.
       // if the upload is successful, delete the old file.
+      this.#replaceElement = element;
       this.#unregisterFile(element);
 
       const changeEventListener = () => {
index 756b1a7b802da7a6aa56b89c6a4f2b1a588c0d3e..94700a0ca40dbf067d23c9b75c71ac67497f4c24 100644 (file)
@@ -121,7 +121,6 @@ define(["require", "exports", "tslib", "WoltLabSuite/Core/Language", "WoltLabSui
             replaceButton.classList.add("button", "small");
             replaceButton.textContent = (0, Language_1.getPhrase)("wcf.global.button.replace");
             replaceButton.addEventListener("click", () => {
-                this.#replaceElement = element;
                 // add to context an extra attribute that the replace button is clicked.
                 // after the dialog is closed or the file is selected, the context will be reset to his old value.
                 // this is necessary as the serverside validation will otherwise fail.
@@ -132,6 +131,7 @@ define(["require", "exports", "tslib", "WoltLabSuite/Core/Language", "WoltLabSui
                 // remove the element and all buttons from the dom, but keep them stored in a variable.
                 // if the user cancels the dialog or the upload fails, reinsert the old elements and show an error message.
                 // if the upload is successful, delete the old file.
+                this.#replaceElement = element;
                 this.#unregisterFile(element);
                 const changeEventListener = () => {
                     this.#uploadButton.dataset.context = oldContext;