@cu-mkp/editioncrafter 1.0.1 → 1.0.2

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.
@@ -190,7 +190,7 @@ function parseSingleManifest(manifest, transcriptionTypes, document) {
190
190
  }
191
191
  var thumbnailURL = "".concat(bodyId, "/full/").concat(thumbnailDimensions.join(','), "/0/default.jpg");
192
192
  var folio = {
193
- id: folioID,
193
+ id: document ? "".concat(document, "_").concat(folioID) : folioID,
194
194
  doc_id: document || manifest.id,
195
195
  name: canvasLabel,
196
196
  pageNumber: i,
@@ -53,6 +53,11 @@ var DocumentView = function DocumentView(props) {
53
53
  var params = useParams();
54
54
  var navigate = useNavigate();
55
55
  var location = useLocation();
56
+
57
+ //"reload" the page if the config props change
58
+ useEffect(function () {
59
+ dispatchAction(props, 'RouteListenerSaga.userNavigatation', location);
60
+ }, [props.config]);
56
61
  useEffect(function () {
57
62
  setSinglePaneMode(props.containerWidth < 960);
58
63
  }, [props.containerWidth]);
@@ -87,7 +92,8 @@ var DocumentView = function DocumentView(props) {
87
92
  }
88
93
  };
89
94
  }
90
- var leftFolioID = folioID;
95
+ var leftFolioValid = Object.keys(document.folioIndex).includes(folioID);
96
+ var leftFolioID = leftFolioValid ? folioID : '-1';
91
97
  var leftTranscriptionType;
92
98
  var rightFolioID;
93
99
  var rightTranscriptionType;
@@ -95,13 +101,15 @@ var DocumentView = function DocumentView(props) {
95
101
  var thirdTranscriptionType;
96
102
  if (folioID2) {
97
103
  // route /ec/:folioID/:transcriptionType/:folioID2/:transcriptionType2
98
- leftTranscriptionType = transcriptionType;
99
- rightFolioID = folioID2;
100
- rightTranscriptionType = transcriptionType2 || firstTranscriptionType;
104
+ var rightFolioValid = Object.keys(document.folioIndex).includes(folioID2);
105
+ leftTranscriptionType = leftFolioValid ? transcriptionType : 'g';
106
+ rightFolioID = rightFolioValid ? folioID2 : '-1';
107
+ rightTranscriptionType = rightFolioValid ? transcriptionType2 ? transcriptionType2 : firstTranscriptionType : 'g';
101
108
  if (folioID3) {
102
109
  // route /ec/:folioID/:transcriptionType/:folioID2/:transcriptionType2/:folioID3/:transcriptionType3
103
- thirdFolioID = folioID3;
104
- thirdTranscriptionType = transcriptionType3 || firstTranscriptionType;
110
+ var thirdFolioValid = Object.keys(document.folioIndex).includes(folioID3);
111
+ thirdFolioID = thirdFolioValid ? folioID3 : '-1';
112
+ thirdTranscriptionType = thirdFolioValid ? transcriptionType3 ? transcriptionType3 : firstTranscriptionType : 'g';
105
113
  } else {
106
114
  thirdFolioID = '-1';
107
115
  thirdTranscriptionType = 'g';
@@ -110,8 +118,8 @@ var DocumentView = function DocumentView(props) {
110
118
  // route /ec/:folioID
111
119
  // route /ec/:folioID/:transcriptionType
112
120
  leftTranscriptionType = 'f';
113
- rightFolioID = folioID;
114
- rightTranscriptionType = transcriptionType || firstTranscriptionType;
121
+ rightFolioID = leftFolioValid ? folioID : '-1';
122
+ rightTranscriptionType = leftFolioValid ? transcriptionType ? transcriptionType : firstTranscriptionType : 'g';
115
123
  thirdFolioID = '-1';
116
124
  thirdTranscriptionType = 'g';
117
125
  }
@@ -334,7 +342,8 @@ var DocumentView = function DocumentView(props) {
334
342
  hasPrevious: current_hasPrev,
335
343
  hasNext: current_hasNext,
336
344
  previousFolioShortID: prevID,
337
- nextFolioShortID: nextID
345
+ nextFolioShortID: nextID,
346
+ documentID: doc.variorum ? doc.folioIndex[shortID].doc_id : doc.documentName
338
347
  });
339
348
  };
340
349
  var documentViewActions = {
@@ -349,6 +358,7 @@ var DocumentView = function DocumentView(props) {
349
358
  var viewType = determineViewType(side);
350
359
  var key = viewPaneKey(side);
351
360
  var folioID = docView[side].iiifShortID;
361
+ var document = docView[side].documentID;
352
362
  var transcriptionType = docView[side].transcriptionType;
353
363
  if (viewType === 'ImageView') {
354
364
  return /*#__PURE__*/React.createElement(ImageView, {
@@ -385,7 +395,7 @@ var DocumentView = function DocumentView(props) {
385
395
  documentView: docView,
386
396
  documentViewActions: documentViewActions,
387
397
  side: side,
388
- selectedDoc: props.document.variorum && Object.keys(props.document.derivativeNames)[side === 'left' ? 0 : side === 'right' ? 1 : Object.keys(props.document.derivativeNames).length > 2 ? 2 : 1]
398
+ selectedDoc: document ? document : props.document.variorum && Object.keys(props.document.derivativeNames)[side === 'left' ? 0 : side === 'right' ? 1 : Object.keys(props.document.derivativeNames).length > 2 ? 2 : 1]
389
399
  });
390
400
  }
391
401
  if (viewType === 'GlossaryView') {
@@ -449,7 +459,8 @@ var DocumentView = function DocumentView(props) {
449
459
  };
450
460
  function mapStateToProps(state) {
451
461
  return {
452
- document: state.document
462
+ document: state.document,
463
+ glossary: state.glossary
453
464
  };
454
465
  }
455
466
  export default withWidth()(connect(mapStateToProps)(DocumentView));
@@ -184,9 +184,11 @@ var ImageGridView = /*#__PURE__*/function (_React$Component) {
184
184
  var _this4 = this;
185
185
  var documentView = this.props.documentView;
186
186
  var folioID = documentView[this.props.side].iiifShortID;
187
- var thumbs = this.generateThumbs(folioID, this.state.currentDoc ? this.props.document.folios.filter(function (folio) {
187
+ var thumbs = this.generateThumbs(folioID, this.props.document.variorum && this.state.currentDoc ? this.props.document.folios.filter(function (folio) {
188
188
  return folio.doc_id === _this4.state.currentDoc;
189
189
  }) : this.props.document.folios);
190
+ console.log(thumbs);
191
+ console.log(this.props.document.folios);
190
192
  var thumbCount = thumbs.length > this.loadIncrement ? this.loadIncrement : thumbs.length;
191
193
  var visibleThumbs = thumbs.slice(0, thumbCount);
192
194
  this.setState({
@@ -205,9 +207,7 @@ var ImageGridView = /*#__PURE__*/function (_React$Component) {
205
207
  React.createElement("li", {
206
208
  key: "thumb-".concat(index),
207
209
  className: "thumbnail"
208
- }, /*#__PURE__*/React.createElement("figure", {
209
- className: folio.id === currentID ? 'current' : ''
210
- }, /*#__PURE__*/React.createElement("a", {
210
+ }, /*#__PURE__*/React.createElement("figure", null, /*#__PURE__*/React.createElement("a", {
211
211
  id: folio.id,
212
212
  onClick: _this5.onClickThumb.bind(_this5, folio.id)
213
213
  }, /*#__PURE__*/React.createElement("img", {
@@ -225,8 +225,8 @@ var ImageGridView = /*#__PURE__*/function (_React$Component) {
225
225
  }
226
226
  }
227
227
  }))), /*#__PURE__*/React.createElement("figcaption", {
228
- className: folio.id === currentID ? 'thumbnail-caption current' : 'thumbnail-caption'
229
- }, folio.id === currentID ? "*".concat(folio.name) : folio.name))
228
+ className: "thumbnail-caption"
229
+ }, folio.name))
230
230
  );
231
231
  });
232
232
  return thumbs;
@@ -122,8 +122,8 @@ var SplitPaneView = /*#__PURE__*/function (_Component) {
122
122
  key: "componentDidMount",
123
123
  value: function componentDidMount() {
124
124
  this.updateUI();
125
- window.addEventListener('mousemove', this.onDrag);
126
- window.addEventListener('mouseup', this.onEndDrag);
125
+ window.addEventListener('pointermove', this.onDrag);
126
+ window.addEventListener('pointerup', this.onEndDrag);
127
127
  window.addEventListener('resize', this.onResize);
128
128
  console.log(this.props);
129
129
  // Set the default width on mount
@@ -144,8 +144,8 @@ var SplitPaneView = /*#__PURE__*/function (_Component) {
144
144
  }, {
145
145
  key: "componentWillUnmount",
146
146
  value: function componentWillUnmount() {
147
- window.removeEventListener('mousemove', this.onDrag);
148
- window.removeEventListener('mouseup', this.onEndDrag);
147
+ window.removeEventListener('pointermove', this.onDrag);
148
+ window.removeEventListener('pointerup', this.onEndDrag);
149
149
  window.removeEventListener('resize', this.onResize);
150
150
  }
151
151
  }, {
@@ -155,7 +155,7 @@ var SplitPaneView = /*#__PURE__*/function (_Component) {
155
155
  var drawerIconClass = 'drawer-icon fas fa-caret-left fa-2x';
156
156
  return /*#__PURE__*/React.createElement("div", {
157
157
  className: "divider ".concat(position, "_divider"),
158
- onMouseDown: function onMouseDown() {
158
+ onPointerDown: function onPointerDown() {
159
159
  return _this2.onStartDrag(position);
160
160
  }
161
161
  }, /*#__PURE__*/React.createElement("div", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cu-mkp/editioncrafter",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "A simple digital critical edition publication tool",
5
5
  "homepage": "https://cu-mkp.github.io/editioncrafter/",
6
6
  "private": false,