NPM Package: @picturepark/sdk-v1-pickers
The picturepark-pickers.js
library provides methods to open the Picturepark content picker dialog to select a content item in a third party application.
NPM Package:
Latest version from master branch (use for development only):
To run the samples navigate to the root of the repository and run:
npm run start:pickers
- pictureparkPickers.showContentPicker():
- Uses window.postMessage() to send messages from the popup to the opener window (caniuse.com)
Load the required JavaScript library:
<script src="picturepark-pickers.js"></script>
Open the picker and handle the response:
pictureparkPickers.showContentPicker("https://your-picturepark-server.com").then(function (result) {
if (result) {
// TODO: The user selected some content items and an embedded share has been created
} else {
// TODO: The user clicked cancel
}
});
The result
is undefined if the user clicked cancel or looks like:
{
"token": "nGmmbMyX",
"shareId": "114bddcf617f4becbc4da981b457ba22",
"items": [
{
"token": "JQTe0hgT",
"url": "https://devnext.preview-picturepark.com/Embed/JQTe0hgT"
},
{
"token": "7EEpblZt",
"url": "https://devnext.preview-picturepark.com/Embed/7EEpblZt"
},
{
"token": "bnNGJUUp",
"url": "https://devnext.preview-picturepark.com/Embed/bnNGJUUp"
}
]
}
Install the NPM package:
npm install @picturepark/sdk-v1-pickers
Next, import the `` function and call it:
import { showContentPicker } from '@picturepark/sdk-v1-pickers';
showContentPicker('https://devnext.preview-picturepark.com').then(...);