File tree Expand file tree Collapse file tree
contentcuration/contentcuration/frontend/shared/views/TipTapEditor/TipTapEditor Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -293,6 +293,10 @@ const MESSAGES = {
293293 } ,
294294
295295 // Error Messages
296+ errorUploadingImage : {
297+ message : 'Error uploading image' ,
298+ context : 'Title for the error modal when an image upload fails.' ,
299+ } ,
296300 noFileProvided : {
297301 message : 'No file provided.' ,
298302 context : 'Error message when no file is provided for upload' ,
Original file line number Diff line number Diff line change 137137 </button >
138138 </template >
139139 </footer >
140+ <KModal
141+ v-if =" showErrorModal"
142+ :appendToOverlay =" true"
143+ :title =" errorUploadingImage$()"
144+ >
145+ <template > {{ errorMessage }} </template >
146+ <template #actions >
147+ <KButton @click =" showErrorModal = false" > {{ close$() }} </KButton >
148+ </template >
149+ </KModal >
140150 </div >
141151
142152</template >
159169 closeModal$ ,
160170 cancelLoading$ ,
161171 cancel$ ,
172+ close$ ,
162173 replaceFile$ ,
163174 selectFile$ ,
164175 imagePreview$ ,
176187 insertImage$ ,
177188 defaultImageName$ ,
178189 multipleFilesDroppedWarning$ ,
190+ errorUploadingImage$ ,
179191 } = getTipTapEditorStrings ();
180192
181193 const modalRoot = ref (null );
186198 const altText = ref (' ' );
187199 const file = ref (null );
188200 const uploadWarning = ref (' ' );
201+ const showErrorModal = ref (false );
202+ const errorMessage = ref (' ' );
189203 let warningTimer = null ;
190204
191205 const isEditMode = computed (() => props .mode === ' edit' );
221235 uploadWarning .value = ' ' ;
222236 }, 5000 );
223237 };
224-
225238 const handleFileChange = async selectedFile => {
226239 if (! selectedFile) return ;
227240 modalState .value = ' loading' ;
231244 file .value = processedFile;
232245 modalState .value = ' preview' ;
233246 } catch (error) {
234- alert (error .message );
247+ errorMessage .value = error .message ;
248+ showErrorModal .value = true ;
235249 resetToPreview ();
236250 }
237251 };
238-
239252 const resetToPreview = () => {
240253 if (props .mode === ' create' && ! originalData .value .file ) {
241254 modalState .value = ' initial' ;
280293 handleFileChange,
281294 uploadWarning,
282295 showMultiFileWarning,
296+ errorMessage,
297+ showErrorModal,
283298
284299 // Strings
285300 editImage$,
286301 uploadImage$,
287302 closeModal$,
288303 cancelLoading$,
289304 cancel$,
305+ close$,
290306 replaceFile$,
291307 selectFile$,
292308 imagePreview$,
302318 save$,
303319 insert$,
304320 insertImage$,
321+ errorUploadingImage$,
305322 };
306323 },
307324 props: {
You can’t perform that action at this time.
0 commit comments