From d4e5383c1ed70cd1a08cd4ed769b413616b5ca3e Mon Sep 17 00:00:00 2001 From: lakatosandrei Date: Wed, 21 Aug 2024 09:25:25 +0300 Subject: [PATCH] fix: made sure image upload works PD-4013 --- src/components/pie-author/pie-author.tsx | 13 ++++++++----- src/demo/multiple-choice-validation.html | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/components/pie-author/pie-author.tsx b/src/components/pie-author/pie-author.tsx index ffd7747..ea3b221 100644 --- a/src/components/pie-author/pie-author.tsx +++ b/src/components/pie-author/pie-author.tsx @@ -272,11 +272,14 @@ export class Author { this.dialogOpened = false; - if (this.fileInput.files.length === 0) { - // it means the user clicked cancel - this.imageHandler.cancel(); - this.imageHandler = null; - } + // needed in order for the fileInput to be populated with the file + setTimeout(() => { + if (this.fileInput.files.length === 0) { + // it means the user clicked cancel + this.imageHandler.cancel(); + this.imageHandler = null; + } + }, 50); }; this.handleInsertImage = (e: InsertImageEvent) => { diff --git a/src/demo/multiple-choice-validation.html b/src/demo/multiple-choice-validation.html index 697463a..6f96c80 100644 --- a/src/demo/multiple-choice-validation.html +++ b/src/demo/multiple-choice-validation.html @@ -29,7 +29,7 @@ const config = { id: '1', elements: { - 'pie-multiple-choice': '@pie-element/multiple-choice@5.9.3-next.760' + 'pie-multiple-choice': '@pie-element/multiple-choice@8.23.2' }, models: [MC_model], markup: ""