Search...
openMediaManager( )
Important:
This API is in Developer Preview and is subject to change.
Opens the Wix Media Manager in a modal.
Description
This function can only be used in page code files for dashboard pages created in the Wix editor or with Wix Blocks.
The Media Manager allows a site contributor to select one or more of the site's media files.
The openMediaManager()
function returns a promise that resolves to an object containing an array of file descriptors for the selected media files.
Syntax
function openMediaManager(options: OpenMediaManagerOptions): Promise<openMediaManagerReturn>
openMediaManager Parameters
NAME
TYPE
DESCRIPTION
options
OpenMediaManagerOptions
Options for the Media Manager.
Returns
Fulfilled - An object containing an array of file descriptors for the selected media files.
Return Type:
Promise<openMediaManagerReturn>
NAME
TYPE
DESCRIPTION
items
Array<FileDescriptor>
An array of file descriptors for the selected media files.
Was this helpful?
Open a media manager modal
Copy Code
1import { openMediaManager } from 'wix-dashboard';23/* Sample options value:4 * {5 * multiSelect: true,6 * category: 'IMAGE'7 * }8 */910openMediaManager(options)11 .then((fileDescriptors) => {12 const firstId = fileDescriptors.items[0]._id;13 const firstDisplayname = fileDescriptors.items[0].displayName;1415 console.log('Success! Retrieved these fileDescriptors:', fileDescriptors);16 return fileDescriptors;17 })18 .catch((error) => {19 console.error(error);20 // Handle the error21 });2223/* Promise resolves to:24 * [25 * {26 * "_createdDate": "2023-07-23T10:33:00.000Z",27 * "_id": "w8ide0_989yy3iic89mi8880kq9jkr9x7nxiz7l~mv2.jpg",28 * "_updatedDate": "2023-07-23T10:33:00.000Z",29 * "displayName": "example.jpg",30 * "hash": "x5bq2o4p8fj68xqt25v49wdnasys04xe",31 * "labels": [],32 * "media": {33 * "image": {34 * "faces": [],35 * "image": "wix:image://v1/w8ide0_989yy3iic89mi8880kq9jkr9x7nxiz7l~mv2.jpg/example.jpg"36 * }37 * },38 * "mediaType": "IMAGE",39 * "operationStatus": "READY",40 * "parentFolderId": "igje5u22nij3qkltzsnol37j3dnthvvh",41 * "private": false,42 * "siteId": "3ecba886-4267-11ee-be56-0242ac120002",43 * "sizeInBytes": "47177",44 * "sourceUrl": "https://example.org/filename.jpg",45 * "state": "OK",46 * "thumbnailUrl": "https://static.wixstatic.com/media/w8ide0_989yy3iic89mi8880kq9jkr9x7nxiz7l~mv2.jpg",47 * "url": "https://static.wixstatic.com/media/w8ide0_989yy3iic89mi8880kq9jkr9x7nxiz7l~mv2.jpg"48 * }49 * ...50 * ]51 */