diff --git a/package.json b/package.json index f8f4fa20b7a8092ec055eeb52bc2a767309fd9a2..7848455a20ef4d320d77e419f9f1c78fbd73e854 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "draft-js": "^0.11.6", "draft-js-export-html": "^1.4.1", "draft-js-import-html": "^1.4.1", + "immutable": "^4.0.0-rc.12", "material-ui-color-components": "^0.3.0", "paper": "^0.12.11", "react-color": "^2.18.1" @@ -64,7 +65,7 @@ "jest": "^26.1.0", "jest-canvas-mock": "^2.2.0", "jest-localstorage-mock": "^2.4.2", - "mirador": "^3.0.0-rc.3", + "mirador": "^3.0.0-rc.5", "nwb": "^0.24.7", "prop-types": "^15.7.2", "react": "^16.13.1", diff --git a/src/WebAnnotation.js b/src/WebAnnotation.js index 119098a49f1b35b50cb5d2166f3e803d04427d5c..22bff181002d0eddab513652f57e877b002419c5 100644 --- a/src/WebAnnotation.js +++ b/src/WebAnnotation.js @@ -50,22 +50,9 @@ export default class WebAnnotation { target() { let target = this.canvasId; if (this.svg || this.xywh) { - if (this.manifestId) { - target = { - source: { - id: this.canvasId, - partOf: { - id: this.manifestId, - type: 'Manifest', - }, - type: 'Canvas', - }, - }; - } else { - target = { - source: this.canvasId, - }; - } + target = { + source: this.source(), + }; } if (this.svg) { target.selector = { @@ -90,4 +77,20 @@ export default class WebAnnotation { } return target; } + + /** */ + source() { + let source = this.canvasId; + if (this.manifest) { + source = { + id: this.canvasId, + partOf: { + id: this.manifest.id, + type: 'Manifest', + }, + type: 'Canvas', + }; + } + return source; + } }