Merge branch 'Molunerfinn:dev' into dev

This commit is contained in:
萌萌哒赫萝
2023-01-16 23:11:36 +08:00
committed by GitHub
2 changed files with 32 additions and 22 deletions
+16 -11
View File
@@ -84,18 +84,23 @@ watch(progress, (val) => {
function onDrop (e: DragEvent) { function onDrop (e: DragEvent) {
dragover.value = false dragover.value = false
const items = e.dataTransfer!.items const items = e.dataTransfer?.items!
if (items.length === 2 && items[0].type === 'text/uri-list') { const files = e.dataTransfer?.files!
handleURLDrag(items, e.dataTransfer!)
} else if (items[0].type === 'text/plain') { // send files first
const str = e.dataTransfer!.getData(items[0].type) if (files?.length) {
if (isUrl(str)) { ipcSendFiles(e.dataTransfer?.files!)
sendToMain('uploadChoosedFiles', [{ path: str }])
} else {
$message.error($T('TIPS_DRAG_VALID_PICTURE_OR_URL'))
}
} else { } else {
ipcSendFiles(e.dataTransfer!.files) if (items.length === 2 && items[0].type === 'text/uri-list') {
handleURLDrag(items, e.dataTransfer!)
} else if (items[0].type === 'text/plain') {
const str = e.dataTransfer!.getData(items[0].type)
if (isUrl(str)) {
sendToMain('uploadChoosedFiles', [{ path: str }])
} else {
$message.error($T('TIPS_DRAG_VALID_PICTURE_OR_URL'))
}
}
} }
} }
+16 -11
View File
@@ -169,18 +169,23 @@ onBeforeUnmount(() => {
function onDrop (e: DragEvent) { function onDrop (e: DragEvent) {
dragover.value = false dragover.value = false
const items = e.dataTransfer!.items const items = e.dataTransfer?.items!
if (items.length === 2 && items[0].type === 'text/uri-list') { const files = e.dataTransfer?.files!
handleURLDrag(items, e.dataTransfer!)
} else if (items[0].type === 'text/plain') { // send files first
const str = e.dataTransfer!.getData(items[0].type) if (files?.length) {
if (isUrl(str)) { ipcSendFiles(e.dataTransfer?.files!)
sendToMain('uploadChoosedFiles', [{ path: str }])
} else {
$message.error($T('TIPS_DRAG_VALID_PICTURE_OR_URL'))
}
} else { } else {
ipcSendFiles(e.dataTransfer!.files) if (items.length === 2 && items[0].type === 'text/uri-list') {
handleURLDrag(items, e.dataTransfer!)
} else if (items[0].type === 'text/plain') {
const str = e.dataTransfer!.getData(items[0].type)
if (isUrl(str)) {
sendToMain('uploadChoosedFiles', [{ path: str }])
} else {
$message.error($T('TIPS_DRAG_VALID_PICTURE_OR_URL'))
}
}
} }
} }