@cu-mkp/editioncrafter 0.0.4

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 (138) hide show
  1. package/dist/cjs/src/action/CommentActions.js +20 -0
  2. package/dist/cjs/src/action/DiplomaticActions.js +19 -0
  3. package/dist/cjs/src/action/DocumentActions.js +188 -0
  4. package/dist/cjs/src/action/GlossaryActions.js +20 -0
  5. package/dist/cjs/src/action/initialState/commentInitialState.js +13 -0
  6. package/dist/cjs/src/action/initialState/diplomaticInitialState.js +10 -0
  7. package/dist/cjs/src/action/initialState/documentInitialState.js +17 -0
  8. package/dist/cjs/src/action/initialState/glossaryInitialState.js +13 -0
  9. package/dist/cjs/src/action/rootReducer.js +30 -0
  10. package/dist/cjs/src/component/AlphabetLinks.js +76 -0
  11. package/dist/cjs/src/component/CustomizedTooltops.js +173 -0
  12. package/dist/cjs/src/component/DiploMatic.js +90 -0
  13. package/dist/cjs/src/component/DocumentView.js +427 -0
  14. package/dist/cjs/src/component/EditorComment.js +124 -0
  15. package/dist/cjs/src/component/ErrorBoundary.js +71 -0
  16. package/dist/cjs/src/component/FigureImage.js +82 -0
  17. package/dist/cjs/src/component/GlossaryView.js +166 -0
  18. package/dist/cjs/src/component/HelpPopper.js +83 -0
  19. package/dist/cjs/src/component/ImageGridView.js +193 -0
  20. package/dist/cjs/src/component/ImageView.js +125 -0
  21. package/dist/cjs/src/component/ImageZoomControl.js +67 -0
  22. package/dist/cjs/src/component/JumpToFolio.js +103 -0
  23. package/dist/cjs/src/component/Navigation.js +266 -0
  24. package/dist/cjs/src/component/Pagination.js +81 -0
  25. package/dist/cjs/src/component/RouteListener.js +66 -0
  26. package/dist/cjs/src/component/SeaDragonComponent.js +51 -0
  27. package/dist/cjs/src/component/SinglePaneView.js +46 -0
  28. package/dist/cjs/src/component/SplitPaneView.js +164 -0
  29. package/dist/cjs/src/component/TranscriptionView.js +147 -0
  30. package/dist/cjs/src/component/XMLView.js +154 -0
  31. package/dist/cjs/src/globals.d.ts +1 -0
  32. package/dist/cjs/src/hocs/withRouter.js +29 -0
  33. package/dist/cjs/src/icons/ByIcon.js +27 -0
  34. package/dist/cjs/src/icons/CcIcon.js +27 -0
  35. package/dist/cjs/src/icons/NcIcon.js +27 -0
  36. package/dist/cjs/src/icons/SaIcon.js +27 -0
  37. package/dist/cjs/src/icons/SideMenuIconLeft.js +49 -0
  38. package/dist/cjs/src/icons/SideMenuIconRight.js +49 -0
  39. package/dist/cjs/src/index.js +34 -0
  40. package/dist/cjs/src/lib/copyObject.js +11 -0
  41. package/dist/cjs/src/lib/registerServiceWorker.js +95 -0
  42. package/dist/cjs/src/model/DocumentHelper.js +17 -0
  43. package/dist/cjs/src/model/Folio.js +92 -0
  44. package/dist/cjs/src/model/ReduxStore.js +110 -0
  45. package/dist/cjs/src/model/folioLayout.js +416 -0
  46. package/dist/cjs/src/polyfills.js +212 -0
  47. package/dist/cjs/src/saga/RouteListenerSaga.js +198 -0
  48. package/dist/cjs/src/saga/rootSaga.js +23 -0
  49. package/dist/cjs/src/scss/_CETEIcean.scss +914 -0
  50. package/dist/cjs/src/scss/_base.scss +187 -0
  51. package/dist/cjs/src/scss/_diplomatic.scss +332 -0
  52. package/dist/cjs/src/scss/_globalNavigation.scss +34 -0
  53. package/dist/cjs/src/scss/_glossary.scss +105 -0
  54. package/dist/cjs/src/scss/_imageGridView.scss +60 -0
  55. package/dist/cjs/src/scss/_imageView.scss +16 -0
  56. package/dist/cjs/src/scss/_imageZoomControl.scss +51 -0
  57. package/dist/cjs/src/scss/_jumpbox.scss +42 -0
  58. package/dist/cjs/src/scss/_navigation.scss +135 -0
  59. package/dist/cjs/src/scss/_pagination.scss +36 -0
  60. package/dist/cjs/src/scss/_spinner.scss +60 -0
  61. package/dist/cjs/src/scss/_splitPaneView.scss +35 -0
  62. package/dist/cjs/src/scss/_thumbnails.scss +17 -0
  63. package/dist/cjs/src/scss/_transcriptView.scss +178 -0
  64. package/dist/cjs/src/scss/_watermark.scss +19 -0
  65. package/dist/cjs/src/scss/_xmlView.scss +25 -0
  66. package/dist/cjs/src/scss/editioncrafter.scss +109 -0
  67. package/dist/editioncrafter.css +2462 -0
  68. package/dist/editioncrafter.css.map +1 -0
  69. package/dist/editioncrafter.min.js +3 -0
  70. package/dist/editioncrafter.min.js.LICENSE.txt +125 -0
  71. package/dist/editioncrafter.min.js.map +1 -0
  72. package/dist/es/src/action/CommentActions.js +13 -0
  73. package/dist/es/src/action/DiplomaticActions.js +12 -0
  74. package/dist/es/src/action/DocumentActions.js +181 -0
  75. package/dist/es/src/action/GlossaryActions.js +13 -0
  76. package/dist/es/src/action/initialState/commentInitialState.js +7 -0
  77. package/dist/es/src/action/initialState/diplomaticInitialState.js +3 -0
  78. package/dist/es/src/action/initialState/documentInitialState.js +11 -0
  79. package/dist/es/src/action/initialState/glossaryInitialState.js +7 -0
  80. package/dist/es/src/action/rootReducer.js +23 -0
  81. package/dist/es/src/component/AlphabetLinks.js +67 -0
  82. package/dist/es/src/component/CustomizedTooltops.js +165 -0
  83. package/dist/es/src/component/DiploMatic.js +80 -0
  84. package/dist/es/src/component/DocumentView.js +417 -0
  85. package/dist/es/src/component/EditorComment.js +114 -0
  86. package/dist/es/src/component/ErrorBoundary.js +63 -0
  87. package/dist/es/src/component/FigureImage.js +74 -0
  88. package/dist/es/src/component/GlossaryView.js +156 -0
  89. package/dist/es/src/component/HelpPopper.js +75 -0
  90. package/dist/es/src/component/ImageGridView.js +185 -0
  91. package/dist/es/src/component/ImageView.js +115 -0
  92. package/dist/es/src/component/ImageZoomControl.js +60 -0
  93. package/dist/es/src/component/JumpToFolio.js +95 -0
  94. package/dist/es/src/component/Navigation.js +256 -0
  95. package/dist/es/src/component/Pagination.js +73 -0
  96. package/dist/es/src/component/RouteListener.js +58 -0
  97. package/dist/es/src/component/SeaDragonComponent.js +42 -0
  98. package/dist/es/src/component/SinglePaneView.js +37 -0
  99. package/dist/es/src/component/SplitPaneView.js +155 -0
  100. package/dist/es/src/component/TranscriptionView.js +137 -0
  101. package/dist/es/src/component/XMLView.js +144 -0
  102. package/dist/es/src/globals.d.ts +1 -0
  103. package/dist/es/src/hocs/withRouter.js +22 -0
  104. package/dist/es/src/icons/ByIcon.js +18 -0
  105. package/dist/es/src/icons/CcIcon.js +18 -0
  106. package/dist/es/src/icons/NcIcon.js +18 -0
  107. package/dist/es/src/icons/SaIcon.js +18 -0
  108. package/dist/es/src/icons/SideMenuIconLeft.js +40 -0
  109. package/dist/es/src/icons/SideMenuIconRight.js +40 -0
  110. package/dist/es/src/index.js +27 -0
  111. package/dist/es/src/lib/copyObject.js +4 -0
  112. package/dist/es/src/lib/registerServiceWorker.js +88 -0
  113. package/dist/es/src/model/DocumentHelper.js +10 -0
  114. package/dist/es/src/model/Folio.js +85 -0
  115. package/dist/es/src/model/ReduxStore.js +101 -0
  116. package/dist/es/src/model/folioLayout.js +407 -0
  117. package/dist/es/src/polyfills.js +216 -0
  118. package/dist/es/src/saga/RouteListenerSaga.js +191 -0
  119. package/dist/es/src/saga/rootSaga.js +16 -0
  120. package/dist/es/src/scss/_CETEIcean.scss +914 -0
  121. package/dist/es/src/scss/_base.scss +187 -0
  122. package/dist/es/src/scss/_diplomatic.scss +332 -0
  123. package/dist/es/src/scss/_globalNavigation.scss +34 -0
  124. package/dist/es/src/scss/_glossary.scss +105 -0
  125. package/dist/es/src/scss/_imageGridView.scss +60 -0
  126. package/dist/es/src/scss/_imageView.scss +16 -0
  127. package/dist/es/src/scss/_imageZoomControl.scss +51 -0
  128. package/dist/es/src/scss/_jumpbox.scss +42 -0
  129. package/dist/es/src/scss/_navigation.scss +135 -0
  130. package/dist/es/src/scss/_pagination.scss +36 -0
  131. package/dist/es/src/scss/_spinner.scss +60 -0
  132. package/dist/es/src/scss/_splitPaneView.scss +35 -0
  133. package/dist/es/src/scss/_thumbnails.scss +17 -0
  134. package/dist/es/src/scss/_transcriptView.scss +178 -0
  135. package/dist/es/src/scss/_watermark.scss +19 -0
  136. package/dist/es/src/scss/_xmlView.scss +25 -0
  137. package/dist/es/src/scss/editioncrafter.scss +109 -0
  138. package/package.json +119 -0
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _withWidth = _interopRequireDefault(require("@material-ui/core/withWidth"));
8
+ var _history = require("history");
9
+ var _react = _interopRequireWildcard(require("react"));
10
+ var _reactRedux = require("react-redux");
11
+ var _reactRouterDom = require("react-router-dom");
12
+ var _DocumentView = _interopRequireDefault(require("./DocumentView"));
13
+ var _RouteListener = _interopRequireDefault(require("./RouteListener"));
14
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
18
+ 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); } }
19
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
20
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
21
+ 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); }
22
+ 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); }
23
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
24
+ 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); }; }
25
+ 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); }
26
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
27
+ 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; } }
28
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
29
+ var DiploMatic = /*#__PURE__*/function (_Component) {
30
+ _inherits(DiploMatic, _Component);
31
+ var _super = _createSuper(DiploMatic);
32
+ function DiploMatic() {
33
+ _classCallCheck(this, DiploMatic);
34
+ return _super.apply(this, arguments);
35
+ }
36
+ _createClass(DiploMatic, [{
37
+ key: "componentDidMount",
38
+ value: function componentDidMount() {
39
+ var history = (0, _history.createBrowserHistory)();
40
+ history.listen(function () {
41
+ window.scrollTo(0, 0);
42
+ });
43
+ }
44
+ }, {
45
+ key: "render",
46
+ value: function render() {
47
+ var fixedFrameMode = this.props.diplomatic.fixedFrameMode;
48
+ var fixedFrameModeClass = fixedFrameMode ? 'fixed' : 'sticky';
49
+ return /*#__PURE__*/_react["default"].createElement(_reactRedux.Provider, {
50
+ store: this.props.store
51
+ }, /*#__PURE__*/_react["default"].createElement(_reactRouterDom.HashRouter, null, /*#__PURE__*/_react["default"].createElement("div", {
52
+ id: "diplomatic",
53
+ className: fixedFrameModeClass
54
+ }, /*#__PURE__*/_react["default"].createElement(_RouteListener["default"], null), /*#__PURE__*/_react["default"].createElement("div", {
55
+ id: "content"
56
+ }, /*#__PURE__*/_react["default"].createElement(_reactRouterDom.Routes, null, /*#__PURE__*/_react["default"].createElement(_reactRouterDom.Route, {
57
+ path: "/ec/:folioID/:transcriptionType/:folioID2/:transcriptionType2",
58
+ element: /*#__PURE__*/_react["default"].createElement(_DocumentView["default"], this.props),
59
+ exact: true
60
+ }), /*#__PURE__*/_react["default"].createElement(_reactRouterDom.Route, {
61
+ path: "/ec/:folioID/:transcriptionType",
62
+ element: /*#__PURE__*/_react["default"].createElement(_DocumentView["default"], this.props),
63
+ exact: true
64
+ }), /*#__PURE__*/_react["default"].createElement(_reactRouterDom.Route, {
65
+ path: "/ec/:folioID",
66
+ element: /*#__PURE__*/_react["default"].createElement(_DocumentView["default"], this.props),
67
+ exact: true
68
+ }), /*#__PURE__*/_react["default"].createElement(_reactRouterDom.Route, {
69
+ path: "/ec",
70
+ element: /*#__PURE__*/_react["default"].createElement(_DocumentView["default"], this.props),
71
+ exact: true
72
+ }), /*#__PURE__*/_react["default"].createElement(_reactRouterDom.Route, {
73
+ path: "/",
74
+ element: /*#__PURE__*/_react["default"].createElement(_reactRouterDom.Navigate, {
75
+ to: "/ec"
76
+ }),
77
+ exact: true
78
+ }))))));
79
+ }
80
+ }]);
81
+ return DiploMatic;
82
+ }(_react.Component);
83
+ function mapStateToProps(state) {
84
+ return {
85
+ diplomatic: state.diplomatic,
86
+ documentView: state.documentView
87
+ };
88
+ }
89
+ var _default = (0, _withWidth["default"])()((0, _reactRedux.connect)(mapStateToProps)(DiploMatic));
90
+ exports["default"] = _default;
@@ -0,0 +1,427 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactRedux = require("react-redux");
9
+ var _withWidth = _interopRequireWildcard(require("@material-ui/core/withWidth"));
10
+ var _SplitPaneView = _interopRequireDefault(require("./SplitPaneView"));
11
+ var _ReduxStore = require("../model/ReduxStore");
12
+ var _ImageView = _interopRequireDefault(require("./ImageView"));
13
+ var _ImageGridView = _interopRequireDefault(require("./ImageGridView"));
14
+ var _TranscriptionView = _interopRequireDefault(require("./TranscriptionView"));
15
+ var _XMLView = _interopRequireDefault(require("./XMLView"));
16
+ var _GlossaryView = _interopRequireDefault(require("./GlossaryView"));
17
+ var _SinglePaneView = _interopRequireDefault(require("./SinglePaneView"));
18
+ var _withRouter = _interopRequireDefault(require("../hocs/withRouter"));
19
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
20
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
22
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
23
+ 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."); }
24
+ 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); }
25
+ 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; }
26
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
27
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
28
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
29
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
30
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
31
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
32
+ 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); } }
33
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
34
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
35
+ 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); }
36
+ 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); }
37
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
38
+ 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); }; }
39
+ 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); }
40
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
41
+ 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; } }
42
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
43
+ var DocumentView = /*#__PURE__*/function (_Component) {
44
+ _inherits(DocumentView, _Component);
45
+ var _super = _createSuper(DocumentView);
46
+ function DocumentView(props) {
47
+ var _this;
48
+ _classCallCheck(this, DocumentView);
49
+ _this = _super.call(this, props);
50
+ _this.onWidth = function (left, right) {
51
+ _this.setState(function (state) {
52
+ var nextState = _objectSpread({}, state);
53
+ nextState.left.width = left;
54
+ nextState.right.width = right;
55
+ return nextState;
56
+ });
57
+ };
58
+ _this.getViewports = function () {
59
+ var _this$props$router$pa = _this.props.router.params,
60
+ folioID = _this$props$router$pa.folioID,
61
+ transcriptionType = _this$props$router$pa.transcriptionType,
62
+ folioID2 = _this$props$router$pa.folioID2,
63
+ transcriptionType2 = _this$props$router$pa.transcriptionType2;
64
+ var viewports;
65
+ if (!folioID) {
66
+ // route /folios
67
+ viewports = {
68
+ left: {
69
+ folioID: '-1',
70
+ transcriptionType: 'g'
71
+ },
72
+ right: {
73
+ folioID: '-1',
74
+ transcriptionType: 'tl'
75
+ }
76
+ };
77
+ } else {
78
+ var leftFolioID = folioID;
79
+ var leftTranscriptionType;
80
+ var rightFolioID;
81
+ var rightTranscriptionType;
82
+ if (folioID2) {
83
+ // route /ec/:folioID/:transcriptionType/:folioID2/:transcriptionType2
84
+ leftTranscriptionType = transcriptionType;
85
+ rightFolioID = folioID2;
86
+ rightTranscriptionType = transcriptionType2 || 'tl';
87
+ } else {
88
+ // route /ec/:folioID
89
+ // route /ec/:folioID/:transcriptionType
90
+ leftTranscriptionType = 'f';
91
+ rightFolioID = folioID;
92
+ rightTranscriptionType = transcriptionType || 'tl';
93
+ }
94
+ viewports = {
95
+ left: {
96
+ folioID: leftFolioID,
97
+ transcriptionType: leftTranscriptionType
98
+ },
99
+ right: {
100
+ folioID: rightFolioID,
101
+ transcriptionType: rightTranscriptionType
102
+ }
103
+ };
104
+ }
105
+ return viewports;
106
+ };
107
+ var paneDefaults = {
108
+ isXMLMode: false,
109
+ width: 0
110
+ };
111
+ _this.state = {
112
+ linkedMode: true,
113
+ bookMode: false,
114
+ left: _objectSpread({}, paneDefaults),
115
+ right: _objectSpread({}, paneDefaults),
116
+ viewports: _this.getViewports()
117
+ };
118
+ _this.documentViewActions = {
119
+ setXMLMode: _this.setXMLMode.bind(_assertThisInitialized(_this)),
120
+ setLinkedMode: _this.setLinkedMode.bind(_assertThisInitialized(_this)),
121
+ setBookMode: _this.setBookMode.bind(_assertThisInitialized(_this)),
122
+ changeTranscriptionType: _this.changeTranscriptionType.bind(_assertThisInitialized(_this)),
123
+ changeCurrentFolio: _this.changeCurrentFolio.bind(_assertThisInitialized(_this)),
124
+ jumpToFolio: _this.jumpToFolio.bind(_assertThisInitialized(_this))
125
+ };
126
+ return _this;
127
+ }
128
+ _createClass(DocumentView, [{
129
+ key: "componentDidMount",
130
+ value: function componentDidMount() {
131
+ (0, _ReduxStore.dispatchAction)(this.props, 'DiplomaticActions.setFixedFrameMode', true);
132
+ }
133
+ }, {
134
+ key: "setXMLMode",
135
+ value: function setXMLMode(side, xmlMode) {
136
+ this.setState(function (state) {
137
+ var nextState = _objectSpread({}, state);
138
+ nextState[side].isXMLMode = xmlMode;
139
+ return nextState;
140
+ });
141
+ }
142
+ }, {
143
+ key: "setLinkedMode",
144
+ value: function setLinkedMode(linkedMode) {
145
+ this.setState(function (state) {
146
+ return _objectSpread(_objectSpread({}, state), {}, {
147
+ linkedMode: linkedMode
148
+ });
149
+ });
150
+ }
151
+ }, {
152
+ key: "setBookMode",
153
+ value: function setBookMode(shortid, bookMode) {
154
+ this.setState(function (state) {
155
+ return _objectSpread(_objectSpread({}, state), {}, {
156
+ bookMode: bookMode
157
+ });
158
+ });
159
+ if (bookMode) {
160
+ var _this$findBookFolios = this.findBookFolios(shortid),
161
+ _this$findBookFolios2 = _slicedToArray(_this$findBookFolios, 2),
162
+ versoID = _this$findBookFolios2[0],
163
+ rectoID = _this$findBookFolios2[1];
164
+ this.navigateFolios(versoID, 'f', rectoID, 'f');
165
+ }
166
+ }
167
+ }, {
168
+ key: "jumpToFolio",
169
+ value: function jumpToFolio(folioName, side) {
170
+ var document = this.props.document;
171
+ // Convert folioName to ID (and confirm it exists)
172
+ if (document.folioByName[folioName]) {
173
+ var _document$folioByName;
174
+ var folioID = (_document$folioByName = document.folioByName[folioName]) === null || _document$folioByName === void 0 ? void 0 : _document$folioByName.id;
175
+ this.changeCurrentFolio(folioID, side, this.getViewports()[side].transcriptionType);
176
+ }
177
+ }
178
+ }, {
179
+ key: "findBookFolios",
180
+ value: function findBookFolios(shortID) {
181
+ var document = this.props.document;
182
+ var versoFolio = document.folioNameByIDIndex[shortID];
183
+ var versoIndex = document.folioIndex.indexOf(shortID);
184
+ if (!versoFolio.endsWith('v')) {
185
+ if (versoFolio.endsWith('r')) {
186
+ versoIndex -= 1;
187
+ } else {
188
+ return [null, null];
189
+ }
190
+ }
191
+ var rectoIndex = versoIndex + 1;
192
+ return [document.folioIndex[versoIndex], document.folioIndex[rectoIndex]];
193
+ }
194
+ }, {
195
+ key: "changeTranscriptionType",
196
+ value: function changeTranscriptionType(side, transcriptionType) {
197
+ var viewports = this.getViewports();
198
+ if (side === 'left') {
199
+ var folioID = viewports.left.folioID;
200
+ var otherSide = viewports.right;
201
+ this.navigateFolios(folioID, transcriptionType, otherSide.folioID, otherSide.transcriptionType);
202
+ } else {
203
+ var _folioID = viewports.right.folioID;
204
+ var _otherSide = viewports.left;
205
+ this.navigateFolios(_otherSide.folioID, _otherSide.transcriptionType, _folioID, transcriptionType);
206
+ }
207
+ }
208
+ }, {
209
+ key: "navigateFolios",
210
+ value: function navigateFolios(folioID, transcriptionType, folioID2, transcriptionType2) {
211
+ if (!folioID) {
212
+ // goto grid view
213
+ this.props.router.navigate('/ec');
214
+ return;
215
+ }
216
+ if (!transcriptionType) {
217
+ // goto folioID, tc
218
+ this.props.router.navigate("/ec/".concat(folioID));
219
+ return;
220
+ }
221
+ if (!folioID2) {
222
+ // goto folioID, transcriptionType
223
+ this.props.router.navigate("/ec/".concat(folioID, "/").concat(transcriptionType));
224
+ return;
225
+ }
226
+ if (!transcriptionType2) {
227
+ // goto folioID, transcriptionType, folioID2, tc
228
+ this.props.router.navigate("/ec/".concat(folioID, "/").concat(transcriptionType, "/").concat(folioID2, "/tc"));
229
+ return;
230
+ }
231
+ // goto folioID, transcriptionType, folioID2, transcriptionType2
232
+ this.props.router.navigate("/ec/".concat(folioID, "/").concat(transcriptionType, "/").concat(folioID2, "/").concat(transcriptionType2));
233
+ }
234
+ }, {
235
+ key: "changeCurrentFolio",
236
+ value: function changeCurrentFolio(folioID, side, transcriptionType) {
237
+ // Lookup prev/next
238
+ var viewports = this.getViewports();
239
+ if (this.state.bookMode) {
240
+ var _this$findBookFolios3 = this.findBookFolios(folioID),
241
+ _this$findBookFolios4 = _slicedToArray(_this$findBookFolios3, 2),
242
+ versoID = _this$findBookFolios4[0],
243
+ rectoID = _this$findBookFolios4[1];
244
+ if (versoID) {
245
+ this.navigateFolios(versoID, 'f', rectoID, 'f');
246
+ }
247
+ } else if (this.state.linkedMode) {
248
+ if (side === 'left') {
249
+ var otherSide = viewports.right;
250
+ this.navigateFolios(folioID, transcriptionType, folioID, otherSide.transcriptionType);
251
+ } else {
252
+ var _otherSide2 = viewports.left;
253
+ this.navigateFolios(folioID, _otherSide2.transcriptionType, folioID, transcriptionType);
254
+ }
255
+ } else if (side === 'left') {
256
+ var _otherSide3 = viewports.right;
257
+ this.navigateFolios(folioID, transcriptionType, _otherSide3.folioID, _otherSide3.transcriptionType);
258
+ } else {
259
+ var _otherSide4 = viewports.left;
260
+ this.navigateFolios(_otherSide4.folioID, _otherSide4.transcriptionType, folioID, transcriptionType);
261
+ }
262
+ }
263
+ }, {
264
+ key: "determineViewType",
265
+ value: function determineViewType(side) {
266
+ var transcriptionType = this.getViewports()[side].transcriptionType;
267
+ var xmlMode = this.state[side].isXMLMode;
268
+ if (transcriptionType === 'g') {
269
+ return 'ImageGridView';
270
+ }
271
+ if (transcriptionType === 'f') {
272
+ return 'ImageView';
273
+ }
274
+ if (transcriptionType === 'glossary') {
275
+ return 'GlossaryView';
276
+ }
277
+ return xmlMode ? 'XMLView' : 'TranscriptionView';
278
+ }
279
+ }, {
280
+ key: "viewportState",
281
+ value: function viewportState(side) {
282
+ var doc = this.props.document;
283
+ var viewport = this.getViewports()[side];
284
+
285
+ // blank folio ID
286
+ if (viewport.folioID === '-1') {
287
+ return _objectSpread(_objectSpread({}, this.state[side]), {}, {
288
+ iiifShortID: viewport.folioID,
289
+ transcriptionType: viewport.transcriptionType
290
+ });
291
+ }
292
+ var shortID = viewport.folioID;
293
+ var folioCount = doc.folios.length;
294
+ var nextID = '';
295
+ var prevID = '';
296
+ var current_hasPrev = false;
297
+ var current_hasNext = false;
298
+ if (this.state.bookMode) {
299
+ var _this$findBookFolios5 = this.findBookFolios(shortID),
300
+ _this$findBookFolios6 = _slicedToArray(_this$findBookFolios5, 1),
301
+ versoID = _this$findBookFolios6[0];
302
+ var current_idx = doc.folioIndex[versoID].pageNumber;
303
+ if (current_idx > -1) {
304
+ current_hasNext = current_idx < folioCount - 2;
305
+ nextID = current_hasNext ? doc.folios[current_idx + 2].id : '';
306
+ current_hasPrev = current_idx > 1 && folioCount > 1;
307
+ prevID = current_hasPrev ? doc.folios[current_idx - 2].id : '';
308
+ }
309
+ } else {
310
+ var _current_idx = doc.folioIndex[shortID].pageNumber;
311
+ if (_current_idx > -1) {
312
+ current_hasNext = _current_idx < folioCount - 1;
313
+ nextID = current_hasNext ? doc.folios[_current_idx + 1].id : '';
314
+ current_hasPrev = _current_idx > 0 && folioCount > 1;
315
+ prevID = current_hasPrev ? doc.folios[_current_idx - 1].id : '';
316
+ }
317
+ }
318
+ return _objectSpread(_objectSpread({}, this.state[side]), {}, {
319
+ iiifShortID: shortID,
320
+ transcriptionType: viewport.transcriptionType,
321
+ hasPrevious: current_hasPrev,
322
+ hasNext: current_hasNext,
323
+ previousFolioShortID: prevID,
324
+ nextFolioShortID: nextID
325
+ });
326
+ }
327
+ }, {
328
+ key: "renderPane",
329
+ value: function renderPane(side, docView) {
330
+ var viewType = this.determineViewType(side);
331
+ var key = this.viewPaneKey(side);
332
+ if (viewType === 'ImageView') {
333
+ var folioID = docView[side].iiifShortID;
334
+ return /*#__PURE__*/_react["default"].createElement(_ImageView["default"], {
335
+ key: key,
336
+ folioID: folioID,
337
+ documentView: docView,
338
+ documentViewActions: this.documentViewActions,
339
+ side: side
340
+ });
341
+ }
342
+ if (viewType === 'TranscriptionView') {
343
+ var _folioID2 = docView[side].iiifShortID;
344
+ var transcriptionType = docView[side].transcriptionType;
345
+ return /*#__PURE__*/_react["default"].createElement(_TranscriptionView["default"], {
346
+ key: key,
347
+ documentView: docView,
348
+ documentViewActions: this.documentViewActions,
349
+ side: side,
350
+ folioID: _folioID2,
351
+ transcriptionType: transcriptionType
352
+ });
353
+ }
354
+ if (viewType === 'XMLView') {
355
+ return /*#__PURE__*/_react["default"].createElement(_XMLView["default"], {
356
+ key: key,
357
+ documentView: docView,
358
+ documentViewActions: this.documentViewActions,
359
+ side: side
360
+ });
361
+ }
362
+ if (viewType === 'ImageGridView') {
363
+ return /*#__PURE__*/_react["default"].createElement(_ImageGridView["default"], {
364
+ key: key,
365
+ documentView: docView,
366
+ documentViewActions: this.documentViewActions,
367
+ side: side
368
+ });
369
+ }
370
+ if (viewType === 'GlossaryView') {
371
+ return /*#__PURE__*/_react["default"].createElement(_GlossaryView["default"], {
372
+ key: key,
373
+ documentView: docView,
374
+ documentViewActions: this.documentViewActions,
375
+ side: side
376
+ });
377
+ }
378
+ return /*#__PURE__*/_react["default"].createElement("div", null, "ERROR: Unrecognized viewType.");
379
+ }
380
+ }, {
381
+ key: "viewPaneKey",
382
+ value: function viewPaneKey(side) {
383
+ var pane = this.state[side];
384
+ if (pane.viewType === 'ImageGridView') {
385
+ return "".concat(side, "-").concat(pane.viewType);
386
+ }
387
+ if (typeof pane.folio !== 'undefined') {
388
+ return "".concat(side, "-").concat(pane.viewType, "-").concat(pane.folio.id);
389
+ }
390
+ return "".concat(side, "-").concat(pane.viewType);
391
+ }
392
+ }, {
393
+ key: "render",
394
+ value: function render() {
395
+ if (!this.props.document.loaded) {
396
+ return null;
397
+ }
398
+
399
+ // combine component state with state from props
400
+ var docView = _objectSpread(_objectSpread({}, this.state), {}, {
401
+ left: this.viewportState('left'),
402
+ right: this.viewportState('right')
403
+ });
404
+ var mobileDocView = _objectSpread(_objectSpread({}, this.state), {}, {
405
+ right: _objectSpread({}, this.viewportState('right'))
406
+ });
407
+ if ((0, _withWidth.isWidthUp)('md', this.props.width)) {
408
+ return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_SplitPaneView["default"], {
409
+ leftPane: this.renderPane('left', docView),
410
+ rightPane: this.renderPane('right', docView),
411
+ onWidth: this.onWidth
412
+ }));
413
+ }
414
+ return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_SinglePaneView["default"], {
415
+ singlePane: this.renderPane('right', mobileDocView)
416
+ }));
417
+ }
418
+ }]);
419
+ return DocumentView;
420
+ }(_react.Component);
421
+ function mapStateToProps(state) {
422
+ return {
423
+ document: state.document
424
+ };
425
+ }
426
+ var _default = (0, _withWidth["default"])()((0, _reactRedux.connect)(mapStateToProps)((0, _withRouter["default"])(DocumentView)));
427
+ exports["default"] = _default;
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactRedux = require("react-redux");
9
+ var _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));
10
+ var _Popper = _interopRequireDefault(require("@material-ui/core/Popper"));
11
+ var _Fade = _interopRequireDefault(require("@material-ui/core/Fade"));
12
+ var _Paper = _interopRequireDefault(require("@material-ui/core/Paper"));
13
+ var _htmlReactParser = _interopRequireDefault(require("html-react-parser"));
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
16
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
18
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
19
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
20
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
21
+ 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); } }
22
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
23
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
24
+ 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); }
25
+ 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); }
26
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
27
+ 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); }; }
28
+ 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); }
29
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
30
+ 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; } }
31
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
32
+ var EditorComment = /*#__PURE__*/function (_Component) {
33
+ _inherits(EditorComment, _Component);
34
+ var _super = _createSuper(EditorComment);
35
+ function EditorComment(props) {
36
+ var _this;
37
+ _classCallCheck(this, EditorComment);
38
+ _this = _super.call(this, props);
39
+ _this.onOpen = function (event) {
40
+ _this.setState({
41
+ anchorRef: event.currentTarget,
42
+ open: true
43
+ });
44
+ };
45
+ _this.onClose = function (event) {
46
+ _this.setState(_objectSpread(_objectSpread({}, _this.state), {}, {
47
+ open: false
48
+ }));
49
+ };
50
+ _this.state = {
51
+ anchorRef: null,
52
+ open: false
53
+ };
54
+ return _this;
55
+ }
56
+ _createClass(EditorComment, [{
57
+ key: "renderPopper",
58
+ value: function renderPopper() {
59
+ var _this$state = this.state,
60
+ anchorRef = _this$state.anchorRef,
61
+ open = _this$state.open;
62
+ var id = "comment-".concat(this.props.commentID);
63
+ var comments = this.props.comments.comments;
64
+ var comment = comments[this.props.commentID] ? comments[this.props.commentID].comment : null;
65
+ var interpreted;
66
+ if (comment) interpreted = (0, _htmlReactParser["default"])(comment);
67
+ var content = interpreted || comment || "ERROR: Could not find comment for id: ".concat(this.props.commentID, ".");
68
+ var style = {
69
+ maxWidth: 200,
70
+ padding: '25px 15px 15px 15px'
71
+ };
72
+ var closeXStyle = {
73
+ "float": 'right',
74
+ padding: 5,
75
+ fontStyle: 'bold'
76
+ };
77
+ return /*#__PURE__*/_react["default"].createElement(_Popper["default"], {
78
+ id: id,
79
+ open: open,
80
+ anchorEl: anchorRef
81
+ }, /*#__PURE__*/_react["default"].createElement(_Fade["default"], {
82
+ "in": open
83
+ }, /*#__PURE__*/_react["default"].createElement(_Paper["default"], {
84
+ className: "editor-comment-content"
85
+ }, /*#__PURE__*/_react["default"].createElement("div", {
86
+ onClick: this.onClose,
87
+ style: closeXStyle
88
+ }, /*#__PURE__*/_react["default"].createElement("span", {
89
+ className: "fa fa-window-close"
90
+ })), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
91
+ style: style
92
+ }, content))));
93
+ }
94
+ }, {
95
+ key: "render",
96
+ value: function render() {
97
+ var _this2 = this;
98
+ var style = {
99
+ display: 'inline'
100
+ };
101
+ var asteriskStyle = {
102
+ fontStyle: 'bold',
103
+ fontSize: '18pt',
104
+ color: 'red'
105
+ };
106
+ return /*#__PURE__*/_react["default"].createElement("div", {
107
+ style: style
108
+ }, /*#__PURE__*/_react["default"].createElement("span", {
109
+ onClick: function onClick(e) {
110
+ return _this2.onOpen(e);
111
+ },
112
+ style: asteriskStyle
113
+ }, "*"), this.renderPopper());
114
+ }
115
+ }]);
116
+ return EditorComment;
117
+ }(_react.Component);
118
+ function mapStateToProps(state) {
119
+ return {
120
+ comments: state.comments
121
+ };
122
+ }
123
+ var _default = (0, _reactRedux.connect)(mapStateToProps)(EditorComment);
124
+ exports["default"] = _default;