diff --git a/src/tools/base64-file-converter/base64-file-converter.vue b/src/tools/base64-file-converter/base64-file-converter.vue index c5a37ccb..1d626dde 100644 --- a/src/tools/base64-file-converter/base64-file-converter.vue +++ b/src/tools/base64-file-converter/base64-file-converter.vue @@ -81,9 +81,15 @@ function onPaste(event: ClipboardEvent) { if (event.clipboardData) { const { items } = event.clipboardData; for (const item of items) { - const file = item.getAsFile(); - if (item.kind === 'file' && file) { - fileInput.value = file; + if (item.kind === 'file') { + fileInput.value = item.getAsFile()!; + } + 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) {