Skip to content

Commit

Permalink
Added canvases as parameter of getCanvasLink
Browse files Browse the repository at this point in the history
  • Loading branch information
morpheus-87 committed Jan 19, 2024
1 parent 12135c0 commit 8837b68
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [Unreleased]

### Added

- Added `canvases` as parameter of `getCanvasLink`

## [0.3.0](https://github.com/dbmdz/mirador-canvaslink/releases/tag/0.3.0) - 2024-01-18

### Added
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ The available settings are:
Receives this information about the current window:
```
{
canvases: [...],
manifestId: ...,
visibleCanvases: [...],
windowViewType: ...,
Expand Down
8 changes: 8 additions & 0 deletions src/components/ShareCanvasLinkDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const useStyles = makeStyles((theme) => ({
const supportsClipboard = "clipboard" in navigator;

const ShareCanvasLinkDialog = ({
canvases,
config,
containerId,
manifestId,
Expand All @@ -56,6 +57,7 @@ const ShareCanvasLinkDialog = ({
dialogOpen: false,
});
const canvasLink = getCanvasLink({
canvases,
manifestId,
visibleCanvases,
windowViewType,
Expand Down Expand Up @@ -134,12 +136,18 @@ const ShareCanvasLinkDialog = ({
};

ShareCanvasLinkDialog.defaultProps = {
canvases: [],
label: "",
rights: [],
visibleCanvases: [],
};

ShareCanvasLinkDialog.propTypes = {
canvases: PropTypes.arrayOf(
PropTypes.shape({
id: PropTypes.string.isRequired,
}),
),
config: PropTypes.shape({
dialogOpen: PropTypes.bool.isRequired,
enabled: PropTypes.bool.isRequired,
Expand Down
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { updateWindow } from "mirador/dist/es/src/state/actions";
import {
getCanvases,
getContainerId,
getRights,
getVisibleCanvases,
Expand Down Expand Up @@ -40,6 +41,7 @@ export default [
dispatch(updateWindow(windowId, { canvasLink })),
}),
mapStateToProps: (state, { windowId }) => ({
canvases: getCanvases(state, { windowId }),
containerId: getContainerId(state),
manifestId: getWindowManifests(state, { windowId })[0],
visibleCanvases: getVisibleCanvases(state, { windowId }),
Expand Down

0 comments on commit 8837b68

Please sign in to comment.