refactor
This commit is contained in:
@@ -192,7 +192,7 @@ const DocumentsPanel: React.FC<DocumentsPanelProps> = ({
|
||||
if (!doc || !doc.id) {
|
||||
return;
|
||||
}
|
||||
const previewAsset = typeof getDocumentAsset === 'function' ? getDocumentAsset(doc, 'preview') : null;
|
||||
const previewAsset = getDocumentAsset(doc, 'preview');
|
||||
if (!previewAsset) {
|
||||
return;
|
||||
}
|
||||
@@ -207,12 +207,8 @@ const DocumentsPanel: React.FC<DocumentsPanelProps> = ({
|
||||
return;
|
||||
}
|
||||
if (event) {
|
||||
if (typeof event.preventDefault === 'function') {
|
||||
event.preventDefault();
|
||||
}
|
||||
if (typeof event.stopPropagation === 'function') {
|
||||
event.stopPropagation();
|
||||
}
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
if (event?.altKey) {
|
||||
handleDocumentPreviewZoom(doc);
|
||||
@@ -489,16 +485,14 @@ const DocumentsPanel: React.FC<DocumentsPanelProps> = ({
|
||||
|
||||
const handleDocumentClick = useCallback(
|
||||
(doc, event) => {
|
||||
if (!doc || suppressDocumentClickRef.current) {
|
||||
if (!doc || suppressDocumentClickRef.current || !onEntryPointer) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof onEntryPointer === 'function') {
|
||||
onEntryPointer(
|
||||
{ type: EntryType.document, id: doc.id, key: `document:${doc.id}`, document: doc },
|
||||
event,
|
||||
);
|
||||
}
|
||||
onEntryPointer(
|
||||
{ type: EntryType.document, id: doc.id, key: `document:${doc.id}`, document: doc },
|
||||
event,
|
||||
);
|
||||
},
|
||||
[onEntryPointer],
|
||||
);
|
||||
@@ -509,7 +503,7 @@ const DocumentsPanel: React.FC<DocumentsPanelProps> = ({
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof onEntryPointer === 'function') {
|
||||
if (onEntryPointer) {
|
||||
onEntryPointer(
|
||||
{ type: EntryType.folder, id: folder.id, key: `folder:${folder.id}`, folder },
|
||||
event,
|
||||
|
||||
Reference in New Issue
Block a user