This commit is contained in:
Nastya 2024-11-04 02:06:00 +03:00
parent 2b87ec6973
commit 2dfd25dc9f
3 changed files with 11 additions and 2 deletions

@ -171,6 +171,7 @@ export const CropGeneral: FC<Props> = ({
} }
> >
<img <img
id="imgid"
onLoad={(e) => { onLoad={(e) => {
setImageWidth(e.currentTarget.naturalWidth); setImageWidth(e.currentTarget.naturalWidth);
setImageHeight(e.currentTarget.naturalHeight); setImageHeight(e.currentTarget.naturalHeight);

@ -32,7 +32,7 @@ export const NavigationPanel: FC<Props> = ({
}; };
const handleNextStep = () => { const handleNextStep = () => {
if (lastStep) { if (lastStep) {
// onSaveImageClick(); onSaveImageClick();
} else { } else {
setCurrentStep(currentStep + 1); setCurrentStep(currentStep + 1);
} }

@ -10,6 +10,7 @@ import {
} from "@/model/CropModal/CropModal" } from "@/model/CropModal/CropModal"
import { isImageBlobAGifFile } from "@/utils/isImageBlobAGifFile"; import { isImageBlobAGifFile } from "@/utils/isImageBlobAGifFile";
import AlertModalDeleteImage from "./AlertModalDeleteImage" import AlertModalDeleteImage from "./AlertModalDeleteImage"
import { getModifiedImageBlob } from "./utils/imageManipulation";
const workSpaceTypesList: WorkSpaceTypesList = { const workSpaceTypesList: WorkSpaceTypesList = {
images: [ images: [
@ -181,7 +182,14 @@ export const CropModalInit: FC<CropOnOpenType> = ({
}; };
const saveImagesAndRules = async (blob?: Blob) => { const saveImagesAndRules = async (blob?: Blob) => {
const img = document.createElement("img");
img.src = editedImages.mobile.url
const bloba = await getModifiedImageBlob(img, editedImages.mobile.newRules.crop, editedImages.mobile.newRules.darken)
const anchor = document.createElement("a");
const blobUrl = URL.createObjectURL(bloba);
anchor.setAttribute("download", "ЖОПА");
anchor.href = blobUrl;
anchor.click();
// if (!selectedVariantId) return; // if (!selectedVariantId) return;
// uploadQuestionImage(questionId, quizId, imageBlob, (question, url) => { // uploadQuestionImage(questionId, quizId, imageBlob, (question, url) => {