mirror of
https://github.com/CorentinTh/it-tools.git
synced 2024-09-11 13:37:53 +03:00
Compare commits
2 Commits
0116e21816
...
c4d33b5c62
Author | SHA1 | Date | |
---|---|---|---|
|
c4d33b5c62 | ||
|
556db15cbe |
@ -81,9 +81,15 @@ function onPaste(event: ClipboardEvent) {
|
|||||||
if (event.clipboardData) {
|
if (event.clipboardData) {
|
||||||
const { items } = event.clipboardData;
|
const { items } = event.clipboardData;
|
||||||
for (const item of items) {
|
for (const item of items) {
|
||||||
const file = item.getAsFile();
|
if (item.kind === 'file') {
|
||||||
if (item.kind === 'file' && file) {
|
fileInput.value = item.getAsFile()!;
|
||||||
fileInput.value = file;
|
}
|
||||||
|
else if (item.kind === 'string' && item.type.match('^text/plain')) {
|
||||||
|
item.getAsString(s => base64Input.value = s);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.info('Unsupport clipboardData', item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -91,7 +97,7 @@ function onPaste(event: ClipboardEvent) {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<c-card title="Base64 to file">
|
<c-card title="Base64 to file" @paste="onPaste">
|
||||||
<n-grid cols="3" x-gap="12">
|
<n-grid cols="3" x-gap="12">
|
||||||
<n-gi span="2">
|
<n-gi span="2">
|
||||||
<c-input-text
|
<c-input-text
|
||||||
|
Loading…
Reference in New Issue
Block a user