kalimu / 媒体管理器
基于RESTful API的媒体管理JavaScript库
0.1
2019-06-14 06:09 UTC
- 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: 2024-09-07 10:14:53 UTC
README
此库是基于RESTFull API的JavaScript媒体管理器。库仅包含客户端库。
目标是提供一个简单的界面用于
- 咨询媒体
- 上传/下载文件
- 对媒体进行简单修改
- 选择文件(在表单上下文中)
目前,该库仅适用于图像,但我们计划很快管理更多类型的文件
KalamuMediaManager
构造函数
var manager = new KalamuMediaManager(config);
配置是一个具有以下属性的对象。
方法
getImages()
返回管理器上的图像对象列表。
示例
console.log(manager.getImages()); // > Array(4) [ {...}, {...}, {...}, {...} ] // get the uniq identifier of an image console.log(manager.getImages()[0].config.identifier); // > "0be916c4219e1a26c..."
getSelection()
返回包含每个选中图像标识符的数组。
示例
console.log(manager.getSelection()); // > Array(2) [ "0be916c4219e1a26c...", "15b8669705ab106b00bfc..." ]
setSelection(identifiers)
此方法允许设置选中的文件。
示例
console.log(manager.getSelection()); // > Array(2) [ "0be916c4219e1a26c...", "15b8669705ab106b00bfc..." ] manager.setSelection(["0be916c4219e1a26c..."]); // change the selection console.log(manager.getSelection()); // > Array(1) [ "0be916c4219e1a26c..." ]