44 строки
1.1 KiB
HTML
44 строки
1.1 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>file-attachment demo</title>
|
|
<style>
|
|
file-attachment {
|
|
display: block;
|
|
text-align: center;
|
|
border: 4px dashed lightgrey;
|
|
padding: 100px;
|
|
font-family: sans-serif;
|
|
}
|
|
file-attachment[hover] {
|
|
border-color: gold;
|
|
}
|
|
input {
|
|
font-size: inherit;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<file-attachment input="file">
|
|
Drop files here or
|
|
<input type="file" id="file" multiple>
|
|
<pre></pre>
|
|
</file-attachment>
|
|
|
|
<!-- GitHub Pages development script, uncomment when running example locally and comment out the production one -->
|
|
<!-- <script type="module" src="../dist/index.js"></script> -->
|
|
|
|
<!-- GitHub Pages demo script -->
|
|
<script type="module" src="https://unpkg.com/@github/file-attachment-element@latest/dist/index.js"></script>
|
|
|
|
<script>
|
|
const pre = document.querySelector('pre')
|
|
document.addEventListener('file-attachment-accepted', function(event) {
|
|
const {attachments} = event.detail
|
|
pre.textContent = attachments.map(a => a.file.name).join('\n')
|
|
})
|
|
</script>
|
|
</body>
|
|
</html>
|