Skip to content

Commit ba8003d

Browse files
authored
Merge pull request #5390 from habibayman/fix/accepted-imagextensions
fix(texteditor): compute accepted images extensions from mimes
2 parents e912315 + 38d7948 commit ba8003d

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

contentcuration/contentcuration/frontend/shared/views/TipTapEditor/TipTapEditor/TipTapEditorStrings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ const MESSAGES = {
224224
context: 'Accessibility label for the button that opens the file picker.',
225225
},
226226
supportedFileTypes: {
227-
message: 'Supported file types: png, jpg, jpeg, svg, webp',
227+
message: 'Supported file types: { extensions }',
228228
context: 'A list of supported image file formats.',
229229
},
230230
removeImage: {

contentcuration/contentcuration/frontend/shared/views/TipTapEditor/TipTapEditor/components/image/ImageUploadModal.vue

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
>
106106
{{ selectFile$() }}
107107
</button>
108-
<p class="drop-zone-text">{{ supportedFileTypes$() }}</p>
108+
<p class="drop-zone-text">{{ supportedFileTypesText }}</p>
109109
</ImageDropZone>
110110
</div>
111111
</div>
@@ -212,6 +212,13 @@
212212
const imageProcessor = inject('imageProcessor', {});
213213
const { processFile, ACCEPTED_MIME_TYPES } = imageProcessor;
214214
215+
const supportedFileTypesText = computed(() => {
216+
const extensions = ACCEPTED_MIME_TYPES.map(type =>
217+
type.replace('image/', '').replace('svg+xml', 'svg'),
218+
);
219+
return supportedFileTypes$({ extensions: extensions.join(', ') });
220+
});
221+
215222
const instance = getCurrentInstance();
216223
const store = instance.proxy.$store;
217224
@@ -285,6 +292,7 @@
285292
isEditMode,
286293
canInsert,
287294
ACCEPTED_MIME_TYPES,
295+
supportedFileTypesText,
288296
triggerFileInput,
289297
onFileSelect,
290298
onInsert,
@@ -311,7 +319,6 @@
311319
altTextDescription$,
312320
imageDropZoneText$,
313321
selectFileToUpload$,
314-
supportedFileTypes$,
315322
removeImage$,
316323
remove$,
317324
saveChanges$,

0 commit comments

Comments
 (0)