@progress/kendo-react-pdf-viewer 5.16.1 → 5.16.2-dev.202308021222

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.
@@ -1,253 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SearchService = void 0;
4
- const unwrapElement = (element) => {
5
- const parentElement = element.parentElement;
6
- if (!element || !parentElement) {
7
- return;
8
- }
9
- parentElement.replaceWith(...Array.from(parentElement.childNodes));
10
- };
11
- const unwrapElements = (elements) => {
12
- if (!elements || !elements.length || elements.length <= 0) {
13
- return;
14
- }
15
- for (let i = 0; i < elements.length; i++) {
16
- unwrapElement(elements[i]);
17
- }
18
- };
19
- const wrapElement = (element, wrapper) => {
20
- if (element.parentNode) {
21
- element.parentNode.insertBefore(wrapper, element);
22
- wrapper.appendChild(element);
23
- }
24
- };
25
- const wrapInnerElement = (element, wrapper) => {
26
- if (!element || !element.parentNode || !wrapper) {
27
- return;
28
- }
29
- element.appendChild(wrapper);
30
- while (element.firstChild && element.firstChild !== wrapper) {
31
- wrapper.appendChild(element.firstChild);
32
- }
33
- };
34
- const addClass = (className, element) => { element.classList.add(className); };
35
- const removeClass = (className, element) => { element.classList.remove(className); };
36
- const toClassSelector = (className) => `.${className}`;
37
- const CHAR_INDEX_DATA_ATTR = 'data-char-index';
38
- const MATCH_INDEX_DATA_ATTR = 'data-match-index';
39
- /**
40
- * @hidden
41
- */
42
- class SearchService {
43
- constructor(options) {
44
- this.options = {
45
- highlightClass: 'k-search-highlight',
46
- highlightMarkClass: 'k-search-highlight-mark',
47
- charClass: 'k-text-char',
48
- textContainers: []
49
- };
50
- this.extendOptions(options);
51
- this.resetState();
52
- }
53
- destroy() {
54
- this.clearSearch();
55
- }
56
- extendOptions(options) {
57
- this.options = Object.assign({}, this.options, options);
58
- }
59
- setState(newState) {
60
- this.state = Object.assign({}, this.state || {}, newState);
61
- }
62
- resetState() {
63
- this.setState({
64
- text: '',
65
- textNodes: [],
66
- charIndex: 0,
67
- activeMatchIndex: 0,
68
- matches: []
69
- });
70
- }
71
- search({ text, matchCase }) {
72
- let searchRegex = new RegExp(text, matchCase ? 'g' : 'ig');
73
- let match;
74
- if (this.shouldTransformText()) {
75
- this.transformTextForSearch();
76
- }
77
- this.state.matches = [];
78
- this.state.activeMatchIndex = 0;
79
- this.removeIndicators();
80
- if (text === '') {
81
- return [];
82
- }
83
- match = searchRegex.exec(this.state.text);
84
- while (match) {
85
- this.state.matches.push({
86
- startOffset: match.index,
87
- endOffset: match.index + match[0].length
88
- });
89
- match = searchRegex.exec(this.state.text);
90
- }
91
- this.highlightAllMatches();
92
- this.addActiveMatchMark();
93
- return this.state.matches;
94
- }
95
- clearSearch() {
96
- this.removeIndicators();
97
- this.restoreOriginalText();
98
- }
99
- restoreOriginalText() {
100
- this.forEachTextContainer((textContainer) => {
101
- const nodes = Array.from(textContainer.querySelectorAll('span:not(.' + this.options.charClass + ')'));
102
- nodes.forEach((node) => {
103
- node.innerHTML = node.textContent;
104
- });
105
- });
106
- }
107
- shouldTransformText() {
108
- return !this.state.text;
109
- }
110
- transformTextForSearch() {
111
- this.state.textNodes = [];
112
- this.state.charIndex = 0;
113
- this.state.text = '';
114
- this.forEachTextContainer((textContainer) => {
115
- this.extractTextNodes(textContainer);
116
- });
117
- this.transformTextNodesForSearch(this.state.textNodes);
118
- }
119
- extractTextNodes(node) {
120
- if (node.nodeType === Node.TEXT_NODE) {
121
- this.state.textNodes.push(node);
122
- }
123
- else {
124
- for (let i = 0; i < node.childNodes.length; i++) {
125
- this.extractTextNodes(node.childNodes[i]);
126
- }
127
- }
128
- }
129
- transformTextNodesForSearch(textNodes) {
130
- for (let i = 0; i < textNodes.length; i++) {
131
- this.transformTextNodeForSearch(textNodes[i]);
132
- }
133
- }
134
- transformTextNodeForSearch(node) {
135
- const text = node.textContent;
136
- if (text.length <= 0) {
137
- return;
138
- }
139
- this.state.text = this.state.text + text;
140
- const span = document.createElement('span');
141
- wrapElement(node, span);
142
- const splittedHtml = this.splitTextByChars(text);
143
- span.innerHTML = splittedHtml;
144
- unwrapElement(span.childNodes[0]);
145
- }
146
- splitTextByChars(text) {
147
- let splittedTextHtml = '';
148
- for (let i = 0; i < text.length; i++) {
149
- splittedTextHtml +=
150
- '<span class=\'' + this.options.charClass + '\' ' + CHAR_INDEX_DATA_ATTR + '=' + this.state.charIndex + '>' +
151
- text[i] +
152
- '</span>';
153
- this.state.charIndex++;
154
- }
155
- return splittedTextHtml;
156
- }
157
- forEachTextContainer(callback) {
158
- for (let i = 0; i < this.options.textContainers.length; i++) {
159
- const textContainer = this.options.textContainers[i];
160
- callback(textContainer, i);
161
- }
162
- }
163
- highlightAllMatches() {
164
- this.state.matches.forEach((match, matchIndex) => {
165
- this.addMatchHighlight(match.startOffset, match.endOffset, matchIndex);
166
- });
167
- }
168
- addMatchHighlight(matchStartOffset, matchEndOffset, matchIndex) {
169
- for (let i = matchStartOffset; i < matchEndOffset; i++) {
170
- this.forEachTextContainer((textContainer) => {
171
- const highlights = Array.from(textContainer.querySelectorAll(toClassSelector(this.options.charClass + '[' + CHAR_INDEX_DATA_ATTR + '=\'' + i + '\'' + ']')));
172
- highlights.forEach((highlight) => {
173
- addClass(this.options.highlightClass, highlight);
174
- highlight.setAttribute(MATCH_INDEX_DATA_ATTR, matchIndex);
175
- });
176
- });
177
- }
178
- }
179
- removeMatchHighlights() {
180
- this.forEachTextContainer((textContainer) => {
181
- const highlights = Array.from(textContainer.querySelectorAll(toClassSelector(this.options.highlightClass)));
182
- highlights.forEach((highlight) => {
183
- removeClass(this.options.highlightClass, highlight);
184
- highlight.removeAttribute(MATCH_INDEX_DATA_ATTR);
185
- });
186
- });
187
- }
188
- addActiveMatchMark() {
189
- if (!this.state.activeMatchIndex && this.state.activeMatchIndex !== 0) {
190
- this.state.activeMatchIndex = 0;
191
- }
192
- else if (this.state.activeMatchIndex > this.state.matches.length) {
193
- this.state.activeMatchIndex = this.state.matches.length;
194
- }
195
- else {
196
- this.removeActiveMatchMark();
197
- }
198
- const mark = document.createElement('span');
199
- mark.classList.add(this.options.highlightMarkClass);
200
- this.forEachTextContainer((textContainer) => {
201
- const matches = Array.from(textContainer.querySelectorAll(toClassSelector(this.options.charClass + '[' + MATCH_INDEX_DATA_ATTR + '=\'' + this.state.activeMatchIndex + '\']')));
202
- matches.forEach((match) => {
203
- wrapInnerElement(match, mark.cloneNode(true));
204
- });
205
- });
206
- }
207
- removeActiveMatchMark() {
208
- this.forEachTextContainer((textContainer) => {
209
- const marks = Array.from(textContainer.querySelectorAll(toClassSelector(this.options.highlightMarkClass)));
210
- const childNodes = marks.flatMap((x) => Array.from(x.childNodes));
211
- unwrapElements(childNodes);
212
- });
213
- }
214
- removeIndicators() {
215
- this.removeActiveMatchMark();
216
- this.removeMatchHighlights();
217
- }
218
- markNextMatch() {
219
- this.markNextMatchIndex();
220
- this.addActiveMatchMark();
221
- }
222
- markPreviousMatch() {
223
- this.markPreviousMatchIndex();
224
- this.addActiveMatchMark();
225
- }
226
- markNextMatchIndex() {
227
- this.moveActiveMatchIndex(1);
228
- }
229
- markPreviousMatchIndex() {
230
- this.moveActiveMatchIndex(-1);
231
- }
232
- moveActiveMatchIndex(delta) {
233
- this.state.activeMatchIndex += delta;
234
- if (this.state.activeMatchIndex < 0) {
235
- this.state.activeMatchIndex = Math.max(this.state.matches.length - 1, 0);
236
- }
237
- else if (this.state.activeMatchIndex > this.state.matches.length - 1) {
238
- this.state.activeMatchIndex = 0;
239
- }
240
- }
241
- getActiveMatchElement() {
242
- let markedMatch;
243
- this.forEachTextContainer((textContainer) => {
244
- const mark = textContainer.querySelector(toClassSelector(this.options.highlightMarkClass));
245
- if (mark) {
246
- markedMatch = mark;
247
- return;
248
- }
249
- });
250
- return markedMatch;
251
- }
252
- }
253
- exports.SearchService = SearchService;
@@ -1,96 +0,0 @@
1
- import { SaveOptions } from '@progress/kendo-file-saver';
2
- import { PDFPageProxy, PDFDocumentProxy } from 'pdfjs-dist';
3
- import { TypedArray } from 'pdfjs-dist/types/src/display/api';
4
- /**
5
- * @hidden
6
- */
7
- export declare type DoneFn = (result: {
8
- pdfPages: PDFPageProxy[];
9
- pdfDoc: PDFDocumentProxy;
10
- zoom: number;
11
- }) => void;
12
- /**
13
- * @hidden
14
- */
15
- export declare type ErrorFn = (e?: any) => void;
16
- /**
17
- * @hidden
18
- */
19
- export interface PDFReadParameters {
20
- url?: string;
21
- data?: string;
22
- arrayBuffer?: ArrayBuffer;
23
- typedArray?: TypedArray;
24
- error: ErrorFn;
25
- }
26
- /**
27
- * @hidden
28
- */
29
- export interface PDFReadOptions extends PDFReadParameters {
30
- dom: HTMLDivElement;
31
- zoom: number;
32
- done: DoneFn;
33
- }
34
- /**
35
- * @hidden
36
- */
37
- export interface PDFReloadParameters {
38
- pdfDoc: PDFDocumentProxy;
39
- zoom: number;
40
- dom: HTMLElement;
41
- done: (pdfPages: PDFPageProxy[]) => void;
42
- error: ErrorFn;
43
- }
44
- /**
45
- * @hidden
46
- */
47
- export declare const DEFAULT_ZOOM_LEVEL = 1.25;
48
- /**
49
- * @hidden
50
- */
51
- export declare const removeChildren: (dom: HTMLElement) => void;
52
- /**
53
- * @hidden
54
- */
55
- export declare const download: (options: {
56
- pdf: PDFDocumentProxy | null;
57
- error: ErrorFn;
58
- }, fileName: string | undefined, saveOptions: SaveOptions | undefined, onDownload: (blob: Blob, fileName: string, saveOptions: SaveOptions) => boolean) => void;
59
- /**
60
- * @hidden
61
- */
62
- export declare const loadPDF: (options: PDFReadOptions) => void;
63
- /**
64
- * @hidden
65
- */
66
- export declare const reloadDocument: (params: PDFReloadParameters) => void;
67
- /**
68
- * @hidden
69
- */
70
- export declare const print: (pages: PDFPageProxy[], done: () => void, error: ErrorFn) => void;
71
- /**
72
- * @hidden
73
- */
74
- export declare const goToNextSearchMatch: (ref: any) => void;
75
- /**
76
- * @hidden
77
- */
78
- export declare const goToPreviousSearchMatch: (ref: any) => void;
79
- /**
80
- * @hidden
81
- */
82
- export declare const calculateZoomLevel: (zoomLevel: number, zoomLevelType: string, currentZoom: number, dom: HTMLDivElement) => number;
83
- /**
84
- * Scrolls the PDFViewer document to the passed page number.
85
- *
86
- * @param rootElement The root HTML element of the PDFViewer component.
87
- * @param pageNumber The page number.
88
- */
89
- export declare const scrollToPage: (rootElement: HTMLElement, pageNumber: number) => void;
90
- /**
91
- * A function which gives you the page number of the document according to the scroll position.
92
- *
93
- * @param rootElement The root HTML element of the PDFViewer component.
94
- * @returns The page number.
95
- */
96
- export declare const currentPage: (rootElement: HTMLElement) => number;
package/dist/npm/utils.js DELETED
@@ -1,287 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.currentPage = exports.scrollToPage = exports.calculateZoomLevel = exports.goToPreviousSearchMatch = exports.goToNextSearchMatch = exports.print = exports.reloadDocument = exports.loadPDF = exports.download = exports.removeChildren = exports.DEFAULT_ZOOM_LEVEL = void 0;
4
- const kendo_file_saver_1 = require("@progress/kendo-file-saver");
5
- const pdfjs_dist_1 = require("pdfjs-dist");
6
- /**
7
- * @hidden
8
- */
9
- exports.DEFAULT_ZOOM_LEVEL = 1.25;
10
- const parsePdfFromBase64String = (base64String) => {
11
- return atob(base64String.replace(/^(data:application\/pdf;base64,)/ig, ''));
12
- };
13
- const getDocumentParameters = (options) => {
14
- let params = { verbosity: 0 };
15
- if (typeof options.data === 'string') {
16
- params.data = parsePdfFromBase64String(options.data);
17
- }
18
- else if (typeof options.url === 'string') {
19
- params.url = options.url;
20
- }
21
- else if (options.arrayBuffer instanceof ArrayBuffer) {
22
- params = options.arrayBuffer;
23
- }
24
- else if (options.typedArray) {
25
- params = options.typedArray;
26
- }
27
- return params;
28
- };
29
- /**
30
- * @hidden
31
- */
32
- const removeChildren = (dom) => {
33
- while (dom.firstChild) {
34
- dom.removeChild(dom.firstChild);
35
- }
36
- };
37
- exports.removeChildren = removeChildren;
38
- const appendPage = (dom, page, index) => {
39
- if (index === 0) {
40
- (0, exports.removeChildren)(dom);
41
- }
42
- dom.appendChild(page);
43
- };
44
- /**
45
- * @hidden
46
- */
47
- const download = (options, fileName = 'Document', saveOptions = {}, onDownload) => {
48
- if (options.pdf) {
49
- options.pdf.getData()
50
- .then((data) => new Blob([data], { type: 'application/pdf' }))
51
- .then((blob) => {
52
- if (!onDownload(blob, fileName, saveOptions)) {
53
- (0, kendo_file_saver_1.saveAs)(blob, fileName, saveOptions);
54
- }
55
- })
56
- .catch((reason) => { options.error.call(undefined, reason); });
57
- }
58
- };
59
- exports.download = download;
60
- /**
61
- * @hidden
62
- */
63
- const loadPDF = (options) => {
64
- const params = getDocumentParameters(options);
65
- const { dom, zoom, done, error } = options;
66
- (0, pdfjs_dist_1.getDocument)(params).promise.then((pdfDoc) => {
67
- const pages = [];
68
- for (let i = 1; i <= pdfDoc.numPages; i++) {
69
- pages.push(pdfDoc.getPage(i));
70
- }
71
- return { pages, pdfDoc };
72
- }).then(({ pages, pdfDoc }) => {
73
- Promise.all(pages)
74
- .then(all => all.map((page, i) => {
75
- appendPage(dom, renderPage(page, zoom, error), i);
76
- return page;
77
- }))
78
- .then((pdfPages) => {
79
- done({ pdfPages, pdfDoc, zoom });
80
- }).catch((reason) => { options.error(reason); });
81
- }).catch((reason) => { options.error(reason); });
82
- };
83
- exports.loadPDF = loadPDF;
84
- /**
85
- * @hidden
86
- */
87
- const reloadDocument = (params) => {
88
- const { pdfDoc, zoom, dom, done, error } = params;
89
- const pages = [];
90
- for (let i = 1; i <= pdfDoc.numPages; i++) {
91
- pages.push(pdfDoc.getPage(i));
92
- }
93
- Promise.all(pages)
94
- .then(all => all.map((page, i) => {
95
- appendPage(dom, renderPage(page, zoom, error), i);
96
- return page;
97
- }))
98
- .then(done)
99
- .catch(error);
100
- };
101
- exports.reloadDocument = reloadDocument;
102
- /**
103
- * @hidden
104
- */
105
- const print = (pages, done, error) => {
106
- const dom = document.createElement('div');
107
- let dones = pages.map(() => false);
108
- pages.forEach((page, index) => {
109
- const viewport = renderCanvas(page, (el) => {
110
- dom.appendChild(el);
111
- dones[index] = true;
112
- if (dones.every(Boolean)) {
113
- openPrintDialog(dom, viewport.width, viewport.height, done, error);
114
- }
115
- }, error);
116
- });
117
- };
118
- exports.print = print;
119
- const openPrintDialog = (dom, width, height, done, onError) => {
120
- const printDialog = window.open('', '', 'innerWidth=' + width + ',innerHeight=' + height + 'location=no,titlebar=no,toolbar=no');
121
- if (!printDialog || !printDialog.document) {
122
- onError();
123
- return;
124
- }
125
- if (printDialog) {
126
- printDialog.document.body.appendChild(dom);
127
- printDialog.focus();
128
- setTimeout(() => {
129
- printDialog.print();
130
- done();
131
- }, 0);
132
- const onAfterPrint = () => {
133
- printDialog.removeEventListener('afterprint', onAfterPrint);
134
- printDialog.close();
135
- };
136
- printDialog.addEventListener('afterprint', onAfterPrint);
137
- }
138
- };
139
- const renderCanvas = (page, done, error) => {
140
- const viewport = page.getViewport({ scale: exports.DEFAULT_ZOOM_LEVEL });
141
- const styles = {};
142
- const pageElement = createElement('div', '', styles);
143
- const canvas = createElement('canvas', '', { width: '100%', height: '100%' });
144
- const canvasContext = canvas.getContext('2d');
145
- canvas.height = viewport.height;
146
- canvas.width = viewport.width;
147
- pageElement.appendChild(canvas);
148
- page.render({ canvasContext, viewport }).promise.then(() => {
149
- const printContent = new Image();
150
- printContent.src = canvas.toDataURL();
151
- pageElement.removeChild(canvas);
152
- pageElement.appendChild(printContent);
153
- printContent.width = canvas.width;
154
- printContent.height = canvas.height;
155
- const onload = () => {
156
- printContent.removeEventListener('load', onload);
157
- done(pageElement);
158
- };
159
- printContent.addEventListener('load', onload);
160
- }).catch(error);
161
- return viewport;
162
- };
163
- const createElement = function (name, className, styles) {
164
- const element = document.createElement(name);
165
- if (className) {
166
- element.className = className;
167
- }
168
- Object.keys(styles).forEach(key => element.style[key] = styles[key]);
169
- return element;
170
- };
171
- const renderPage = (page, zoom, error) => {
172
- const viewport = page.getViewport({ scale: zoom });
173
- const styles = { width: viewport.width + 'px', height: viewport.height + 'px' };
174
- const pageElement = createElement('div', 'k-page', styles);
175
- const canvas = createElement('canvas', '', { width: '100%', height: '100%' });
176
- const canvasContext = canvas.getContext('2d');
177
- canvas.height = viewport.height;
178
- canvas.width = viewport.width;
179
- pageElement.appendChild(canvas);
180
- page.render({ canvasContext, viewport }).promise.then(() => {
181
- page.getTextContent().then((textContent) => {
182
- const textLayer = createElement('div', 'k-text-layer', styles);
183
- (0, pdfjs_dist_1.renderTextLayer)({
184
- textContentSource: textContent,
185
- container: textLayer,
186
- viewport: viewport,
187
- textDivs: []
188
- }).promise.then(() => {
189
- pageElement.appendChild(textLayer);
190
- }).catch(error);
191
- });
192
- }).catch(error);
193
- return pageElement;
194
- };
195
- const searchMatchScrollLeftOffset = 0;
196
- const searchMatchScrollTopOffset = -64;
197
- const scrollToSearchMatch = (matchElement, ref) => {
198
- if (!matchElement) {
199
- return;
200
- }
201
- const closestCharElement = matchElement.closest('.k-text-char');
202
- const closestTextElement = closestCharElement ?
203
- closestCharElement.closest('span[role=\'presentation\']') :
204
- null;
205
- if (!closestTextElement) {
206
- return;
207
- }
208
- const closestPageElement = closestTextElement.closest('.k-page');
209
- if (!closestPageElement) {
210
- return;
211
- }
212
- const scrollLeft = closestPageElement.offsetLeft +
213
- (-1) * ref.scroller.element.offsetLeft +
214
- closestTextElement.offsetLeft + searchMatchScrollLeftOffset;
215
- const scrollTop = closestPageElement.offsetTop +
216
- (-1) * ref.scroller.element.offsetTop +
217
- closestTextElement.offsetTop + searchMatchScrollTopOffset;
218
- ref.scroller.scrollTo(scrollLeft, scrollTop, { trackScrollEvent: false });
219
- };
220
- /**
221
- * @hidden
222
- */
223
- const goToNextSearchMatch = (ref) => {
224
- ref.search.markNextMatch();
225
- const matchElement = ref.search.getActiveMatchElement();
226
- scrollToSearchMatch(matchElement, ref);
227
- };
228
- exports.goToNextSearchMatch = goToNextSearchMatch;
229
- /**
230
- * @hidden
231
- */
232
- const goToPreviousSearchMatch = (ref) => {
233
- ref.search.markPreviousMatch();
234
- const matchElement = ref.search.getActiveMatchElement();
235
- scrollToSearchMatch(matchElement, ref);
236
- };
237
- exports.goToPreviousSearchMatch = goToPreviousSearchMatch;
238
- /**
239
- * @hidden
240
- */
241
- const calculateZoomLevel = (zoomLevel, zoomLevelType, currentZoom, dom) => {
242
- const documentContainer = dom.closest('.k-pdf-viewer-canvas');
243
- const page = dom.querySelector('.k-page');
244
- const pageSize = { width: page.offsetWidth, height: page.offsetHeight };
245
- let calculatedZoomLevel = zoomLevel;
246
- if (zoomLevelType === 'ActualWidth') {
247
- calculatedZoomLevel = 1;
248
- }
249
- else if (zoomLevelType === 'FitToWidth') {
250
- calculatedZoomLevel = (documentContainer.offsetWidth / (pageSize.width / currentZoom));
251
- }
252
- else if (zoomLevelType === 'FitToPage') {
253
- calculatedZoomLevel = (documentContainer.offsetHeight / (pageSize.height / currentZoom));
254
- }
255
- return calculatedZoomLevel;
256
- };
257
- exports.calculateZoomLevel = calculateZoomLevel;
258
- /**
259
- * Scrolls the PDFViewer document to the passed page number.
260
- *
261
- * @param rootElement The root HTML element of the PDFViewer component.
262
- * @param pageNumber The page number.
263
- */
264
- const scrollToPage = (rootElement, pageNumber) => {
265
- const pages = rootElement.querySelectorAll('.k-page');
266
- const page = pages[0];
267
- if (page instanceof HTMLDivElement) {
268
- const top = (page.offsetHeight + page.offsetTop) * Math.max(0, Math.min(pageNumber, pages.length - 1));
269
- const scrollElement = page.closest('.k-pdf-viewer-canvas');
270
- if (scrollElement) {
271
- scrollElement.scrollTo({ top, behavior: 'auto' });
272
- }
273
- }
274
- };
275
- exports.scrollToPage = scrollToPage;
276
- /**
277
- * A function which gives you the page number of the document according to the scroll position.
278
- *
279
- * @param rootElement The root HTML element of the PDFViewer component.
280
- * @returns The page number.
281
- */
282
- const currentPage = (rootElement) => {
283
- const scrollElement = rootElement.querySelector('.k-pdf-viewer-canvas');
284
- const page = rootElement.querySelector('.k-page');
285
- return (scrollElement && page) ? Math.floor((Math.round(scrollElement.scrollTop)) / (page.offsetHeight + page.offsetTop) + 0.01) : 0;
286
- };
287
- exports.currentPage = currentPage;