@cu-mkp/editioncrafter 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -66,6 +66,9 @@ function parseImageURLs(canvas) {
66
66
  if (annotation.type !== 'Annotation') throwError("Expected Annotation in items property of ".concat(annotationPage.id));
67
67
  if (annotation.motivation === 'painting') {
68
68
  if (!annotation.body) throwError("Expected body property in Annotation ".concat(annotation.id));
69
+ if (!annotation.body.id) {
70
+ return null;
71
+ }
69
72
  return {
70
73
  bodyId: annotation.body.id,
71
74
  imageURL: "".concat(annotation.body.id, "/info.json")
@@ -171,33 +174,35 @@ function parseSingleManifest(manifest, transcriptionTypes, document) {
171
174
  var canvas = canvases[i];
172
175
  if (canvas.type !== 'Canvas') throwError("Expected items[".concat(i, "] to be of type 'Canvas'."));
173
176
  if (!canvas.id) throwError("Expected items[".concat(i, "] to have an id property."));
174
- var folioID = canvas.id.substr(canvas.id.lastIndexOf('/') + 1);
175
- var canvasLabel = parseLabel(canvas);
176
- var _parseImageURLs = parseImageURLs(canvas),
177
- bodyId = _parseImageURLs.bodyId,
178
- imageURL = _parseImageURLs.imageURL;
179
- var annotationURLs = parseAnnotationURLs(canvas, transcriptionTypes);
180
- var ratio = canvas.width / canvas.height;
181
- var thumbnailDimensions = [];
182
- if (ratio > 1) {
183
- thumbnailDimensions = [MAX_THUMBNAIL_DIMENSION, Math.round(MAX_THUMBNAIL_DIMENSION / ratio)];
184
- } else {
185
- thumbnailDimensions = [Math.round(MAX_THUMBNAIL_DIMENSION * ratio), MAX_THUMBNAIL_DIMENSION];
177
+ if (parseImageURLs(canvas)) {
178
+ var folioID = canvas.id.substr(canvas.id.lastIndexOf('/') + 1);
179
+ var canvasLabel = parseLabel(canvas);
180
+ var _parseImageURLs = parseImageURLs(canvas),
181
+ bodyId = _parseImageURLs.bodyId,
182
+ imageURL = _parseImageURLs.imageURL;
183
+ var annotationURLs = parseAnnotationURLs(canvas, transcriptionTypes);
184
+ var ratio = canvas.width / canvas.height;
185
+ var thumbnailDimensions = [];
186
+ if (ratio > 1) {
187
+ thumbnailDimensions = [MAX_THUMBNAIL_DIMENSION, Math.round(MAX_THUMBNAIL_DIMENSION / ratio)];
188
+ } else {
189
+ thumbnailDimensions = [Math.round(MAX_THUMBNAIL_DIMENSION * ratio), MAX_THUMBNAIL_DIMENSION];
190
+ }
191
+ var thumbnailURL = "".concat(bodyId, "/full/").concat(thumbnailDimensions.join(','), "/0/default.jpg");
192
+ var folio = {
193
+ id: folioID,
194
+ doc_id: document || manifest.id,
195
+ name: canvasLabel,
196
+ pageNumber: i,
197
+ image_zoom_url: imageURL,
198
+ image_thumbnail_url: thumbnailURL,
199
+ annotationURLs: annotationURLs,
200
+ annotations: canvas.annotations ? canvas.annotations.filter(function (a) {
201
+ return a.motivation === 'tagging';
202
+ }) : []
203
+ };
204
+ folios.push(folio);
186
205
  }
187
- var thumbnailURL = "".concat(bodyId, "/full/").concat(thumbnailDimensions.join(','), "/0/default.jpg");
188
- var folio = {
189
- id: folioID,
190
- doc_id: document || manifest.id,
191
- name: canvasLabel,
192
- pageNumber: i,
193
- image_zoom_url: imageURL,
194
- image_thumbnail_url: thumbnailURL,
195
- annotationURLs: annotationURLs,
196
- annotations: canvas.annotations ? canvas.annotations.filter(function (a) {
197
- return a.motivation === 'tagging';
198
- }) : []
199
- };
200
- folios.push(folio);
201
206
  }
202
207
  return folios;
203
208
  }
@@ -36,7 +36,7 @@ var DiploMatic = function DiploMatic(props) {
36
36
  }
37
37
  }, [containerRef]);
38
38
  var fixedFrameMode = props.diplomatic.fixedFrameMode;
39
- var fixedFrameModeClass = fixedFrameMode ? 'fixed' : 'sticky';
39
+ var fixedFrameModeClass = fixedFrameMode ? 'editioncrafter' : 'editioncrafter sticky';
40
40
  return /*#__PURE__*/React.createElement(Provider, {
41
41
  store: props.store
42
42
  }, /*#__PURE__*/React.createElement(HashRouter, null, /*#__PURE__*/React.createElement("div", {
@@ -220,7 +220,9 @@ var ImageGridView = /*#__PURE__*/function (_React$Component) {
220
220
  onError: function onError(_ref) {
221
221
  var currentTarget = _ref.currentTarget;
222
222
  currentTarget.onerror = null;
223
- currentTarget.src = "".concat(folio.image_zoom_url.slice(0, -9), "full/full/0/default.jpg");
223
+ if (folio.image_zoom_url && currentTarget.src !== "".concat(folio.image_zoom_url.slice(0, -9), "full/full/0/default.jpg")) {
224
+ currentTarget.src = "".concat(folio.image_zoom_url.slice(0, -9), "full/full/0/default.jpg");
225
+ }
224
226
  }
225
227
  }))), /*#__PURE__*/React.createElement("figcaption", {
226
228
  className: folio.id === currentID ? 'thumbnail-caption current' : 'thumbnail-caption'