box-ui-elements
box-ui-elements copied to clipboard
Box Content Preview - Cannot override the staticHost in contentPreviewProps
Environment:
- Elements version: -- Content Preview: 1.60.0
Desktop (please complete the following information):
- OS: macOS 10.12.6
- Browser Chrome 71
Steps to reproduce the problem:
- Instantiate a new Box.Preview() instance.
- Modify the
staticHost,staticPath, andpreviewLibraryVersionparams - Verify that that the Content Preview element is retrieving the preview.js from the new staticHost and not https://cdn01.boxcdn.net
What is the expected behavior? The Content Preview UI Element concatenates a new path leveraging the overridden staticHost, staticPath, and previewLibraryVersion props.
What went wrong?
The Content Preview UI Element ignores the overridden staticHost and uses https://cdn01.boxcdn.net
Sample Code
this.boxContentExplorer = explorer.show(rootFolderId, downscopedToken, {
container: explorerContainer,
autoFocus: true,
canPreview: true,
canDownload: true,
canUpload: true,
canCreateNewFolder: true,
canDelete: true,
canRename: true,
canShare: true,
canSetShareAccess: true,
contentPreviewProps: {
staticHost: 'https://www.myfakecdn.com',
staticPath: 'super/awesome/path/preview',
previewLibraryVersion: '1.60.0'
}
});
Hi @kylefernandadams. I was able to recreate this issue with our latest release. We'll look into addressing this more permanently in the future, but as a workaround, you can move staticHost into the root options object:
this.boxContentExplorer = explorer.show(rootFolderId, downscopedToken, {
container: explorerContainer,
autoFocus: true,
canPreview: true,
canDownload: true,
canUpload: true,
canCreateNewFolder: true,
canDelete: true,
canRename: true,
canShare: true,
canSetShareAccess: true,
contentPreviewProps: {
staticPath: 'super/awesome/path/preview',
previewLibraryVersion: '1.60.0'
},
staticHost: 'https://www.myfakecdn.com',
});