From 5011b8105d8cd591b133cb82b487aaef84643b81 Mon Sep 17 00:00:00 2001 From: Jared Stoffan Date: Wed, 2 Oct 2019 15:11:23 -0700 Subject: [PATCH] docs(examples): Provide example for startAt option (#1080) --- README.md | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index f3b555025..d923ba84c 100644 --- a/README.md +++ b/README.md @@ -145,30 +145,39 @@ preview.show(fileId, accessToken, { | useHotkeys | true | Whether hotkeys (keyboard shortcuts) are enabled | | fixDependencies | false | Temporarily patches AMD to properly load Preview's dependencies. You may need to enable this if your project uses RequireJS | | disableEventLog | false | Disables client-side `preview` event log. Previewing with this option enabled will not increment access stats (content access is still logged server-side) | -| fileOptions | {} | Mapping of file ID to file-level options. See the file option table below for details | +| fileOptions | {} | Mapping of file ID to file-level options. See the File Option table below for details | | previewWMPref | `any` | String value of `all`, `any`, or `none` that sets how previews of watermarked files behave. See https://community.box.com/t5/Sharing-Content-with-Box/Watermarking-Files/ta-p/30766 for more information about watermarking and https://community.box.com/t5/Collaborate-By-Inviting-Others/Understanding-Collaborator-Permission-Levels/ta-p/144 for more information about permissions and collaboration roles.

`all` forces watermarked previews. If the file type supports watermarking, users with `can_preview` permissions will see a watermarked preview. If the file type cannot be watermarked, no preview is shown.

`any` is the default watermarking behavior in the Box Web Application. If the file type supports watermarking, users with `can_preview` permissions will see a watermarked preview. If the file type cannot be watermarked, users that have both `can_preview` and `can_upload` permissions will see a non-watermarked preview and no preview otherwise.

`none` forces non-watermarked previews. Users that have both `can_preview` and `can_upload` permissions will see a non-watermarked preview and no preview otherwise. | | downloadWM | false | Whether the download of a watermarked file should be watermarked. This option does not affect non-watermarked files. If true, users will be able to download watermarked versions of supported file types as long as they have `can_preview` permissions (any collaboration role except for `Uploader`). | | responseInterceptor | | Function to intercept responses. For an example see https://codepen.io/box-platform/pen/jLdxEv | | requestInterceptor | | Function to intercept requests. For an example see https://codepen.io/box-platform/pen/jLdxEv | -| File Option | Description | -| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| fileVersionId | File version ID to preview. This must be a valid non-current file version ID. Use [Get Versions](https://developer.box.com/reference#view-versions-of-a-file) to fetch a list of file versions | -| startAt | Object with unit and value properties indicating where to start the preview at. Current supported units are 'seconds' for media and 'pages' for documents. | +| File Option | Default | Description | +| ------------- | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| fileVersionId | (Current) | File version ID to preview. This must be a valid non-current file version ID. Use [Get Versions](https://developer.box.com/reference#view-versions-of-a-file) to fetch a list of file versions | +| startAt | {} | Options for starting location. See the Start At table below for details | + +| Start At | Description | +| -------- | ------------------------------------------------------------- | +| unit | Supported values: "pages" for documents; "seconds" for media | +| value | Integer value specifying the start location | **Example** -This configuration sets version `54321` as the preview version for a file with the ID `12345`: +This configuration will attempt to Preview a non-current version of the given file (a document, in this case) at a specific starting page: -``` -const FILE_ID = '12345'; -const TOKEN = 'abcdefg'; +```javascript +var FILE_ID = '12345'; +var TOKEN = 'abcdefg'; preview.show(FILE_ID, TOKEN, { - fileOptions: { - [FILE_ID]: { - fileVersionId: '54321' - } - } + fileOptions: { + [FILE_ID]: { + fileVersionId: '54321', + startAt: { + unit: 'pages', + value: 2, + }, + }, + }, }); ```