@umbraco/headless-backoffice-bridge
Version:
Native javascript bridge for the Umbraco Backoffice.
73 lines • 2.38 kB
TypeScript
import { Coordinates, Size, FocalPoint, Udi } from '../../types';
/**
* Represents a picked Media item.
*/
export interface MediaPickerItem {
/** The image alt text. */
altText?: String;
/** The image alt caption. */
caption?: String;
/** The image crop coordinates. */
coordinates?: Coordinates;
/** The image focal point. */
focalPoint?: FocalPoint;
/** The UDI of the Media item. */
udi: String;
}
export interface MediaPickerConfig {
/** Specifies whether or not editing the Image in the Media Library in an inline dialog is allowed. */
allowMediaEdit?: Boolean;
/** If specified the image will be cropped to the size. The user will be able to select how the image is cropped. */
cropSize?: Size;
/** Specifies whether the Focal Point is disabled or not. */
disableFocalPoint?: Boolean;
/** Specifies whether selecttion folders is disabled or not. */
disableFolderSelect?: Boolean;
/**
* UDI of the Media item where the tree should start.
*
* If not specified the tree will start at the root.
*/
startMedia?: Udi;
/** If defined a dialog allowing editing alt text, caption, focal point and crop wil be opened and prefilled with the passed in values. */
target?: MediaPickerItem;
/** Specifies whether or not multiple items can be selected. */
multiple?: Boolean;
/** Specifies whether or not only images can be selected. */
onlyImages?: Boolean;
/** Specifies whether or not only folders can be selected. */
onlyFolders?: Boolean;
/** Specifies whether or not alt text, caption, focal point and crop can be edited. */
showDetails?: Boolean;
/**
* Callback invoked when the submit buttton is clicked.
*
* @param items - The selected items.
*/
submit: (items: MediaPickerItem[]) => void;
}
/**
* @example
*
* ```js
* import mediaPicker from '@umbraco/headless-backoffice-bridge/pickers/media'
*
* mediaPicker.show({
* multiple: true,
* onlyImages: true,
* submit(items) => {
* // do something with the selected items
* }
* })
* ```
*/
declare const _default: {
/**
* Shows the Media Picker.
*
* @param config - The Media Picker Configuration.
*/
show: (config: MediaPickerConfig) => void;
};
export default _default;
//# sourceMappingURL=index.d.ts.map