@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,67 +1,45 @@
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 { Link } from 'react-scroll';
15
- export var alpha = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'Z'];
16
- var AlphabetLinks = /*#__PURE__*/function (_Component) {
17
- _inherits(AlphabetLinks, _Component);
18
- var _super = _createSuper(AlphabetLinks);
19
- function AlphabetLinks() {
20
- _classCallCheck(this, AlphabetLinks);
21
- return _super.apply(this, arguments);
22
- }
23
- _createClass(AlphabetLinks, [{
24
- key: "renderAlphaLinks",
25
- value: function renderAlphaLinks() {
26
- var letterLinks = [];
27
- for (var i = 0; i < alpha.length; i++) {
28
- var letter = alpha[i];
29
- var alphaID = "alpha-".concat(i);
30
- letterLinks.push( /*#__PURE__*/React.createElement("span", {
31
- key: "link-".concat(alphaID)
32
- }, /*#__PURE__*/React.createElement(Link, {
33
- to: alphaID,
34
- offset: -120,
35
- containerId: "glossaryViewInner",
36
- smooth: "true"
37
- }, letter), ' '));
38
- }
39
- return /*#__PURE__*/React.createElement("div", {
40
- style: {
41
- display: 'inline'
42
- }
43
- }, /*#__PURE__*/React.createElement("input", {
44
- id: "glossary-filter",
45
- className: "searchBox",
46
- placeholder: "Filter by Entry",
47
- onChange: this.props.onFilterChange,
48
- value: this.props.filterTerm
49
- }), /*#__PURE__*/React.createElement("div", {
50
- className: "alphaNav"
51
- }, /*#__PURE__*/React.createElement("span", {
52
- style: {
53
- color: 'black'
54
- }
55
- }, "Go to: "), letterLinks));
56
- }
57
- }, {
58
- key: "render",
59
- value: function render() {
60
- return /*#__PURE__*/React.createElement("div", {
61
- className: "glossaryNav"
62
- }, this.renderAlphaLinks());
1
+ import React, { Component } from 'react'
2
+ import { Link } from 'react-scroll'
3
+
4
+ export const alpha = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'Z']
5
+
6
+ export default class AlphabetLinks extends Component {
7
+ renderAlphaLinks() {
8
+ const letterLinks = []
9
+ for (let i = 0; i < alpha.length; i++) {
10
+ const letter = alpha[i]
11
+ const alphaID = `alpha-${i}`
12
+ letterLinks.push(
13
+ <span key={`link-${alphaID}`}>
14
+ <Link to={alphaID} offset={-120} containerId="glossaryViewInner" smooth="true">{letter}</Link>
15
+ {' '}
16
+ </span>,
17
+ )
63
18
  }
64
- }]);
65
- return AlphabetLinks;
66
- }(Component);
67
- export { AlphabetLinks as default };
19
+
20
+ return (
21
+ <div style={{ display: 'inline' }}>
22
+ <input
23
+ id="glossary-filter"
24
+ className="searchBox"
25
+ placeholder="Filter by Entry"
26
+ onChange={this.props.onFilterChange}
27
+ value={this.props.filterTerm}
28
+ />
29
+
30
+ <div className="alphaNav">
31
+ <span style={{ color: 'black' }}>Go to: </span>
32
+ { letterLinks }
33
+ </div>
34
+ </div>
35
+ )
36
+ }
37
+
38
+ render() {
39
+ return (
40
+ <div className="glossaryNav">
41
+ { this.renderAlphaLinks() }
42
+ </div>
43
+ )
44
+ }
45
+ }
@@ -1,165 +1,156 @@
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 from 'react';
14
- import { withStyles } from '@material-ui/core/styles';
15
- import Tooltip from '@material-ui/core/Tooltip';
1
+ import { withStyles } from '@material-ui/core/styles'
2
+ import Tooltip from '@material-ui/core/Tooltip'
3
+ import PropTypes from 'prop-types'
4
+ import React from 'react'
5
+
16
6
  function arrowGenerator(color) {
17
7
  return {
18
8
  '&[x-placement*="bottom"] $arrow': {
19
- top: 0,
20
- left: 0,
21
- marginTop: '-0.95em',
22
- width: '3em',
23
- height: '1em',
9
+ 'top': 0,
10
+ 'left': 0,
11
+ 'marginTop': '-0.95em',
12
+ 'width': '3em',
13
+ 'height': '1em',
24
14
  '&::before': {
25
15
  borderWidth: '0 1em 1em 1em',
26
- borderColor: "transparent transparent ".concat(color, " transparent")
27
- }
16
+ borderColor: `transparent transparent ${color} transparent`,
17
+ },
28
18
  },
29
19
  '&[x-placement*="top"] $arrow': {
30
- bottom: 0,
31
- left: 0,
32
- marginBottom: '-0.95em',
33
- width: '3em',
34
- height: '1em',
20
+ 'bottom': 0,
21
+ 'left': 0,
22
+ 'marginBottom': '-0.95em',
23
+ 'width': '3em',
24
+ 'height': '1em',
35
25
  '&::before': {
36
26
  borderWidth: '1em 1em 0 1em',
37
- borderColor: "".concat(color, " transparent transparent transparent")
38
- }
27
+ borderColor: `${color} transparent transparent transparent`,
28
+ },
39
29
  },
40
30
  '&[x-placement*="right"] $arrow': {
41
- left: 0,
42
- marginLeft: '-0.95em',
43
- height: '3em',
44
- width: '1em',
31
+ 'left': 0,
32
+ 'marginLeft': '-0.95em',
33
+ 'height': '3em',
34
+ 'width': '1em',
45
35
  '&::before': {
46
36
  borderWidth: '1em 1em 1em 0',
47
- borderColor: "transparent ".concat(color, " transparent transparent")
48
- }
37
+ borderColor: `transparent ${color} transparent transparent`,
38
+ },
49
39
  },
50
40
  '&[x-placement*="left"] $arrow': {
51
- right: 0,
52
- marginRight: '-0.95em',
53
- height: '3em',
54
- width: '1em',
41
+ 'right': 0,
42
+ 'marginRight': '-0.95em',
43
+ 'height': '3em',
44
+ 'width': '1em',
55
45
  '&::before': {
56
46
  borderWidth: '1em 0 1em 1em',
57
- borderColor: "transparent transparent transparent ".concat(color)
58
- }
59
- }
60
- };
47
+ borderColor: `transparent transparent transparent ${color}`,
48
+ },
49
+ },
50
+ }
61
51
  }
62
- var styles = function styles(theme) {
52
+
53
+ function styles(theme) {
63
54
  return {
64
55
  button: {
65
- margin: theme.spacing()
56
+ margin: theme.spacing(),
66
57
  },
67
58
  lightTooltip: {
68
59
  backgroundColor: theme.palette.common.white,
69
60
  color: 'rgba(0, 0, 0, 0.87)',
70
61
  boxShadow: theme.shadows[1],
71
- fontSize: 11
62
+ fontSize: 11,
72
63
  },
73
64
  arrowPopper: arrowGenerator(theme.palette.grey[700]),
74
65
  arrow: {
75
- position: 'absolute',
76
- fontSize: 6,
77
- width: '3em',
78
- height: '3em',
66
+ 'position': 'absolute',
67
+ 'fontSize': 6,
68
+ 'width': '3em',
69
+ 'height': '3em',
79
70
  '&::before': {
80
71
  content: '""',
81
72
  margin: 'auto',
82
73
  display: 'block',
83
74
  width: 0,
84
75
  height: 0,
85
- borderStyle: 'solid'
86
- }
76
+ borderStyle: 'solid',
77
+ },
87
78
  },
88
79
  bootstrapPopper: arrowGenerator(theme.palette.common.black),
89
80
  bootstrapTooltip: {
90
- backgroundColor: theme.palette.common.black
81
+ backgroundColor: theme.palette.common.black,
91
82
  },
92
83
  bootstrapPlacementLeft: {
93
- margin: '0 8px'
84
+ margin: '0 8px',
94
85
  },
95
86
  bootstrapPlacementRight: {
96
- margin: '0 8px'
87
+ margin: '0 8px',
97
88
  },
98
89
  bootstrapPlacementTop: {
99
- margin: '8px 0'
90
+ margin: '8px 0',
100
91
  },
101
92
  bootstrapPlacementBottom: {
102
- margin: '8px 0'
93
+ margin: '8px 0',
103
94
  },
104
95
  htmlPopper: arrowGenerator('#dadde9'),
105
96
  htmlTooltip: {
106
- backgroundColor: '#f5f5f9',
107
- color: 'rgba(0, 0, 0, 0.87)',
108
- maxWidth: 220,
109
- fontSize: theme.typography.pxToRem(12),
110
- border: '1px solid #dadde9',
97
+ 'backgroundColor': '#f5f5f9',
98
+ 'color': 'rgba(0, 0, 0, 0.87)',
99
+ 'maxWidth': 220,
100
+ 'fontSize': theme.typography.pxToRem(12),
101
+ 'border': '1px solid #dadde9',
111
102
  '& b': {
112
- fontWeight: theme.typography.fontWeightMedium
113
- }
114
- }
115
- };
116
- };
117
- var CustomizedTooltips = /*#__PURE__*/function (_React$Component) {
118
- _inherits(CustomizedTooltips, _React$Component);
119
- var _super = _createSuper(CustomizedTooltips);
120
- function CustomizedTooltips() {
121
- var _this;
122
- _classCallCheck(this, CustomizedTooltips);
123
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
124
- args[_key] = arguments[_key];
125
- }
126
- _this = _super.call.apply(_super, [this].concat(args));
127
- _this.state = {
128
- arrowRef: null
129
- };
130
- _this.handleArrowRef = function (node) {
131
- _this.setState({
132
- arrowRef: node
133
- });
134
- };
135
- return _this;
103
+ fontWeight: theme.typography.fontWeightMedium,
104
+ },
105
+ },
106
+ }
107
+ }
108
+
109
+ class CustomizedTooltips extends React.Component {
110
+ state = {
111
+ arrowRef: null,
112
+ }
113
+
114
+ handleArrowRef = (node) => {
115
+ this.setState({
116
+ arrowRef: node,
117
+ })
136
118
  }
137
- _createClass(CustomizedTooltips, [{
138
- key: "render",
139
- value: function render() {
140
- var classes = this.props.classes;
141
- return /*#__PURE__*/React.createElement(Tooltip, {
142
- classes: {
119
+
120
+ render() {
121
+ const { classes } = this.props
122
+
123
+ return (
124
+ <Tooltip
125
+ classes={{
143
126
  popper: classes.htmlPopper,
144
- tooltip: classes.htmlTooltip
145
- },
146
- PopperProps: {
127
+ tooltip: classes.htmlTooltip,
128
+ }}
129
+ PopperProps={{
147
130
  popperOptions: {
148
131
  modifiers: {
149
132
  arrow: {
150
133
  enabled: Boolean(this.state.arrowRef),
151
- element: this.state.arrowRef
152
- }
153
- }
154
- }
155
- },
156
- title: /*#__PURE__*/React.createElement(React.Fragment, null, this.props.htmlFragment, /*#__PURE__*/React.createElement("span", {
157
- className: classes.arrow,
158
- ref: this.handleArrowRef
159
- }))
160
- }, this.props.inner);
161
- }
162
- }]);
163
- return CustomizedTooltips;
164
- }(React.Component);
165
- export default withStyles(styles)(CustomizedTooltips);
134
+ element: this.state.arrowRef,
135
+ },
136
+ },
137
+ },
138
+ }}
139
+ title={(
140
+ <>
141
+ { this.props.htmlFragment }
142
+ <span className={classes.arrow} ref={this.handleArrowRef} />
143
+ </>
144
+ )}
145
+ >
146
+ { this.props.inner }
147
+ </Tooltip>
148
+ )
149
+ }
150
+ }
151
+
152
+ CustomizedTooltips.propTypes = {
153
+ classes: PropTypes.object.isRequired,
154
+ }
155
+
156
+ export default withStyles(styles)(CustomizedTooltips)
@@ -1,98 +1,71 @@
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 withWidth from '@material-ui/core/withWidth';
8
- import { createBrowserHistory } from 'history';
9
- import React, { useEffect, useRef, useState } from 'react';
10
- import { connect, Provider } from 'react-redux';
11
- import { HashRouter, Route, Navigate, Routes } from 'react-router-dom';
12
- import DocumentView from './DocumentView';
13
- import RouteListener from './RouteListener';
14
- var DiploMatic = function DiploMatic(props) {
15
- var _useState = useState(0),
16
- _useState2 = _slicedToArray(_useState, 2),
17
- containerWidth = _useState2[0],
18
- setContainerWidth = _useState2[1];
19
- var _useState3 = useState('min(100%, 100dvh'),
20
- _useState4 = _slicedToArray(_useState3, 2),
21
- containerHeight = _useState4[0],
22
- setContainerHeight = _useState4[1];
23
- var containerRef = useRef(null);
24
- useEffect(function () {
25
- var history = createBrowserHistory();
26
- history.listen(function () {
27
- window.scrollTo(0, 0);
28
- });
29
- }, []);
30
- useEffect(function () {
1
+ import withWidth from '@material-ui/core/withWidth'
2
+ import { createBrowserHistory } from 'history'
3
+ import PropTypes from 'prop-types'
4
+ import React, { useEffect, useRef, useState } from 'react'
5
+ import { connect, Provider } from 'react-redux'
6
+ import {
7
+ HashRouter,
8
+ Navigate,
9
+ Route,
10
+ Routes,
11
+ } from 'react-router-dom'
12
+ import DocumentView from './DocumentView'
13
+ import RouteListener from './RouteListener'
14
+
15
+ function DiploMatic(props) {
16
+ const [containerWidth, setContainerWidth] = useState(0)
17
+ const [containerHeight, setContainerHeight] = useState('min(100%, 100dvh')
18
+ const containerRef = useRef(null)
19
+ useEffect(() => {
20
+ const history = createBrowserHistory()
21
+ history.listen(() => {
22
+ window.scrollTo(0, 0)
23
+ })
24
+ }, [])
25
+
26
+ useEffect(() => {
31
27
  if (containerRef.current) {
32
- setContainerWidth(containerRef.current.offsetWidth);
33
- if (containerRef.current.clientHeight == 0) {
34
- setContainerHeight('100dvh');
28
+ setContainerWidth(containerRef.current.offsetWidth)
29
+ if (containerRef.current.clientHeight === 0) {
30
+ setContainerHeight('100dvh')
35
31
  }
36
32
  }
37
- }, [containerRef]);
38
- var fixedFrameMode = props.diplomatic.fixedFrameMode;
39
- var fixedFrameModeClass = fixedFrameMode ? 'editioncrafter' : 'editioncrafter sticky';
40
- return /*#__PURE__*/React.createElement(Provider, {
41
- store: props.store
42
- }, /*#__PURE__*/React.createElement(HashRouter, null, /*#__PURE__*/React.createElement("div", {
43
- id: "diplomatic",
44
- className: fixedFrameModeClass,
45
- ref: containerRef,
46
- style: {
47
- height: containerHeight
48
- }
49
- }, /*#__PURE__*/React.createElement(RouteListener, null), /*#__PURE__*/React.createElement("div", {
50
- id: "content",
51
- style: {
52
- height: '100%'
53
- }
54
- }, /*#__PURE__*/React.createElement(Routes, null, /*#__PURE__*/React.createElement(Route, {
55
- path: "/ec/:folioID/:transcriptionType/:folioID2/:transcriptionType2/:folioID3/:transcriptionType3",
56
- element: /*#__PURE__*/React.createElement(DocumentView, Object.assign({}, props, {
57
- containerWidth: containerWidth
58
- })),
59
- exact: true
60
- }), /*#__PURE__*/React.createElement(Route, {
61
- path: "/ec/:folioID/:transcriptionType/:folioID2/:transcriptionType2",
62
- element: /*#__PURE__*/React.createElement(DocumentView, Object.assign({}, props, {
63
- containerWidth: containerWidth
64
- })),
65
- exact: true
66
- }), /*#__PURE__*/React.createElement(Route, {
67
- path: "/ec/:folioID/:transcriptionType",
68
- element: /*#__PURE__*/React.createElement(DocumentView, Object.assign({}, props, {
69
- containerWidth: containerWidth
70
- })),
71
- exact: true
72
- }), /*#__PURE__*/React.createElement(Route, {
73
- path: "/ec/:folioID",
74
- element: /*#__PURE__*/React.createElement(DocumentView, Object.assign({}, props, {
75
- containerWidth: containerWidth
76
- })),
77
- exact: true
78
- }), /*#__PURE__*/React.createElement(Route, {
79
- path: "/ec",
80
- element: /*#__PURE__*/React.createElement(DocumentView, Object.assign({}, props, {
81
- containerWidth: containerWidth
82
- })),
83
- exact: true
84
- }), /*#__PURE__*/React.createElement(Route, {
85
- path: "/",
86
- element: /*#__PURE__*/React.createElement(Navigate, {
87
- to: "/ec"
88
- }),
89
- exact: true
90
- }))))));
91
- };
33
+ }, [containerRef])
34
+
35
+ const { fixedFrameMode } = props.diplomatic
36
+ const fixedFrameModeClass = fixedFrameMode ? 'editioncrafter' : 'editioncrafter sticky'
37
+
38
+ return (
39
+ <Provider store={props.store}>
40
+ <HashRouter>
41
+ <div id="diplomatic" className={fixedFrameModeClass} ref={containerRef} style={{ height: containerHeight }}>
42
+ <RouteListener />
43
+ <div id="content" style={{ height: '100%' }}>
44
+ <Routes>
45
+ <Route path="/ec/:folioID/:transcriptionType/:folioID2/:transcriptionType2/:folioID3/:transcriptionType3" element={<DocumentView {...props} containerWidth={containerWidth} />} exact />
46
+ <Route path="/ec/:folioID/:transcriptionType/:folioID2/:transcriptionType2" element={<DocumentView {...props} containerWidth={containerWidth} />} exact />
47
+ <Route path="/ec/:folioID/:transcriptionType" element={<DocumentView {...props} containerWidth={containerWidth} />} exact />
48
+ <Route path="/ec/:folioID" element={<DocumentView {...props} containerWidth={containerWidth} />} exact />
49
+ <Route path="/ec" element={<DocumentView {...props} containerWidth={containerWidth} />} exact />
50
+ <Route path="/" element={<Navigate to="/ec" />} exact />
51
+ </Routes>
52
+ </div>
53
+ </div>
54
+ </HashRouter>
55
+ </Provider>
56
+ )
57
+ }
58
+
59
+ DiploMatic.propTypes = {
60
+ store: PropTypes.isRequired,
61
+ config: PropTypes.isRequired,
62
+ }
63
+
92
64
  function mapStateToProps(state) {
93
65
  return {
94
66
  diplomatic: state.diplomatic,
95
- documentView: state.documentView
96
- };
67
+ documentView: state.documentView,
68
+ }
97
69
  }
98
- export default withWidth()(connect(mapStateToProps)(DiploMatic));
70
+
71
+ export default withWidth()(connect(mapStateToProps)(DiploMatic))