@chialab/pdfjs-lib 1.0.0-alpha.0
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 +29 -0
- package/dist/browser/FoxitDingbats-SB6TO3S5.js +9 -0
- package/dist/browser/FoxitFixed-UIGSMBQB.js +9 -0
- package/dist/browser/FoxitFixedBold-2PAEIZAT.js +9 -0
- package/dist/browser/FoxitFixedBoldItalic-OSQUQDEE.js +9 -0
- package/dist/browser/FoxitFixedItalic-W73RDK22.js +9 -0
- package/dist/browser/FoxitSerif-3HH3SOZF.js +9 -0
- package/dist/browser/FoxitSerifBold-HXP2QOO7.js +9 -0
- package/dist/browser/FoxitSerifBoldItalic-FZXLNWD7.js +9 -0
- package/dist/browser/FoxitSerifItalic-WQFHUBI2.js +9 -0
- package/dist/browser/FoxitSymbol-OVWU7LKS.js +9 -0
- package/dist/browser/LiberationMono-Regular-UUOCTXY2.js +9 -0
- package/dist/browser/LiberationSans-Bold-GSJN42N5.js +9 -0
- package/dist/browser/LiberationSans-BoldItalic-UCPQJ3L2.js +9 -0
- package/dist/browser/LiberationSans-Italic-6CIHEALY.js +9 -0
- package/dist/browser/LiberationSans-Regular-KIF3IRJY.js +9 -0
- package/dist/browser/LiberationSerif-Regular-ASQ2LI3D.js +9 -0
- package/dist/browser/chunk-DYHYQ33L.js +1775 -0
- package/dist/browser/chunk-O4UKW7AD.js +44 -0
- package/dist/browser/index.js +26324 -0
- package/dist/browser/worker.js +84242 -0
- package/dist/index.d.ts +10 -0
- package/dist/lib/AnnotationData.d.ts +204 -0
- package/dist/lib/Canvas.d.ts +17 -0
- package/dist/lib/PDFPageProxy.d.ts +1 -0
- package/dist/lib/Path2D.d.ts +72 -0
- package/dist/lib/StandardFontDataFactory.d.ts +14 -0
- package/dist/lib/SvgCanvasContext.d.ts +156 -0
- package/dist/lib/TextLayer.d.ts +51 -0
- package/dist/lib/polyfills.d.ts +0 -0
- package/dist/lib/utils.d.ts +13 -0
- package/dist/node/FoxitDingbats-65AZ2Z2V.js +9 -0
- package/dist/node/FoxitFixed-OZGLVVOQ.js +9 -0
- package/dist/node/FoxitFixedBold-37OOYMV7.js +9 -0
- package/dist/node/FoxitFixedBoldItalic-XYFHEG2V.js +9 -0
- package/dist/node/FoxitFixedItalic-MM7OSGS6.js +9 -0
- package/dist/node/FoxitSerif-MLMJQPRP.js +9 -0
- package/dist/node/FoxitSerifBold-AC7RJQWJ.js +9 -0
- package/dist/node/FoxitSerifBoldItalic-YCQ4CLKE.js +9 -0
- package/dist/node/FoxitSerifItalic-CXVTCST4.js +9 -0
- package/dist/node/FoxitSymbol-VUGMZN5C.js +9 -0
- package/dist/node/LiberationMono-Regular-KMFXXO3B.js +9 -0
- package/dist/node/LiberationSans-Bold-XSHQQBWB.js +9 -0
- package/dist/node/LiberationSans-BoldItalic-CTAZRFRL.js +9 -0
- package/dist/node/LiberationSans-Italic-WIOTUKLC.js +9 -0
- package/dist/node/LiberationSans-Regular-CDMMZL5S.js +9 -0
- package/dist/node/LiberationSerif-Regular-WAOWR76G.js +9 -0
- package/dist/node/chunk-7MW5RQZ5.js +30 -0
- package/dist/node/chunk-KTTVPO2G.js +1775 -0
- package/dist/node/index.js +26621 -0
- package/dist/node/worker.js +84242 -0
- package/dist/pdf.js/src/display/annotation_layer.d.ts +241 -0
- package/dist/pdf.js/src/display/annotation_storage.d.ts +99 -0
- package/dist/pdf.js/src/display/api.d.ts +1586 -0
- package/dist/pdf.js/src/display/canvas.d.ts +213 -0
- package/dist/pdf.js/src/display/canvas_factory.d.ts +27 -0
- package/dist/pdf.js/src/display/cmap_reader_factory.d.ts +25 -0
- package/dist/pdf.js/src/display/display_utils.d.ts +247 -0
- package/dist/pdf.js/src/display/draw_layer.d.ts +26 -0
- package/dist/pdf.js/src/display/editor/alt_text.d.ts +34 -0
- package/dist/pdf.js/src/display/editor/annotation_editor_layer.d.ts +230 -0
- package/dist/pdf.js/src/display/editor/color_picker.d.ts +20 -0
- package/dist/pdf.js/src/display/editor/draw.d.ts +121 -0
- package/dist/pdf.js/src/display/editor/drawers/contour.d.ts +3 -0
- package/dist/pdf.js/src/display/editor/drawers/freedraw.d.ts +31 -0
- package/dist/pdf.js/src/display/editor/drawers/highlight.d.ts +36 -0
- package/dist/pdf.js/src/display/editor/drawers/inkdraw.d.ts +129 -0
- package/dist/pdf.js/src/display/editor/drawers/outline.d.ts +19 -0
- package/dist/pdf.js/src/display/editor/drawers/signaturedraw.d.ts +79 -0
- package/dist/pdf.js/src/display/editor/editor.d.ts +474 -0
- package/dist/pdf.js/src/display/editor/freetext.d.ts +59 -0
- package/dist/pdf.js/src/display/editor/highlight.d.ts +70 -0
- package/dist/pdf.js/src/display/editor/ink.d.ts +36 -0
- package/dist/pdf.js/src/display/editor/signature.d.ts +79 -0
- package/dist/pdf.js/src/display/editor/stamp.d.ts +48 -0
- package/dist/pdf.js/src/display/editor/toolbar.d.ts +21 -0
- package/dist/pdf.js/src/display/editor/tools.d.ts +424 -0
- package/dist/pdf.js/src/display/filter_factory.d.ts +29 -0
- package/dist/pdf.js/src/display/font_loader.d.ts +39 -0
- package/dist/pdf.js/src/display/metadata.d.ts +11 -0
- package/dist/pdf.js/src/display/node_utils.d.ts +32 -0
- package/dist/pdf.js/src/display/optional_content_config.d.ts +18 -0
- package/dist/pdf.js/src/display/pattern_helper.d.ts +73 -0
- package/dist/pdf.js/src/display/standard_fontdata_factory.d.ts +20 -0
- package/dist/pdf.js/src/display/svg_factory.d.ts +14 -0
- package/dist/pdf.js/src/display/text_layer.d.ts +85 -0
- package/dist/pdf.js/src/display/touch_manager.d.ts +14 -0
- package/dist/pdf.js/src/display/transport_stream.d.ts +67 -0
- package/dist/pdf.js/src/display/wasm_factory.d.ts +20 -0
- package/dist/pdf.js/src/display/worker_options.d.ts +25 -0
- package/dist/pdf.js/src/display/xfa_layer.d.ts +47 -0
- package/dist/pdf.js/src/display/xfa_text.d.ts +21 -0
- package/dist/pdf.js/src/interfaces.d.ts +122 -0
- package/dist/pdf.js/src/pdf.d.ts +55 -0
- package/dist/pdf.js/src/shared/image_utils.d.ts +17 -0
- package/dist/pdf.js/src/shared/message_handler.d.ts +48 -0
- package/dist/pdf.js/src/shared/murmurhash3.d.ts +7 -0
- package/dist/pdf.js/src/shared/scripting_utils.d.ts +16 -0
- package/dist/pdf.js/src/shared/util.d.ts +388 -0
- package/dist/pdf.js/web/interfaces.d.ts +167 -0
- package/dist/pdf.js/web/struct_tree_layer_builder.d.ts +25 -0
- package/dist/pdf.js/web/text_accessibility.d.ts +44 -0
- package/dist/pdf.js/web/ui_utils.d.ts +273 -0
- package/package.json +43 -0
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
export type AnnotationEditorLayer = import("./annotation_editor_layer.js").AnnotationEditorLayer;
|
|
2
|
+
export type AnnotationEditorParameters = {
|
|
3
|
+
/**
|
|
4
|
+
* - the global manager
|
|
5
|
+
*/
|
|
6
|
+
uiManager: AnnotationEditorUIManager;
|
|
7
|
+
/**
|
|
8
|
+
* - the layer containing this editor
|
|
9
|
+
*/
|
|
10
|
+
parent: AnnotationEditorLayer;
|
|
11
|
+
/**
|
|
12
|
+
* - editor id
|
|
13
|
+
*/
|
|
14
|
+
id: string;
|
|
15
|
+
/**
|
|
16
|
+
* - x-coordinate
|
|
17
|
+
*/
|
|
18
|
+
x: number;
|
|
19
|
+
/**
|
|
20
|
+
* - y-coordinate
|
|
21
|
+
*/
|
|
22
|
+
y: number;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* @typedef {Object} AnnotationEditorParameters
|
|
26
|
+
* @property {AnnotationEditorUIManager} uiManager - the global manager
|
|
27
|
+
* @property {AnnotationEditorLayer} parent - the layer containing this editor
|
|
28
|
+
* @property {string} id - editor id
|
|
29
|
+
* @property {number} x - x-coordinate
|
|
30
|
+
* @property {number} y - y-coordinate
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* Base class for editors.
|
|
34
|
+
*/
|
|
35
|
+
export class AnnotationEditor {
|
|
36
|
+
static _l10n: null;
|
|
37
|
+
static _l10nResizer: null;
|
|
38
|
+
static _borderLineWidth: number;
|
|
39
|
+
static _colorManager: ColorManager;
|
|
40
|
+
static _zIndex: number;
|
|
41
|
+
static _telemetryTimeout: number;
|
|
42
|
+
static get _resizerKeyboardManager(): any;
|
|
43
|
+
static get isDrawer(): boolean;
|
|
44
|
+
static get _defaultLineColor(): any;
|
|
45
|
+
static deleteAnnotationElement(editor: any): void;
|
|
46
|
+
/**
|
|
47
|
+
* Initialize the l10n stuff for this type of editor.
|
|
48
|
+
* @param {Object} l10n
|
|
49
|
+
*/
|
|
50
|
+
static initialize(l10n: Object, _uiManager: any): void;
|
|
51
|
+
/**
|
|
52
|
+
* Update the default parameters for this type of editor.
|
|
53
|
+
* @param {number} _type
|
|
54
|
+
* @param {*} _value
|
|
55
|
+
*/
|
|
56
|
+
static updateDefaultParams(_type: number, _value: any): void;
|
|
57
|
+
/**
|
|
58
|
+
* Get the default properties to set in the UI for this type of editor.
|
|
59
|
+
* @returns {Array}
|
|
60
|
+
*/
|
|
61
|
+
static get defaultPropertiesToUpdate(): any[];
|
|
62
|
+
/**
|
|
63
|
+
* Check if this kind of editor is able to handle the given mime type for
|
|
64
|
+
* pasting.
|
|
65
|
+
* @param {string} mime
|
|
66
|
+
* @returns {boolean}
|
|
67
|
+
*/
|
|
68
|
+
static isHandlingMimeForPasting(mime: string): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Extract the data from the clipboard item and delegate the creation of the
|
|
71
|
+
* editor to the parent.
|
|
72
|
+
* @param {DataTransferItem} item
|
|
73
|
+
* @param {AnnotationEditorLayer} parent
|
|
74
|
+
*/
|
|
75
|
+
static paste(item: DataTransferItem, parent: AnnotationEditorLayer): void;
|
|
76
|
+
static "__#42@#rotatePoint"(x: any, y: any, angle: any): any[];
|
|
77
|
+
static _round(x: any): number;
|
|
78
|
+
/**
|
|
79
|
+
* Deserialize the editor.
|
|
80
|
+
* The result of the deserialization is a new editor.
|
|
81
|
+
*
|
|
82
|
+
* @param {Object} data
|
|
83
|
+
* @param {AnnotationEditorLayer} parent
|
|
84
|
+
* @param {AnnotationEditorUIManager} uiManager
|
|
85
|
+
* @returns {Promise<AnnotationEditor | null>}
|
|
86
|
+
*/
|
|
87
|
+
static deserialize(data: Object, parent: AnnotationEditorLayer, uiManager: AnnotationEditorUIManager): Promise<AnnotationEditor | null>;
|
|
88
|
+
static get MIN_SIZE(): number;
|
|
89
|
+
static canCreateNewEmptyEditor(): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* @param {AnnotationEditorParameters} parameters
|
|
92
|
+
*/
|
|
93
|
+
constructor(parameters: AnnotationEditorParameters);
|
|
94
|
+
_isCopy: boolean;
|
|
95
|
+
_editToolbar: null;
|
|
96
|
+
_initialOptions: any;
|
|
97
|
+
_initialData: null;
|
|
98
|
+
_isVisible: boolean;
|
|
99
|
+
_uiManager: null;
|
|
100
|
+
_focusEventsAllowed: boolean;
|
|
101
|
+
parent: import("./annotation_editor_layer.js").AnnotationEditorLayer;
|
|
102
|
+
id: string;
|
|
103
|
+
width: any;
|
|
104
|
+
height: any;
|
|
105
|
+
pageIndex: number;
|
|
106
|
+
name: any;
|
|
107
|
+
div: HTMLDivElement | null;
|
|
108
|
+
annotationElementId: any;
|
|
109
|
+
_willKeepAspectRatio: boolean;
|
|
110
|
+
_structTreeParentId: any;
|
|
111
|
+
rotation: number;
|
|
112
|
+
pageRotation: number;
|
|
113
|
+
pageDimensions: any[];
|
|
114
|
+
pageTranslation: any[];
|
|
115
|
+
x: number;
|
|
116
|
+
y: number;
|
|
117
|
+
isAttachedToDOM: boolean;
|
|
118
|
+
deleted: boolean;
|
|
119
|
+
get editorType(): any;
|
|
120
|
+
/**
|
|
121
|
+
* Get the properties to update in the UI for this editor.
|
|
122
|
+
* @returns {Array}
|
|
123
|
+
*/
|
|
124
|
+
get propertiesToUpdate(): any[];
|
|
125
|
+
set _isDraggable(value: boolean);
|
|
126
|
+
get _isDraggable(): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* @returns {boolean} true if the editor handles the Enter key itself.
|
|
129
|
+
*/
|
|
130
|
+
get isEnterHandled(): boolean;
|
|
131
|
+
center(): void;
|
|
132
|
+
/**
|
|
133
|
+
* Add some commands into the CommandManager (undo/redo stuff).
|
|
134
|
+
* @param {Object} params
|
|
135
|
+
*/
|
|
136
|
+
addCommands(params: Object): void;
|
|
137
|
+
get currentLayer(): any;
|
|
138
|
+
/**
|
|
139
|
+
* This editor will be behind the others.
|
|
140
|
+
*/
|
|
141
|
+
setInBackground(): void;
|
|
142
|
+
/**
|
|
143
|
+
* This editor will be in the foreground.
|
|
144
|
+
*/
|
|
145
|
+
setInForeground(): void;
|
|
146
|
+
setParent(parent: any): void;
|
|
147
|
+
/**
|
|
148
|
+
* onfocus callback.
|
|
149
|
+
*/
|
|
150
|
+
focusin(event: any): void;
|
|
151
|
+
/**
|
|
152
|
+
* onblur callback.
|
|
153
|
+
* @param {FocusEvent} event
|
|
154
|
+
*/
|
|
155
|
+
focusout(event: FocusEvent): void;
|
|
156
|
+
commitOrRemove(): void;
|
|
157
|
+
/**
|
|
158
|
+
* Commit the data contained in this editor.
|
|
159
|
+
*/
|
|
160
|
+
commit(): void;
|
|
161
|
+
addToAnnotationStorage(): void;
|
|
162
|
+
/**
|
|
163
|
+
* Set the editor position within its parent.
|
|
164
|
+
* @param {number} x
|
|
165
|
+
* @param {number} y
|
|
166
|
+
* @param {number} tx - x-translation in screen coordinates.
|
|
167
|
+
* @param {number} ty - y-translation in screen coordinates.
|
|
168
|
+
*/
|
|
169
|
+
setAt(x: number, y: number, tx: number, ty: number): void;
|
|
170
|
+
_moveAfterPaste(baseX: any, baseY: any): void;
|
|
171
|
+
/**
|
|
172
|
+
* Translate the editor position within its parent.
|
|
173
|
+
* @param {number} x - x-translation in screen coordinates.
|
|
174
|
+
* @param {number} y - y-translation in screen coordinates.
|
|
175
|
+
*/
|
|
176
|
+
translate(x: number, y: number): void;
|
|
177
|
+
/**
|
|
178
|
+
* Translate the editor position within its page and adjust the scroll
|
|
179
|
+
* in order to have the editor in the view.
|
|
180
|
+
* @param {number} x - x-translation in page coordinates.
|
|
181
|
+
* @param {number} y - y-translation in page coordinates.
|
|
182
|
+
*/
|
|
183
|
+
translateInPage(x: number, y: number): void;
|
|
184
|
+
translationDone(): void;
|
|
185
|
+
drag(tx: any, ty: any): void;
|
|
186
|
+
/**
|
|
187
|
+
* Called when the editor is being translated.
|
|
188
|
+
* @param {number} x - in page coordinates.
|
|
189
|
+
* @param {number} y - in page coordinates.
|
|
190
|
+
*/
|
|
191
|
+
_onTranslating(x: number, y: number): void;
|
|
192
|
+
/**
|
|
193
|
+
* Called when the editor has been translated.
|
|
194
|
+
* @param {number} x - in page coordinates.
|
|
195
|
+
* @param {number} y - in page coordinates.
|
|
196
|
+
*/
|
|
197
|
+
_onTranslated(x: number, y: number): void;
|
|
198
|
+
get _hasBeenMoved(): boolean;
|
|
199
|
+
get _hasBeenResized(): boolean;
|
|
200
|
+
/**
|
|
201
|
+
* Get the translation to take into account the editor border.
|
|
202
|
+
* The CSS engine positions the element by taking the border into account so
|
|
203
|
+
* we must apply the opposite translation to have the editor in the right
|
|
204
|
+
* position.
|
|
205
|
+
* @returns {Array<number>}
|
|
206
|
+
*/
|
|
207
|
+
getBaseTranslation(): Array<number>;
|
|
208
|
+
/**
|
|
209
|
+
* @returns {boolean} true if position must be fixed (i.e. make the x and y
|
|
210
|
+
* living in the page).
|
|
211
|
+
*/
|
|
212
|
+
get _mustFixPosition(): boolean;
|
|
213
|
+
/**
|
|
214
|
+
* Fix the position of the editor in order to keep it inside its parent page.
|
|
215
|
+
* @param {number} [rotation] - the rotation of the page.
|
|
216
|
+
*/
|
|
217
|
+
fixAndSetPosition(rotation?: number): void;
|
|
218
|
+
/**
|
|
219
|
+
* Convert a screen translation into a page one.
|
|
220
|
+
* @param {number} x
|
|
221
|
+
* @param {number} y
|
|
222
|
+
*/
|
|
223
|
+
screenToPageTranslation(x: number, y: number): any[];
|
|
224
|
+
/**
|
|
225
|
+
* Convert a page translation into a screen one.
|
|
226
|
+
* @param {number} x
|
|
227
|
+
* @param {number} y
|
|
228
|
+
*/
|
|
229
|
+
pageTranslationToScreen(x: number, y: number): any[];
|
|
230
|
+
get parentScale(): any;
|
|
231
|
+
get parentRotation(): number;
|
|
232
|
+
get parentDimensions(): number[];
|
|
233
|
+
/**
|
|
234
|
+
* Set the dimensions of this editor.
|
|
235
|
+
* @param {number} width
|
|
236
|
+
* @param {number} height
|
|
237
|
+
*/
|
|
238
|
+
setDims(width: number, height: number): void;
|
|
239
|
+
fixDims(): void;
|
|
240
|
+
/**
|
|
241
|
+
* Get the translation used to position this editor when it's created.
|
|
242
|
+
* @returns {Array<number>}
|
|
243
|
+
*/
|
|
244
|
+
getInitialTranslation(): Array<number>;
|
|
245
|
+
/**
|
|
246
|
+
* Called when the editor has been resized.
|
|
247
|
+
*/
|
|
248
|
+
_onResized(): void;
|
|
249
|
+
/**
|
|
250
|
+
* Called when the editor is being resized.
|
|
251
|
+
*/
|
|
252
|
+
_onResizing(): void;
|
|
253
|
+
/**
|
|
254
|
+
* Called when the alt text dialog is closed.
|
|
255
|
+
*/
|
|
256
|
+
altTextFinish(): void;
|
|
257
|
+
/**
|
|
258
|
+
* Add a toolbar for this editor.
|
|
259
|
+
* @returns {Promise<EditorToolbar|null>}
|
|
260
|
+
*/
|
|
261
|
+
addEditToolbar(): Promise<EditorToolbar | null>;
|
|
262
|
+
removeEditToolbar(): void;
|
|
263
|
+
addContainer(container: any): void;
|
|
264
|
+
getClientDimensions(): DOMRect;
|
|
265
|
+
addAltTextButton(): Promise<void>;
|
|
266
|
+
/**
|
|
267
|
+
* Set the alt text data.
|
|
268
|
+
*/
|
|
269
|
+
set altTextData(data: any);
|
|
270
|
+
get altTextData(): any;
|
|
271
|
+
get guessedAltText(): any;
|
|
272
|
+
setGuessedAltText(text: any): Promise<void>;
|
|
273
|
+
serializeAltText(isForCopying: any): any;
|
|
274
|
+
hasAltText(): boolean;
|
|
275
|
+
hasAltTextData(): any;
|
|
276
|
+
/**
|
|
277
|
+
* Render this editor in a div.
|
|
278
|
+
* @returns {HTMLDivElement | null}
|
|
279
|
+
*/
|
|
280
|
+
render(): HTMLDivElement | null;
|
|
281
|
+
/**
|
|
282
|
+
* Onpointerdown callback.
|
|
283
|
+
* @param {PointerEvent} event
|
|
284
|
+
*/
|
|
285
|
+
pointerdown(event: PointerEvent): void;
|
|
286
|
+
get isSelected(): any;
|
|
287
|
+
_onStartDragging(): void;
|
|
288
|
+
_onStopDragging(): void;
|
|
289
|
+
moveInDOM(): void;
|
|
290
|
+
_setParentAndPosition(parent: any, x: any, y: any): void;
|
|
291
|
+
/**
|
|
292
|
+
* Convert the current rect into a page one.
|
|
293
|
+
* @param {number} tx - x-translation in screen coordinates.
|
|
294
|
+
* @param {number} ty - y-translation in screen coordinates.
|
|
295
|
+
* @param {number} [rotation] - the rotation of the page.
|
|
296
|
+
*/
|
|
297
|
+
getRect(tx: number, ty: number, rotation?: number): any[];
|
|
298
|
+
getRectInCurrentCoords(rect: any, pageHeight: any): any[];
|
|
299
|
+
/**
|
|
300
|
+
* Executed once this editor has been rendered.
|
|
301
|
+
* @param {boolean} focus - true if the editor should be focused.
|
|
302
|
+
*/
|
|
303
|
+
onceAdded(focus: boolean): void;
|
|
304
|
+
/**
|
|
305
|
+
* Check if the editor contains something.
|
|
306
|
+
* @returns {boolean}
|
|
307
|
+
*/
|
|
308
|
+
isEmpty(): boolean;
|
|
309
|
+
/**
|
|
310
|
+
* Enable edit mode.
|
|
311
|
+
*/
|
|
312
|
+
enableEditMode(): void;
|
|
313
|
+
/**
|
|
314
|
+
* Disable edit mode.
|
|
315
|
+
*/
|
|
316
|
+
disableEditMode(): void;
|
|
317
|
+
/**
|
|
318
|
+
* Check if the editor is edited.
|
|
319
|
+
* @returns {boolean}
|
|
320
|
+
*/
|
|
321
|
+
isInEditMode(): boolean;
|
|
322
|
+
/**
|
|
323
|
+
* If it returns true, then this editor handles the keyboard
|
|
324
|
+
* events itself.
|
|
325
|
+
* @returns {boolean}
|
|
326
|
+
*/
|
|
327
|
+
shouldGetKeyboardEvents(): boolean;
|
|
328
|
+
/**
|
|
329
|
+
* Check if this editor needs to be rebuilt or not.
|
|
330
|
+
* @returns {boolean}
|
|
331
|
+
*/
|
|
332
|
+
needsToBeRebuilt(): boolean;
|
|
333
|
+
get isOnScreen(): boolean;
|
|
334
|
+
/**
|
|
335
|
+
* Rebuild the editor in case it has been removed on undo.
|
|
336
|
+
*
|
|
337
|
+
* To implement in subclasses.
|
|
338
|
+
*/
|
|
339
|
+
rebuild(): void;
|
|
340
|
+
/**
|
|
341
|
+
* Rotate the editor when the page is rotated.
|
|
342
|
+
* @param {number} angle
|
|
343
|
+
*/
|
|
344
|
+
rotate(_angle: any): void;
|
|
345
|
+
/**
|
|
346
|
+
* Resize the editor when the page is resized.
|
|
347
|
+
*/
|
|
348
|
+
resize(): void;
|
|
349
|
+
/**
|
|
350
|
+
* Serialize the editor when it has been deleted.
|
|
351
|
+
* @returns {Object}
|
|
352
|
+
*/
|
|
353
|
+
serializeDeleted(): Object;
|
|
354
|
+
/**
|
|
355
|
+
* Serialize the editor.
|
|
356
|
+
* The result of the serialization will be used to construct a
|
|
357
|
+
* new annotation to add to the pdf document.
|
|
358
|
+
*
|
|
359
|
+
* To implement in subclasses.
|
|
360
|
+
* @param {boolean} [isForCopying]
|
|
361
|
+
* @param {Object | null} [context]
|
|
362
|
+
* @returns {Object | null}
|
|
363
|
+
*/
|
|
364
|
+
serialize(isForCopying?: boolean, context?: Object | null): Object | null;
|
|
365
|
+
/**
|
|
366
|
+
* Check if an existing annotation associated with this editor has been
|
|
367
|
+
* modified.
|
|
368
|
+
* @returns {boolean}
|
|
369
|
+
*/
|
|
370
|
+
get hasBeenModified(): boolean;
|
|
371
|
+
/**
|
|
372
|
+
* Remove this editor.
|
|
373
|
+
* It's used on ctrl+backspace action.
|
|
374
|
+
*/
|
|
375
|
+
remove(): void;
|
|
376
|
+
/**
|
|
377
|
+
* @returns {boolean} true if this editor can be resized.
|
|
378
|
+
*/
|
|
379
|
+
get isResizable(): boolean;
|
|
380
|
+
/**
|
|
381
|
+
* Add the resizers to this editor.
|
|
382
|
+
*/
|
|
383
|
+
makeResizable(): void;
|
|
384
|
+
get toolbarPosition(): null;
|
|
385
|
+
/**
|
|
386
|
+
* onkeydown callback.
|
|
387
|
+
* @param {KeyboardEvent} event
|
|
388
|
+
*/
|
|
389
|
+
keydown(event: KeyboardEvent): void;
|
|
390
|
+
_resizeWithKeyboard(x: any, y: any): void;
|
|
391
|
+
_stopResizingWithKeyboard(): void;
|
|
392
|
+
/**
|
|
393
|
+
* Select this editor.
|
|
394
|
+
*/
|
|
395
|
+
select(): void;
|
|
396
|
+
/**
|
|
397
|
+
* Unselect this editor.
|
|
398
|
+
*/
|
|
399
|
+
unselect(): void;
|
|
400
|
+
/**
|
|
401
|
+
* Update some parameters which have been changed through the UI.
|
|
402
|
+
* @param {number} type
|
|
403
|
+
* @param {*} value
|
|
404
|
+
*/
|
|
405
|
+
updateParams(type: number, value: any): void;
|
|
406
|
+
/**
|
|
407
|
+
* When the user disables the editing mode some editors can change some of
|
|
408
|
+
* their properties.
|
|
409
|
+
*/
|
|
410
|
+
disableEditing(): void;
|
|
411
|
+
/**
|
|
412
|
+
* When the user enables the editing mode some editors can change some of
|
|
413
|
+
* their properties.
|
|
414
|
+
*/
|
|
415
|
+
enableEditing(): void;
|
|
416
|
+
/**
|
|
417
|
+
* The editor is about to be edited.
|
|
418
|
+
*/
|
|
419
|
+
enterInEditMode(): void;
|
|
420
|
+
/**
|
|
421
|
+
* @returns {HTMLElement | null} the element requiring an alt text.
|
|
422
|
+
*/
|
|
423
|
+
getImageForAltText(): HTMLElement | null;
|
|
424
|
+
/**
|
|
425
|
+
* Get the div which really contains the displayed content.
|
|
426
|
+
* @returns {HTMLDivElement | undefined}
|
|
427
|
+
*/
|
|
428
|
+
get contentDiv(): HTMLDivElement | undefined;
|
|
429
|
+
/**
|
|
430
|
+
* When set to true, it means that this editor is currently edited.
|
|
431
|
+
* @param {boolean} value
|
|
432
|
+
*/
|
|
433
|
+
set isEditing(value: boolean);
|
|
434
|
+
/**
|
|
435
|
+
* If true then the editor is currently edited.
|
|
436
|
+
* @type {boolean}
|
|
437
|
+
*/
|
|
438
|
+
get isEditing(): boolean;
|
|
439
|
+
/**
|
|
440
|
+
* Set the aspect ratio to use when resizing.
|
|
441
|
+
* @param {number} width
|
|
442
|
+
* @param {number} height
|
|
443
|
+
*/
|
|
444
|
+
setAspectRatio(width: number, height: number): void;
|
|
445
|
+
/**
|
|
446
|
+
* Get the data to report to the telemetry when the editor is added.
|
|
447
|
+
* @returns {Object}
|
|
448
|
+
*/
|
|
449
|
+
get telemetryInitialData(): Object;
|
|
450
|
+
/**
|
|
451
|
+
* The telemetry data to use when saving/printing.
|
|
452
|
+
* @returns {Object|null}
|
|
453
|
+
*/
|
|
454
|
+
get telemetryFinalData(): Object | null;
|
|
455
|
+
_reportTelemetry(data: any, mustWait?: boolean): void;
|
|
456
|
+
/**
|
|
457
|
+
* Show or hide this editor.
|
|
458
|
+
* @param {boolean|undefined} visible
|
|
459
|
+
*/
|
|
460
|
+
show(visible?: boolean | undefined): void;
|
|
461
|
+
enable(): void;
|
|
462
|
+
disable(): void;
|
|
463
|
+
/**
|
|
464
|
+
* Render an annotation in the annotation layer.
|
|
465
|
+
* @param {Object} annotation
|
|
466
|
+
* @returns {HTMLElement|null}
|
|
467
|
+
*/
|
|
468
|
+
renderAnnotationElement(annotation: Object): HTMLElement | null;
|
|
469
|
+
resetAnnotationElement(annotation: any): void;
|
|
470
|
+
#private;
|
|
471
|
+
}
|
|
472
|
+
import { AnnotationEditorUIManager } from "./tools.js";
|
|
473
|
+
import { EditorToolbar } from "./toolbar.js";
|
|
474
|
+
import { ColorManager } from "./tools.js";
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export type AnnotationEditorLayer = import("./annotation_editor_layer.js").AnnotationEditorLayer;
|
|
2
|
+
/**
|
|
3
|
+
* Basic text editor in order to create a FreeTex annotation.
|
|
4
|
+
*/
|
|
5
|
+
export class FreeTextEditor extends AnnotationEditor {
|
|
6
|
+
static _freeTextDefaultContent: string;
|
|
7
|
+
static _internalPadding: number;
|
|
8
|
+
static _defaultColor: null;
|
|
9
|
+
static _defaultFontSize: number;
|
|
10
|
+
static get _keyboardManager(): any;
|
|
11
|
+
static _type: string;
|
|
12
|
+
static _editorType: number;
|
|
13
|
+
/** @inheritdoc */
|
|
14
|
+
static initialize(l10n: any, uiManager: any): void;
|
|
15
|
+
/** @inheritdoc */
|
|
16
|
+
static updateDefaultParams(type: any, value: any): void;
|
|
17
|
+
/** @inheritdoc */
|
|
18
|
+
static get defaultPropertiesToUpdate(): any[][];
|
|
19
|
+
static "__#18@#getNodeContent"(node: any): any;
|
|
20
|
+
static "__#18@#deserializeContent"(content: any): any;
|
|
21
|
+
/** @inheritdoc */
|
|
22
|
+
static deserialize(data: any, parent: any, uiManager: any): Promise<AnnotationEditor | null>;
|
|
23
|
+
constructor(params: any);
|
|
24
|
+
/** @inheritdoc */
|
|
25
|
+
updateParams(type: any, value: any): void;
|
|
26
|
+
/** @inheritdoc */
|
|
27
|
+
get propertiesToUpdate(): any[][];
|
|
28
|
+
/**
|
|
29
|
+
* Helper to translate the editor with the keyboard when it's empty.
|
|
30
|
+
* @param {number} x in page units.
|
|
31
|
+
* @param {number} y in page units.
|
|
32
|
+
*/
|
|
33
|
+
_translateEmpty(x: number, y: number): void;
|
|
34
|
+
/** @inheritdoc */
|
|
35
|
+
onceAdded(focus: any): void;
|
|
36
|
+
/**
|
|
37
|
+
* Commit the content we have in this editor.
|
|
38
|
+
* @returns {undefined}
|
|
39
|
+
*/
|
|
40
|
+
commit(): undefined;
|
|
41
|
+
/**
|
|
42
|
+
* ondblclick callback.
|
|
43
|
+
* @param {MouseEvent} event
|
|
44
|
+
*/
|
|
45
|
+
dblclick(event: MouseEvent): void;
|
|
46
|
+
editorDivKeydown(event: any): void;
|
|
47
|
+
editorDivFocus(event: any): void;
|
|
48
|
+
editorDivBlur(event: any): void;
|
|
49
|
+
editorDivInput(event: any): void;
|
|
50
|
+
editorDiv: HTMLDivElement | undefined;
|
|
51
|
+
overlayDiv: HTMLDivElement | undefined;
|
|
52
|
+
editorDivPaste(event: any): void;
|
|
53
|
+
/** @inheritdoc */
|
|
54
|
+
serialize(isForCopying?: boolean): Object | null;
|
|
55
|
+
/** @inheritdoc */
|
|
56
|
+
renderAnnotationElement(annotation: any): HTMLElement | null;
|
|
57
|
+
#private;
|
|
58
|
+
}
|
|
59
|
+
import { AnnotationEditor } from "./editor.js";
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Basic draw editor in order to generate an Highlight annotation.
|
|
3
|
+
*/
|
|
4
|
+
export class HighlightEditor extends AnnotationEditor {
|
|
5
|
+
static _defaultColor: null;
|
|
6
|
+
static _defaultOpacity: number;
|
|
7
|
+
static _defaultThickness: number;
|
|
8
|
+
static _type: string;
|
|
9
|
+
static _editorType: number;
|
|
10
|
+
static _freeHighlightId: number;
|
|
11
|
+
static _freeHighlight: null;
|
|
12
|
+
static _freeHighlightClipId: string;
|
|
13
|
+
static get _keyboardManager(): any;
|
|
14
|
+
static computeTelemetryFinalData(data: any): {
|
|
15
|
+
numberOfColors: any;
|
|
16
|
+
};
|
|
17
|
+
/** @inheritdoc */
|
|
18
|
+
static initialize(l10n: any, uiManager: any): void;
|
|
19
|
+
/** @inheritdoc */
|
|
20
|
+
static updateDefaultParams(type: any, value: any): void;
|
|
21
|
+
static get defaultPropertiesToUpdate(): (number | null)[][];
|
|
22
|
+
static "__#24@#rotateBbox"([x, y, width, height]: [any, any, any, any], angle: any): any[];
|
|
23
|
+
static startHighlighting(parent: any, isLTR: any, { target: textLayer, x, y }: {
|
|
24
|
+
target: any;
|
|
25
|
+
x: any;
|
|
26
|
+
y: any;
|
|
27
|
+
}): void;
|
|
28
|
+
static "__#24@#highlightMove"(parent: any, event: any): void;
|
|
29
|
+
static "__#24@#endHighlight"(parent: any, event: any): void;
|
|
30
|
+
/** @inheritdoc */
|
|
31
|
+
static deserialize(data: any, parent: any, uiManager: any): Promise<AnnotationEditor | null>;
|
|
32
|
+
constructor(params: any);
|
|
33
|
+
color: any;
|
|
34
|
+
/** @inheritdoc */
|
|
35
|
+
get telemetryInitialData(): {
|
|
36
|
+
action: string;
|
|
37
|
+
type: string;
|
|
38
|
+
color: any;
|
|
39
|
+
thickness: any;
|
|
40
|
+
methodOfCreation: string;
|
|
41
|
+
};
|
|
42
|
+
/** @inheritdoc */
|
|
43
|
+
get telemetryFinalData(): {
|
|
44
|
+
type: string;
|
|
45
|
+
color: any;
|
|
46
|
+
};
|
|
47
|
+
/** @inheritdoc */
|
|
48
|
+
translateInPage(x: any, y: any): void;
|
|
49
|
+
/** @inheritdoc */
|
|
50
|
+
updateParams(type: any, value: any): void;
|
|
51
|
+
/** @inheritdoc */
|
|
52
|
+
get propertiesToUpdate(): any[][];
|
|
53
|
+
/** @inheritdoc */
|
|
54
|
+
fixAndSetPosition(): void;
|
|
55
|
+
/** @inheritdoc */
|
|
56
|
+
getRect(tx: any, ty: any): any[];
|
|
57
|
+
/** @inheritdoc */
|
|
58
|
+
onceAdded(focus: any): void;
|
|
59
|
+
/** @inheritdoc */
|
|
60
|
+
rotate(angle: any): void;
|
|
61
|
+
pointerover(): void;
|
|
62
|
+
pointerleave(): void;
|
|
63
|
+
_moveCaret(direction: any): void;
|
|
64
|
+
/** @inheritdoc */
|
|
65
|
+
serialize(isForCopying?: boolean): Object | null;
|
|
66
|
+
/** @inheritdoc */
|
|
67
|
+
renderAnnotationElement(annotation: any): null;
|
|
68
|
+
#private;
|
|
69
|
+
}
|
|
70
|
+
import { AnnotationEditor } from "./editor.js";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export class InkDrawingOptions extends DrawingOptions {
|
|
2
|
+
constructor(viewerParameters: any);
|
|
3
|
+
_viewParameters: any;
|
|
4
|
+
clone(): InkDrawingOptions;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Basic draw editor in order to generate an Ink annotation.
|
|
8
|
+
*/
|
|
9
|
+
export class InkEditor extends DrawingEditor {
|
|
10
|
+
static _type: string;
|
|
11
|
+
static _editorType: number;
|
|
12
|
+
static _defaultDrawingOptions: null;
|
|
13
|
+
/** @inheritdoc */
|
|
14
|
+
static initialize(l10n: any, uiManager: any): void;
|
|
15
|
+
/** @inheritdoc */
|
|
16
|
+
static getDefaultDrawingOptions(options: any): any;
|
|
17
|
+
/** @inheritdoc */
|
|
18
|
+
static get typesMap(): any;
|
|
19
|
+
/** @inheritdoc */
|
|
20
|
+
static createDrawerInstance(x: any, y: any, parentWidth: any, parentHeight: any, rotation: any): InkDrawOutliner;
|
|
21
|
+
/** @inheritdoc */
|
|
22
|
+
static deserializeDraw(pageX: any, pageY: any, pageWidth: any, pageHeight: any, innerMargin: any, data: any): any;
|
|
23
|
+
/** @inheritdoc */
|
|
24
|
+
createDrawingOptions({ color, thickness, opacity }: {
|
|
25
|
+
color: any;
|
|
26
|
+
thickness: any;
|
|
27
|
+
opacity: any;
|
|
28
|
+
}): void;
|
|
29
|
+
_drawingOptions: any;
|
|
30
|
+
/** @inheritdoc */
|
|
31
|
+
serialize(isForCopying?: boolean): Object | null;
|
|
32
|
+
#private;
|
|
33
|
+
}
|
|
34
|
+
import { DrawingOptions } from "./draw.js";
|
|
35
|
+
import { DrawingEditor } from "./draw.js";
|
|
36
|
+
import { InkDrawOutliner } from "./drawers/inkdraw.js";
|