kalamu / media-manager
Javascript library for media managment on top of a RESTfull API
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 18
Language:JavaScript
- dev-master
- 0.1
- dev-dependabot/npm_and_yarn/json5-1.0.2
- dev-dependabot/npm_and_yarn/json5-and-css-loader-and-mini-css-extract-plugin-and-sass-loader-and-style-loader-and-webpack-and-webpack-cli--removed
- dev-dependabot/npm_and_yarn/qs-6.5.3
- dev-dependabot/npm_and_yarn/decode-uri-component-0.2.2
- dev-dependabot/npm_and_yarn/loader-utils-1.4.2
- dev-dependabot/npm_and_yarn/terser-4.8.1
- dev-dependabot/npm_and_yarn/ajv-6.12.6
- dev-dependabot/npm_and_yarn/node-sass-7.0.0
- dev-dependabot/npm_and_yarn/path-parse-1.0.7
- dev-dependabot/npm_and_yarn/postcss-7.0.36
- dev-dependabot/npm_and_yarn/hosted-git-info-2.8.9
- dev-dependabot/npm_and_yarn/lodash-4.17.21
- dev-dependabot/npm_and_yarn/ssri-6.0.2
- dev-dependabot/npm_and_yarn/y18n-3.2.2
- dev-dependabot/npm_and_yarn/elliptic-6.5.4
- dev-dependabot/npm_and_yarn/ini-1.3.7
- dev-dependabot/npm_and_yarn/acorn-6.4.1
- dev-dependabot/npm_and_yarn/mixin-deep-1.3.2
This package is auto-updated.
Last update: 2025-03-07 11:07:44 UTC
README
This library is a JavaScript media manager based on top of a RESTFull API. The library include only the client side library.
The goal is to provide a simple interface for :
- consulting medias
- uploadind/downloading files
- making simple changes on medias
- selecting files (in a form context)
For the moment, the library only work for images, but we plan to manage more types of files shortly
KalamuMediaManager
Constructor
var manager = new KalamuMediaManager(config);
Config is a object with the following properties.
Parameter | Required ? | Description |
---|---|---|
lang |
optional | Define the interface language. If not set, navigator.language is used. Accepted values are : en, fr |
dropZone |
required | DOM Element to add files (by drag'n drop or file input) |
displayZone |
required | DOM Element to display the file list |
infoZone |
required | DOM Element that must be a bootstrap modal to display file informations |
apiEntryPoint |
required | URL address of the RESTfull API |
selectable |
optional | Define if the files can be selected. Accepted values are : none, single, multiple |
onStart |
optional | Function triggered at startup, once the file list has been fetched from the API |
onSelectionChanged |
optional | Function triggered when the user change the file selection |
Methods
getImages()
Return the list of image objects that are on the manager.
Exemple :
console.log(manager.getImages()); // > Array(4) [ {...}, {...}, {...}, {...} ] // get the uniq identifier of an image console.log(manager.getImages()[0].config.identifier); // > "0be916c4219e1a26c..."
getSelection()
Return an array containing the identifier of each image selected.
Exemple :
console.log(manager.getSelection()); // > Array(2) [ "0be916c4219e1a26c...", "15b8669705ab106b00bfc..." ]
setSelection(identifiers)
This method allow to set which files are selected.
Exemple :
console.log(manager.getSelection()); // > Array(2) [ "0be916c4219e1a26c...", "15b8669705ab106b00bfc..." ] manager.setSelection(["0be916c4219e1a26c..."]); // change the selection console.log(manager.getSelection()); // > Array(1) [ "0be916c4219e1a26c..." ]