From 7433572cf54ce1b23c59c5846aeb397ae40e7e2a Mon Sep 17 00:00:00 2001 From: Joaquin Rivero Date: Thu, 12 Dec 2024 20:06:46 -0800 Subject: [PATCH] Adding multiple attribute and increasing max file size in compress pdf --- acrobat/blocks/verb-widget/limits.js | 26 +++++++++++++++++------ acrobat/blocks/verb-widget/verb-widget.js | 9 +++++++- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/acrobat/blocks/verb-widget/limits.js b/acrobat/blocks/verb-widget/limits.js index 4457b30b..f9436f94 100644 --- a/acrobat/blocks/verb-widget/limits.js +++ b/acrobat/blocks/verb-widget/limits.js @@ -1,25 +1,37 @@ const LIMITS = { fillsign: { - maxFileSize: 100000000, // 100 MB + maxFileSize: 104857600, // 100 MB maxFileSizeFriendly: '100 MB', // 100 MB - acceptedFiles: '.pdf', + acceptedFiles: ['application/pdf'], maxNumFiles: 1, + multipleFiles: false, mobileApp: true, }, 'delete-pages': { maxFileSize: 100000000, // 1 MB - acceptedFiles: '.pdf', + acceptedFiles: ['application/pdf'], maxNumFiles: 1, }, 'number-pages': { maxFileSize: 100000000, // 1 MB - acceptedFiles: '.pdf', + acceptedFiles: ['application/pdf'], maxNumFiles: 1, }, 'compress-pdf': { - maxFileSize: 100000000, - acceptedFiles: '.pdf', - maxNumFiles: 1, + maxFileSize: 2147483648, + maxFileSizeFriendly: '2 GB', + acceptedFiles: [ + 'application/pdf', + 'application/msword', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'application/vnd.ms-powerpoint', + 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'application/vnd.ms-excel', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'image/jpeg', + 'image/png', + ], + multipleFiles: true, }, }; diff --git a/acrobat/blocks/verb-widget/verb-widget.js b/acrobat/blocks/verb-widget/verb-widget.js index 6d559290..dbc69271 100644 --- a/acrobat/blocks/verb-widget/verb-widget.js +++ b/acrobat/blocks/verb-widget/verb-widget.js @@ -130,7 +130,14 @@ export default async function init(element) { } const widgetMobileButton = createTag('a', { class: 'verb-mobile-cta', href: mobileLink }, window.mph['verb-widget-cta-mobile']); - const button = createTag('input', { type: 'file', accept: LIMITS[VERB].acceptedFiles, id: 'file-upload', class: 'hide', 'aria-hidden': true }); + const button = createTag('input', { + type: 'file', + accept: LIMITS[VERB]?.acceptedFiles, + id: 'file-upload', + class: 'hide', + 'aria-hidden': true, + ...(LIMITS[VERB]?.multipleFiles && { multiple: '' }), + }); const widgetImage = createTag('div', { class: 'verb-image' }); const verbIconName = `${VERB}`; const verbImageSvg = createSvgElement(verbIconName);