Files
spacedrive/interface/hooks/useKeyDeleteFile.tsx
Vítor Vasconcellos 0676c40331 [ENG-651] Fix PDF rendering breaking app on macOS (#854)
* Fix macOS PDF rendering
 - Fix app crashing due to PDF rendering receiving empty URLs
 - Attempt fix PDF rendering empty PDFs due to it not supporting range requests

* Fix dumb change from `data` to `src` in `<object>`
 - Fix QuickPreview not closing with space bar
 - Fix double-click simultaneously renaming and opening file
 - Minor improvements to QuickPreview header
 - Fix Button inside Button react error in QuickPreview
 - Don't render thumb without a valid source

* ExternalObject events must not influence the link state
 - More macOS PDF range changes

* Use `<iframe>` instead of `<embed>` or `<object>` to load pdf in macOS
 - Revert removing range support for macOS pdf type
 - Rename `ExternalObject` to `PDFViewer`
 - Fix `AddLocationDialog` sometimes requiring multiple confimations on first load

* `Accept-Ranges: none` Header response as it breaks linux video playback
 - Extract location id from from `ExplorerItemData`, to allow rendering original versions on `Overview`

* Format

* cargo fmt
2023-05-25 06:34:18 +00:00

17 lines
524 B
TypeScript

import { useKey } from 'rooks';
import { ExplorerItem } from '@sd/client';
import { dialogManager } from '@sd/ui';
import DeleteDialog from '~/app/$libraryId/Explorer/File/DeleteDialog';
export const useKeyDeleteFile = (selectedItem: ExplorerItem | null, location_id: number | null) => {
return useKey('Delete', (e) => {
e.preventDefault();
if (!selectedItem || !location_id) return;
dialogManager.create((dp) => (
<DeleteDialog {...dp} location_id={location_id} path_id={selectedItem.item.id} />
));
});
};