From 0e602153f3e7629aa06ca9ab9b79f925fde05844 Mon Sep 17 00:00:00 2001 From: reecebrowne <74901996+reecebrowne@users.noreply.github.com> Date: Fri, 22 Nov 2024 11:39:22 +0000 Subject: [PATCH] Feature/2198/multitool multi select move pages (#2294) * Multitool - Select multiple pages for rotation tool * Multitool multi select delete feature * Multitool multi select UI improvements and big fixes * Multitool multi select select all and UI improvements * Multi tool multi select, download selected, clean up and bug fixes * Groundwork for multiselect drag and drop * Multi select drag and drop finalised * Update translation files Signed-off-by: GitHub Action * Turn off select mode after multidrag --------- Signed-off-by: GitHub Action Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../api/security/CertSignController.java | 35 +++--- src/main/resources/messages_ar_AR.properties | 1 + src/main/resources/messages_bg_BG.properties | 1 + src/main/resources/messages_ca_CA.properties | 1 + src/main/resources/messages_cs_CZ.properties | 1 + src/main/resources/messages_da_DK.properties | 1 + src/main/resources/messages_de_DE.properties | 1 + src/main/resources/messages_el_GR.properties | 1 + src/main/resources/messages_en_GB.properties | 1 + src/main/resources/messages_en_US.properties | 1 + src/main/resources/messages_es_ES.properties | 1 + src/main/resources/messages_eu_ES.properties | 1 + src/main/resources/messages_fr_FR.properties | 1 + src/main/resources/messages_ga_IE.properties | 1 + src/main/resources/messages_hi_IN.properties | 1 + src/main/resources/messages_hr_HR.properties | 1 + src/main/resources/messages_hu_HU.properties | 1 + src/main/resources/messages_id_ID.properties | 1 + src/main/resources/messages_it_IT.properties | 1 + src/main/resources/messages_ja_JP.properties | 1 + src/main/resources/messages_ko_KR.properties | 1 + src/main/resources/messages_nl_NL.properties | 1 + src/main/resources/messages_no_NB.properties | 1 + src/main/resources/messages_pl_PL.properties | 1 + src/main/resources/messages_pt_BR.properties | 1 + src/main/resources/messages_pt_PT.properties | 1 + src/main/resources/messages_ro_RO.properties | 1 + src/main/resources/messages_ru_RU.properties | 1 + src/main/resources/messages_sk_SK.properties | 1 + .../resources/messages_sr_LATN_RS.properties | 1 + src/main/resources/messages_sv_SE.properties | 1 + src/main/resources/messages_th_TH.properties | 1 + src/main/resources/messages_tr_TR.properties | 1 + src/main/resources/messages_uk_UA.properties | 1 + src/main/resources/messages_vi_VN.properties | 1 + src/main/resources/messages_zh_CN.properties | 1 + src/main/resources/messages_zh_TW.properties | 1 + src/main/resources/static/css/dragdrop.css | 9 ++ src/main/resources/static/css/pdfActions.css | 2 +- .../static/js/multitool/DragDropManager.js | 114 ++++++++++++------ .../static/js/multitool/PdfContainer.js | 30 ++++- src/main/resources/templates/multi-tool.html | 10 +- 42 files changed, 165 insertions(+), 71 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/controller/api/security/CertSignController.java b/src/main/java/stirling/software/SPDF/controller/api/security/CertSignController.java index 27262febd..cb5eef104 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/security/CertSignController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/security/CertSignController.java @@ -98,10 +98,10 @@ public class CertSignController { public CreateSignature(KeyStore keystore, char[] pin) throws KeyStoreException, - UnrecoverableKeyException, - NoSuchAlgorithmException, - IOException, - CertificateException { + UnrecoverableKeyException, + NoSuchAlgorithmException, + IOException, + CertificateException { super(keystore, pin); ClassPathResource resource = new ClassPathResource("static/images/signature.png"); try (InputStream is = resource.getInputStream()) { @@ -160,8 +160,7 @@ public class CertSignController { extState.setNonStrokingAlphaConstant(0.5f); cs.setGraphicsStateParameters(extState); cs.transform(Matrix.getScaleInstance(0.08f, 0.08f)); - PDImageXObject img = - PDImageXObject.createFromFileByExtension(logoFile, doc); + PDImageXObject img = PDImageXObject.createFromFileByExtension(logoFile, doc); cs.drawImage(img, 100, 0); cs.restoreGraphicsState(); } @@ -209,10 +208,7 @@ public class CertSignController { } @PostMapping(consumes = "multipart/form-data", value = "/cert-sign") - @Operation( - summary = "Sign PDF with a Digital Certificate", - description = - "This endpoint accepts a PDF file, a digital certificate and related information to sign the PDF. It then returns the digitally signed PDF file. Input:PDF Output:PDF Type:SISO") + @Operation(summary = "Sign PDF with a Digital Certificate", description = "This endpoint accepts a PDF file, a digital certificate and related information to sign the PDF. It then returns the digitally signed PDF file. Input:PDF Output:PDF Type:SISO") public ResponseEntity signPDFWithCert(@ModelAttribute SignPDFWithCertRequest request) throws Exception { MultipartFile pdf = request.getFileInput(); @@ -242,7 +238,7 @@ public class CertSignController { PrivateKey privateKey = getPrivateKeyFromPEM(privateKeyFile.getBytes(), password); Certificate cert = (Certificate) getCertificateFromPEM(certFile.getBytes()); ks.setKeyEntry( - "alias", privateKey, password.toCharArray(), new Certificate[] {cert}); + "alias", privateKey, password.toCharArray(), new Certificate[] { cert }); break; case "PKCS12": ks = KeyStore.getInstance("PKCS12"); @@ -314,22 +310,19 @@ public class CertSignController { private PrivateKey getPrivateKeyFromPEM(byte[] pemBytes, String password) throws IOException, OperatorCreationException, PKCSException { - try (PEMParser pemParser = - new PEMParser(new InputStreamReader(new ByteArrayInputStream(pemBytes)))) { + try (PEMParser pemParser = new PEMParser(new InputStreamReader(new ByteArrayInputStream(pemBytes)))) { Object pemObject = pemParser.readObject(); JcaPEMKeyConverter converter = new JcaPEMKeyConverter().setProvider("BC"); PrivateKeyInfo pkInfo; if (pemObject instanceof PKCS8EncryptedPrivateKeyInfo) { - InputDecryptorProvider decProv = - new JceOpenSSLPKCS8DecryptorProviderBuilder().build(password.toCharArray()); + InputDecryptorProvider decProv = new JceOpenSSLPKCS8DecryptorProviderBuilder() + .build(password.toCharArray()); pkInfo = ((PKCS8EncryptedPrivateKeyInfo) pemObject).decryptPrivateKeyInfo(decProv); } else if (pemObject instanceof PEMEncryptedKeyPair) { - PEMDecryptorProvider decProv = - new JcePEMDecryptorProviderBuilder().build(password.toCharArray()); - pkInfo = - ((PEMEncryptedKeyPair) pemObject) - .decryptKeyPair(decProv) - .getPrivateKeyInfo(); + PEMDecryptorProvider decProv = new JcePEMDecryptorProviderBuilder().build(password.toCharArray()); + pkInfo = ((PEMEncryptedKeyPair) pemObject) + .decryptKeyPair(decProv) + .getPrivateKeyInfo(); } else { pkInfo = ((PEMKeyPair) pemObject).getPrivateKeyInfo(); } diff --git a/src/main/resources/messages_ar_AR.properties b/src/main/resources/messages_ar_AR.properties index 1257625eb..bd7d3b105 100644 --- a/src/main/resources/messages_ar_AR.properties +++ b/src/main/resources/messages_ar_AR.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=هذه الميزة متوفرة في صفحة الأدوات المتعددة لدينا. اطلع عليها للحصول على واجهة مستخدم محسّنة لكل صفحة وميزات إضافية! diff --git a/src/main/resources/messages_bg_BG.properties b/src/main/resources/messages_bg_BG.properties index 1521c77db..8374f522e 100644 --- a/src/main/resources/messages_bg_BG.properties +++ b/src/main/resources/messages_bg_BG.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_ca_CA.properties b/src/main/resources/messages_ca_CA.properties index 38ee1edd6..0de8afc7e 100644 --- a/src/main/resources/messages_ca_CA.properties +++ b/src/main/resources/messages_ca_CA.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_cs_CZ.properties b/src/main/resources/messages_cs_CZ.properties index a74901210..ac8c6f00a 100644 --- a/src/main/resources/messages_cs_CZ.properties +++ b/src/main/resources/messages_cs_CZ.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_da_DK.properties b/src/main/resources/messages_da_DK.properties index e744d7f48..8750bcfdc 100644 --- a/src/main/resources/messages_da_DK.properties +++ b/src/main/resources/messages_da_DK.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_de_DE.properties b/src/main/resources/messages_de_DE.properties index 019a07253..a51e010db 100644 --- a/src/main/resources/messages_de_DE.properties +++ b/src/main/resources/messages_de_DE.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=Diese Funktion ist auch auf unserer PDF-Multitool-Seite verfügbar. Probieren Sie sie aus, denn sie bietet eine verbesserte Benutzeroberfläche und zusätzliche Funktionen! diff --git a/src/main/resources/messages_el_GR.properties b/src/main/resources/messages_el_GR.properties index 093b5fc35..cf4f2e47a 100644 --- a/src/main/resources/messages_el_GR.properties +++ b/src/main/resources/messages_el_GR.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_en_GB.properties b/src/main/resources/messages_en_GB.properties index bc0b97454..bfd98861b 100644 --- a/src/main/resources/messages_en_GB.properties +++ b/src/main/resources/messages_en_GB.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_en_US.properties b/src/main/resources/messages_en_US.properties index d80281422..8bc953930 100644 --- a/src/main/resources/messages_en_US.properties +++ b/src/main/resources/messages_en_US.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_es_ES.properties b/src/main/resources/messages_es_ES.properties index db7c43bc7..125ff16c6 100644 --- a/src/main/resources/messages_es_ES.properties +++ b/src/main/resources/messages_es_ES.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_eu_ES.properties b/src/main/resources/messages_eu_ES.properties index ecfef3f20..a9e9a1604 100644 --- a/src/main/resources/messages_eu_ES.properties +++ b/src/main/resources/messages_eu_ES.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_fr_FR.properties b/src/main/resources/messages_fr_FR.properties index aa4753b3a..97b9f16a0 100644 --- a/src/main/resources/messages_fr_FR.properties +++ b/src/main/resources/messages_fr_FR.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_ga_IE.properties b/src/main/resources/messages_ga_IE.properties index 2e1dfbc21..2787fd025 100644 --- a/src/main/resources/messages_ga_IE.properties +++ b/src/main/resources/messages_ga_IE.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_hi_IN.properties b/src/main/resources/messages_hi_IN.properties index 3547f9beb..32762eede 100644 --- a/src/main/resources/messages_hi_IN.properties +++ b/src/main/resources/messages_hi_IN.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_hr_HR.properties b/src/main/resources/messages_hr_HR.properties index d4025f827..7ab24943b 100644 --- a/src/main/resources/messages_hr_HR.properties +++ b/src/main/resources/messages_hr_HR.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_hu_HU.properties b/src/main/resources/messages_hu_HU.properties index 7890785c9..dc2092075 100644 --- a/src/main/resources/messages_hu_HU.properties +++ b/src/main/resources/messages_hu_HU.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_id_ID.properties b/src/main/resources/messages_id_ID.properties index ec4d30367..d58409264 100644 --- a/src/main/resources/messages_id_ID.properties +++ b/src/main/resources/messages_id_ID.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_it_IT.properties b/src/main/resources/messages_it_IT.properties index 1e0f6d73f..1cd634188 100644 --- a/src/main/resources/messages_it_IT.properties +++ b/src/main/resources/messages_it_IT.properties @@ -952,6 +952,7 @@ multiTool.split=Dividi multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=Questa funzione è disponibile anche nella nostra pagina multi-strumento. Scoprila per un'interfaccia utente pagina per pagina migliorata e funzionalità aggiuntive! diff --git a/src/main/resources/messages_ja_JP.properties b/src/main/resources/messages_ja_JP.properties index 48e3e4d91..1a84eedd3 100644 --- a/src/main/resources/messages_ja_JP.properties +++ b/src/main/resources/messages_ja_JP.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_ko_KR.properties b/src/main/resources/messages_ko_KR.properties index 577918936..792dd7cd4 100644 --- a/src/main/resources/messages_ko_KR.properties +++ b/src/main/resources/messages_ko_KR.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_nl_NL.properties b/src/main/resources/messages_nl_NL.properties index 098bbee73..451d7e8c1 100644 --- a/src/main/resources/messages_nl_NL.properties +++ b/src/main/resources/messages_nl_NL.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_no_NB.properties b/src/main/resources/messages_no_NB.properties index 077822839..f4ac6dc81 100644 --- a/src/main/resources/messages_no_NB.properties +++ b/src/main/resources/messages_no_NB.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_pl_PL.properties b/src/main/resources/messages_pl_PL.properties index 11b1414ad..520b27565 100755 --- a/src/main/resources/messages_pl_PL.properties +++ b/src/main/resources/messages_pl_PL.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_pt_BR.properties b/src/main/resources/messages_pt_BR.properties index 9629d40d3..bc75eecda 100644 --- a/src/main/resources/messages_pt_BR.properties +++ b/src/main/resources/messages_pt_BR.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_pt_PT.properties b/src/main/resources/messages_pt_PT.properties index d48c9e44c..720481203 100644 --- a/src/main/resources/messages_pt_PT.properties +++ b/src/main/resources/messages_pt_PT.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_ro_RO.properties b/src/main/resources/messages_ro_RO.properties index b3d552984..b7005691f 100644 --- a/src/main/resources/messages_ro_RO.properties +++ b/src/main/resources/messages_ro_RO.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_ru_RU.properties b/src/main/resources/messages_ru_RU.properties index 708fe435a..29b07bb18 100644 --- a/src/main/resources/messages_ru_RU.properties +++ b/src/main/resources/messages_ru_RU.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_sk_SK.properties b/src/main/resources/messages_sk_SK.properties index 1b26fc2aa..88709aef5 100644 --- a/src/main/resources/messages_sk_SK.properties +++ b/src/main/resources/messages_sk_SK.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_sr_LATN_RS.properties b/src/main/resources/messages_sr_LATN_RS.properties index ebd60d6f1..966fc7494 100644 --- a/src/main/resources/messages_sr_LATN_RS.properties +++ b/src/main/resources/messages_sr_LATN_RS.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_sv_SE.properties b/src/main/resources/messages_sv_SE.properties index 5051fea81..c1b0ed2af 100644 --- a/src/main/resources/messages_sv_SE.properties +++ b/src/main/resources/messages_sv_SE.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_th_TH.properties b/src/main/resources/messages_th_TH.properties index 849446633..229a8eb3b 100644 --- a/src/main/resources/messages_th_TH.properties +++ b/src/main/resources/messages_th_TH.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_tr_TR.properties b/src/main/resources/messages_tr_TR.properties index 3458f679b..d8adef67c 100644 --- a/src/main/resources/messages_tr_TR.properties +++ b/src/main/resources/messages_tr_TR.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_uk_UA.properties b/src/main/resources/messages_uk_UA.properties index d0266f59e..bfeee3a92 100644 --- a/src/main/resources/messages_uk_UA.properties +++ b/src/main/resources/messages_uk_UA.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_vi_VN.properties b/src/main/resources/messages_vi_VN.properties index be7a3775e..e75ae6709 100644 --- a/src/main/resources/messages_vi_VN.properties +++ b/src/main/resources/messages_vi_VN.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_zh_CN.properties b/src/main/resources/messages_zh_CN.properties index 1aa3f9c8b..2db63cf8e 100644 --- a/src/main/resources/messages_zh_CN.properties +++ b/src/main/resources/messages_zh_CN.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/messages_zh_TW.properties b/src/main/resources/messages_zh_TW.properties index 6db39f9cb..1e0834f09 100644 --- a/src/main/resources/messages_zh_TW.properties +++ b/src/main/resources/messages_zh_TW.properties @@ -952,6 +952,7 @@ multiTool.split=Split multiTool.moveLeft=Move Left multiTool.moveRight=Move Right multiTool.delete=Delete +multiTool.dragDropMessage=Page(s) Selected #multiTool-advert multiTool-advert.message=This feature is also available in our multi-tool page. Check it out for enhanced page-by-page UI and additional features! diff --git a/src/main/resources/static/css/dragdrop.css b/src/main/resources/static/css/dragdrop.css index 7758bdd9d..65ec786f6 100644 --- a/src/main/resources/static/css/dragdrop.css +++ b/src/main/resources/static/css/dragdrop.css @@ -19,6 +19,15 @@ transform-origin: top left; } +#drag-container .multidrag { + position: fixed; + max-width: 200px; + max-height: 200px; + transform-origin: top left; + margin-left: 1rem; + background-color: rgba(0, 29, 41, 0.9); +} + .drag-manager_dragging { width: 0px; visibility: hidden; diff --git a/src/main/resources/static/css/pdfActions.css b/src/main/resources/static/css/pdfActions.css index 023097352..8d69d792e 100644 --- a/src/main/resources/static/css/pdfActions.css +++ b/src/main/resources/static/css/pdfActions.css @@ -138,7 +138,7 @@ html[dir="rtl"] .pdf-actions_container:last-child>.pdf-actions_insert-file-butto padding: 6px 8px; border-radius: 8px; font-size: 16px; - z-index: 3; + z-index: 10; } .hidden { diff --git a/src/main/resources/static/js/multitool/DragDropManager.js b/src/main/resources/static/js/multitool/DragDropManager.js index 969f2fc2c..ce79ee141 100644 --- a/src/main/resources/static/js/multitool/DragDropManager.js +++ b/src/main/resources/static/js/multitool/DragDropManager.js @@ -1,29 +1,21 @@ class DragDropManager { - dragContainer; - wrapper; - pageDirection; - movePageTo; - pageDragging; - draggelEl; - draggedImageEl; - hoveredEl; - endInsertionElement; - constructor(id, wrapperId) { this.dragContainer = document.getElementById(id); this.pageDirection = document.documentElement.getAttribute("dir"); this.wrapper = document.getElementById(wrapperId); this.pageDragging = false; this.hoveredEl = undefined; - this.draggelEl = undefined; this.draggedImageEl = undefined; + this.draggedEl = undefined; + this.selectedPageElements = []; // Store selected pages for multi-page mode - var styleElement = document.createElement("link"); + // Add CSS dynamically + const styleElement = document.createElement("link"); styleElement.rel = "stylesheet"; styleElement.href = "css/dragdrop.css"; - document.head.appendChild(styleElement); + // Create the endpoint element const div = document.createElement("div"); div.classList.add("drag-manager_endpoint"); div.innerHTML = ` @@ -32,6 +24,7 @@ class DragDropManager { `; this.endInsertionElement = div; + // Bind methods this.startDraggingPage = this.startDraggingPage.bind(this); this.onDragEl = this.onDragEl.bind(this); this.stopDraggingPage = this.stopDraggingPage.bind(this); @@ -40,20 +33,41 @@ class DragDropManager { } startDraggingPage(div) { - this.pageDragging = true; - this.draggedEl = div; - const img = div.querySelector("img"); - div.classList.add("drag-manager_dragging"); - const imageSrc = img.src; + if (window.selectPage) { + // Multi-page drag logic + this.selectedPageElements = window.selectedPages.map((index) => { + const pageEl = document.getElementById(`page-container-${index}`); + if (pageEl) { + pageEl.initialTransform = pageEl.style.transform || "translate(0px, 0px)"; + } + return pageEl; + }).filter(Boolean); - const imgEl = document.createElement("img"); - imgEl.classList.add("dragged-img"); - imgEl.src = imageSrc; - this.draggedImageEl = imgEl; - imgEl.style.visibility = "hidden"; - imgEl.style.transform = `rotate(${img.style.rotate === "" ? "0deg" : img.style.rotate}) translate(-50%, -50%)`; - this.dragContainer.appendChild(imgEl); + if (this.selectedPageElements.length === 0) return; + this.pageDragging = true; + this.draggedImageEl = document.createElement("div"); + this.draggedImageEl.classList.add("multidrag"); + this.draggedImageEl.textContent = `${this.selectedPageElements.length} ${window.translations.dragDropMessage}`; + this.draggedImageEl.style.visibility = "hidden"; + this.dragContainer.appendChild(this.draggedImageEl); + } else { + // Single-page drag logic + this.pageDragging = true; + this.draggedEl = div; + const img = div.querySelector("img"); + div.classList.add("drag-manager_dragging"); + + const imgEl = document.createElement("img"); + imgEl.classList.add("dragged-img"); + imgEl.src = img.src; + imgEl.style.visibility = "hidden"; + imgEl.style.transform = `rotate(${img.style.rotate === "" ? "0deg" : img.style.rotate}) translate(-50%, -50%)`; + this.draggedImageEl = imgEl; + this.dragContainer.appendChild(imgEl); + } + + // Common setup for both modes window.addEventListener("mouseup", this.stopDraggingPage); window.addEventListener("mousemove", this.onDragEl); this.wrapper.classList.add("drag-manager_dragging-container"); @@ -74,21 +88,43 @@ class DragDropManager { this.wrapper.classList.remove("drag-manager_dragging-container"); this.wrapper.removeChild(this.endInsertionElement); window.removeEventListener("mouseup", this.stopDraggingPage); - this.draggedImageEl = undefined; + + if (this.draggedImageEl) { + this.dragContainer.removeChild(this.draggedImageEl); + this.draggedImageEl = undefined; + } + + if (window.selectPage) { + // Multi-page drop logic + if (!this.hoveredEl) { + this.selectedPageElements.forEach((pageEl) => { + pageEl.style.transform = pageEl.initialTransform || "translate(0px, 0px)"; + pageEl.classList.remove("drag-manager_dragging"); + }); + } else { + this.selectedPageElements.forEach((pageEl) => { + pageEl.classList.remove("drag-manager_dragging"); + if (this.hoveredEl === this.endInsertionElement) { + this.movePageTo(pageEl); + } else { + this.movePageTo(pageEl, this.hoveredEl); + } + }); + } + this.selectedPageElements = []; + window.resetPages() + } else { + // Single-page drop logic + if (!this.hoveredEl) return; + this.draggedEl.classList.remove("drag-manager_dragging"); + if (this.hoveredEl === this.endInsertionElement) { + this.movePageTo(this.draggedEl); + } else { + this.movePageTo(this.draggedEl, this.hoveredEl); + } + } + this.pageDragging = false; - this.draggedEl.classList.remove("drag-manager_dragging"); - this.hoveredEl?.classList.remove("drag-manager_draghover"); - this.dragContainer.childNodes.forEach((dragChild) => { - this.dragContainer.removeChild(dragChild); - }); - if (!this.hoveredEl) { - return; - } - if (this.hoveredEl === this.endInsertionElement) { - this.movePageTo(this.draggedEl); - return; - } - this.movePageTo(this.draggedEl, this.hoveredEl); } setActions({ movePageTo }) { diff --git a/src/main/resources/static/js/multitool/PdfContainer.js b/src/main/resources/static/js/multitool/PdfContainer.js index c7db2829f..41d96ac45 100644 --- a/src/main/resources/static/js/multitool/PdfContainer.js +++ b/src/main/resources/static/js/multitool/PdfContainer.js @@ -29,6 +29,7 @@ class PdfContainer { this.updatePagesFromCSV = this.updatePagesFromCSV.bind(this); this.addFilesBlankAll = this.addFilesBlankAll.bind(this) this.removeAllElements = this.removeAllElements.bind(this); + this.resetPages = this.resetPages.bind(this); this.pdfAdapters = pdfAdapters; @@ -55,6 +56,7 @@ class PdfContainer { window.updatePageNumbersAndCheckboxes = this.updatePageNumbersAndCheckboxes; window.addFilesBlankAll = this.addFilesBlankAll window.removeAllElements = this.removeAllElements; + window.resetPages = this.resetPages; const filenameInput = document.getElementById("filename-input"); const downloadBtn = document.getElementById("export-button"); @@ -193,7 +195,7 @@ class PdfContainer { const div = document.createElement("div"); div.classList.add("page-container"); - + div.id = "page-container-" + (i + 1); var img = document.createElement("img"); img.classList.add("page-image"); const imageSrc = await renderer.renderPage(i); @@ -202,7 +204,6 @@ class PdfContainer { img.rend = renderer; img.doc = pdfDocument; div.appendChild(img); - this.pdfAdapters.forEach((adapter) => { adapter.adapt?.(div); }); @@ -701,6 +702,31 @@ class PdfContainer { } } + resetPages() { + const pageContainers = this.pagesContainer.querySelectorAll(".page-container"); + + pageContainers.forEach((container, index) => { + container.id = "page-container-" + (index + 1); + }); + + const checkboxes = document.querySelectorAll(".pdf-actions_checkbox"); + window.selectAll = false; + const selectIcon = document.getElementById("select-All-Container"); + const deselectIcon = document.getElementById("deselect-All-Container"); + + selectIcon.style.display = "inline"; + deselectIcon.style.display = "none"; + + checkboxes.forEach((checkbox) => { + const pageNumber = Array.from(checkbox.parentNode.parentNode.children).indexOf(checkbox.parentNode) + 1; + + const index = window.selectedPages.indexOf(pageNumber); + if (index !== -1) { + window.selectedPages.splice(index, 1); + } + }); + window.toggleSelectPageVisibility(); + } setDownloadAttribute() { this.downloadLink.setAttribute("download", this.fileName ? this.fileName : "managed.pdf"); diff --git a/src/main/resources/templates/multi-tool.html b/src/main/resources/templates/multi-tool.html index 5ac9039e9..2a47a1e92 100644 --- a/src/main/resources/templates/multi-tool.html +++ b/src/main/resources/templates/multi-tool.html @@ -112,13 +112,6 @@
-
-
- -
- File Page -
@@ -145,7 +138,8 @@ delete: '[[#{multiTool.delete}]]', split: '[[#{multiTool.split}]]', addFile: '[[#{multiTool.addFile}]]', - insertPageBreak:'[[#{multiTool.insertPageBreak}]]' + insertPageBreak:'[[#{multiTool.insertPageBreak}]]', + dragDropMessage:'[[#{multiTool.dragDropMessage}]]' };