From e37e9c4cee748c065cbf5b8ebcc8710bd6670a14 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 14 May 2023 18:47:58 +0200 Subject: [PATCH] Fix the replacement of the pagination in the media manager Fixes #5503 --- ts/WoltLabSuite/Core/Media/Manager/Base.ts | 8 ++++---- .../files/js/WoltLabSuite/Core/Media/Manager/Base.js | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ts/WoltLabSuite/Core/Media/Manager/Base.ts b/ts/WoltLabSuite/Core/Media/Manager/Base.ts index 69d4272fa4..8b6989d588 100644 --- a/ts/WoltLabSuite/Core/Media/Manager/Base.ts +++ b/ts/WoltLabSuite/Core/Media/Manager/Base.ts @@ -296,10 +296,10 @@ abstract class MediaManager 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, diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Manager/Base.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Manager/Base.js index 4d0eeeb19c..3649ebef33 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Manager/Base.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Manager/Base.js @@ -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), -- 2.20.1