Add image support to multi-tool page (#1769)

* Add image support to multi-tool page

Related to #278

* changes to support image types

* final touches

---------

Co-authored-by: a <a>
This commit is contained in:
Anthony Stirling
2024-08-29 11:07:31 +02:00
committed by GitHub
parent 316021453f
commit 68bc4d82de
4 changed files with 140 additions and 22 deletions

View File

@@ -90,6 +90,25 @@ class FileDragManager {
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;