mediapicker
Advanced tools
Comparing version 5.1.6 to 5.1.8
@@ -21,5 +21,6 @@ # Documentation | ||
## Integrating the Library | ||
There are two versions of MediaPicker currently available: one can be found in Atlassian repository and the other is available by public. | ||
The library currently require no dependencies. | ||
There are two versions of MediaPicker currently available: one can be found in Atlassian repository (@atlassian/mediapicker) and the other is available by public (mediapicker). | ||
The library currently requires no dependencies. | ||
### NPM | ||
@@ -29,10 +30,14 @@ **Installation** | ||
```bash | ||
npm install @atlassian/mediapicker | ||
npm install mediapicker --save | ||
``` | ||
or | ||
```bash | ||
yarn add mediapicker | ||
``` | ||
**Using the library** | ||
### ES2015 Modules | ||
```javascript | ||
import { MediaPicker } from '@atlassian/mediapicker'; | ||
console.log(MediaPicker); | ||
import { MediaPicker } from 'mediapicker'; | ||
``` | ||
@@ -54,3 +59,3 @@ | ||
Let's take the Browser component as an example and see how to write a simple file uploading app around it. | ||
Let's take the `MediaPickerBrowser` component as an example and see how to write a simple file uploading app around it. | ||
The easiest integration may look like this: | ||
@@ -60,3 +65,3 @@ | ||
import * as $ from 'jquery'; | ||
import { MediaPicker } from '@atlassian/mediapicker'; | ||
import { MediaPicker } from 'mediapicker'; | ||
@@ -75,7 +80,7 @@ const mpConfig = { | ||
``` | ||
This little app will let the user browse a file on his hard drive and upload it by clicking the button. You can find each step of it explained in the documentation below. | ||
This little app will let the user browse a file on his hard drive and upload it by clicking the button. You can more detailed documentation of the `MediaPickerBrowser` component below. | ||
--- | ||
## Configuration | ||
Each component takes configuration object as a parameter. There are 5 parameters that you may specify in your config. | ||
Each component takes a configuration object as a parameter. There are 5 parameters that you may specify in your config. | ||
@@ -103,3 +108,3 @@ ```javascript | ||
### tokenSource <_[TokenSource](./tokenSource.md)_> | ||
With this parameter integrator passes the token to the MediaPicker | ||
`MediaPicker` uses this parameter to get a JWT token used for authorization against the Media API. | ||
@@ -109,3 +114,3 @@ ### uploadParams? <_{expireAfter: number, skipConversions: boolean, collection: string, fetchMetadata: boolean, autoFinalize: boolean})_> | ||
**expireAfter** <_number_> — | ||
Indicate that the uploaded file can be cleaned up after the provided expiry. After the file expired, we don't guarantee access to it anymore (but it might still be available). Use an absolute UNIX Epoch timestamp in seconds. | ||
Indicates that the uploaded file can be cleaned up after the provided expiry. After the file expired, we don't guarantee access to it any more (but it might still be available). Use an absolute UNIX Epoch timestamp in seconds. | ||
@@ -117,6 +122,6 @@ **skipConversions** <_boolean_> — | ||
**collection** <_string_> — | ||
Set the collection name where the files should be uploaded to | ||
The name of the collection where files should be uploaded to | ||
**fetchMetadata** <_boolean_> — | ||
If true, MediaPicker will wait until all file processing is done and will return file objects with metadata (which includes links to previews, file size, etc.). | ||
If true, `MediaPicker` will wait until all file processing is done and will return file objects with metadata (which includes links to previews, file size, etc.). | ||
@@ -134,6 +139,6 @@ Default is true. | ||
## Component creation | ||
All MediaPicker components are created the same way. The first parameter is always the name of the component, the second is the config and the third is the component-specific parameter | ||
All MediaPicker components are created the same way. The first parameter is always the name of the component, the second is the general `MediaPicker` config and the third is the component-specific config | ||
```javascript | ||
const dropzone = MediaPicker('dropzone', mpConfig, {container: $('body')}) | ||
const dropzone = MediaPicker('dropzone', mpConfig, {container: $('body')}) | ||
``` | ||
@@ -147,3 +152,3 @@ | ||
```javascript | ||
MediaPicker('dropzone', mpConfig, {continer: $('body')}) instanceof MediaPicker('dropzone') | ||
MediaPicker('dropzone', mpConfig, {container: $('body')}) instanceof MediaPicker('dropzone') | ||
``` | ||
@@ -162,3 +167,3 @@ #### How to integrate it into typescript app | ||
#### upload-preview-update {file: MediaFile, preview: Blob | undefined} | ||
Emitted when MediaPicker have preview. Can be undefined if MediaPicker can't generate a preview. | ||
Emitted when `MediaPicker` has a preview. `preview` be undefined if `MediaPicker` fails to generate one. | ||
@@ -276,3 +281,3 @@ #### upload-status-update {file: MediaFile, progress: MediaProgress} | ||
### Browser | ||
Opens a file browser window. Doesn't have it's own UI. | ||
Opens native Operating System file browser window. | ||
@@ -335,3 +340,3 @@ ![alt text](./browser.png "Browser") | ||
### Popup | ||
Lets user pick files from the cloud storages. | ||
Lets user pick files from their local computer or cloud storage. | ||
@@ -367,3 +372,1 @@ ![alt text](./popup.png "Popup") | ||
** | ||
{ | ||
"name": "mediapicker", | ||
"version": "5.1.6", | ||
"version": "5.1.8", | ||
"description": "Library for handling file uploads", | ||
@@ -23,2 +23,3 @@ "main": "./lib/mediapicker.js", | ||
"test-only-watch": "(npm run start & node_modules/.bin/karma start --no-single-run); EX=$?; npm run kill-server; exit $EX", | ||
"lint": "./node_modules/.bin/tslint -c tslint.json 'src/**/*.ts'", | ||
"s3-upload": "npm run test && npm run build && ./node_modules/.bin/grunt s3", | ||
@@ -25,0 +26,0 @@ "pub": "npm run s3-upload && npm publish", |
@@ -12,2 +12,3 @@ { | ||
"test": "node_modules/.bin/karma start --single-run", | ||
"lint": "./node_modules/.bin/eslint -c .eslintrc 'src/**/*.js*'", | ||
"ci-all": "karma start --single-run --browsers bsChrome" | ||
@@ -23,3 +24,3 @@ }, | ||
"@atlaskit/media-core": "^8.0.0", | ||
"@atlaskit/media-editor": "^3.0.0", | ||
"@atlaskit/media-editor": "^3.1.0", | ||
"@atlaskit/spinner": "^2.2.3", | ||
@@ -26,0 +27,0 @@ "@atlaskit/util-shared-styles": "^2.2.1", |
@@ -1,2 +0,2 @@ | ||
export default function serviceConnect(state, action) { | ||
export default function resetView(state, action) { | ||
if (action.type === 'RESET_VIEW') { | ||
@@ -14,6 +14,9 @@ const view = { | ||
const oldUploads = state.uploads; | ||
let uploads = Object.keys(oldUploads).filter((uploadId) => { | ||
const progress = oldUploads[uploadId].file.progress; | ||
return progress && progress < 1; // remove files that finished upload | ||
}); | ||
const uploads = Object.keys(oldUploads).filter((uploadId) => { | ||
const progress = oldUploads[uploadId].progress; | ||
return (typeof progress === 'number') && progress < 1; // remove files that finished upload | ||
}).reduce((uploads, fileIdToKeep) => { | ||
uploads[fileIdToKeep] = oldUploads[fileIdToKeep]; | ||
return uploads; | ||
}, {}); | ||
@@ -20,0 +23,0 @@ return Object.assign({}, state, {view, selectedItems, uploads}); |
@@ -77,3 +77,3 @@ import '!style!css!less!./dropzone.less'; | ||
}).then(() => { | ||
this.deactivate(); //in case we call activate twice in a row | ||
this.deactivate(); // in case we call activate twice in a row | ||
@@ -80,0 +80,0 @@ this._container.addEventListener('dragover', this._onDragOver, false); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16527765
315
19140