From 82219dd899f5dd1575a929ca72d8a0c298621532 Mon Sep 17 00:00:00 2001 From: FiratUsta <67150276+FiratUsta@users.noreply.github.com> Date: Sat, 7 Sep 2024 23:40:19 +0300 Subject: [PATCH] [Bug Fix] Multiple Bug Fixes (#1836) * Fix the add file button on the multi-tools page. * Fix a bug where the page numbers wouldn't be removed on page move on Firefox. --------- Co-authored-by: kazandaki --- .../resources/static/js/multitool/PdfActionsManager.js | 2 +- src/main/resources/static/js/multitool/PdfContainer.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/resources/static/js/multitool/PdfActionsManager.js b/src/main/resources/static/js/multitool/PdfActionsManager.js index 83768dc0..3701266e 100644 --- a/src/main/resources/static/js/multitool/PdfActionsManager.js +++ b/src/main/resources/static/js/multitool/PdfActionsManager.js @@ -78,7 +78,7 @@ class PdfActionsManager { imgContainer.classList.toggle("split-before"); } - setActions({ movePageTo, addPdfs, rotateElement }) { + setActions({ movePageTo, addFiles, rotateElement }) { this.movePageTo = movePageTo; this.addFiles = addFiles; this.rotateElement = rotateElement; diff --git a/src/main/resources/static/js/multitool/PdfContainer.js b/src/main/resources/static/js/multitool/PdfContainer.js index b55b5699..0654cac9 100644 --- a/src/main/resources/static/js/multitool/PdfContainer.js +++ b/src/main/resources/static/js/multitool/PdfContainer.js @@ -53,6 +53,13 @@ class PdfContainer { const childArray = Array.from(this.pagesContainer.childNodes); const startIndex = childArray.indexOf(startElement); const endIndex = childArray.indexOf(endElement); + + // Check & remove page number elements here too if they exist because Firefox doesn't fire the relevant event on page move. + const pageNumberElement = startElement.querySelector(".page-number"); + if (pageNumberElement) { + startElement.removeChild(pageNumberElement); + } + this.pagesContainer.removeChild(startElement); if (!endElement) { this.pagesContainer.append(startElement);