From 06e9e80d4b59595962600890592c0a27243c26ec Mon Sep 17 00:00:00 2001 From: spencerwooo Date: Sat, 5 Feb 2022 19:05:13 +0800 Subject: [PATCH] fix onclick events get passed to a tags --- components/FolderGridLayout.tsx | 126 ++++++++++++++++---------------- 1 file changed, 64 insertions(+), 62 deletions(-) diff --git a/components/FolderGridLayout.tsx b/components/FolderGridLayout.tsx index f0f7f73..a895094 100644 --- a/components/FolderGridLayout.tsx +++ b/components/FolderGridLayout.tsx @@ -81,7 +81,7 @@ const FolderGridLayout = ({ checked={totalSelected} onChange={toggleTotalSelected} indeterminate={true} - title={'Select files'} + title={'Select all files'} /> {totalGenerating ? ( @@ -98,76 +98,78 @@ const FolderGridLayout = ({ -
+
{folderChildren.map((c: OdFolderChildren) => ( - - -
- {c.folder ? ( -
+
+
+ {c.folder ? ( +
+ { + clipboard.copy(`${getBaseUrl()}${path === '/' ? '' : path}/${encodeURIComponent(c.name)}`) + toast('Copied folder permalink.', { icon: '👌' }) + }} + > + + + {folderGenerating[c.id] ? ( + + ) : ( { - clipboard.copy(`${getBaseUrl()}${path === '/' ? '' : path}/${encodeURIComponent(c.name)}`) - toast('Copied folder permalink.', { icon: '👌' }) + const p = `${path === '/' ? '' : path}/${encodeURIComponent(c.name)}` + handleFolderDownload(p, c.id, c.name)() }} - > - - - {folderGenerating[c.id] ? ( - - ) : ( - { - const p = `${path === '/' ? '' : path}/${encodeURIComponent(c.name)}` - handleFolderDownload(p, c.id, c.name)() - }} - > - - - )} -
- ) : ( -
- )} -
+ + )} +
+ ) : ( +
+ { + clipboard.copy( + `${getBaseUrl()}/api?path=${path === '/' ? '' : path}/${encodeURIComponent(c.name)}&raw=true` + ) + toast.success('Copied raw file permalink.') + }} + > + + + + + +
+ )} +
-
- {!c.folder && !(c.name === '.password') && ( - toggleItemSelected(c.id)} - title="Select file" - /> - )} -
+
+ {!c.folder && !(c.name === '.password') && ( + toggleItemSelected(c.id)} + title="Select file" + /> + )} +
- - - + + + + + +
))}