Add menu option for copying supported images in lightbox (#4614)
This commit is contained in:
parent
2373209834
commit
526ab4fe29
4 changed files with 52 additions and 15 deletions
|
@ -376,6 +376,7 @@ export class Lightbox extends React.Component<Props, State> {
|
|||
alt={i18n('lightboxImageAlt')}
|
||||
style={styles.img}
|
||||
src={objectURL}
|
||||
onContextMenu={this.onContextMenu}
|
||||
/>
|
||||
</button>
|
||||
);
|
||||
|
@ -415,6 +416,15 @@ export class Lightbox extends React.Component<Props, State> {
|
|||
);
|
||||
};
|
||||
|
||||
private readonly onContextMenu = (event: React.MouseEvent<HTMLImageElement>) => {
|
||||
const { contentType } = this.props;
|
||||
|
||||
// These are the only image types supported by Electron's NativeImage
|
||||
if (contentType !== "image/png" && contentType !== "image/jpg") {
|
||||
event?.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
private readonly onClose = () => {
|
||||
const { close } = this.props;
|
||||
if (!close) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue