Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
c2565a8
pkp/pkp-lib#12262 Add locale keys for Media Files manager
blesildaramirez Feb 2, 2026
bc29ffd
pkp/pkp-lib#12262 Add MediaFileManager component
blesildaramirez Feb 2, 2026
a2ca959
pkp/pkp-lib#12262 Add TableRowSpan and TableBodyGroup components to s…
blesildaramirez Feb 4, 2026
d4ed0a9
pkp/pkp-lib#12262 Add fileUtils file
blesildaramirez Feb 4, 2026
6bc17f2
pkp/pkp-lib#12262 Add FileMediaUploader component
blesildaramirez Feb 4, 2026
87f9030
pkp/pkp-lib#12262 Adjust padding and border for FileMediaUploader com…
blesildaramirez Feb 4, 2026
6b83849
pkp/pkp-lib#12262 Add modal to open for Add Media File action
blesildaramirez Feb 4, 2026
9056040
pkp/pkp-lib#12262 Add FieldSelectBorderless field component
blesildaramirez Feb 5, 2026
f0207c1
pkp/pkp-lib#12262 Add Batch Link Images modal component
blesildaramirez Feb 5, 2026
c543e8c
pkp/pkp-lib#12262 Add hideOnDisplay prop to FieldBase component
blesildaramirez Feb 6, 2026
61c6dd4
pkp/pkp-lib#12262 Add Metadata modal form component
blesildaramirez Feb 6, 2026
b5c11ef
pkp/pkp-lib#12262 Add handler to delete media file
blesildaramirez Feb 6, 2026
76e206a
pkp/pkp-lib#12262 Add size prop to FieldSelectBorderless component
blesildaramirez Feb 10, 2026
999d38d
pkp/pkp-lib#12262 Filter high res options for bacth link form to excl…
blesildaramirez Feb 10, 2026
2d8cc05
pkp/pkp-lib#12262 Set null for unlinked files in payload
blesildaramirez Feb 10, 2026
08f5ba2
pkp/pkp-lib#12262 Move linking image methods to shared api for batch …
blesildaramirez Feb 11, 2026
d3181da
pkp/pkp-lib#12262 Add component to handle manual linking of an image
blesildaramirez Feb 11, 2026
3f8d263
pkp/pkp-lib#12262 Rename useMediaFileManagerLinkImageTypes file with …
blesildaramirez Feb 11, 2026
3c1fbfb
pkp/pkp-lib#12262 Only allow manual linking of image action for image…
blesildaramirez Feb 11, 2026
bcb69be
pkp/pkp-lib#12262 Add safety check for mediaFiles.value
blesildaramirez Feb 11, 2026
7e00efb
pkp/pkp-lib#12262 Add resolution type field after uploading media file
blesildaramirez Feb 11, 2026
8564e8b
pkp/pkp-lib#12262 Fix dropzone issue when dragging dropping files
blesildaramirez Feb 11, 2026
4087b1f
pkp/pkp-lib#12262 Move dropzone handlers to composeable for FileUploa…
blesildaramirez Feb 12, 2026
12c3ab4
pkp/pkp-lib#12262 Remove duplicated locale keys for media files
blesildaramirez Feb 12, 2026
7f1f709
pkp/pkp-lib#12262 Add MediaFileManager to workflow config for publica…
blesildaramirez Feb 12, 2026
4baed60
pkp/pkp-lib#12262 Remove unused locale key common.selectOption
blesildaramirez Feb 12, 2026
15c1c0f
pkp/pkp-lib#12262 Add missing locale keys for editing metadata
blesildaramirez Feb 12, 2026
5a547e5
pkp/pkp-lib#12262 Open legacy modal to view more information for each…
blesildaramirez Feb 12, 2026
fbcc6ba
pkp/pkp-lib#12262 Update media file manager to use variantGroupId and…
blesildaramirez Feb 15, 2026
156409c
pkp/pkp-lib#12262 Update upload endpoint and payload for media files
blesildaramirez Feb 15, 2026
920bdb4
pkp/pkp-lib#12262 Update api and payload for linking images for media…
blesildaramirez Feb 15, 2026
2cf00ae
pkp/pkp-lib#12262 Update payload and api used for editing metadata of…
blesildaramirez Feb 15, 2026
509aa7a
pkp/pkp-lib#12262 Update endpoint used for deleting a media file
blesildaramirez Feb 15, 2026
855a70e
pkp/pkp-lib#12262 Update sample api responses for media files stories
blesildaramirez Feb 15, 2026
2b520cc
pkp/pkp-lib#12262 Add No Items display for empty media files table
blesildaramirez Feb 18, 2026
9b90df1
pkp/pkp-lib#12262 Fix display of media files when variantGroupId is u…
blesildaramirez Feb 18, 2026
aac781b
pkp/pkp-lib#12262 Update locale messages for resolution type options
blesildaramirez Feb 18, 2026
9d45498
pkp/pkp-lib#12262 Use correct submission id when viewing more informa…
blesildaramirez Feb 18, 2026
0d0b762
pkp/pkp-lib#12262 Fix table display when a file is deleted from a row…
blesildaramirez Feb 18, 2026
93cb5b5
pkp/pkp-lib#12262 Remove registerRowSpanGroupIndex from Table and han…
blesildaramirez Feb 18, 2026
3c0ac98
pkp/pkp-lib#12262 Sort the items in group for media files
blesildaramirez Feb 18, 2026
1b526e3
pkp/pkp-lib#12262 Use genre api to get genre options for uploading me…
blesildaramirez Feb 20, 2026
1154792
pkp/pkp-lib#12262 Add linking of other media types if the genre suppo…
blesildaramirez Feb 20, 2026
6885c34
pkp/pkp-lib#12262 Update Metadata form based on genre's file metadata…
blesildaramirez Feb 20, 2026
b6f5aa0
pkp/pkp-lib#12262 Update attributes used and docs for FileMediaUpload…
blesildaramirez Feb 20, 2026
a76447c
pkp/pkp-lib#12262 Render media file names as downloadable links
blesildaramirez Feb 23, 2026
02cb1e9
pkp/pkp-lib#12262 Add genre categories to global js vars
blesildaramirez Mar 2, 2026
abde623
pkp/pkp-lib#12262 Update properties used based on media files updated…
blesildaramirez Mar 2, 2026
398c5fc
pkp/pkp-lib#12262 update labels and messages used for medial files
blesildaramirez Mar 2, 2026
5344e7c
pkp/pkp-lib#12262 Use producton workflow stage when viewing media fil…
blesildaramirez Mar 2, 2026
be67e02
pkp/pkp-lib#12262 Use file id for unlinked files/no group id
blesildaramirez Apr 23, 2026
4bfb799
pkp/pkp-lib#12262 Set multilingual fields to supplementary metadata
blesildaramirez Apr 27, 2026
0096a81
pkp/pkp-lib#12262 Use pkp.const.MEDIA_VARIANT_TYPE_HIGH_RESOLUTION fo…
blesildaramirez Apr 27, 2026
398a4d8
pkp/pkp-lib#12262 Warn user before closing batch link image modal wit…
blesildaramirez Apr 27, 2026
1869177
pkp/pkp-lib#12262 Warn for unsaved changes when closing add media fil…
blesildaramirez Apr 27, 2026
7d1c0ab
pkp/pkp-lib#12262 Add a message to the upload media file modal when t…
blesildaramirez Apr 27, 2026
ba8744d
pkp/pkp-lib#12262 Validate only supported media files when uploading
blesildaramirez Apr 27, 2026
fe604a5
pkp/pkp-lib#12262 Use date field for date created metadata with type …
blesildaramirez Apr 27, 2026
f019c92
pkp/pkp-lib#12262 Disable Link Media when there are no web version fi…
blesildaramirez Apr 30, 2026
de59685
pkp/pkp-lib#12262 Filter media files by submission and publication
blesildaramirez Apr 30, 2026
c2214ca
pkp/pkp-lib#12262 Correct data shape for genre api data
blesildaramirez Apr 30, 2026
76deeed
pkp/pkp-lib#12262 Use textarea field for artwork metadata
blesildaramirez Apr 30, 2026
b7cc410
pkp/pkp-lib#12262 Remove hardcoded string 'web' and use pkp.const.MED…
blesildaramirez May 4, 2026
9c304a0
pkp/pkp-lib#12262 Make supportedFileTypes prop required
blesildaramirez May 4, 2026
9d83a61
pkp/pkp-lib#12262 Add story files for FieldSelectBorderless component…
blesildaramirez May 4, 2026
9d317a5
pkp/pkp-lib#12262 Add Media link to OMP config
blesildaramirez May 4, 2026
96d0401
pkp/pkp-lib#12262 Only reload list when deletion is successful
blesildaramirez May 4, 2026
c6f1268
pkp/pkp-lib#12262 Update access config for media files
blesildaramirez May 4, 2026
37657c0
pkp/pkp-lib#12262 Code cleanup for media files
blesildaramirez May 4, 2026
11cf3bb
pkp/pkp-lib#12262 Add FileTypeIcon component and use it for any file …
blesildaramirez May 4, 2026
631c0cd
pkp/pkp-lib#12262 Get supportedFileTypes from fileTypeGroups
blesildaramirez May 4, 2026
71fb125
pkp/pkp-lib#12262 Remove duplicate locales for uploads
blesildaramirez May 4, 2026
0eb7ee3
pkp/pkp-lib#12262 Add required supportedFileTypes prop to media file …
blesildaramirez May 4, 2026
b9f312d
pkp/pkp-lib#12262 Increase pageSize to 9999 to fetch all items in one…
blesildaramirez May 5, 2026
327984e
pkp/pkp-lib#12262 Move parseDropzoneError from fileUtils to useDropzo…
blesildaramirez May 5, 2026
a7e8ba6
pkp/pkp-lib#12262 Add useFile composeable
blesildaramirez May 5, 2026
2778367
pkp/pkp-lib#12262 Rename FieldSelectBorderless with InlineSelect
blesildaramirez May 5, 2026
91d2578
pkp/pkp-lib#12262 Switch groupSize from getter to toRef
blesildaramirez May 6, 2026
ca0b0df
pkp/pkp-lib#12262 Remove TableRowSpan and extend TableCell for rowspa…
blesildaramirez May 6, 2026
6f47f91
pkp/pkp-lib#12262 Remove supportedFileTypes prop from FileMediaUpload…
blesildaramirez May 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions public/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,15 @@ window.pkp = {
ORCID: 4,
PROCESSED: 5,
},

// Genre categories
GENRE_CATEGORY_DOCUMENT: 1,
GENRE_CATEGORY_ARTWORK: 2,
GENRE_CATEGORY_SUPPLEMENTARY: 3,

// Media variant types
MEDIA_VARIANT_TYPE_WEB: 'web',
MEDIA_VARIANT_TYPE_HIGH_RESOLUTION: 'high_resolution',
},

/**
Expand Down Expand Up @@ -237,6 +246,7 @@ window.pkp = {
'common.cancel': 'Cancel',
'common.changeLanguage': 'Change Language',
'common.clearSearch': 'Clear search phrase',
'common.clickToUploadFiles': 'Click to upload files',
'common.close': 'Close',
'common.closed': 'Closed',
'common.commaListSeparator': ', ',
Expand Down Expand Up @@ -296,6 +306,7 @@ window.pkp = {
'common.numberedMore': '{$number} more',
'common.numero': 'No',
'common.ok': 'OK',
'common.or': 'or',
'common.oneMonth': '1 month',
'common.oneWeek': '1 week',
'common.order': 'Order',
Expand All @@ -322,12 +333,14 @@ window.pkp = {
'common.searchPhrase': 'Search Phrase',
'common.searching': 'Searching',
'common.selectAll': 'Select All',
'common.selectedFile': 'Selected File',
'common.selectNone': 'Select None',
'common.selectWithName': 'Select {$name}',
'common.semicolonListSeparator': '; ',
'common.showingSteps': '{$current}/{$total} steps',
'common.showingXofX':
'Showing <strong>{$start} to {$finish}</strong> of {$total}',
'common.size': 'Size',
'common.startDate': 'Start Date',
'common.status': 'Status',
'common.switchTo': 'Switch to',
Expand All @@ -339,6 +352,7 @@ window.pkp = {
'common.upload': 'Upload',
'common.upload.addFile': 'Add File',
'common.upload.addFile.description': 'Upload a file from your computer.',
'common.upload.addFiles': 'Add Files',
'common.uploadedBy': 'Uploaded by {$name}',
'common.uploadedByAndWhen': 'Uploaded by {$name} on {$date}',
'common.user': 'User',
Expand Down Expand Up @@ -670,12 +684,14 @@ window.pkp = {
'grid.action.deleteContributor': 'Delete Contributor',
'grid.action.deleteContributor.confirmationMessage':
'Are you sure you want to remove {$name} as a contributor? This action can not be undone.',
'grid.action.deleteFile': 'Delete File',
'grid.action.deleteReviewerRecommendation': 'Delete Recommendation',
'grid.action.deleteReviewerSuggestion': 'Delete Reviewer Suggestion',
'grid.action.deleteReviewerSuggestion.confirmationMessage':
'Are you sure you want to remove this suggestion? This action can not be undone.',
'grid.action.edit': 'Edit',
'grid.action.editFile': 'Edit a file',
'grid.action.editMetadata': 'Edit Metadata',
'grid.action.editReviewerRecommendation': 'Edit Recommendation',
'grid.action.logInAs': 'Login As',
'grid.action.mergeUser': 'Merge user',
Expand All @@ -685,6 +701,17 @@ window.pkp = {
'grid.action.sendToTextEditor': 'Send to Text Editor',
'grid.action.sort': 'Sort',
'grid.action.updateFile': 'Update File Details',
'grid.artworkFile.caption': 'Caption',
'grid.artworkFile.copyrightOwner': 'Copyright Owner',
'grid.artworkFile.credit': 'Credit',
'grid.artworkFile.permissionTerms': 'Permission Terms',
'grid.supplementaryFile.creator': 'Creator',
'grid.supplementaryFile.publisher': 'Publisher',
'grid.supplementaryFile.source': 'Source',
'grid.supplementaryFile.subject': 'Subject',
'grid.supplementaryFile.sponsor': 'Sponsor',
'grid.supplementaryFile.date': 'Date Created',
'grid.supplementaryFile.language': 'Language',
'grid.category.add': 'Add Category',
'grid.category.categories': 'Categories',
'grid.category.categoryName': 'Category Name',
Expand Down Expand Up @@ -984,6 +1011,46 @@ window.pkp = {
'publication.jats.confirmDeleteFileTitle': 'Confirm deleting JATS XML',
'publication.jats.lastModified':
'Last Modification at {$modificationDate} by {$username}',
'publication.mediaFiles': 'Media Files',
'publication.mediaFiles.add': 'Add Media File',
'publication.mediaFiles.batchLinkMedia': 'Batch Link Media',
'publication.mediaFiles.batchLinkMedia.description':
'Link web version media files to their high-resolution counterparts. Select a high-resolution file for each web version below.',
'publication.mediaFiles.confirmDelete':
'Are you sure you want to delete "{$fileName}"? This action cannot be undone. If this file is linked to other media, those links will be removed.',
'publication.mediaFiles.delete': 'Delete media file?',
'publication.mediaFiles.description':
'Upload media files in bulk, including high-resolution versions. After uploading, link each file to its web or high resolution counterpart by cliking Manually Link Media from the More Actions dropdown, or use Batch Link Media to link multiple files at once.',
'publication.mediaFiles.linkHighResolutionVersion':
'Link High-Resolution Version',
'publication.mediaFiles.linkMedia': 'Link Media',
'publication.mediaFiles.manuallyLinkMedia': 'Manually Link Media',
'publication.mediaFiles.metadataName': 'Name of the file',
'publication.mediaFiles.metadataNameDescription':
'(e.g., Manuscript; Table 1)',
'publication.mediaFiles.upload.noMediaTypes':
'No media types are configured. Please contact the system administrator.',
'publication.mediaFiles.noHighResolutionFile': 'No high-resolution file',
'publication.mediaFiles.noWebVersionFile': 'No web version file',
'publication.mediaFiles.selectHighResolutionFor':
'Select high-resolution version for {$fileName}',
'publication.mediaFiles.selectMediaFileToLink':
'Select the media file to link as its counterpart',
'publication.mediaFiles.selectMediaFileToLink.description':
'Only one file can be linked. The file types must differ (web <> high-res).',
'publication.mediaFiles.selectedWebVersion': 'Selected Web Version',
'publication.mediaFiles.upload': 'Upload Media File',
'publication.mediaFiles.upload.description':
'Upload image or multimedia files in bulk. The system will auto-link them to your HTML galley using matching filenames. You can manually adjust or link files later if needed.',
'publication.mediaFiles.upload.variantTypeWeb': 'Web resolution',
'publication.mediaFiles.upload.variantTypeHighRes': 'High resolution',
'publication.mediaFiles.upload.selectMediaType':
'What kind of media is this?',
'publication.mediaFiles.upload.selectMediaTypeDescription':
'Select a media type from the dropdown.',
'publication.mediaFiles.upload.fileResType': 'File resolution type',
'publication.mediaFiles.upload.fileResTypeDescription':
'Select a file resolution from the dropdown.',
'publication.publicationLicense': 'Permissions & Disclosure',
'publication.publish': 'Publish',
'publication.revisionSignificance.description':
Expand Down
21 changes: 4 additions & 17 deletions src/components/Composer/Composer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@
:key="i"
class="composer__attachment"
>
<Icon
:icon="getDocumentTypeIcon(attachment)"
<FileTypeIcon
:document-type="attachment.documentType"
:inline="true"
class="composer__attachment__documentType"
/>
Expand Down Expand Up @@ -280,6 +280,7 @@ import Panel from '@/components/Panel/Panel.vue';
import PanelSection from '@/components/Panel/PanelSection.vue';
import PkpButton from '@/components/Button/Button.vue';
import Icon from '@/components/Icon/Icon.vue';
import FileTypeIcon from '@/components/FileTypeIcon/FileTypeIcon.vue';
import Badge from '@/components/Badge/Badge.vue';
import Spinner from '@/components/Spinner/Spinner.vue';

Expand All @@ -300,6 +301,7 @@ export default {
Spinner,
PkpButton,
Icon,
FileTypeIcon,
Badge,
},
mixins: [ajaxErrorCallback, dialog, preparedContent],
Expand Down Expand Up @@ -782,21 +784,6 @@ export default {
}
},

/**
* Get the icon to match this document type,
* such as PDF, Word, spreadsheet, etc.
*
* @param {Object} attachment The file attachment
* @return {String}
*/
getDocumentTypeIcon(attachment) {
return !!pkp.documentTypeIcons &&
!!attachment.documentType &&
!!pkp.documentTypeIcons[attachment.documentType]
? pkp.documentTypeIcons[attachment.documentType]
: 'DefaultDocument';
},

/**
* Emit an event to change a prop
*
Expand Down
22 changes: 6 additions & 16 deletions src/components/File/File.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<template>
<div class="flex min-w-0 items-center">
<Icon :icon="documentTypeIcon" class="h-6 w-6 flex-none text-heading" />
<FileTypeIcon
:document-type="documentType"
class="h-6 w-6 flex-none text-heading"
/>
<span v-if="fileId" class="file__id">
{{ fileId }}
</span>
Expand All @@ -16,10 +19,10 @@
</template>

<script>
import Icon from '@/components/Icon/Icon.vue';
import FileTypeIcon from '@/components/FileTypeIcon/FileTypeIcon.vue';

export default {
components: {Icon},
components: {FileTypeIcon},
props: {
/** Optional but recommended. Pass one of the `DOCUMENT_TYPE_` constants to show an icon that will match this document type. */
documentType: {
Expand Down Expand Up @@ -49,18 +52,5 @@ export default {
},
},
},
computed: {
/**
* The icon to match this document type
*
* @return {String}
*/
documentTypeIcon() {
return !!pkp.documentTypeIcons &&
!!pkp.documentTypeIcons[this.documentType]
? pkp.documentTypeIcons[this.documentType]
: 'DocumentDefault';
},
},
};
</script>
97 changes: 97 additions & 0 deletions src/components/FileMediaUploader/FileMediaUploader.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import {Meta, ArgTypes, Canvas} from '@storybook/addon-docs/blocks';
import * as FileMediaUploaderStories from './FileMediaUploader.stories';

<Meta of={FileMediaUploaderStories} />

# FileMediaUploader

A file upload component for media files with drag-and-drop support, progress tracking, genre selection, and resolution type selection.

## Usage

The `FileMediaUploader` component allows users to upload files via drag-and-drop or by clicking to browse. After each file is uploaded, users must select a genre and resolution type before submitting.

Genre options should be filtered to only include dependent genres (e.g., Image, Multimedia). Each genre option includes a `supportsFileVariants` flag that controls whether the resolution type dropdown is enabled.

### Basic usage

```vue
<template>
<FileMediaUploader
id="mediaUploader"
api-url="/api/v1/temporaryFiles"
:genre-options="genreOptions"
@uploaded="handleUploaded"
/>
</template>

<script setup>
const genreOptions = [
{value: 9, label: 'Multimedia', supportsFileVariants: true},
{value: 10, label: 'Image', supportsFileVariants: true},
{value: 11, label: 'HTML Stylesheet', supportsFileVariants: false},
];

function handleUploaded(files) {
// files: [{fileId, genreId, variantType, name, mimetype, ...}]
console.log('Uploaded files:', files);
}
</script>
```

### Tracking unsaved changes

Listen to `file-count-change` to know when the user has staged at least one file. Useful for warning before closing a modal with pending uploads.

