Ability for Preview UI Element to show a particular Version
For version display, extend Preview UI element to take version id as one of the optional parameter and not default to Preview of current version if version id is present.
-
Adminrsangal (Admin, Box) commented
Our Dev team has identified an issue with how the ContentPreview Panel displays the current version of the document in the Box Preview process. They are asking if there could be a small code change (explained below) so we can render the correct document version for our clients. Could you please review and let us know if this is possible?
Thanks, Steve
--------------------------------------------------------------------------------------------------------------------------------------
Requirement:
The current ContentPreview Panel loads and displays the current version of the document. We need an option to load and display a Document (File) based on FileID and VersionID, so that an older version of the file can be viewed on the ContentPreview panel.
Code we are doing it now:
We are currently loading the ContentPreview Panel as follows:
<ContentPreview
language='en-US'
messages={{ 'be.close': 'Close' }}
hasHeader='true'
isVeryLarge={true}
canPreview='true'
canDownload='true'
fileId={previewFile.id [previewfile.id]}
token={token}
onClose={contentPreviewOnClose}
file={previewFile}
isLoading='false'
onDownload={() =>eventLog(previewFile, 'Download')}
onPrint={() => eventLog(previewFile, 'Print')}
contentSidebarProps={{
detailsSidebarProps: {
hasAccessStats: false,
hasClassification: false,
hasNotices: false,
hasProperties: false,
hasRetentionPolicy: false,
hasVersions: false,
isLoading:false
},
hasActivityFeed: false,
hasMetadata: false,
hasSkills: false,
hasVersions: false,
}}
/>
How we believe the Content Preview code could be updated:
Proposed code changes is as shown below. We have added versionId={previewFile.versionId} for the Versioned Document to load (and not the current document).
If {previewFile.versionId} is null or empty then we can load the current version by default.
<ContentPreview
language='en-US'
messages={{ 'be.close': 'Close' }}
hasHeader='true'
isVeryLarge={true}
canPreview='true'
canDownload='true'
fileId={previewFile.id [previewfile.id]}
versionId={previewFile.versionId}
token={token}
onClose={contentPreviewOnClose}
file={previewFile}
isLoading='false'
onDownload={() =>eventLog(previewFile, 'Download')}
onPrint={() => eventLog(previewFile, 'Print')}
contentSidebarProps={{
detailsSidebarProps: {
hasAccessStats: false,
hasClassification: false,
hasNotices: false,
hasProperties: false,
hasRetentionPolicy: false,
hasVersions: false,
isLoading:false
},
hasActivityFeed: false,
hasMetadata: false,
hasSkills: false,
hasVersions: false,
}}
/>