Merge pull request #1836 from umbraco/bugfix/fix-image-cropper-remove-issue

Bugfix: Fix image cropper remove issue
This commit is contained in:
Jacob Overgaard
2024-05-16 15:07:37 +02:00
committed by GitHub
2 changed files with 6 additions and 3 deletions

View File

@@ -68,8 +68,9 @@ export class UmbInputImageCropperElement extends UmbLitElement {
#onRemove = () => {
this.value = assignToFrozenObject(this.value, { src: '', temporaryFileId: null });
if (!this.fileUnique) return;
this.#manager?.removeOne(this.fileUnique);
if (this.fileUnique) {
this.#manager?.removeOne(this.fileUnique);
}
this.fileUnique = undefined;
this.file = undefined;
@@ -114,7 +115,7 @@ export class UmbInputImageCropperElement extends UmbLitElement {
const value = (e.target as UmbInputImageCropperFieldElement).value;
if (!value) {
this.value = { src: '', crops: [], focalPoint: { left: 0.5, top: 0.5 } };
this.value = { src: '', crops: [], focalPoint: { left: 0.5, top: 0.5 }, temporaryFileId: null };
this.dispatchEvent(new UmbChangeEvent());
return;
}

View File

@@ -15,6 +15,7 @@ import {
export class UmbPropertyEditorUIImageCropperElement extends UmbLitElement implements UmbPropertyEditorUiElement {
@property({ attribute: false })
value: UmbImageCropperPropertyEditorValue = {
temporaryFileId: null,
src: '',
crops: [],
focalPoint: { left: 0.5, top: 0.5 },
@@ -28,6 +29,7 @@ export class UmbPropertyEditorUIImageCropperElement extends UmbLitElement implem
if (changedProperties.has('value')) {
if (!this.value) {
this.value = {
temporaryFileId: null,
src: '',
crops: [],
focalPoint: { left: 0.5, top: 0.5 },