```vue
<FileMediaUploader
id="mediaUploader"
api-url="/api/v1/temporaryFiles"
:genre-options="genreOptions"
@uploaded="handleUploaded"
@file-count-change="handleFileCountChange"
/>
```

## Features

- **Drag and Drop**: Users can drag files directly onto the dropzone area
- **Click to Upload**: Users can click to open the file browser
- **Progress Tracking**: Shows upload progress with a progress bar and percentage
- **Genre Selection**: After upload, users select a genre from a dropdown (required)
- **Resolution Type Selection**: Users select a resolution type (Web or High-resolution). The dropdown is disabled for genres that do not support high-resolution versions
- **File Removal**: Users can remove files before uploading
- **Error Handling**: Displays error messages when uploads fail

## Props

<ArgTypes />

## Events

### `uploaded`

Emitted when the user clicks the "Upload Files" button after all files have been uploaded and assigned a genre and resolution type.

**Payload**: An array of file objects with the following structure:

```js
[
{
fileId: 123,
genreId: 10,
variantType: 'web',
name: 'photo.jpg',
mimetype: 'image/jpeg',
// ...other server response fields
},
];
```

### `fileCountChange`

Emitted on file count changes (add/remove/failed upload). Useful for parents that need to know if anything is staged - e.g., to trigger an "unsaved changes" warning before closing a modal.

