From f43692ec25ba914fb18af8d4ddfbee4e6f6e098c Mon Sep 17 00:00:00 2001 From: Ramesh Mane <101566080+rameshmane7218@users.noreply.github.com> Date: Wed, 20 Nov 2024 17:11:14 +0000 Subject: [PATCH] fix(nc-gui): keep same image type after cropping it --- packages/nc-gui/components/general/ImageCropper.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/nc-gui/components/general/ImageCropper.vue b/packages/nc-gui/components/general/ImageCropper.vue index 2c62d9263b..4eacd21852 100644 --- a/packages/nc-gui/components/general/ImageCropper.vue +++ b/packages/nc-gui/components/general/ImageCropper.vue @@ -25,6 +25,10 @@ const showCropper = useVModel(props, 'showCropper', emit) const { cropperConfig } = toRefs(props) +const imageRestriction = computed(() => { + return cropperConfig.value.imageRestriction || 'fit-area' +}) + const { api, isLoading } = useApi() const cropperRef = ref() @@ -38,7 +42,7 @@ const handleCropImage = () => { const { canvas } = cropperRef.value.getResult() previewImage.value = { canvas, - src: canvas.toDataURL(), + src: canvas.toDataURL(imageConfig.type), } } @@ -116,7 +120,7 @@ watch(showCropper, () => { :stencil-props="cropperConfig?.stencilProps || {}" :min-height="cropperConfig?.minHeight" :min-width="cropperConfig?.minWidth" - :image-restriction="cropperConfig?.imageRestriction" + :image-restriction="imageRestriction" v-bind=" cropperConfig.stencilProps?.fillDefault || cropperConfig.stencilProps?.fillDefault === undefined ? { defaultSize } : {} "