diff --git a/src/main/resources/static/css/multi-tool.css b/src/main/resources/static/css/multi-tool.css index eb882a3ba..aeb756057 100644 --- a/src/main/resources/static/css/multi-tool.css +++ b/src/main/resources/static/css/multi-tool.css @@ -14,26 +14,30 @@ label { border-radius: 16px !important; padding: 0.75rem; border: 1px solid var(--theme-color-outline-variant); + flex-grow: 5; } .mt-action-bar { display: flex; gap: 10px; align-items: start; - background-color: var(--md-sys-color-surface-5); border: none; backdrop-filter: blur(2px); top: 10px; - z-index: 10; + z-index: 11; padding: 1.25rem; border-radius: 2rem; margin: 0px 25px; + justify-content:center; } + .mt-action-bar>* { padding-bottom: 0.5rem; } - +.mt-file-uploader { + width:100% +} .mt-action-bar svg, .mt-action-btn svg { width: 20px; @@ -42,16 +46,22 @@ label { .mt-action-bar .mt-filename { width: 100%; + display: flex; + gap: 10px; } .mt-action-btn { + position: fixed; + bottom: 8%; + background-color: var(--md-sys-color-surface-container-low) ; display: flex; gap: 10px; - align-items: start; - top: 10px; - z-index: 10; + z-index: 12; padding: 12px 0px 0px; - width: 100%; + width: fit-content; + justify-content: center; + border-radius: 2rem; + padding: 10px 20px } .mt-action-btn .btn { diff --git a/src/main/resources/static/js/multitool/fileInput.js b/src/main/resources/static/js/multitool/fileInput.js deleted file mode 100644 index ec7fa4c1e..000000000 --- a/src/main/resources/static/js/multitool/fileInput.js +++ /dev/null @@ -1,114 +0,0 @@ -class FileDragManager { - overlay; - dragCounter; - updateFilename; - - constructor(cb = null) { - this.dragCounter = 0; - this.setCallback(cb); - - // Prevent default behavior for drag events - ['dragenter', 'dragover', 'dragleave', 'drop'].forEach((eventName) => { - document.body.addEventListener(eventName, preventDefaults, false); - }); - - function preventDefaults(e) { - e.preventDefault(); - e.stopPropagation(); - } - - this.dragenterListener = this.dragenterListener.bind(this); - this.dragleaveListener = this.dragleaveListener.bind(this); - this.dropListener = this.dropListener.bind(this); - - document.body.addEventListener('dragenter', this.dragenterListener); - document.body.addEventListener('dragleave', this.dragleaveListener); - // Add drop event listener - document.body.addEventListener('drop', this.dropListener); - } - - setActions({updateFilename}) { - this.updateFilename = updateFilename; - } - - setCallback(cb) { - if (cb) { - this.callback = cb; - } else { - this.callback = (files) => console.warn('FileDragManager not set'); - } - } - - dragenterListener() { - this.dragCounter++; - if (!this.overlay) { - // Create and show the overlay - this.overlay = document.createElement('div'); - this.overlay.style.position = 'fixed'; - this.overlay.style.top = 0; - this.overlay.style.left = 0; - this.overlay.style.width = '100%'; - this.overlay.style.height = '100%'; - this.overlay.style.background = 'rgba(0, 0, 0, 0.5)'; - this.overlay.style.color = '#fff'; - this.overlay.style.zIndex = '1000'; - this.overlay.style.display = 'flex'; - this.overlay.style.alignItems = 'center'; - this.overlay.style.justifyContent = 'center'; - this.overlay.style.pointerEvents = 'none'; - this.overlay.innerHTML = '
Drop files anywhere to upload
'; - document.getElementById('content-wrap').appendChild(this.overlay); - } - } - - dragleaveListener() { - this.dragCounter--; - if (this.dragCounter === 0) { - // Hide and remove the overlay - if (this.overlay) { - this.overlay.remove(); - this.overlay = null; - } - } - } - - dropListener(e) { - const dt = e.dataTransfer; - const files = dt.files; - this.callback(files) - .catch((err) => { - console.error(err); - //maybe - }) - .finally(() => { - // Hide and remove the overlay - if (this.overlay) { - this.overlay.remove(); - this.overlay = null; - } - - this.updateFilename(files ? files[0].name : ''); - }); - } - - async addImageFile(file, nextSiblingElement) { - const div = document.createElement('div'); - div.classList.add('page-container'); - - var img = document.createElement('img'); - img.classList.add('page-image'); - img.src = URL.createObjectURL(file); - div.appendChild(img); - - this.pdfAdapters.forEach((adapter) => { - adapter.adapt?.(div); - }); - if (nextSiblingElement) { - this.pagesContainer.insertBefore(div, nextSiblingElement); - } else { - this.pagesContainer.appendChild(div); - } - } -} - -export default FileDragManager; diff --git a/src/main/resources/templates/multi-tool.html b/src/main/resources/templates/multi-tool.html index 19ced3d84..330f4bdee 100644 --- a/src/main/resources/templates/multi-tool.html +++ b/src/main/resources/templates/multi-tool.html @@ -14,111 +14,112 @@