Options
The File Selector supports a wide range of configuration options to customize its behavior and appearance. These options can be passed as an object when initializing the FileSelector and allow you to control everything from localization to available crop formats, GDPR filtering, and UI behavior. This page lists all available options with their types and descriptions.
Name | Type | Description |
---|---|---|
aiAltTextDisabled | bool | Set to true to explicitly disable AI alt text option. |
aiAltTextLanguageCode | string | The field can be used if you want to lock the alt text to a specific language. This language could, for example, come from the page you are editing in your content management system (CMS). If the field is not used, a dropdown list with languages to choose the alt text from will be displayed. |
aiSearchDisabled | bool | Set to true to explicitly disable AI search option. |
allowIframeVideo | bool | Allow embedding of video using an iframe. The default is true. |
allowJSVideo | bool | Allow embedding of video using JavaScript. The default is true. |
allowSelectFormat | bool | If the user is allowed to select the crop format from a list. Otherwise you must specify a crop format with downloadFormats. Default is true. |
auth | string | Specifies the login method. Possible values:
|
autosetAltText | bool | If the alt-text field is to be filled in automatically based on what is in Mediaflow. Default is true. |
autosetDescription | bool | Determines whether the image description should populate the field. The default is false. |
client_id | string | Used if auth = token. |
client_secret | string | Used if auth = token. |
customAltText | string | Enter your own alt text that is filled in by default. |
downloadFormat | string | How to handle crop formats. Possible values: fixed - use only those specified in downloadFormats mediaflow - use the crop formats specified in Mediaflow both - use the crop formats specified in Mediaflow and add those included in downloadFormats. original - always use the original format stream - applies to media files. Save a stream URL instead of a downloadable URL. |
downloadFormats | object array | List of specified download formats (always saved as JPEG. Each format is specified with: name - name of the format in the list width - width in pixels height - height in pixels |
events | function | A callback function that is called at various user events, for example when a folder is displayed, when a file is selected, and so on. The function should receive two parameters, an event name as string and an event object whose content depends on which event occurred. |
excludePrivateFolders | bool | Set to true to not include private folders (such as "My files") in folder tree. |
forceAltText | bool | If the alt text field is mandatory to fill in. Default is false. |
hideUnsafeGDPR | bool | Filter out files that are not approved according to GDPR. Does not affect files that do not have any GDPR information set. Default is false. |
hideUnassignedGDPR | bool | Also filter out files that do not have any GDPR information set. Default is false. |
ignorePermissionChecks | bool | Set to true to ignore permission warnings and disabling of download etc. |
limitFileType | string | Comma-separated list of allowed file extensions. All files that do not match this are filtered out. |
locale | string | Language, sv_SE (default) or en_US. |
noCropButton | bool | If image files are to be cropped manually. If set to true, image files are not cropped but the original file is downloaded. Default is false. |
permanentURL | bool | Whether the download url should be temporary or permanent. Default is false. |
refresh_token | string | Used if auth = token. |
selectedFile | int | Here you can enter a file ID that is selected in the folder that you have specified with selectedFolder. |
selectedFolder | int | Here you can enter a folder ID that opens at startup. |
setAltText | bool | If the alt text field should be included. Default is true. |
setDescription | bool | Determines whether the field for image description should be displayed. The default is false. |
showDoneButton | bool | If an OK button is to be displayed in the interface. If set to false, it is required that there is another button outside the interface that calls the method clickDone(). |
showDoneButtonWorkingFlow | bool | Displays a message when clicking “Use this file” (the second button). A message shows the status while data is being fetched, and a confirmation message is displayed when the request is completed. This is mainly used when the File Selector is utilized in an extension where you need to manually close the window, such as in Sitevision. The default is false. |
success | function | A callback function that is called when the user is finished and the interface is expected to be deleted. It is called with a parameter that is an object with information about the selected file. |
useNavigationLink | bool | Enable adding an URL to the output data. If used - an input field is added to the "last step" when selecting an image. Default is false. |
defaults | object | See section below. |
The defaults object
Allows you to define default crop settings when initializing the File Selector—an alternative to using download presets configured in the Mediaflow app.
Example:
..., default: {width: 100, height: 100, format: -1, imageDownloadFileType: "webp"}, ...
Name | Type | Description |
---|---|---|
width | int | Width in pixels. Must be used together with height and format. |
height | int | Height in pixels. Must be used together with width and format. |
format | int | Preselected default format -1: Free crop -2: User format -3: Do not crop Must be used together with width and height. |
imageDownloadFileType | string | Allowed formats: "jpg", "png", "webp". |
Functions
The File Selector includes built-in functions that can be triggered programmatically. These are useful when customizing the interface or integrating with external controls.
Name | Description |
---|---|
clickDone() | Equivalent to clicking "Insert File" in the interface. If showDoneButton is set to false, it must be called manually. |
showFolder(folderId, fileId) | Open a selected folder. If fileId! = Null, the file will be marked with that id if it is in that folder. |