@d-i-t-a/reader 2.1.3 → 2.2.0-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.
@@ -43,6 +43,7 @@ export interface HTMLElementRect {
43
43
  left: number;
44
44
  textContent: string;
45
45
  }
46
+ export declare const _blacklistIdClassForCssSelectors: string[];
46
47
  export interface TextHighlighterProperties {
47
48
  selectionMenuItems?: Array<SelectionMenuItem>;
48
49
  }
@@ -6,6 +6,8 @@ export interface ContentProtectionModuleProperties {
6
6
  enableObfuscation: boolean;
7
7
  disablePrint: boolean;
8
8
  disableCopy: boolean;
9
+ canCopy: boolean;
10
+ charactersToCopy: number;
9
11
  detectInspect: boolean;
10
12
  clearOnInspect: boolean;
11
13
  detectInspectInitDelay: number;
@@ -75,6 +77,26 @@ export declare class ContentProtectionModule implements ReaderModule {
75
77
  preventDefault: () => void;
76
78
  stopPropagation: () => void;
77
79
  }): boolean;
80
+ preventCopyKey(event: {
81
+ keyCode: any;
82
+ metaKey: any;
83
+ ctrlKey: any;
84
+ key: string;
85
+ preventDefault: () => void;
86
+ stopPropagation: () => void;
87
+ }): boolean;
88
+ restrictCopy(event: {
89
+ clipboardData: {
90
+ getData: (arg0: string) => any;
91
+ setData: (arg0: string, arg1: any) => void;
92
+ };
93
+ preventDefault: () => void;
94
+ stopPropagation: () => void;
95
+ }): boolean;
96
+ restrictCopyKey(event: any): boolean;
97
+ copyToClipboard(textToClipboard: any): void;
98
+ createElementForExecCommand(textToClipboard: any): HTMLDivElement;
99
+ selectContent(element: any): void;
78
100
  beforePrint(event: {
79
101
  preventDefault: () => void;
80
102
  stopPropagation: () => void;
@@ -1,3 +1,40 @@
1
+ import { Locator } from "../model/Locator";
2
+ import { IFrameAttributes } from "./IFrameNavigator";
1
3
  interface Navigator {
4
+ publication: any;
5
+ rights?: any;
6
+ hasMediaOverlays?: any;
7
+ addListener?(argument: any, argument2: any): void;
8
+ startReadAloud?(): void;
9
+ stopReadAloud?(): void;
10
+ pauseReadAloud?(): void;
11
+ resumeReadAloud?(): void;
12
+ startReadAlong?(): void;
13
+ stopReadAlong?(): void;
14
+ pauseReadAlong?(): void;
15
+ resumeReadAlong?(): void;
16
+ hideLayer?(layer: any): any;
17
+ showLayer?(layer: any): any;
18
+ activateMarker?(id: string, position: string): any;
19
+ deactivateMarker?(): any;
20
+ tableOfContents(): any;
21
+ readingOrder(): any;
22
+ currentResource(): any;
23
+ mostRecentNavigatedTocItem?(): any;
24
+ totalResources(): any;
25
+ currentLocator(): any;
26
+ positions(): any;
27
+ goTo(locator: Locator): void;
28
+ goToPosition(value: number): any;
29
+ goToPage(page: number): any;
30
+ nextResource(): void;
31
+ previousResource(): void;
32
+ nextPage(): void;
33
+ previousPage(): void;
34
+ atStart?(): any;
35
+ atEnd?(): any;
36
+ snapToSelector?(selector: any): void;
37
+ applyAttributes?(value: IFrameAttributes): void;
38
+ stop(): void;
2
39
  }
3
40
  export default Navigator;
@@ -0,0 +1,60 @@
1
+ import EventEmitter from "eventemitter3";
2
+ import Navigator from "./Navigator";
3
+ import { UserSettings } from "../model/user-settings/UserSettings";
4
+ import { Publication } from "../model/Publication";
5
+ import { Locator } from "../model/Locator";
6
+ export interface PDFNavigatorConfig {
7
+ mainElement: HTMLElement;
8
+ headerMenu?: HTMLElement | null;
9
+ footerMenu?: HTMLElement | null;
10
+ publication: Publication;
11
+ settings: UserSettings;
12
+ }
13
+ export declare enum ScaleType {
14
+ Page = 0,
15
+ Width = 1
16
+ }
17
+ export declare class PDFNavigator extends EventEmitter implements Navigator {
18
+ settings: UserSettings;
19
+ publication: Publication;
20
+ headerMenu?: HTMLElement | null;
21
+ footerMenu?: HTMLElement | null;
22
+ mainElement: HTMLElement;
23
+ pdfDoc: any;
24
+ pageNum: number;
25
+ scaleType: ScaleType;
26
+ pageRendering: boolean;
27
+ pageNumPending: any;
28
+ scale: number;
29
+ canvas: HTMLCanvasElement;
30
+ ctx: CanvasRenderingContext2D | null;
31
+ resourceIndex: number;
32
+ resource: any;
33
+ static create(config: PDFNavigatorConfig): Promise<PDFNavigator>;
34
+ protected constructor(settings: UserSettings, publication: Publication);
35
+ protected start(mainElement: HTMLElement, headerMenu?: HTMLElement | null, footerMenu?: HTMLElement | null): Promise<void>;
36
+ timeout: any;
37
+ onResize: () => void;
38
+ handleResize(): Promise<void>;
39
+ private setupEvents;
40
+ renderPage(num: any, type: any): void;
41
+ queueRenderPage(num: any): void;
42
+ readingOrder(): any;
43
+ tableOfContents(): any;
44
+ currentResource(): any;
45
+ totalResources(): any;
46
+ currentLocator(): any;
47
+ positions(): any;
48
+ nextPage(): void;
49
+ previousPage(): void;
50
+ nextResource(): void;
51
+ previousResource(): void;
52
+ goTo(locator: Locator): void;
53
+ goToPosition(value: number): void;
54
+ goToPage(page: number): Promise<void>;
55
+ fitToWidth(): void;
56
+ fitToPage(): void;
57
+ zoomIn(): void;
58
+ zoomOut(): void;
59
+ stop(): void;
60
+ }
@@ -17,7 +17,7 @@ import { IFrameAttributes, ReaderConfig } from "./navigator/IFrameNavigator";
17
17
  export default class D2Reader {
18
18
  private readonly settings;
19
19
  private readonly navigator;
20
- private readonly highlighter;
20
+ private readonly highlighter?;
21
21
  private readonly bookmarkModule?;
22
22
  private readonly annotationModule?;
23
23
  private readonly ttsSettings?;
@@ -79,14 +79,14 @@ export default class D2Reader {
79
79
  /** Show Annotation Layer */
80
80
  showAnnotationLayer: () => void | undefined;
81
81
  /** Hide Layer */
82
- hideLayer: (layer: any) => void;
82
+ hideLayer: (layer: any) => false | void;
83
83
  /** Show Layer */
84
- showLayer: (layer: any) => void;
84
+ showLayer: (layer: any) => false | void;
85
85
  /** Activate Marker <br>
86
86
  * Activated Marker will be used for active annotation creation */
87
- activateMarker: (id: string, position: string) => void;
87
+ activateMarker: (id: string, position: string) => false | void;
88
88
  /** Deactivate Marker */
89
- deactivateMarker: () => void;
89
+ deactivateMarker: () => false | void;
90
90
  /**
91
91
  * Definitions
92
92
  */
@@ -115,10 +115,10 @@ export default class D2Reader {
115
115
  /**
116
116
  * Resources
117
117
  */
118
- get currentResource(): number | undefined;
119
- get mostRecentNavigatedTocItem(): string;
120
- get totalResources(): number;
121
- get publicationLanguage(): string[];
118
+ get currentResource(): any;
119
+ get mostRecentNavigatedTocItem(): string | false;
120
+ get totalResources(): any;
121
+ get publicationLanguage(): any;
122
122
  /**
123
123
  * Settings
124
124
  */
@@ -171,11 +171,16 @@ export default class D2Reader {
171
171
  * Navigation
172
172
  * @TODO : These should return promises that complete when they are done.
173
173
  */
174
- get currentLocator(): Locator;
174
+ get currentLocator(): any;
175
175
  get positions(): any;
176
176
  goTo: (locator: Locator) => Promise<void>;
177
- goToPosition: (value: number) => Promise<void>;
177
+ goToPosition: (value: number) => Promise<any>;
178
178
  goToPage: (page: number) => Promise<void>;
179
+ fitToPage: () => void;
180
+ fitToWidth: () => void;
181
+ zoomIn: () => void;
182
+ zoomOut: () => void;
183
+ copyToClipboard: (text: any) => void;
179
184
  nextResource: () => void;
180
185
  previousResource: () => void;
181
186
  nextPage: () => Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d-i-t-a/reader",
3
- "version": "2.1.3",
3
+ "version": "2.2.0-beta.1",
4
4
  "description": "A viewer application for EPUB files.",
5
5
  "repository": "https://github.com/d-i-t-a/R2D2BC",
6
6
  "license": "Apache-2.0",
@@ -25,6 +25,7 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@types/sass": "^1.43.1",
28
+ "@types/pdfjs-dist": "^2.7.4",
28
29
  "browserslist-useragent": "^3.0.3",
29
30
  "cssesc": "^3.0.0",
30
31
  "detect-browser": "^5.2.0",
@@ -34,6 +35,7 @@
34
35
  "lodash.clonedeep": "^4.5.0",
35
36
  "loglevel": "^1.8.0",
36
37
  "mark.js": "^8.11.1",
38
+ "pdfjs-dist": "2.16.105",
37
39
  "promise-polyfill": "^8.2.0",
38
40
  "r2-shared-js": "^1.0.51",
39
41
  "recursive-readdir": "^2.2.2",