summaryrefslogtreecommitdiff
path: root/public/static
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-06-16 22:15:15 +0400
committerilotterytea <iltsu@alright.party>2025-06-16 22:15:15 +0400
commit0a6f00749bb0720664409e9c4eca82928e6773c7 (patch)
tree86c61bd923d3e5eee5c675e81f726101f0f4c458 /public/static
parentcbba97e43ce50f41cb2e6697bb6e49ac678d4ccf (diff)
feat: paste images
Diffstat (limited to 'public/static')
-rw-r--r--public/static/scripts/form.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/public/static/scripts/form.js b/public/static/scripts/form.js
new file mode 100644
index 0000000..6e4f608
--- /dev/null
+++ b/public/static/scripts/form.js
@@ -0,0 +1,29 @@
+document.onpaste = () => {
+ var items = (event.clipboardData || event.originalEvent.clipboardData).items;
+
+ for (index in items) {
+ var item = items[index];
+ if (item.kind === 'file') {
+ file = item.getAsFile();
+ showFile(file);
+ }
+ }
+};
+
+function showFile(file) {
+ setFormDetailsVisiblity(file != null);
+
+ if (file == null) {
+ fileUploadWrapper.innerHTML = '<h1>Click, drop, or paste files here</h1>';
+
+ if (fileURLWrapper) {
+ fileURLWrapper.style.display = 'flex';
+ }
+ } else {
+ fileUploadWrapper.innerHTML = `<h1>File: ${file.name}</h1>`;
+
+ if (fileURLWrapper) {
+ fileURLWrapper.style.display = 'none';
+ }
+ }
+} \ No newline at end of file