(event: DragEvent)
| 149 | } |
| 150 | |
| 151 | function handleFileDrop(event: DragEvent): void { |
| 152 | const files = Array.from(event.dataTransfer?.files || []); |
| 153 | if (!files.length) return; |
| 154 | |
| 155 | if (!settings.store.bypassDragDrop || !isConfigured()) return; |
| 156 | if (!isChatAreaDrop(event.target)) return; |
| 157 | if (isForumOrSlashContext(SelectedChannelStore.getChannelId())) return; |
| 158 | |
| 159 | const allowed = files.filter(f => isFileTypeAllowed(f)); |
| 160 | if (!allowed.length) return; |
| 161 | if (!shouldInterceptUploadFiles(allowed, getGuildIdForChannel(SelectedChannelStore.getChannelId()))) return; |
| 162 | |
| 163 | event.preventDefault(); |
| 164 | event.stopImmediatePropagation(); |
| 165 | event.stopPropagation(); |
| 166 | |
| 167 | allowed.forEach(file => handledDropFiles.add(file)); |
| 168 | void uploadProvidedFiles(allowed); |
| 169 | } |
| 170 | |
| 171 | function formatBytes(bytes: number): string { |
| 172 | if (!bytes) return ""; |
no test coverage detected