Initialize the image viewer for dynamic attachments
authorAlexander Ebert <ebert@woltlab.com>
Sat, 4 May 2024 10:08:05 +0000 (12:08 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 8 Jun 2024 10:19:39 +0000 (12:19 +0200)
com.woltlab.wcf/templates/attachments.tpl
ts/WoltLabSuite/Core/Component/Attachment/List.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Component/Attachment/List.js

index 4ddb0882fa50cb0dd83aa60523c2e9d413e5bf73..f52a2c5db2dd23e3405cc6477e8f1bdc95da04ec 100644 (file)
                                                                                        {icon name='up-right-and-down-left-from-center'}
                                                                                        {#$attachment->width} × {#$attachment->height}
                                                                                </li>
-                                                                               <li>
-                                                                                       {icon name='eye'}
-                                                                                       {#$attachment->downloads}
-                                                                               </li>
                                                                        </ul>
                                                                </a>
                                                        </li>
index 2f535e5fcbbcf485b7efc40c528b9fe8792339cf..652edbbe5946bfa6d7e2c6b38d17c37d20c7d1d3 100644 (file)
@@ -5,6 +5,7 @@ import WoltlabCoreFileElement from "../File/woltlab-core-file";
 import "../File/woltlab-core-file";
 import { CkeditorDropEvent } from "../File/Upload";
 import { formatFilesize } from "WoltLabSuite/Core/FileUtil";
+import DomChangeListener from "WoltLabSuite/Core/Dom/Change/Listener";
 
 type FileProcessorData = {
   attachmentID: number;
@@ -74,6 +75,8 @@ function upload(fileList: HTMLElement, file: WoltlabCoreFileElement, editorId: s
 
           filename.innerHTML = "";
           filename.append(link);
+
+          DomChangeListener.trigger();
         }
       }
 
index f159627094d52e5900f29f7ab0ec1a8792b6244e..9b0bc37881a68afdedb0e29b84c6bb1c1c3402eb 100644 (file)
@@ -1,7 +1,8 @@
-define(["require", "exports", "WoltLabSuite/Core/Api/Files/DeleteFile", "../Ckeditor/Event", "WoltLabSuite/Core/FileUtil", "../File/woltlab-core-file"], function (require, exports, DeleteFile_1, Event_1, FileUtil_1) {
+define(["require", "exports", "tslib", "WoltLabSuite/Core/Api/Files/DeleteFile", "../Ckeditor/Event", "WoltLabSuite/Core/FileUtil", "WoltLabSuite/Core/Dom/Change/Listener", "../File/woltlab-core-file"], function (require, exports, tslib_1, DeleteFile_1, Event_1, FileUtil_1, Listener_1) {
     "use strict";
     Object.defineProperty(exports, "__esModule", { value: true });
     exports.setup = void 0;
+    Listener_1 = tslib_1.__importDefault(Listener_1);
     function upload(fileList, file, editorId) {
         const element = document.createElement("li");
         element.classList.add("attachment__item");
@@ -48,6 +49,7 @@ define(["require", "exports", "WoltLabSuite/Core/Api/Files/DeleteFile", "../Cked
                     link.textContent = file.filename;
                     filename.innerHTML = "";
                     filename.append(link);
+                    Listener_1.default.trigger();
                 }
             }
             element.append(buttonList);