@progress/kendo-pdfviewer-common 0.4.2-develop.1 → 0.5.0-develop.2
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/dist/es/annotations/annotation-editor-layer-builder.js +6 -1
- package/dist/es/annotations/annotation-editor-ui-manager.js +25 -0
- package/dist/es/annotations/annotation-layer-builder.js +14 -4
- package/dist/es/annotations/annotation-layer.js +358 -337
- package/dist/es/annotations/draw-layer-builder.js +5 -1
- package/dist/es/annotations/helpers/annotation-storage.js +14 -0
- package/dist/es/annotations/helpers/text-accessibility-manager.js +5 -0
- package/dist/es/annotations/shared/event_utils.js +6 -0
- package/dist/es/text/text-layer-builder.js +13 -1
- package/dist/es/utils.js +3 -2
- package/dist/es/widget/page.js +22 -0
- package/dist/es/widget/pdfviewer.js +24 -13
- package/dist/es2015/annotations/annotation-editor-layer-builder.js +6 -1
- package/dist/es2015/annotations/annotation-editor-ui-manager.js +25 -0
- package/dist/es2015/annotations/annotation-layer-builder.js +14 -4
- package/dist/es2015/annotations/annotation-layer.js +358 -337
- package/dist/es2015/annotations/draw-layer-builder.js +5 -1
- package/dist/es2015/annotations/helpers/annotation-storage.js +14 -0
- package/dist/es2015/annotations/helpers/text-accessibility-manager.js +5 -0
- package/dist/es2015/annotations/shared/event_utils.js +6 -0
- package/dist/es2015/text/text-layer-builder.js +13 -1
- package/dist/es2015/utils.js +3 -2
- package/dist/es2015/widget/page.js +22 -0
- package/dist/es2015/widget/pdfviewer.js +24 -13
- package/dist/npm/annotations/annotation-editor-layer-builder.d.ts +3 -1
- package/dist/npm/annotations/annotation-editor-layer-builder.js +6 -1
- package/dist/npm/annotations/annotation-editor-ui-manager.d.ts +3 -0
- package/dist/npm/annotations/annotation-editor-ui-manager.js +25 -0
- package/dist/npm/annotations/annotation-layer-builder.d.ts +3 -1
- package/dist/npm/annotations/annotation-layer-builder.js +14 -4
- package/dist/npm/annotations/annotation-layer.d.ts +3 -1
- package/dist/npm/annotations/annotation-layer.js +358 -337
- package/dist/npm/annotations/draw-layer-builder.d.ts +3 -1
- package/dist/npm/annotations/draw-layer-builder.js +5 -1
- package/dist/npm/annotations/helpers/annotation-storage.d.ts +10 -0
- package/dist/npm/annotations/helpers/annotation-storage.js +14 -0
- package/dist/npm/annotations/helpers/text-accessibility-manager.d.ts +1 -0
- package/dist/npm/annotations/helpers/text-accessibility-manager.js +5 -0
- package/dist/npm/annotations/shared/event_utils.d.ts +4 -0
- package/dist/npm/annotations/shared/event_utils.js +6 -0
- package/dist/npm/text/text-layer-builder.d.ts +3 -1
- package/dist/npm/text/text-layer-builder.js +13 -1
- package/dist/npm/utils.d.ts +1 -0
- package/dist/npm/utils.js +5 -3
- package/dist/npm/widget/page.js +22 -0
- package/dist/npm/widget/pdfviewer.d.ts +1 -0
- package/dist/npm/widget/pdfviewer.js +23 -12
- package/package.json +1 -1
|
@@ -47,10 +47,11 @@ class DrawLayerBuilder {
|
|
|
47
47
|
}
|
|
48
48
|
cancel() {
|
|
49
49
|
// this._cancelled = true;
|
|
50
|
+
var _a;
|
|
50
51
|
if (!__classPrivateFieldGet(this, _DrawLayerBuilder_drawLayer, "f")) {
|
|
51
52
|
return;
|
|
52
53
|
}
|
|
53
|
-
__classPrivateFieldGet(this, _DrawLayerBuilder_drawLayer, "f").destroy();
|
|
54
|
+
(_a = __classPrivateFieldGet(this, _DrawLayerBuilder_drawLayer, "f")) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
54
55
|
__classPrivateFieldSet(this, _DrawLayerBuilder_drawLayer, null, "f");
|
|
55
56
|
}
|
|
56
57
|
setParent(parent) {
|
|
@@ -60,6 +61,9 @@ class DrawLayerBuilder {
|
|
|
60
61
|
getDrawLayer() {
|
|
61
62
|
return __classPrivateFieldGet(this, _DrawLayerBuilder_drawLayer, "f");
|
|
62
63
|
}
|
|
64
|
+
destroy() {
|
|
65
|
+
this.cancel();
|
|
66
|
+
}
|
|
63
67
|
}
|
|
64
68
|
_DrawLayerBuilder_drawLayer = new WeakMap();
|
|
65
69
|
export { DrawLayerBuilder };
|
|
@@ -45,6 +45,20 @@ class AnnotationStorage {
|
|
|
45
45
|
this.onResetModified = null;
|
|
46
46
|
this.onAnnotationEditor = null;
|
|
47
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Get the value for the storage - used purely for debugging purposes.
|
|
50
|
+
* @returns {Object}
|
|
51
|
+
*/
|
|
52
|
+
getStorage() {
|
|
53
|
+
return __classPrivateFieldGet(this, _AnnotationStorage_storage, "f");
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Get the modified flag for the storage - used purely for debugging purposes.
|
|
57
|
+
* @returns {Object}
|
|
58
|
+
*/
|
|
59
|
+
getModified() {
|
|
60
|
+
return __classPrivateFieldGet(this, _AnnotationStorage_modified, "f");
|
|
61
|
+
}
|
|
48
62
|
/**
|
|
49
63
|
* Get the value for a given key if it exists, or return the default value.
|
|
50
64
|
* @param {string} key
|
|
@@ -178,6 +178,11 @@ class TextAccessibilityManager {
|
|
|
178
178
|
}
|
|
179
179
|
return id;
|
|
180
180
|
}
|
|
181
|
+
destroy() {
|
|
182
|
+
__classPrivateFieldSet(this, _TextAccessibilityManager_textNodes, new Map(), "f");
|
|
183
|
+
__classPrivateFieldSet(this, _TextAccessibilityManager_waitingElements, new Map(), "f");
|
|
184
|
+
__classPrivateFieldSet(this, _TextAccessibilityManager_textChildren, null, "f");
|
|
185
|
+
}
|
|
181
186
|
}
|
|
182
187
|
_a = TextAccessibilityManager, _TextAccessibilityManager_enabled = new WeakMap(), _TextAccessibilityManager_textChildren = new WeakMap(), _TextAccessibilityManager_textNodes = new WeakMap(), _TextAccessibilityManager_waitingElements = new WeakMap(), _TextAccessibilityManager_instances = new WeakSet(), _TextAccessibilityManager_compareElementPositions = function _TextAccessibilityManager_compareElementPositions(e1, e2) {
|
|
183
188
|
const rect1 = e1.getBoundingClientRect();
|
|
@@ -64,6 +64,12 @@ class EventBus {
|
|
|
64
64
|
constructor() {
|
|
65
65
|
_EventBus_listeners.set(this, Object.create(null));
|
|
66
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Returs the current event listeners - used purely for debugging purposes.
|
|
69
|
+
*/
|
|
70
|
+
getListeners() {
|
|
71
|
+
return __classPrivateFieldGet(this, _EventBus_listeners, "f");
|
|
72
|
+
}
|
|
67
73
|
/**
|
|
68
74
|
* @param {string} eventName
|
|
69
75
|
* @param {function} listener
|
|
@@ -124,13 +124,25 @@ class TextLayerBuilder {
|
|
|
124
124
|
* Cancel rendering of the text layer.
|
|
125
125
|
*/
|
|
126
126
|
cancel() {
|
|
127
|
-
var _b, _c;
|
|
127
|
+
var _b, _c, _d;
|
|
128
128
|
(_b = __classPrivateFieldGet(this, _TextLayerBuilder_textLayer, "f")) === null || _b === void 0 ? void 0 : _b.cancel();
|
|
129
129
|
__classPrivateFieldSet(this, _TextLayerBuilder_textLayer, null, "f");
|
|
130
130
|
// this.highlighter?.disable();
|
|
131
131
|
(_c = this.accessibilityManager) === null || _c === void 0 ? void 0 : _c.disable();
|
|
132
|
+
(_d = this.accessibilityManager) === null || _d === void 0 ? void 0 : _d.destroy();
|
|
132
133
|
__classPrivateFieldGet(_a, _a, "m", _TextLayerBuilder_removeGlobalSelectionListener).call(_a, this.div);
|
|
133
134
|
}
|
|
135
|
+
destroy() {
|
|
136
|
+
var _b, _c;
|
|
137
|
+
TextLayer.cleanup();
|
|
138
|
+
this.cancel();
|
|
139
|
+
this.pdfPage = null;
|
|
140
|
+
// this.highlighter = null;
|
|
141
|
+
(_b = this.accessibilityManager) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
142
|
+
this.accessibilityManager = null;
|
|
143
|
+
(_c = this.div) === null || _c === void 0 ? void 0 : _c.remove();
|
|
144
|
+
this.div = null;
|
|
145
|
+
}
|
|
134
146
|
}
|
|
135
147
|
_a = TextLayerBuilder, _TextLayerBuilder_onAppend = new WeakMap(), _TextLayerBuilder_textLayer = new WeakMap(), _TextLayerBuilder_instances = new WeakSet(), _TextLayerBuilder_bindMouse = function _TextLayerBuilder_bindMouse(end) {
|
|
136
148
|
const { div } = this;
|
package/dist/es/utils.js
CHANGED
|
@@ -399,10 +399,10 @@ export const scrollToPage = (rootElement, pageNumber) => {
|
|
|
399
399
|
*/
|
|
400
400
|
export const currentPage = (rootElement) => {
|
|
401
401
|
const scrollElement = rootElement.querySelector('.k-pdf-viewer-canvas');
|
|
402
|
-
const page = rootElement.querySelector('.k-page');
|
|
402
|
+
const page = rootElement.querySelector('.k-page:not(.k-blank-page)');
|
|
403
403
|
return scrollElement && page
|
|
404
404
|
? Math.floor(Math.round(scrollElement.scrollTop) /
|
|
405
|
-
(page.offsetHeight + page.offsetTop) +
|
|
405
|
+
Math.max(1, page.offsetHeight + page.offsetTop) +
|
|
406
406
|
0.01)
|
|
407
407
|
: 0;
|
|
408
408
|
};
|
|
@@ -482,3 +482,4 @@ const createCanvas = (page, zoom = 1, cssClass = '') => {
|
|
|
482
482
|
styles
|
|
483
483
|
};
|
|
484
484
|
};
|
|
485
|
+
export const getDevicePixelRatio = () => (window === null || window === void 0 ? void 0 : window.devicePixelRatio) || 1;
|
package/dist/es/widget/page.js
CHANGED
|
@@ -92,12 +92,31 @@ export class Page extends Component {
|
|
|
92
92
|
// todo: ported from pdf.js
|
|
93
93
|
this.pdfViewer = options.pdfViewer;
|
|
94
94
|
this.pdfPage = options.pdfPage;
|
|
95
|
+
__classPrivateFieldSet(this, _Page_annotationMode, this.pdfViewer.getAnnotationMode(), "f");
|
|
95
96
|
this.resetState();
|
|
96
97
|
}
|
|
97
98
|
destroy() {
|
|
99
|
+
var _a, _b, _c, _d, _e;
|
|
98
100
|
this.destroyTextLayer();
|
|
101
|
+
if (this.canvas) {
|
|
102
|
+
this.canvas.width = 0;
|
|
103
|
+
this.canvas.height = 0;
|
|
104
|
+
this.canvas.remove();
|
|
105
|
+
this.canvas = null;
|
|
106
|
+
}
|
|
107
|
+
if (this.canvasForPrint) {
|
|
108
|
+
this.canvasForPrint.width = 0;
|
|
109
|
+
this.canvasForPrint.height = 0;
|
|
110
|
+
this.canvasForPrint.remove();
|
|
111
|
+
this.canvasForPrint = null;
|
|
112
|
+
}
|
|
113
|
+
(_a = this.drawLayer) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
114
|
+
(_b = this.annotationLayer) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
115
|
+
(_c = this.annotationEditorLayer) === null || _c === void 0 ? void 0 : _c.destroy();
|
|
116
|
+
(_d = this.div) === null || _d === void 0 ? void 0 : _d.remove();
|
|
99
117
|
this.div = null;
|
|
100
118
|
this.pdfViewer = null;
|
|
119
|
+
(_e = this.pdfPage) === null || _e === void 0 ? void 0 : _e.cleanup();
|
|
101
120
|
this.pdfPage = null;
|
|
102
121
|
}
|
|
103
122
|
get isEditing() {
|
|
@@ -128,6 +147,9 @@ export class Page extends Component {
|
|
|
128
147
|
return viewport;
|
|
129
148
|
}
|
|
130
149
|
destroyTextLayer() {
|
|
150
|
+
var _a, _b;
|
|
151
|
+
(_a = this.textLayer) === null || _a === void 0 ? void 0 : _a.cancel();
|
|
152
|
+
(_b = this.textLayer) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
131
153
|
this.removeTextLayer();
|
|
132
154
|
this.textLayer = null;
|
|
133
155
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var _PdfViewer_instances, _PdfViewer_annotationEditorMode, _PdfViewer_switchAnnotationEditorModeTimeoutId, _PdfViewer_eventAbortController, _PdfViewer_onPageRenderedCallback, _PdfViewer_switchToEditAnnotationMode, _PdfViewer_scrollIntoView;
|
|
1
|
+
var _PdfViewer_instances, _PdfViewer_annotationEditorMode, _PdfViewer_switchAnnotationEditorModeTimeoutId, _PdfViewer_annotationMode, _PdfViewer_eventAbortController, _PdfViewer_onPageRenderedCallback, _PdfViewer_switchToEditAnnotationMode, _PdfViewer_scrollIntoView;
|
|
2
2
|
import { __awaiter, __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
|
3
3
|
import { deepExtend, Component, isString, toArray, noop, hasValue, toClassSelector, addClass, removeClass, mousewheelDelta, convertToHtml, clamp, createPromise } from "../common/main";
|
|
4
|
-
import { currentPage, parsePdfFromBase64String,
|
|
4
|
+
import { currentPage, parsePdfFromBase64String, adjustCanvasSize, createElement, getDevicePixelRatio } from "../utils";
|
|
5
5
|
import { SearchService } from "../search";
|
|
6
6
|
import { Scroller, throttle } from "../scroller";
|
|
7
7
|
import { saveAs } from "@progress/kendo-file-saver";
|
|
@@ -49,6 +49,7 @@ export class PdfViewer extends Component {
|
|
|
49
49
|
zoomLevel: DEFAULT_ZOOM_LEVEL,
|
|
50
50
|
zoomBeforePrint: false,
|
|
51
51
|
zoomLevelForPrint: 3,
|
|
52
|
+
renderForms: false,
|
|
52
53
|
searchMatchScrollLeftOffset: 0,
|
|
53
54
|
// add some default offset, so that the found match
|
|
54
55
|
// does not appear on the top edge of the page when navigated to
|
|
@@ -60,6 +61,7 @@ export class PdfViewer extends Component {
|
|
|
60
61
|
pageWheelThrottleDelay: 200,
|
|
61
62
|
// ported from pdf.js
|
|
62
63
|
printResolution: 100,
|
|
64
|
+
renderScale: 1.4,
|
|
63
65
|
loadOnDemand: false,
|
|
64
66
|
loadOnDemandPageSize: 2,
|
|
65
67
|
messages: {
|
|
@@ -121,7 +123,7 @@ export class PdfViewer extends Component {
|
|
|
121
123
|
// #annotationEditorHighlightColors = null;
|
|
122
124
|
// #annotationEditorMode = AnnotationEditorType.NONE;
|
|
123
125
|
// #annotationEditorUIManager = null;
|
|
124
|
-
|
|
126
|
+
_PdfViewer_annotationMode.set(this, AnnotationMode.ENABLE);
|
|
125
127
|
// #containerTopLeft = null;
|
|
126
128
|
// #enableHWA = false;
|
|
127
129
|
// #enableHighlightFloatingButton = false;
|
|
@@ -181,7 +183,7 @@ export class PdfViewer extends Component {
|
|
|
181
183
|
// as this can only be obtained by JS
|
|
182
184
|
this.tryTriggerScroll = (e) => {
|
|
183
185
|
let isPageChanged = false;
|
|
184
|
-
const pageNumber =
|
|
186
|
+
const pageNumber = this.getCurrentPageIndex() + 1;
|
|
185
187
|
if (pageNumber !== this.state.activePageNumber && (pageNumber >= 1 && pageNumber <= this.state.pdfDocument.numPages)) {
|
|
186
188
|
isPageChanged = true;
|
|
187
189
|
this.state.activePageNumber = pageNumber;
|
|
@@ -218,6 +220,7 @@ export class PdfViewer extends Component {
|
|
|
218
220
|
return;
|
|
219
221
|
}
|
|
220
222
|
e.preventDefault();
|
|
223
|
+
e.stopPropagation();
|
|
221
224
|
const wheelDelta = mousewheelDelta(e);
|
|
222
225
|
const zoomModifier = wheelDelta < 0 ? 1 : -1;
|
|
223
226
|
const zoomLevel = this.state.zoomLevel + (zoomModifier * this.options.zoomRate);
|
|
@@ -236,6 +239,8 @@ export class PdfViewer extends Component {
|
|
|
236
239
|
this.wrapper = this.element;
|
|
237
240
|
this.initEventBus();
|
|
238
241
|
__classPrivateFieldSet(this, _PdfViewer_eventAbortController, new AbortController(), "f");
|
|
242
|
+
if (this.options.renderForms)
|
|
243
|
+
__classPrivateFieldSet(this, _PdfViewer_annotationMode, AnnotationMode.ENABLE_FORMS, "f");
|
|
239
244
|
this.resetState();
|
|
240
245
|
this.bindEvents();
|
|
241
246
|
this.initLinkService();
|
|
@@ -326,6 +331,9 @@ export class PdfViewer extends Component {
|
|
|
326
331
|
}
|
|
327
332
|
updater();
|
|
328
333
|
}
|
|
334
|
+
getAnnotationMode() {
|
|
335
|
+
return __classPrivateFieldGet(this, _PdfViewer_annotationMode, "f");
|
|
336
|
+
}
|
|
329
337
|
getPrintUnits() {
|
|
330
338
|
return this.options.printResolution / PixelsPerInch.PDF;
|
|
331
339
|
}
|
|
@@ -740,20 +748,15 @@ export class PdfViewer extends Component {
|
|
|
740
748
|
if (zoom <= 0) {
|
|
741
749
|
return;
|
|
742
750
|
}
|
|
743
|
-
const renderScale =
|
|
751
|
+
const renderScale = this.options.renderScale * getDevicePixelRatio();
|
|
744
752
|
let scaleNum = zoom * renderScale;
|
|
745
753
|
if (printUnits) {
|
|
746
754
|
scaleNum = zoom || renderScale;
|
|
747
755
|
}
|
|
748
|
-
// const scaleNum = zoom * renderScale;
|
|
749
756
|
// changing the viewport dimensions here requires changes in
|
|
750
757
|
// page.getPrintContentAsync for the printing dimensions
|
|
751
758
|
const viewport = pdfPage === null || pdfPage === void 0 ? void 0 : pdfPage.getViewport({ scale: scaleNum });
|
|
752
759
|
const { adjustedWidth, adjustedHeight, adjustRatio } = adjustCanvasSize(viewport.width, viewport.height);
|
|
753
|
-
// const styles = {
|
|
754
|
-
// width: Math.floor(viewport.width / scaleNum) * zoom + 'pt',
|
|
755
|
-
// height: Math.floor(viewport.height / scaleNum) * zoom + 'pt'
|
|
756
|
-
// };
|
|
757
760
|
// use PageView.setLayerDimensions
|
|
758
761
|
const { pageWidth, pageHeight } = viewport.rawDims;
|
|
759
762
|
const styles = {
|
|
@@ -851,7 +854,7 @@ export class PdfViewer extends Component {
|
|
|
851
854
|
// optionalContentConfigPromise,
|
|
852
855
|
// renderingQueue: this.renderingQueue,
|
|
853
856
|
textLayerMode: TextLayerMode.ENABLE,
|
|
854
|
-
annotationMode:
|
|
857
|
+
annotationMode: this.getAnnotationMode(),
|
|
855
858
|
// imageResourcesPath: this.imageResourcesPath,
|
|
856
859
|
// maxCanvasPixels: this.maxCanvasPixels,
|
|
857
860
|
// pageColors,
|
|
@@ -940,8 +943,16 @@ export class PdfViewer extends Component {
|
|
|
940
943
|
// and then revert
|
|
941
944
|
serializedAnnotationStorage = {};
|
|
942
945
|
originalAnnotationStorage = options.pdf.annotationStorage.getAll();
|
|
946
|
+
// With the form filling functionality enabled, values could be coming as pure JSON objects,
|
|
947
|
+
// thus the additional assertion.
|
|
943
948
|
Object.keys(originalAnnotationStorage).forEach((key) => {
|
|
944
|
-
|
|
949
|
+
var _a;
|
|
950
|
+
if (typeof ((_a = originalAnnotationStorage[key]) === null || _a === void 0 ? void 0 : _a.toJSON) === "function") {
|
|
951
|
+
serializedAnnotationStorage[key] = originalAnnotationStorage[key].toJSON();
|
|
952
|
+
}
|
|
953
|
+
else {
|
|
954
|
+
serializedAnnotationStorage[key] = originalAnnotationStorage[key];
|
|
955
|
+
}
|
|
945
956
|
});
|
|
946
957
|
Object.keys(originalAnnotationStorage).forEach((key) => {
|
|
947
958
|
options.pdf.annotationStorage.remove(key);
|
|
@@ -1628,7 +1639,7 @@ export class PdfViewer extends Component {
|
|
|
1628
1639
|
return true;
|
|
1629
1640
|
}
|
|
1630
1641
|
}
|
|
1631
|
-
_PdfViewer_annotationEditorMode = new WeakMap(), _PdfViewer_switchAnnotationEditorModeTimeoutId = new WeakMap(), _PdfViewer_eventAbortController = new WeakMap(), _PdfViewer_onPageRenderedCallback = new WeakMap(), _PdfViewer_instances = new WeakSet(), _PdfViewer_switchToEditAnnotationMode = function _PdfViewer_switchToEditAnnotationMode() {
|
|
1642
|
+
_PdfViewer_annotationEditorMode = new WeakMap(), _PdfViewer_switchAnnotationEditorModeTimeoutId = new WeakMap(), _PdfViewer_annotationMode = new WeakMap(), _PdfViewer_eventAbortController = new WeakMap(), _PdfViewer_onPageRenderedCallback = new WeakMap(), _PdfViewer_instances = new WeakSet(), _PdfViewer_switchToEditAnnotationMode = function _PdfViewer_switchToEditAnnotationMode() {
|
|
1632
1643
|
// const visible = this._getVisiblePages();
|
|
1633
1644
|
// const visible = this._getVisiblePages();
|
|
1634
1645
|
const pagesToRefresh = [];
|
|
@@ -112,11 +112,12 @@ class AnnotationEditorLayerBuilder {
|
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
114
|
cancel() {
|
|
115
|
+
var _a;
|
|
115
116
|
this._cancelled = true;
|
|
116
117
|
if (!this.div) {
|
|
117
118
|
return;
|
|
118
119
|
}
|
|
119
|
-
this.annotationEditorLayer.destroy();
|
|
120
|
+
(_a = this.annotationEditorLayer) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
120
121
|
}
|
|
121
122
|
hide() {
|
|
122
123
|
if (!this.div) {
|
|
@@ -130,6 +131,10 @@ class AnnotationEditorLayerBuilder {
|
|
|
130
131
|
}
|
|
131
132
|
this.div.hidden = false;
|
|
132
133
|
}
|
|
134
|
+
destroy() {
|
|
135
|
+
var _a;
|
|
136
|
+
(_a = this.annotationEditorLayer) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
137
|
+
}
|
|
133
138
|
}
|
|
134
139
|
_AnnotationEditorLayerBuilder_annotationLayer = new WeakMap(), _AnnotationEditorLayerBuilder_drawLayer = new WeakMap(), _AnnotationEditorLayerBuilder_onAppend = new WeakMap(), _AnnotationEditorLayerBuilder_textLayer = new WeakMap(), _AnnotationEditorLayerBuilder_uiManager = new WeakMap();
|
|
135
140
|
export { AnnotationEditorLayerBuilder };
|
|
@@ -242,6 +242,9 @@ export class AnnotationEditorUIManager {
|
|
|
242
242
|
this._eventBus._on("setpreference", this.onSetPreference.bind(this), {
|
|
243
243
|
signal
|
|
244
244
|
});
|
|
245
|
+
this._eventBus._on("namedaction", this.onNamedAction.bind(this), {
|
|
246
|
+
signal
|
|
247
|
+
});
|
|
245
248
|
__classPrivateFieldGet(this, _AnnotationEditorUIManager_instances, "m", _AnnotationEditorUIManager_addSelectionListener).call(this);
|
|
246
249
|
__classPrivateFieldGet(this, _AnnotationEditorUIManager_instances, "m", _AnnotationEditorUIManager_addDragAndDropListeners).call(this);
|
|
247
250
|
__classPrivateFieldGet(this, _AnnotationEditorUIManager_instances, "m", _AnnotationEditorUIManager_addKeyboardManager).call(this);
|
|
@@ -388,6 +391,18 @@ export class AnnotationEditorUIManager {
|
|
|
388
391
|
default: break;
|
|
389
392
|
}
|
|
390
393
|
}
|
|
394
|
+
onNamedAction(event) {
|
|
395
|
+
// Processing a couple of named actions that might be useful, see also
|
|
396
|
+
// `PDFLinkService.executeNamedAction`.
|
|
397
|
+
switch (event.action) {
|
|
398
|
+
case "Print":
|
|
399
|
+
this.triggerPrinting();
|
|
400
|
+
break;
|
|
401
|
+
case "SaveAs":
|
|
402
|
+
this.downloadOrSave();
|
|
403
|
+
break;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
391
406
|
onPageChanging({ pageNumber }) {
|
|
392
407
|
__classPrivateFieldSet(this, _AnnotationEditorUIManager_currentPageIndex, pageNumber - 1, "f");
|
|
393
408
|
}
|
|
@@ -407,6 +422,16 @@ export class AnnotationEditorUIManager {
|
|
|
407
422
|
}
|
|
408
423
|
return null;
|
|
409
424
|
}
|
|
425
|
+
triggerPrinting() {
|
|
426
|
+
var _a;
|
|
427
|
+
(_a = this.pdfViewer) === null || _a === void 0 ? void 0 : _a.printFile();
|
|
428
|
+
}
|
|
429
|
+
downloadOrSave() {
|
|
430
|
+
var _a, _b;
|
|
431
|
+
(_a = this.pdfViewer) === null || _a === void 0 ? void 0 : _a.downloadFile({
|
|
432
|
+
fileName: (_b = this.pdfViewer) === null || _b === void 0 ? void 0 : _b.options.downloadFileName
|
|
433
|
+
});
|
|
434
|
+
}
|
|
410
435
|
disableUserSelect(value = false) {
|
|
411
436
|
var _a;
|
|
412
437
|
(_a = __classPrivateFieldGet(this, _AnnotationEditorUIManager_viewer, "f")) === null || _a === void 0 ? void 0 : _a.classList.toggle("noUserSelect", value);
|
|
@@ -143,8 +143,8 @@ class AnnotationLayerBuilder {
|
|
|
143
143
|
(_b = __classPrivateFieldGet(this, _AnnotationLayerBuilder_onAppend, "f")) === null || _b === void 0 ? void 0 : _b.call(this, div);
|
|
144
144
|
this.annotationLayer = new AnnotationLayer({
|
|
145
145
|
div,
|
|
146
|
-
|
|
147
|
-
accessibilityManager: null,
|
|
146
|
+
accessibilityManager: this._accessibilityManager,
|
|
147
|
+
// accessibilityManager: null,
|
|
148
148
|
annotationCanvasMap: this._annotationCanvasMap,
|
|
149
149
|
annotationEditorUIManager: this._annotationEditorUIManager,
|
|
150
150
|
page: this.pdfPage,
|
|
@@ -154,9 +154,9 @@ class AnnotationLayerBuilder {
|
|
|
154
154
|
annotations,
|
|
155
155
|
// imageResourcesPath: this.imageResourcesPath,
|
|
156
156
|
renderForms: this.renderForms,
|
|
157
|
-
linkService: this.linkService
|
|
157
|
+
linkService: this.linkService,
|
|
158
158
|
// downloadManager: this.downloadManager,
|
|
159
|
-
|
|
159
|
+
annotationStorage: this.annotationStorage
|
|
160
160
|
// enableScripting: this.enableScripting,
|
|
161
161
|
// hasJSActions,
|
|
162
162
|
// fieldObjects,
|
|
@@ -190,6 +190,16 @@ class AnnotationLayerBuilder {
|
|
|
190
190
|
var _a;
|
|
191
191
|
return !!((_a = this.annotationLayer) === null || _a === void 0 ? void 0 : _a.hasEditableAnnotations());
|
|
192
192
|
}
|
|
193
|
+
destroy() {
|
|
194
|
+
var _a, _b, _c;
|
|
195
|
+
this.cancel();
|
|
196
|
+
(_a = this.annotationLayer) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
197
|
+
this.annotationLayer = null;
|
|
198
|
+
(_b = __classPrivateFieldGet(this, _AnnotationLayerBuilder_eventAbortController, "f")) === null || _b === void 0 ? void 0 : _b.abort();
|
|
199
|
+
__classPrivateFieldSet(this, _AnnotationLayerBuilder_eventAbortController, null, "f");
|
|
200
|
+
(_c = this.div) === null || _c === void 0 ? void 0 : _c.remove();
|
|
201
|
+
this.div = null;
|
|
202
|
+
}
|
|
193
203
|
}
|
|
194
204
|
_AnnotationLayerBuilder_onAppend = new WeakMap(), _AnnotationLayerBuilder_eventAbortController = new WeakMap(), _AnnotationLayerBuilder_instances = new WeakSet(), _AnnotationLayerBuilder_updatePresentationModeState = function _AnnotationLayerBuilder_updatePresentationModeState(state) {
|
|
195
205
|
if (!this.div) {
|