**Payload**: `Number` — current file count.

<Canvas of={FileMediaUploaderStories.Default} />
73 changes: 73 additions & 0 deletions src/components/FileMediaUploader/FileMediaUploader.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import FileMediaUploader from './FileMediaUploader.vue';
import {http, HttpResponse, delay} from 'msw';
import dropzoneOptions from '@/mocks/dropzoneOptions';
import articleComponentGenres from '@/mocks/articleComponentGenres';
import {useLocalize} from '@/composables/useLocalize';

export default {
title: 'Components/FileMediaUploader',
component: FileMediaUploader,
};

const {localize} = useLocalize();

const genreOptions = articleComponentGenres
.filter((genre) => genre.dependent)
.map((genre) => ({
value: genre.id,
label: localize(genre.name),
supportsFileVariants: genre.supportsFileVariants,
}));

export const Default = {
render: (args) => ({
components: {FileMediaUploader},
setup() {
function onUploaded(files) {
console.log('Uploaded files:', JSON.stringify(files, null, 2));
alert(
`Uploaded ${files.length} file(s):\n${files.map((f) => `- ${f.name} (genreId: ${f.genreId})`).join('\n')}`,
);
}

return {args, onUploaded};
},
template: `
<FileMediaUploader
v-bind="args"
@uploaded="onUploaded"
/>
`,
}),
args: {
id: 'fileMediaUploader',
apiUrl: 'https://mock/index.php/publicknowledge/api/v1/temporaryFiles',
genreOptions,
options: dropzoneOptions,
},
parameters: {
msw: {
handlers: [
http.post(
'https://mock/index.php/publicknowledge/api/v1/temporaryFiles',
async ({request}) => {
// Simulate upload delay
await delay(1500);

const formData = await request.formData();
const file = formData.get('file');
const fileName =
file?.name || formData.get('name') || 'uploaded-file';

return HttpResponse.json({
id: Math.floor(Math.random() * 1000) + 1,
name: fileName,
mimetype: file?.type || 'application/octet-stream',
documentType: 'default',
});
},
),
],
},
},
};
Loading