Web: Common: fixed the ability to spam deleting a media file with hotkey
This commit is contained in:
parent
596f4213b5
commit
c8da0fe2c6
@ -267,17 +267,24 @@ function MediaViewer({
|
|||||||
return 0 <= posExt ? fileTitle.substring(posExt).trim().toLowerCase() : "";
|
return 0 <= posExt ? fileTitle.substring(posExt).trim().toLowerCase() : "";
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
let isRemoved: null | number = null;
|
||||||
|
|
||||||
const onDelete = () => {
|
const onDelete = () => {
|
||||||
const { playlist, onDelete } = props;
|
const { playlist, onDelete } = props;
|
||||||
|
|
||||||
let currentFileId = playlist.find((file) => file.id === playlistPos)
|
let currentFileId = playlist.find((file) => file.id === playlistPos)
|
||||||
?.fileId;
|
?.fileId;
|
||||||
|
|
||||||
|
if (currentFileId === isRemoved) return;
|
||||||
|
|
||||||
const canDelete = targetFile?.security?.Delete;
|
const canDelete = targetFile?.security?.Delete;
|
||||||
|
|
||||||
if (!canDelete) return;
|
if (!canDelete) return;
|
||||||
|
|
||||||
if (!isNullOrUndefined(currentFileId)) onDelete(currentFileId);
|
if (!isNullOrUndefined(currentFileId)) {
|
||||||
|
onDelete(currentFileId);
|
||||||
|
isRemoved = currentFileId;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onDownload = () => {
|
const onDownload = () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user