Fix the replacement of the pagination in the media manager
authorAlexander Ebert <ebert@woltlab.com>
Sun, 14 May 2023 16:47:58 +0000 (18:47 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 14 May 2023 16:47:58 +0000 (18:47 +0200)
Fixes #5503

ts/WoltLabSuite/Core/Media/Manager/Base.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Media/Manager/Base.js

index 69d4272fa4b014008d0fa829defd9c2ec671345b..8b6989d588fa0d95b4cb961af2b6389ca1e293e8 100644 (file)
@@ -296,10 +296,10 @@ abstract class MediaManager<TOptions extends MediaManagerOptions = MediaManagerO
     if (pageCount > 1) {
       const newPagination = document.createElement("div");
       newPagination.className = "paginationBottom jsPagination";
-      DomUtil.replaceElement(
-        UiDialog.getDialog(this)!.content.querySelector(".jsPagination") as HTMLElement,
-        newPagination,
-      );
+
+      const oldPagination = UiDialog.getDialog(this)!.content.querySelector(".jsPagination") as HTMLElement;
+      oldPagination.insertAdjacentElement("beforebegin", newPagination);
+      oldPagination.remove();
 
       this._pagination = new UiPagination(newPagination, {
         activePage: pageNo,
index 4d0eeeb19c3a70a1b7ddcd2927fa27236337660e..3649ebef334c03cfac229f8c1513044dd2e33f09 100644 (file)
@@ -236,7 +236,9 @@ define(["require", "exports", "tslib", "../../Core", "../../Language", "../../Pe
             if (pageCount > 1) {
                 const newPagination = document.createElement("div");
                 newPagination.className = "paginationBottom jsPagination";
-                DomUtil.replaceElement(UiDialog.getDialog(this).content.querySelector(".jsPagination"), newPagination);
+                const oldPagination = UiDialog.getDialog(this).content.querySelector(".jsPagination");
+                oldPagination.insertAdjacentElement("beforebegin", newPagination);
+                oldPagination.remove();
                 this._pagination = new Pagination_1.default(newPagination, {
                     activePage: pageNo,
                     callbackSwitch: (pageNo) => this._search.search(pageNo),