Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 22 additions & 21 deletions pages/docs/viewer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -142,27 +142,28 @@ const MyCustomViewer = () => {

`Viewer` can configured through an `options` prop, which will serve as a object for common options.

| Prop | Type | Required | Default |
| ------------------------------- | --------------------------------------------------------------------------- | -------- | ---------------------------------------- |
| `iiifContent` | `string` | Yes | |
| `iiifContentSearchQuery` | [See Content Search](#content-search) | No | |
| `canvasIdCallback` | `function` | No | |
| `customDisplays` | [See Custom Displays](#custom-displays) | No | |
| `customTheme` | `object` | No | |
| `plugins` | [See Plugins](#plugins) | No | |
| `options` | `object` | No | |
| `options.background` | `string` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS/background) | No | `transparent` |
| `options.canvasBackgroundColor` | `string` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS/background) | No | `#1a1d1e` |
| `options.canvasHeight` | `string` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS/height) | No | `500px` |
| `options.ignoreCaptionLabels` | `string[]` | No | [] |
| `options.openSeadragon` | `OpenSeadragon.Options` | No | |
| `options.informationPanel` | [See Information Panel](#information-panel) | No | |
| `options.requestHeaders` | `IncomingHttpHeaders` | No | `{ "Content-Type": "application/json" }` |
| `options.showDownload` | `boolean` | No | true |
| `options.showIIIFBadge` | `boolean` | No | true |
| `options.showTitle` | `boolean` | No | true |
| `options.withCredentials` | `boolean` | No | false |
| `options.contentSearch` | [See Content Search](#content-search) | No | |
| Prop | Type | Required | Default |
| -------------------------------- | --------------------------------------------------------------------------- | -------- | ---------------------------------------- |
| `iiifContent` | `string` | Yes | |
| `iiifContentSearchQuery` | [See Content Search](#content-search) | No | |
| `canvasIdCallback` | `function` | No | |
| `customDisplays` | [See Custom Displays](#custom-displays) | No | |
| `customTheme` | `object` | No | |
| `plugins` | [See Plugins](#plugins) | No | |
| `options` | `object` | No | |
| `options.background` | `string` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS/background) | No | `transparent` |
| `options.canvasBackgroundColor` | `string` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS/background) | No | `#1a1d1e` |
| `options.canvasHeight` | `string` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS/height) | No | `500px` |
| `options.ignoreCaptionLabels` | `string[]` | No | [] |
| `options.openSeadragon` | `OpenSeadragon.Options` | No | |
| `options.informationPanel` | [See Information Panel](#information-panel) | No | |
| `options.requestHeaders` | `IncomingHttpHeaders` | No | `{ "Content-Type": "application/json" }` |
| `options.showDownload` | `boolean` | No | true |
| `options.showIIIFBadge` | `boolean` | No | true |
| `options.showTitle` | `boolean` | No | true |
| `options.customLoadingComponent` | `React.ComponentType` | No | |
| `options.withCredentials` | `boolean` | No | false |
| `options.contentSearch` | [See Content Search](#content-search) | No | |

- Options `canvasBackgroundColor` and `canvasHeight` will apply to both `<video>` elements and the OpenseaDragon canvas.
- Option `withCredentials` being set as `true` will inform IIIF resource requests to be made [using credentials](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials) such as cookies, authorization headers or TLS client certificates.
Expand Down
9 changes: 8 additions & 1 deletion src/components/Viewer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,14 @@ const RenderViewer: React.FC<CloverViewerProps> = ({
* loaded into React.Context as `vault`. Upon completion
* (error or not) isLoaded will be set to true.
*/
if (!isLoaded) return <>Loading</>;
if (!isLoaded) {
if (options?.customLoadingComponent) {
const CustomLoadingComponent = options.customLoadingComponent;
return <CustomLoadingComponent />;
} else {
return <>Loading</>;
}
}

/**
* If an error occurs during manifest fetch process used by
Expand Down
1 change: 1 addition & 0 deletions src/context/viewer-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export type ViewerConfigOptions = {
showDownload?: boolean;
showIIIFBadge?: boolean;
showTitle?: boolean;
customLoadingComponent?: React.ComponentType;
withCredentials?: boolean;
localeText?: {
contentSearch?: {
Expand Down