UNPKG

@scalar/api-client

Version:

the open source API testing client

25 lines (24 loc) 740 B
import { defineComponent as r, onMounted as c, onBeforeUnmount as m } from "vue"; const p = /* @__PURE__ */ r({ __name: "PasteEventListener", emits: ["input"], setup(u, { emit: o }) { const s = o; c(() => { document.addEventListener("paste", n); }), m(() => { document.removeEventListener("paste", n); }); function n(e) { const t = e.target, i = !!document.activeElement?.classList.contains("cm-content"); if (!(t && (t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.isContentEditable || i)) && e.clipboardData) { const a = e.clipboardData.getData("text"); a && s("input", a, null, "paste"); } } return (e, t) => null; } }); export { p as default };