Skip to content

Commit

Permalink
Merge pull request #1692 from yannikreiter-maxworx/issue-1679
Browse files Browse the repository at this point in the history
Fix click behavior in ListItemAttachments component
  • Loading branch information
michaelmaillot authored Nov 9, 2023
2 parents ca1f3ce + f4b1e77 commit 7bc4cb3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/controls/listItemAttachments/ListItemAttachments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ export class ListItemAttachments extends React.Component<IListItemAttachmentsPro
this.state.attachments.map(file => {
const fileName = file.FileName;
const previewImage = this.previewImages[fileName];
const clickDisabled = !this.state.itemId;
return (
<div key={fileName} className={styles.documentCardWrapper}>
<TooltipHost
Expand All @@ -276,8 +277,8 @@ export class ListItemAttachments extends React.Component<IListItemAttachmentsPro
directionalHint={DirectionalHint.rightCenter}>

<DocumentCard
onClickHref={!openAttachmentsInNewWindow && `${file.ServerRelativeUrl}?web=1`}
onClick={openAttachmentsInNewWindow && (() => window.open(`${file.ServerRelativeUrl}?web=1`, "_blank"))} // JJ - 20200613 - needed to support Microsoft Teams
onClickHref={!clickDisabled && !openAttachmentsInNewWindow && `${file.ServerRelativeUrl}?web=1`}
onClick={!clickDisabled && openAttachmentsInNewWindow && (() => window.open(`${file.ServerRelativeUrl}?web=1`, "_blank"))} // JJ - 20200613 - needed to support Microsoft Teams
className={styles.documentCard}>
<DocumentCardPreview previewImages={[previewImage]} />
<Label className={styles.fileLabel}>{fileName}</Label>
Expand Down

0 comments on commit 7bc4cb3

Please sign in to comment.