mirror of https://github.com/stashapp/stash.git
Don't show dialog when setting front movie image (#678)
This commit is contained in:
parent
c104c6d075
commit
c1be600b01
|
@ -138,7 +138,7 @@ export const Movie: React.FC = () => {
|
|||
}
|
||||
}, [data, updateMovieData]);
|
||||
|
||||
function onImageLoad(imageData: string) {
|
||||
function showImageAlert(imageData: string) {
|
||||
setImageClipboard(imageData);
|
||||
setIsImageAlertOpen(true);
|
||||
}
|
||||
|
@ -161,7 +161,12 @@ export const Movie: React.FC = () => {
|
|||
setBackImage(imageData);
|
||||
}
|
||||
|
||||
const encodingImage = ImageUtils.usePasteImage(onImageLoad, isEditing);
|
||||
function onFrontImageLoad(imageData: string) {
|
||||
setImagePreview(imageData);
|
||||
setFrontImage(imageData);
|
||||
}
|
||||
|
||||
const encodingImage = ImageUtils.usePasteImage(showImageAlert, isEditing);
|
||||
|
||||
if (!isNew && !isEditing) {
|
||||
if (!data || !data.findMovie || loading) return <LoadingIndicator />;
|
||||
|
@ -222,8 +227,8 @@ export const Movie: React.FC = () => {
|
|||
history.push(`/movies`);
|
||||
}
|
||||
|
||||
function onImageChange(event: React.FormEvent<HTMLInputElement>) {
|
||||
ImageUtils.onImageChange(event, onImageLoad);
|
||||
function onFrontImageChange(event: React.FormEvent<HTMLInputElement>) {
|
||||
ImageUtils.onImageChange(event, onFrontImageLoad);
|
||||
}
|
||||
|
||||
function onBackImageChange(event: React.FormEvent<HTMLInputElement>) {
|
||||
|
@ -388,7 +393,7 @@ export const Movie: React.FC = () => {
|
|||
isEditing={isEditing}
|
||||
onToggleEdit={onToggleEdit}
|
||||
onSave={onSave}
|
||||
onImageChange={onImageChange}
|
||||
onImageChange={onFrontImageChange}
|
||||
onBackImageChange={onBackImageChange}
|
||||
onDelete={onDelete}
|
||||
/>
|
||||
|
|
|
@ -3,7 +3,12 @@ import Jimp from "jimp";
|
|||
|
||||
const readImage = (file: File, onLoadEnd: (imageData: string) => void) => {
|
||||
const reader: FileReader = new FileReader();
|
||||
reader.onloadend = () => onLoadEnd(reader.result as string);
|
||||
reader.onloadend = () => {
|
||||
// only proceed if no error encountered
|
||||
if (!reader.error) {
|
||||
onLoadEnd(reader.result as string);
|
||||
}
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue