@cu-mkp/editioncrafter 1.0.2 → 1.0.4-beta.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.
Files changed (57) hide show
  1. package/README.md +7 -7
  2. package/dist/editioncrafter.js +65802 -0
  3. package/dist/editioncrafter.umd.cjs +553 -0
  4. package/dist/es/src/action/DiplomaticActions.js +9 -11
  5. package/dist/es/src/action/DocumentActions.js +164 -154
  6. package/dist/es/src/action/GlossaryActions.js +9 -11
  7. package/dist/es/src/action/initialState/diplomaticInitialState.js +2 -2
  8. package/dist/es/src/action/initialState/documentInitialState.js +9 -12
  9. package/dist/es/src/action/initialState/glossaryInitialState.js +3 -3
  10. package/dist/es/src/action/rootReducer.js +31 -29
  11. package/dist/es/src/component/AlphabetLinks.js +44 -66
  12. package/dist/es/src/component/CustomizedTooltops.js +101 -110
  13. package/dist/es/src/component/DiploMatic.js +64 -91
  14. package/dist/es/src/component/DocumentView.js +442 -366
  15. package/dist/es/src/component/EditorComment.js +51 -75
  16. package/dist/es/src/component/ErrorBoundary.js +37 -61
  17. package/dist/es/src/component/FigureImage.js +56 -67
  18. package/dist/es/src/component/GlossaryView.js +157 -149
  19. package/dist/es/src/component/HelpPopper.js +96 -78
  20. package/dist/es/src/component/ImageGridView.js +184 -249
  21. package/dist/es/src/component/ImageView.js +155 -165
  22. package/dist/es/src/component/ImageZoomControl.js +19 -38
  23. package/dist/es/src/component/JumpToFolio.js +56 -60
  24. package/dist/es/src/component/Navigation.js +374 -328
  25. package/dist/es/src/component/Pagination.js +73 -70
  26. package/dist/es/src/component/Parser.js +11 -32
  27. package/dist/es/src/component/RingSpinner.js +31 -32
  28. package/dist/es/src/component/RouteListener.js +30 -21
  29. package/dist/es/src/component/SeaDragonComponent.js +33 -56
  30. package/dist/es/src/component/SinglePaneView.js +15 -33
  31. package/dist/es/src/component/SplitPaneView.js +151 -170
  32. package/dist/es/src/component/TranscriptionView.js +190 -179
  33. package/dist/es/src/component/Watermark.js +21 -30
  34. package/dist/es/src/component/XMLView.js +60 -82
  35. package/dist/es/src/hooks/useIsWidthUp.js +9 -7
  36. package/dist/es/src/icons/ByIcon.js +16 -16
  37. package/dist/es/src/icons/CcIcon.js +16 -16
  38. package/dist/es/src/icons/NcIcon.js +16 -16
  39. package/dist/es/src/icons/SaIcon.js +16 -16
  40. package/dist/es/src/icons/SideMenuIconLeft.js +30 -38
  41. package/dist/es/src/icons/SideMenuIconRight.js +32 -38
  42. package/dist/es/src/index.js +21 -20
  43. package/dist/es/src/lib/copyObject.js +3 -2
  44. package/dist/es/src/lib/registerServiceWorker.js +77 -54
  45. package/dist/es/src/model/DocumentHelper.js +7 -6
  46. package/dist/es/src/model/Folio.js +64 -86
  47. package/dist/es/src/model/ReduxStore.js +32 -78
  48. package/dist/es/src/model/folioLayout.js +275 -280
  49. package/dist/es/src/saga/RouteListenerSaga.js +89 -193
  50. package/dist/es/src/saga/rootSaga.js +9 -16
  51. package/dist/es/src/scss/_imageView.scss +1 -1
  52. package/dist/es/src/scss/_navigation.scss +1 -1
  53. package/dist/es/src/scss/editioncrafter.scss +1 -1
  54. package/dist/style.css +1 -0
  55. package/package.json +36 -51
  56. package/dist/editioncrafter.min.js +0 -2
  57. package/dist/editioncrafter.min.js.LICENSE.txt +0 -144
@@ -1,209 +1,220 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
- import React from 'react';
8
- import { connect } from 'react-redux';
9
- import { useSearchParams } from 'react-router-dom';
10
- import Navigation from './Navigation';
11
- import Pagination from './Pagination';
12
- import Parser from './Parser';
13
- import EditorComment from './EditorComment';
14
- import ErrorBoundary from './ErrorBoundary';
15
- import Watermark from './Watermark';
16
- import { BigRingSpinner } from './RingSpinner';
17
- var addZoneStyle = function addZoneStyle(selectedZone, domNode, facses) {
1
+ import React from 'react'
2
+ import { connect } from 'react-redux'
3
+ import { useSearchParams } from 'react-router-dom'
4
+ import EditorComment from './EditorComment'
5
+ import ErrorBoundary from './ErrorBoundary'
6
+ import Navigation from './Navigation'
7
+ import Pagination from './Pagination'
8
+ import Parser from './Parser'
9
+ import { BigRingSpinner } from './RingSpinner'
10
+ import Watermark from './Watermark'
11
+
12
+ function addZoneStyle(selectedZone, domNode, facses) {
18
13
  if (facses.includes(selectedZone)) {
19
14
  // Keep any classes that might already be set
20
15
  if (domNode.attribs.classname) {
21
- domNode.attribs.classname += ' selected-zone';
22
- } else {
23
- domNode.attribs.classname = 'selected-zone';
16
+ domNode.attribs.classname += ' selected-zone'
17
+ }
18
+ else {
19
+ domNode.attribs.classname = 'selected-zone'
24
20
  }
25
21
  }
26
- return domNode;
27
- };
28
- var setUpForZoneHighlighting = function setUpForZoneHighlighting(selectedZone, domNode) {
22
+
23
+ return domNode
24
+ }
25
+
26
+ function setUpForZoneHighlighting(selectedZone, domNode) {
29
27
  if (selectedZone && domNode.attribs['data-facs']) {
30
28
  // The facs field can contain multiple values
31
- var facses = domNode.attribs['data-facs'].split(' ');
32
- return addZoneStyle(selectedZone, domNode, facses);
29
+ const facses = domNode.attribs['data-facs'].split(' ')
30
+
31
+ return addZoneStyle(selectedZone, domNode, facses)
33
32
  }
34
- return domNode;
35
- };
36
- var htmlToReactParserOptions = function htmlToReactParserOptions(selectedZone) {
37
- var parserOptions = {
38
- replace: function replace(domNode) {
33
+
34
+ return domNode
35
+ }
36
+
37
+ function htmlToReactParserOptions(selectedZone) {
38
+ const parserOptions = {
39
+ replace(domNode) {
39
40
  switch (domNode.name) {
40
- case 'tei-line':
41
- {
42
- console.log(domNode.attribs['data-facs']);
43
- return setUpForZoneHighlighting(selectedZone, domNode);
44
- }
45
- case 'tei-surface':
46
- {
47
- return setUpForZoneHighlighting(selectedZone, domNode);
48
- }
49
- case 'tei-note':
50
- {
51
- var _domNode$children$;
52
- var text = ((_domNode$children$ = domNode.children[0]) === null || _domNode$children$ === void 0 ? void 0 : _domNode$children$.data) || '';
53
- var id = domNode.attribs.n || domNode.attribs.id;
54
-
55
- // Not sure what else to do if there's no ID
56
- if (!id) {
57
- return domNode;
58
- }
59
- return /*#__PURE__*/React.createElement(EditorComment, {
60
- commentID: id,
61
- text: text
62
- });
63
- }
64
- case 'tei-figure':
65
- {
66
- var _graphicEl$attribs, _descEl$children$;
67
- var graphicEl = domNode.children.find(function (ch) {
68
- return ch.name === 'tei-graphic';
69
- });
70
- var src = graphicEl === null || graphicEl === void 0 ? void 0 : (_graphicEl$attribs = graphicEl.attribs) === null || _graphicEl$attribs === void 0 ? void 0 : _graphicEl$attribs.url;
71
- if (!src) {
72
- return domNode;
73
- }
74
- var descEl = domNode.children.find(function (ch) {
75
- return ch.name === 'tei-figdesc';
76
- });
77
- var desc = descEl === null || descEl === void 0 ? void 0 : (_descEl$children$ = descEl.children[0]) === null || _descEl$children$ === void 0 ? void 0 : _descEl$children$.data;
78
- return /*#__PURE__*/React.createElement("figure", {
79
- className: "inline-figure"
80
- }, /*#__PURE__*/React.createElement("img", {
81
- src: src,
82
- alt: desc || '',
83
- className: "inline-image"
84
- }), desc ? /*#__PURE__*/React.createElement("figcaption", null, desc) : null);
41
+ case 'tei-line': {
42
+ return setUpForZoneHighlighting(selectedZone, domNode)
43
+ }
44
+ case 'tei-surface': {
45
+ return setUpForZoneHighlighting(selectedZone, domNode)
46
+ }
47
+ case 'tei-note': {
48
+ const text = domNode.children[0]?.data || ''
49
+ const id = domNode.attribs.n || domNode.attribs.id
50
+
51
+ // Not sure what else to do if there's no ID
52
+ if (!id) {
53
+ return domNode
85
54
  }
86
- case 'div':
87
- {
88
- return setUpForZoneHighlighting(selectedZone, domNode);
55
+
56
+ return (
57
+ <EditorComment commentID={id} text={text} />
58
+ )
59
+ }
60
+ case 'tei-figure': {
61
+ const graphicEl = domNode.children.find(ch => ch.name === 'tei-graphic')
62
+ const src = graphicEl?.attribs?.url
63
+ if (!src) {
64
+ return domNode
89
65
  }
66
+
67
+ const descEl = domNode.children.find(ch => ch.name === 'tei-figdesc')
68
+ const desc = descEl?.children[0]?.data
69
+ return (
70
+ <figure className="inline-figure">
71
+ <img src={src} alt={desc || ''} className="inline-image" />
72
+ { desc ? <figcaption>{desc}</figcaption> : null }
73
+ </figure>
74
+ )
75
+ }
76
+
77
+ case 'div': {
78
+ return setUpForZoneHighlighting(selectedZone, domNode)
79
+ }
80
+
90
81
  default:
91
82
  /* Otherwise, Just pass through */
92
- return domNode;
83
+ return domNode
93
84
  }
94
- }
95
- };
96
- return parserOptions;
97
- };
98
- var TranscriptionView = function TranscriptionView(props) {
99
- var _useSearchParams = useSearchParams(),
100
- _useSearchParams2 = _slicedToArray(_useSearchParams, 1),
101
- searchParams = _useSearchParams2[0];
102
- var side = props.side,
103
- folioID = props.folioID,
104
- transcriptionType = props.transcriptionType,
105
- document = props.document,
106
- documentView = props.documentView,
107
- documentViewActions = props.documentViewActions;
85
+ },
86
+ }
87
+ return parserOptions
88
+ }
89
+
90
+ function TranscriptionView(props) {
91
+ const [searchParams] = useSearchParams()
92
+
93
+ const {
94
+ side,
95
+ folioID,
96
+ transcriptionType,
97
+ document,
98
+ documentView,
99
+ documentViewActions,
100
+ } = props
101
+
108
102
  if (folioID === '-1') {
109
- console.log('no folio');
110
- return /*#__PURE__*/React.createElement(Watermark, {
111
- documentView: documentView,
112
- documentViewActions: documentViewActions,
113
- side: side
114
- });
103
+ return (
104
+ <Watermark
105
+ documentView={documentView}
106
+ documentViewActions={documentViewActions}
107
+ side={side}
108
+ />
109
+ )
115
110
  }
116
- var folio = document.folioIndex[folioID];
111
+
112
+ const folio = document.folioIndex[folioID]
113
+
117
114
  if (folio && !folio.loading && !folio.transcription) {
118
- return /*#__PURE__*/React.createElement(Watermark, {
119
- documentView: documentView,
120
- documentViewActions: documentViewActions,
121
- side: side
122
- });
115
+ return (
116
+ <Watermark
117
+ documentView={documentView}
118
+ documentViewActions={documentViewActions}
119
+ side={side}
120
+ />
121
+ )
123
122
  }
124
- var transcriptionData = folio && folio.transcription && folio.transcription[transcriptionType];
123
+ const transcriptionData = folio && folio.transcription && folio.transcription[transcriptionType]
124
+
125
125
  if (folio && !folio.loading && !transcriptionData) {
126
- console.log('no transcription data');
127
- return /*#__PURE__*/React.createElement(Watermark, {
128
- documentView: documentView,
129
- documentViewActions: documentViewActions,
130
- side: side
131
- });
126
+ return (
127
+ <Watermark
128
+ documentView={documentView}
129
+ documentViewActions={documentViewActions}
130
+ side={side}
131
+ />
132
+ )
132
133
  }
133
134
 
134
135
  // Configure parser to replace certain tags with components
135
- var htmlToReactParserOptionsSide = htmlToReactParserOptions(searchParams.get('zone'));
136
- var html = transcriptionData && transcriptionData.html;
137
- var layout = transcriptionData && transcriptionData.layout;
136
+ const htmlToReactParserOptionsSide = htmlToReactParserOptions(searchParams.get('zone'))
137
+ const html = transcriptionData && transcriptionData.html
138
+ const layout = transcriptionData && transcriptionData.layout
139
+
138
140
  if (folio && !folio.loading && !html) {
139
- console.log('no html');
140
- return /*#__PURE__*/React.createElement(Watermark, {
141
- documentView: documentView,
142
- documentViewActions: documentViewActions,
143
- side: side
144
- });
141
+ return (
142
+ <Watermark
143
+ documentView={documentView}
144
+ documentViewActions={documentViewActions}
145
+ side={side}
146
+ />
147
+ )
145
148
  }
149
+
146
150
  if (folio && folio.loading) {
147
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Navigation, {
148
- side: side,
149
- documentView: documentView,
150
- documentViewActions: documentViewActions,
151
- documentName: document.variorum && folio.doc_id
152
- }), /*#__PURE__*/React.createElement(Pagination, {
153
- side: side,
154
- documentView: documentView,
155
- documentViewActions: documentViewActions
156
- }), /*#__PURE__*/React.createElement("div", {
157
- className: "transcriptionViewComponent"
158
- }, /*#__PURE__*/React.createElement("div", {
159
- className: "transcriptContent"
160
- }, /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement(BigRingSpinner, {
161
- delay: 3000,
162
- color: "dark"
163
- })))), /*#__PURE__*/React.createElement(Pagination, {
164
- side: side,
165
- documentView: documentView,
166
- documentViewActions: documentViewActions,
167
- bottom: true
168
- }));
151
+ return (
152
+ <div>
153
+ <Navigation
154
+ side={side}
155
+ documentView={documentView}
156
+ documentViewActions={documentViewActions}
157
+ documentName={document.variorum && folio.doc_id}
158
+ />
159
+ <Pagination side={side} documentView={documentView} documentViewActions={documentViewActions} />
160
+ <div className="transcriptionViewComponent">
161
+ <div className="transcriptContent">
162
+ <ErrorBoundary>
163
+ <BigRingSpinner delay={3000} color="dark" />
164
+ </ErrorBoundary>
165
+ </div>
166
+ </div>
167
+
168
+ <Pagination
169
+ side={side}
170
+ documentView={documentView}
171
+ documentViewActions={documentViewActions}
172
+ bottom
173
+ />
174
+ </div>
175
+ )
169
176
  }
170
- return /*#__PURE__*/React.createElement("div", {
171
- style: {
172
- position: "relative",
173
- overflow: "auto"
174
- }
175
- }, /*#__PURE__*/React.createElement(Navigation, {
176
- side: side,
177
- documentView: documentView,
178
- documentViewActions: documentViewActions,
179
- documentName: document.variorum && folio.doc_id
180
- }), /*#__PURE__*/React.createElement(Pagination, {
181
- side: side,
182
- documentView: documentView,
183
- documentViewActions: documentViewActions
184
- }), /*#__PURE__*/React.createElement("div", {
185
- className: "transcriptionViewComponent"
186
- }, /*#__PURE__*/React.createElement("div", {
187
- className: "transcriptContent"
188
- }, /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement("div", {
189
- className: "surface grid-mode",
190
- style: {
191
- gridTemplateAreas: layout
192
- }
193
- }, /*#__PURE__*/React.createElement(Parser, {
194
- html: html,
195
- htmlToReactParserOptionsSide: htmlToReactParserOptionsSide
196
- }))))), /*#__PURE__*/React.createElement(Pagination, {
197
- side: side,
198
- documentView: documentView,
199
- documentViewActions: documentViewActions,
200
- bottom: true
201
- }));
202
- };
177
+
178
+ return (
179
+ <div style={{ position: 'relative', overflow: 'auto' }}>
180
+ <Navigation
181
+ side={side}
182
+ documentView={documentView}
183
+ documentViewActions={documentViewActions}
184
+ documentName={document.variorum && folio.doc_id}
185
+ />
186
+ <Pagination side={side} documentView={documentView} documentViewActions={documentViewActions} />
187
+ <div className="transcriptionViewComponent">
188
+ <div className="transcriptContent">
189
+ <ErrorBoundary>
190
+ <div
191
+ className="surface grid-mode"
192
+ style={{ gridTemplateAreas: layout }}
193
+ >
194
+ <Parser
195
+ html={html}
196
+ htmlToReactParserOptionsSide={htmlToReactParserOptionsSide}
197
+ />
198
+ </div>
199
+ </ErrorBoundary>
200
+ </div>
201
+ </div>
202
+
203
+ <Pagination
204
+ side={side}
205
+ documentView={documentView}
206
+ documentViewActions={documentViewActions}
207
+ bottom
208
+ />
209
+ </div>
210
+ )
211
+ }
212
+
203
213
  function mapStateToProps(state) {
204
214
  return {
205
215
  annotations: state.annotations,
206
- document: state.document
207
- };
216
+ document: state.document,
217
+ }
208
218
  }
209
- export default connect(mapStateToProps)(TranscriptionView);
219
+
220
+ export default connect(mapStateToProps)(TranscriptionView)
@@ -1,30 +1,21 @@
1
- import React from 'react';
2
- import Navigation from './Navigation';
3
- import Pagination from './Pagination';
4
- var Watermark = function Watermark(_ref) {
5
- var side = _ref.side,
6
- documentView = _ref.documentView,
7
- documentViewActions = _ref.documentViewActions;
8
- return /*#__PURE__*/React.createElement("div", {
9
- style: {
10
- position: "relative"
11
- },
12
- className: "watermarkContainer"
13
- }, documentView.left.iiifShortID !== '-1' && documentView.right.iiifShortID !== '-1' ? /*#__PURE__*/React.createElement(Navigation, {
14
- side: side,
15
- documentView: documentView,
16
- documentViewActions: documentViewActions
17
- }) : null, /*#__PURE__*/React.createElement("div", {
18
- className: "transcriptContent"
19
- }, /*#__PURE__*/React.createElement(Pagination, {
20
- side: side,
21
- className: "pagination_upper",
22
- documentView: documentView,
23
- documentViewActions: documentViewActions
24
- }), /*#__PURE__*/React.createElement("div", {
25
- className: "watermark"
26
- }, /*#__PURE__*/React.createElement("div", {
27
- className: side !== 'third' ? "watermark_contents" : "third_pane_blank"
28
- }))));
29
- };
30
- export default Watermark;
1
+ import React from 'react'
2
+ import Navigation from './Navigation'
3
+ import Pagination from './Pagination'
4
+
5
+ function Watermark({ side, documentView, documentViewActions }) {
6
+ return (
7
+ <div style={{ position: 'relative' }} className="watermarkContainer">
8
+ { documentView.left.iiifShortID !== '-1' && documentView.right.iiifShortID !== '-1'
9
+ ? <Navigation side={side} documentView={documentView} documentViewActions={documentViewActions} />
10
+ : null}
11
+ <div className="transcriptContent">
12
+ <Pagination side={side} className="pagination_upper" documentView={documentView} documentViewActions={documentViewActions} />
13
+ <div className="watermark">
14
+ <div className={side !== 'third' ? 'watermark_contents' : 'third_pane_blank'} />
15
+ </div>
16
+ </div>
17
+ </div>
18
+ )
19
+ }
20
+
21
+ export default Watermark
@@ -1,87 +1,65 @@
1
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
3
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
4
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
5
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
7
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
8
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
9
- function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
10
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
11
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
13
- import React, { Component } from 'react';
14
- import { connect } from 'react-redux';
15
- import Navigation from './Navigation';
16
- import Pagination from './Pagination';
17
- import Watermark from './Watermark';
18
- var XMLView = /*#__PURE__*/function (_Component) {
19
- _inherits(XMLView, _Component);
20
- var _super = _createSuper(XMLView);
21
- function XMLView() {
22
- _classCallCheck(this, XMLView);
23
- return _super.apply(this, arguments);
24
- }
25
- _createClass(XMLView, [{
26
- key: "render",
27
- value:
28
- // RENDER
29
- function render() {
30
- var _this$props = this.props,
31
- side = _this$props.side,
32
- document = _this$props.document,
33
- documentView = _this$props.documentView,
34
- documentViewActions = _this$props.documentViewActions;
35
- var thisClass = "xmlViewComponent ".concat(side);
36
- var thisID = "xmlViewComponent_".concat(side);
1
+ import React, { Component } from 'react'
2
+ import { connect } from 'react-redux'
3
+ import Navigation from './Navigation'
4
+ import Pagination from './Pagination'
5
+ import Watermark from './Watermark'
6
+
7
+ class XMLView extends Component {
8
+ // RENDER
9
+ render() {
10
+ const {
11
+ side,
12
+ document,
13
+ documentView,
14
+ documentViewActions,
15
+ } = this.props
37
16
 
38
- // Retrofit - the folios are loaded asynchronously
39
- var folioID = documentView[side].iiifShortID;
40
- if (folioID === '-1') {
41
- return /*#__PURE__*/React.createElement("div", {
42
- className: "watermark"
43
- }, /*#__PURE__*/React.createElement("div", {
44
- className: "watermark_contents"
45
- }));
46
- }
47
- var folio = document.folioIndex[folioID];
48
- if (!folio.transcription) {
49
- return /*#__PURE__*/React.createElement(Watermark, {
50
- documentView: documentView,
51
- documentViewActions: documentViewActions,
52
- side: side
53
- });
54
- }
55
- var transcriptionType = documentView[side].transcriptionType;
56
- var transcriptionData = folio.transcription[transcriptionType];
57
- var xmlContent = transcriptionData.xml;
58
- return /*#__PURE__*/React.createElement("div", {
59
- id: thisID,
60
- className: thisClass,
61
- style: {
62
- position: "relative",
63
- overflow: "auto"
64
- }
65
- }, /*#__PURE__*/React.createElement(Navigation, {
66
- side: side,
67
- documentView: documentView,
68
- documentViewActions: documentViewActions,
69
- documentName: document.variorum && folio.doc_id
70
- }), /*#__PURE__*/React.createElement(Pagination, {
71
- side: side,
72
- className: "pagination_upper",
73
- documentView: documentView,
74
- documentViewActions: documentViewActions
75
- }), /*#__PURE__*/React.createElement("div", {
76
- className: "xmlContentInner"
77
- }, /*#__PURE__*/React.createElement("pre", null, xmlContent)));
17
+ const thisClass = `xmlViewComponent ${side}`
18
+ const thisID = `xmlViewComponent_${side}`
19
+
20
+ // Retrofit - the folios are loaded asynchronously
21
+ const folioID = documentView[side].iiifShortID
22
+ if (folioID === '-1') {
23
+ return (
24
+ <div className="watermark">
25
+ <div className="watermark_contents" />
26
+ </div>
27
+ )
78
28
  }
79
- }]);
80
- return XMLView;
81
- }(Component);
29
+
30
+ const folio = document.folioIndex[folioID]
31
+ if (!folio.transcription) {
32
+ return (
33
+ <Watermark
34
+ documentView={documentView}
35
+ documentViewActions={documentViewActions}
36
+ side={side}
37
+ />
38
+ )
39
+ }
40
+
41
+ const { transcriptionType } = documentView[side]
42
+ const transcriptionData = folio.transcription[transcriptionType]
43
+ const { xml: xmlContent } = transcriptionData
44
+
45
+ return (
46
+ <div id={thisID} className={thisClass} style={{ position: 'relative', overflow: 'auto' }}>
47
+ <Navigation side={side} documentView={documentView} documentViewActions={documentViewActions} documentName={document.variorum && folio.doc_id} />
48
+ <Pagination side={side} className="pagination_upper" documentView={documentView} documentViewActions={documentViewActions} />
49
+
50
+ <div className="xmlContentInner">
51
+ <pre>{xmlContent}</pre>
52
+ </div>
53
+
54
+ </div>
55
+ )
56
+ }
57
+ }
58
+
82
59
  function mapStateToProps(state) {
83
60
  return {
84
- document: state.document
85
- };
61
+ document: state.document,
62
+ }
86
63
  }
87
- export default connect(mapStateToProps)(XMLView);
64
+
65
+ export default connect(mapStateToProps)(XMLView)
@@ -1,7 +1,9 @@
1
- import { useTheme } from '@material-ui/core/styles';
2
- import useMediaQuery from '@material-ui/core/useMediaQuery';
3
- var useIsWidthUp = function useIsWidthUp(breakpoint) {
4
- var theme = useTheme();
5
- return useMediaQuery(theme.breakpoints.up(breakpoint));
6
- };
7
- export default useIsWidthUp;
1
+ import { useTheme } from '@material-ui/core/styles'
2
+ import useMediaQuery from '@material-ui/core/useMediaQuery'
3
+
4
+ function useIsWidthUp(breakpoint) {
5
+ const theme = useTheme()
6
+ return useMediaQuery(theme.breakpoints.up(breakpoint))
7
+ }
8
+
9
+ export default useIsWidthUp