@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.
- package/README.md +7 -7
- package/dist/editioncrafter.js +65802 -0
- package/dist/editioncrafter.umd.cjs +553 -0
- package/dist/es/src/action/DiplomaticActions.js +9 -11
- package/dist/es/src/action/DocumentActions.js +164 -154
- package/dist/es/src/action/GlossaryActions.js +9 -11
- package/dist/es/src/action/initialState/diplomaticInitialState.js +2 -2
- package/dist/es/src/action/initialState/documentInitialState.js +9 -12
- package/dist/es/src/action/initialState/glossaryInitialState.js +3 -3
- package/dist/es/src/action/rootReducer.js +31 -29
- package/dist/es/src/component/AlphabetLinks.js +44 -66
- package/dist/es/src/component/CustomizedTooltops.js +101 -110
- package/dist/es/src/component/DiploMatic.js +64 -91
- package/dist/es/src/component/DocumentView.js +442 -366
- package/dist/es/src/component/EditorComment.js +51 -75
- package/dist/es/src/component/ErrorBoundary.js +37 -61
- package/dist/es/src/component/FigureImage.js +56 -67
- package/dist/es/src/component/GlossaryView.js +157 -149
- package/dist/es/src/component/HelpPopper.js +96 -78
- package/dist/es/src/component/ImageGridView.js +184 -249
- package/dist/es/src/component/ImageView.js +155 -165
- package/dist/es/src/component/ImageZoomControl.js +19 -38
- package/dist/es/src/component/JumpToFolio.js +56 -60
- package/dist/es/src/component/Navigation.js +374 -328
- package/dist/es/src/component/Pagination.js +73 -70
- package/dist/es/src/component/Parser.js +11 -32
- package/dist/es/src/component/RingSpinner.js +31 -32
- package/dist/es/src/component/RouteListener.js +30 -21
- package/dist/es/src/component/SeaDragonComponent.js +33 -56
- package/dist/es/src/component/SinglePaneView.js +15 -33
- package/dist/es/src/component/SplitPaneView.js +151 -170
- package/dist/es/src/component/TranscriptionView.js +190 -179
- package/dist/es/src/component/Watermark.js +21 -30
- package/dist/es/src/component/XMLView.js +60 -82
- package/dist/es/src/hooks/useIsWidthUp.js +9 -7
- package/dist/es/src/icons/ByIcon.js +16 -16
- package/dist/es/src/icons/CcIcon.js +16 -16
- package/dist/es/src/icons/NcIcon.js +16 -16
- package/dist/es/src/icons/SaIcon.js +16 -16
- package/dist/es/src/icons/SideMenuIconLeft.js +30 -38
- package/dist/es/src/icons/SideMenuIconRight.js +32 -38
- package/dist/es/src/index.js +21 -20
- package/dist/es/src/lib/copyObject.js +3 -2
- package/dist/es/src/lib/registerServiceWorker.js +77 -54
- package/dist/es/src/model/DocumentHelper.js +7 -6
- package/dist/es/src/model/Folio.js +64 -86
- package/dist/es/src/model/ReduxStore.js +32 -78
- package/dist/es/src/model/folioLayout.js +275 -280
- package/dist/es/src/saga/RouteListenerSaga.js +89 -193
- package/dist/es/src/saga/rootSaga.js +9 -16
- package/dist/es/src/scss/_imageView.scss +1 -1
- package/dist/es/src/scss/_navigation.scss +1 -1
- package/dist/es/src/scss/editioncrafter.scss +1 -1
- package/dist/style.css +1 -0
- package/package.json +36 -51
- package/dist/editioncrafter.min.js +0 -2
- package/dist/editioncrafter.min.js.LICENSE.txt +0 -144
|
@@ -1,184 +1,165 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
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); }
|
|
9
|
-
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); }
|
|
10
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
11
|
-
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); }; }
|
|
12
|
-
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); }
|
|
13
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
14
|
-
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; } }
|
|
15
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
16
|
-
import React, { Component } from 'react';
|
|
17
|
-
import { connect } from 'react-redux';
|
|
18
|
-
var SplitPaneView = /*#__PURE__*/function (_Component) {
|
|
19
|
-
_inherits(SplitPaneView, _Component);
|
|
20
|
-
var _super = _createSuper(SplitPaneView);
|
|
21
|
-
function SplitPaneView(props) {
|
|
22
|
-
var _this;
|
|
23
|
-
_classCallCheck(this, SplitPaneView);
|
|
24
|
-
_this = _super.call(this);
|
|
25
|
-
// On drag, update the UI continuously
|
|
26
|
-
_this.onDrag = function (e) {
|
|
27
|
-
if (_this.dragging) {
|
|
28
|
-
var whole = window.innerWidth - 2 * _this.dividerWidth;
|
|
29
|
-
var left_viewWidth;
|
|
30
|
-
var right_viewWidth;
|
|
31
|
-
var third_viewWidth;
|
|
32
|
-
if (_this.activeDivider === 1) {
|
|
33
|
-
left_viewWidth = e.clientX - _this.dividerWidth / 2;
|
|
34
|
-
third_viewWidth = whole * _this.splitFractionRight;
|
|
35
|
-
right_viewWidth = whole - left_viewWidth - third_viewWidth;
|
|
36
|
-
} else {
|
|
37
|
-
third_viewWidth = whole - e.clientX - _this.dividerWidth / 2;
|
|
38
|
-
left_viewWidth = whole * _this.splitFraction;
|
|
39
|
-
right_viewWidth = whole - left_viewWidth - third_viewWidth;
|
|
40
|
-
}
|
|
41
|
-
// Update as long as we're within limits
|
|
42
|
-
if (left_viewWidth >= _this.leftPaneMinWidth && right_viewWidth >= _this.rightPaneMinWidth && third_viewWidth >= _this.thirdPaneMinWidth) {
|
|
43
|
-
console.log(whole, left_viewWidth, third_viewWidth);
|
|
44
|
-
_this.splitFraction = whole === 0 ? 0.0 : left_viewWidth / whole;
|
|
45
|
-
_this.splitFractionRight = whole === 0 ? 0.0 : third_viewWidth / whole;
|
|
46
|
-
_this.updateUI();
|
|
47
|
-
}
|
|
48
|
-
_this.updatePaneSize();
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
// Drag start: mark it
|
|
52
|
-
_this.onStartDrag = function (position) {
|
|
53
|
-
_this.dragging = true;
|
|
54
|
-
_this.activeDivider = position === 'first' ? 1 : 2;
|
|
55
|
-
};
|
|
56
|
-
// Drag end
|
|
57
|
-
_this.onEndDrag = function (e) {
|
|
58
|
-
_this.dragging = false;
|
|
59
|
-
_this.activeDivider = 0;
|
|
60
|
-
};
|
|
61
|
-
// On window resize
|
|
62
|
-
_this.onResize = function (e) {
|
|
63
|
-
_this.updatePaneSize();
|
|
64
|
-
};
|
|
65
|
-
_this.firstFolio = props.document.folios[0];
|
|
1
|
+
import React, { Component } from 'react'
|
|
2
|
+
import { connect } from 'react-redux'
|
|
3
|
+
|
|
4
|
+
class SplitPaneView extends Component {
|
|
5
|
+
constructor(props) {
|
|
6
|
+
super()
|
|
7
|
+
this.firstFolio = props.document.folios[0]
|
|
66
8
|
// Initialize the splitter
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
9
|
+
this.rightPaneMinWidth = props.rightPane.props.documentView.right.transcriptionType === 'glossary' ? 450 : 200
|
|
10
|
+
this.leftPaneMinWidth = props.leftPane.props.documentView.left.transcriptionType === 'glossary' ? 450 : 200
|
|
11
|
+
this.thirdPaneMinWidth = props.thirdPane.props.documentView.third.transcriptionType === 'glossary' ? 450 : props.thirdPane.props.documentView.third.transcriptionType === 'g' ? 0 : 200
|
|
12
|
+
this.splitFraction = props.threePanel ? 0.49 : 0.5
|
|
13
|
+
this.splitFractionRight = props.threePanel ? 0.01 : 0
|
|
14
|
+
this.dividerWidth = 16
|
|
15
|
+
const whole = window.innerWidth
|
|
16
|
+
const leftW = whole / 3
|
|
17
|
+
|
|
18
|
+
const split_left = (leftW / whole)
|
|
19
|
+
const split_right = (1 - split_left) / 2
|
|
20
|
+
const split_third = 1 - split_left - split_right
|
|
21
|
+
this.state = {
|
|
79
22
|
style: {
|
|
80
|
-
gridTemplateColumns:
|
|
81
|
-
}
|
|
82
|
-
}
|
|
23
|
+
gridTemplateColumns: `${this.splitFraction}fr ${this.dividerWidth}px ${1 - this.splitFraction - this.splitFractionRight}fr ${this.dividerWidth}px ${this.splitFractionRight}fr`,
|
|
24
|
+
},
|
|
25
|
+
}
|
|
83
26
|
|
|
84
27
|
// event handlers
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
return _this;
|
|
28
|
+
this.dragging = false
|
|
29
|
+
this.activeDivider = 0
|
|
30
|
+
this.onDrag = this.onDrag.bind(this)
|
|
31
|
+
this.onResize = this.onResize.bind(this)
|
|
32
|
+
this.onEndDrag = this.onEndDrag.bind(this)
|
|
33
|
+
this.updatePaneSize = this.updatePaneSize.bind(this)
|
|
34
|
+
this.updatePaneSize = this.updatePaneSize.bind(this)
|
|
93
35
|
}
|
|
94
|
-
_createClass(SplitPaneView, [{
|
|
95
|
-
key: "updateUI",
|
|
96
|
-
value:
|
|
97
|
-
// Update the screen with the new split info
|
|
98
|
-
function updateUI() {
|
|
99
|
-
var left = this.splitFraction;
|
|
100
|
-
var third = this.splitFractionRight;
|
|
101
|
-
var right = 1.0 - left - third;
|
|
102
|
-
this.setState(_objectSpread(_objectSpread({}, this.state), {}, {
|
|
103
|
-
style: _objectSpread(_objectSpread({}, this.state.style), {}, {
|
|
104
|
-
gridTemplateColumns: "".concat(left, "fr ").concat(this.dividerWidth, "px ").concat(right, "fr ").concat(this.dividerWidth, "px ").concat(third, "fr")
|
|
105
|
-
})
|
|
106
|
-
}));
|
|
107
|
-
}
|
|
108
36
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
this.
|
|
37
|
+
// On drag, update the UI continuously
|
|
38
|
+
onDrag = (e) => {
|
|
39
|
+
if (this.dragging) {
|
|
40
|
+
const whole = window.innerWidth - 2 * this.dividerWidth
|
|
41
|
+
let left_viewWidth
|
|
42
|
+
let right_viewWidth
|
|
43
|
+
let third_viewWidth
|
|
44
|
+
if (this.activeDivider === 1) {
|
|
45
|
+
left_viewWidth = e.clientX - this.dividerWidth / 2
|
|
46
|
+
third_viewWidth = whole * this.splitFractionRight
|
|
47
|
+
right_viewWidth = whole - left_viewWidth - third_viewWidth
|
|
119
48
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
this.updateUI();
|
|
125
|
-
window.addEventListener('pointermove', this.onDrag);
|
|
126
|
-
window.addEventListener('pointerup', this.onEndDrag);
|
|
127
|
-
window.addEventListener('resize', this.onResize);
|
|
128
|
-
console.log(this.props);
|
|
129
|
-
// Set the default width on mount
|
|
130
|
-
if (this.props.onWidth) {
|
|
131
|
-
var left_px = Math.floor(Math.abs(window.innerWidth * this.splitFraction));
|
|
132
|
-
var right_px = Math.floor(window.innerWidth * (1.0 - this.splitFraction));
|
|
133
|
-
var third_px = Math.floor(window.innerWidth * (1.0 - this.splitFraction));
|
|
134
|
-
this.props.onWidth(left_px, right_px, third_px);
|
|
49
|
+
else {
|
|
50
|
+
third_viewWidth = whole - e.clientX - this.dividerWidth / 2
|
|
51
|
+
left_viewWidth = whole * this.splitFraction
|
|
52
|
+
right_viewWidth = whole - left_viewWidth - third_viewWidth
|
|
135
53
|
}
|
|
54
|
+
// Update as long as we're within limits
|
|
55
|
+
if (left_viewWidth >= this.leftPaneMinWidth
|
|
56
|
+
&& right_viewWidth >= this.rightPaneMinWidth
|
|
57
|
+
&& third_viewWidth >= this.thirdPaneMinWidth) {
|
|
58
|
+
this.splitFraction = (whole === 0) ? 0.0 : left_viewWidth / whole
|
|
59
|
+
this.splitFractionRight = (whole === 0) ? 0.0 : third_viewWidth / whole
|
|
60
|
+
this.updateUI()
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
this.updatePaneSize()
|
|
136
64
|
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
},
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Drag start: mark it
|
|
68
|
+
onStartDrag = (position) => {
|
|
69
|
+
this.dragging = true
|
|
70
|
+
this.activeDivider = position === 'first' ? 1 : 2
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Drag end
|
|
74
|
+
onEndDrag = (e) => {
|
|
75
|
+
this.dragging = false
|
|
76
|
+
this.activeDivider = 0
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// On window resize
|
|
80
|
+
onResize = (e) => {
|
|
81
|
+
this.updatePaneSize()
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Update the screen with the new split info
|
|
85
|
+
updateUI() {
|
|
86
|
+
const left = this.splitFraction
|
|
87
|
+
const third = this.splitFractionRight
|
|
88
|
+
const right = 1.0 - left - third
|
|
89
|
+
this.setState({
|
|
90
|
+
...this.state,
|
|
91
|
+
style: {
|
|
92
|
+
...this.state.style,
|
|
93
|
+
gridTemplateColumns: `${left}fr ${this.dividerWidth}px ${right}fr ${this.dividerWidth}px ${third}fr`,
|
|
94
|
+
},
|
|
95
|
+
})
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Update the sizes of the panes
|
|
99
|
+
updatePaneSize() {
|
|
100
|
+
// Record state change
|
|
101
|
+
const left_px = Math.floor(Math.abs(window.innerWidth * this.splitFraction))
|
|
102
|
+
const third_px = Math.floor(Math.abs(window.innerWidth * this.splitFractionRight))
|
|
103
|
+
const right_px = Math.floor(window.innerWidth * (1.0 - this.splitFraction - this.splitFractionRight))
|
|
104
|
+
if (this.props.onWidth && left_px >= this.leftPaneMinWidth && right_px >= this.rightPaneMinWidth && third_px >= this.thirdPaneMinWidth) {
|
|
105
|
+
this.props.onWidth(left_px, right_px, third_px)
|
|
167
106
|
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
componentDidMount() {
|
|
110
|
+
this.updateUI()
|
|
111
|
+
window.addEventListener('pointermove', this.onDrag)
|
|
112
|
+
window.addEventListener('pointerup', this.onEndDrag)
|
|
113
|
+
window.addEventListener('resize', this.onResize)
|
|
114
|
+
// Set the default width on mount
|
|
115
|
+
if (this.props.onWidth) {
|
|
116
|
+
const left_px = Math.floor(Math.abs(window.innerWidth * this.splitFraction))
|
|
117
|
+
const right_px = Math.floor(window.innerWidth * (1.0 - this.splitFraction))
|
|
118
|
+
const third_px = Math.floor(window.innerWidth * (1.0 - this.splitFraction))
|
|
119
|
+
this.props.onWidth(left_px, right_px, third_px)
|
|
175
120
|
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
componentDidUpdate(prevProps) {
|
|
124
|
+
this.rightPaneMinWidth = this.props.rightPane.props.documentView.right.transcriptionType === 'glossary' ? 450 : 200
|
|
125
|
+
this.leftPaneMinWidth = this.props.leftPane.props.documentView.left.transcriptionType === 'glossary' ? 450 : 200
|
|
126
|
+
this.thirdPaneMinWidth = this.props.thirdPane.props.documentView.third.transcriptionType === 'glossary' ? 450 : this.props.thirdPane.props.documentView.third.transcriptionType === 'g' ? 0 : 200
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
componentWillUnmount() {
|
|
130
|
+
window.removeEventListener('pointermove', this.onDrag)
|
|
131
|
+
window.removeEventListener('pointerup', this.onEndDrag)
|
|
132
|
+
window.removeEventListener('resize', this.onResize)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
renderDivider(position) {
|
|
136
|
+
const drawerIconClass = 'drawer-icon fas fa-caret-left fa-2x'
|
|
137
|
+
|
|
138
|
+
return (
|
|
139
|
+
<div className={`divider ${position}_divider`} onPointerDown={() => this.onStartDrag(position)}>
|
|
140
|
+
<div className="drawer-button hidden" onClick={this.onDrawerButton}>
|
|
141
|
+
<i className={drawerIconClass}> </i>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
render() {
|
|
148
|
+
return (
|
|
149
|
+
<div className="split-pane-view three-pane" style={{ ...this.state.style }}>
|
|
150
|
+
{ this.props.leftPane }
|
|
151
|
+
{ this.renderDivider('first') }
|
|
152
|
+
{ this.props.rightPane }
|
|
153
|
+
{ this.props.threePanel && this.renderDivider('second') }
|
|
154
|
+
{ this.props.threePanel && this.props.thirdPane }
|
|
155
|
+
</div>
|
|
156
|
+
)
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
179
160
|
function mapStateToProps(state) {
|
|
180
161
|
return {
|
|
181
|
-
document: state.document
|
|
182
|
-
}
|
|
162
|
+
document: state.document,
|
|
163
|
+
}
|
|
183
164
|
}
|
|
184
|
-
export default connect(mapStateToProps)(SplitPaneView)
|
|
165
|
+
export default connect(mapStateToProps)(SplitPaneView)
|