Only show image editing icon in composition area

This commit is contained in:
Josh Perez 2022-02-02 10:31:16 -05:00 committed by GitHub
parent e79fb9d2e5
commit a0c61e5b4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -641,6 +641,7 @@ export const CompositionArea = ({
<div className="CompositionArea__attachment-list"> <div className="CompositionArea__attachment-list">
<AttachmentList <AttachmentList
attachments={draftAttachments} attachments={draftAttachments}
canEditImages
i18n={i18n} i18n={i18n}
onAddAttachment={launchAttachmentPicker} onAddAttachment={launchAttachmentPicker}
onClickAttachment={maybeEditAttachment} onClickAttachment={maybeEditAttachment}

View file

@ -20,6 +20,7 @@ import {
export type Props<T extends AttachmentType | AttachmentDraftType> = Readonly<{ export type Props<T extends AttachmentType | AttachmentDraftType> = Readonly<{
attachments: ReadonlyArray<T>; attachments: ReadonlyArray<T>;
canEditImages?: boolean;
i18n: LocalizerType; i18n: LocalizerType;
onAddAttachment?: () => void; onAddAttachment?: () => void;
onClickAttachment?: (attachment: T) => void; onClickAttachment?: (attachment: T) => void;
@ -50,6 +51,7 @@ function getUrl(
export const AttachmentList = <T extends AttachmentType | AttachmentDraftType>({ export const AttachmentList = <T extends AttachmentType | AttachmentDraftType>({
attachments, attachments,
canEditImages,
i18n, i18n,
onAddAttachment, onAddAttachment,
onClickAttachment, onClickAttachment,
@ -119,7 +121,7 @@ export const AttachmentList = <T extends AttachmentType | AttachmentDraftType>({
/> />
); );
if (isImage) { if (isImage && canEditImages) {
return ( return (
<div className="module-attachments--editable"> <div className="module-attachments--editable">
{imgElement} {imgElement}