filepond
Version:
FilePond, where files go to stretch their bits.
43 lines (42 loc) • 990 B
JavaScript
/*!
* FilePond v5.0.2
* Copyright (c) 2017-2026 Pqina B.V.
* Released under the MIT License
* https://filepond.com
*/
import { createExtension as s } from "./common/createExtension.js";
import { addListener as n } from "../utils/dom.js";
const f = s({
name: "DragDropSource",
type: "source",
props: {
shouldHandleDrop: () => !0
},
factory: ({ didSetProps: o, props: a }, { insertEntries: d }) => {
let r, t;
function u(e) {
e.preventDefault();
}
async function p(e) {
const { shouldHandleDrop: c } = a;
!e.dataTransfer || !e.target || e.target.type === "file" || c(e) && (e.preventDefault(), d({
src: e.dataTransfer,
origin: "drop"
}));
}
return o(() => {
r?.(), t?.(), r = n(document.documentElement, "drop", p), t = n(
document.documentElement,
"dragover",
u
);
}), {
destroy: () => {
r?.(), t?.();
}
};
}
});
export {
f as DragDropSource
};