Skip to content

Commit 2e830dc

Browse files
committed
Disable file dropping
1 parent 696969d commit 2e830dc

1 file changed

Lines changed: 41 additions & 41 deletions

File tree

web/app.js

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -822,47 +822,47 @@ const PDFViewerApplication = {
822822
file = AppOptions.get("defaultUrl");
823823
}
824824

825-
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
826-
const fileInput = (this._openFileInput = document.createElement("input"));
827-
fileInput.id = "fileInput";
828-
fileInput.hidden = true;
829-
fileInput.type = "file";
830-
fileInput.value = null;
831-
document.body.append(fileInput);
832-
833-
fileInput.addEventListener("change", function (evt) {
834-
const { files } = evt.target;
835-
if (!files || files.length === 0) {
836-
return;
837-
}
838-
eventBus.dispatch("fileinputchange", {
839-
source: this,
840-
fileInput: evt.target,
841-
});
842-
});
843-
844-
// Enable dragging-and-dropping a new PDF file onto the viewerContainer.
845-
appConfig.mainContainer.addEventListener("dragover", function (evt) {
846-
for (const item of evt.dataTransfer.items) {
847-
if (item.type === "application/pdf") {
848-
evt.dataTransfer.dropEffect =
849-
evt.dataTransfer.effectAllowed === "copy" ? "copy" : "move";
850-
stopEvent(evt);
851-
return;
852-
}
853-
}
854-
});
855-
appConfig.mainContainer.addEventListener("drop", function (evt) {
856-
if (evt.dataTransfer.files?.[0].type !== "application/pdf") {
857-
return;
858-
}
859-
stopEvent(evt);
860-
eventBus.dispatch("fileinputchange", {
861-
source: this,
862-
fileInput: evt.dataTransfer,
863-
});
864-
});
865-
}
825+
// if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
826+
// const fileInput = (this._openFileInput = document.createElement("input"));
827+
// fileInput.id = "fileInput";
828+
// fileInput.hidden = true;
829+
// fileInput.type = "file";
830+
// fileInput.value = null;
831+
// document.body.append(fileInput);
832+
//
833+
// fileInput.addEventListener("change", function (evt) {
834+
// const { files } = evt.target;
835+
// if (!files || files.length === 0) {
836+
// return;
837+
// }
838+
// eventBus.dispatch("fileinputchange", {
839+
// source: this,
840+
// fileInput: evt.target,
841+
// });
842+
// });
843+
//
844+
// // Enable dragging-and-dropping a new PDF file onto the viewerContainer.
845+
// appConfig.mainContainer.addEventListener("dragover", function (evt) {
846+
// for (const item of evt.dataTransfer.items) {
847+
// if (item.type === "application/pdf") {
848+
// evt.dataTransfer.dropEffect =
849+
// evt.dataTransfer.effectAllowed === "copy" ? "copy" : "move";
850+
// stopEvent(evt);
851+
// return;
852+
// }
853+
// }
854+
// });
855+
// appConfig.mainContainer.addEventListener("drop", function (evt) {
856+
// if (evt.dataTransfer.files?.[0].type !== "application/pdf") {
857+
// return;
858+
// }
859+
// stopEvent(evt);
860+
// eventBus.dispatch("fileinputchange", {
861+
// source: this,
862+
// fileInput: evt.dataTransfer,
863+
// });
864+
// });
865+
// }
866866

867867
if (!AppOptions.get("supportsDocumentFonts")) {
868868
AppOptions.set("disableFontFace", true);

0 commit comments

Comments
 (0)