diff --git a/src/components/create.vue b/src/components/create.vue index 335e0a7..e54f7b0 100644 --- a/src/components/create.vue +++ b/src/components/create.vue @@ -36,6 +36,7 @@ v-model="secret" class="form-control" :rows="2" + @pasteFile="handlePasteFile" />
{{ $t('text-max-filesize', { maxSize: bytesToHuman(maxFileSize) }) }} @@ -67,6 +68,14 @@ > {{ $t('text-max-filesize-exceeded', { curSize: bytesToHuman(fileSize), maxSize: bytesToHuman(maxFileSize) }) }}
+

@@ -88,17 +67,16 @@ import appClipboardButton from './clipboard-button.vue' import appCrypto from '../crypto.js' import appQrButton from './qr-button.vue' -import { bytesToHuman } from '../helpers' +import FilesDisplay from './fileDisplay.vue' import GrowArea from './growarea.vue' import OTSMeta from '../ots-meta' export default { - components: { GrowArea, appClipboardButton, appQrButton }, + components: { FilesDisplay, GrowArea, appClipboardButton, appQrButton }, data() { return { files: [], - hasDownloaded: {}, popover: null, secret: null, secretContentBlobURL: null, @@ -107,25 +85,6 @@ export default { }, methods: { - bytesToHuman, - - fasFileType(type) { - return [ - 'fas', - 'fa-fw', - 'me-2', - ...[ - { icon: ['fa-file-pdf'], match: /application\/pdf/ }, - { icon: ['fa-file-audio'], match: /^audio\// }, - { icon: ['fa-file-image'], match: /^image\// }, - { icon: ['fa-file-lines'], match: /^text\// }, - { icon: ['fa-file-video'], match: /^video\// }, - { icon: ['fa-file-zipper'], match: /^application\/(gzip|x-tar|zip)$/ }, - { icon: ['fa-file-circle-question'], match: /.*/ }, - ].filter(el => el.match.test(type))[0].icon, - ].join(' ') - }, - // requestSecret requests the encrypted secret from the backend requestSecret() { this.secretLoading = true @@ -161,7 +120,13 @@ export default { file.arrayBuffer() .then(ab => { const blobURL = window.URL.createObjectURL(new Blob([ab], { type: file.type })) - this.files.push({ name: file.name, size: ab.byteLength, type: file.type, url: blobURL }) + this.files.push({ + id: window.crypto.randomUUID(), + name: file.name, + size: ab.byteLength, + type: file.type, + url: blobURL, + }) }) }) this.secretLoading = false diff --git a/src/style.scss b/src/style.scss index 794e1f5..11a4be3 100644 --- a/src/style.scss +++ b/src/style.scss @@ -8,4 +8,8 @@ $web-font-path: ''; textarea { font-family: monospace !important; } + + .cursor-pointer { + cursor: pointer; + } } \ No newline at end of file