@d-i-t-a/reader 1.10.0 → 1.11.0-beta.5
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/index.d.ts +12 -1
- package/dist/injectables/footnotes/footnotes.js.LICENSE.txt +6 -0
- package/dist/model/Locator.d.ts +3 -18
- package/dist/modules/AnnotationModule.d.ts +16 -5
- package/dist/modules/BookmarkModule.d.ts +12 -1
- package/dist/modules/TTS/TTSModule.d.ts +2 -27
- package/dist/modules/TTS/TTSModule2.d.ts +73 -0
- package/dist/modules/TTS/TTSSettings.d.ts +29 -5
- package/dist/modules/citations/CitationModule.d.ts +37 -0
- package/dist/modules/footnotes/FootnotesEventHandler.d.ts +0 -0
- package/dist/modules/highlight/TextHighlighter.d.ts +36 -46
- package/dist/modules/highlight/TextHighlighterFXL.d.ts +278 -0
- package/dist/modules/highlight/common/highlight.d.ts +53 -2
- package/dist/modules/highlight/common/rect-utils.d.ts +1 -1
- package/dist/modules/highlight/common/selection.d.ts +5 -0
- package/dist/modules/highlight/renderer/iframe/state.d.ts +0 -3
- package/dist/modules/linefocus/LineFocusModule.d.ts +43 -0
- package/dist/modules/pagebreak/PageBreakModule.d.ts +26 -0
- package/dist/modules/search/DefinitionsModule.d.ts +49 -0
- package/dist/modules/search/Popup.d.ts +8 -0
- package/dist/modules/search/SearchModule.d.ts +8 -5
- package/dist/navigator/IFrameNavigator.d.ts +17 -12
- package/dist/reader.css +0 -3
- package/dist/reader.css.map +1 -1
- package/dist/reader.js +1 -1
- package/dist/reader.js.LICENSE.txt +9 -0
- package/dist/reader.js.map +1 -1
- package/dist/store/Annotator.d.ts +2 -2
- package/dist/store/LocalAnnotator.d.ts +2 -2
- package/dist/utils/EventHandler.d.ts +5 -0
- package/dist/utils/IconLib.d.ts +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/views/BookView.d.ts +4 -3
- package/dist/views/FixedBookView.d.ts +4 -1
- package/dist/views/ReflowableBookView.d.ts +2 -2
- package/package.json +3 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { ReaderConfig } from "./navigator/IFrameNavigator";
|
|
2
2
|
import { Locator } from "./model/Locator";
|
|
3
|
-
export declare const IS_DEV: boolean;
|
|
4
3
|
export declare function unload(): Promise<void>;
|
|
5
4
|
export declare function hasMediaOverlays(): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Read Along
|
|
7
|
+
*/
|
|
8
|
+
export declare function startReadAlong(): void;
|
|
9
|
+
export declare function stopReadAlong(): void;
|
|
10
|
+
export declare function pauseReadAlong(): void;
|
|
11
|
+
export declare function resumeReadAlong(): void;
|
|
6
12
|
export declare function startReadAloud(): void;
|
|
7
13
|
export declare function stopReadAloud(): void;
|
|
8
14
|
export declare function pauseReadAloud(): void;
|
|
9
15
|
export declare function resumeReadAloud(): void;
|
|
16
|
+
export declare function saveBookmarkPlus(): void;
|
|
10
17
|
export declare function saveBookmark(): Promise<any>;
|
|
11
18
|
export declare function deleteBookmark(bookmark: any): Promise<any>;
|
|
12
19
|
export declare function deleteAnnotation(highlight: any): Promise<any>;
|
|
@@ -57,5 +64,9 @@ export declare function currentLocator(): Locator;
|
|
|
57
64
|
export declare function positions(): any;
|
|
58
65
|
export declare function goToPosition(value: any): void;
|
|
59
66
|
export declare function applyAttributes(value: any): void;
|
|
67
|
+
export declare function hideAnnotationLayer(): void;
|
|
68
|
+
export declare function showAnnotationLayer(): void;
|
|
60
69
|
export declare function snapToElement(value: any): void;
|
|
70
|
+
export declare function activateMarker(id: any, position: any): void;
|
|
71
|
+
export declare function deactivateMarker(): void;
|
|
61
72
|
export declare function load(config: ReaderConfig): Promise<any>;
|
package/dist/model/Locator.d.ts
CHANGED
|
@@ -29,29 +29,14 @@ export interface Bookmark extends Locator {
|
|
|
29
29
|
}
|
|
30
30
|
export declare enum AnnotationMarker {
|
|
31
31
|
Highlight = 0,
|
|
32
|
-
Underline = 1
|
|
32
|
+
Underline = 1,
|
|
33
|
+
Bookmark = 2,
|
|
34
|
+
Custom = 3
|
|
33
35
|
}
|
|
34
36
|
export interface Annotation extends Locator {
|
|
35
37
|
id?: any;
|
|
36
38
|
created: Date;
|
|
37
39
|
highlight?: IHighlight;
|
|
38
|
-
marker: AnnotationMarker;
|
|
39
|
-
color: string;
|
|
40
|
-
}
|
|
41
|
-
export interface ISelectionInfo {
|
|
42
|
-
rangeInfo: IRangeInfo;
|
|
43
|
-
cleanText: string;
|
|
44
|
-
rawText: string;
|
|
45
|
-
color: string;
|
|
46
|
-
range: Range;
|
|
47
|
-
}
|
|
48
|
-
export interface IRangeInfo {
|
|
49
|
-
startContainerElementCssSelector: string;
|
|
50
|
-
startContainerChildTextNodeIndex: number;
|
|
51
|
-
startOffset: number;
|
|
52
|
-
endContainerElementCssSelector: string;
|
|
53
|
-
endContainerChildTextNodeIndex: number;
|
|
54
|
-
endOffset: number;
|
|
55
40
|
}
|
|
56
41
|
export interface ChapterWeight {
|
|
57
42
|
chapterHref: string;
|
|
@@ -4,11 +4,12 @@ import { Publication } from "../model/Publication";
|
|
|
4
4
|
import TextHighlighter from "./highlight/TextHighlighter";
|
|
5
5
|
import ReaderModule from "./ReaderModule";
|
|
6
6
|
import { IHighlight } from "./highlight/common/highlight";
|
|
7
|
-
import { Annotation
|
|
7
|
+
import { Annotation } from "../model/Locator";
|
|
8
8
|
export declare type Highlight = (highlight: Annotation) => Promise<Annotation>;
|
|
9
9
|
export interface AnnotationModuleAPI {
|
|
10
10
|
addAnnotation: Highlight;
|
|
11
11
|
deleteAnnotation: Highlight;
|
|
12
|
+
updateAnnotation: Highlight;
|
|
12
13
|
selectedAnnotation: Highlight;
|
|
13
14
|
}
|
|
14
15
|
export interface AnnotationModuleProperties {
|
|
@@ -25,7 +26,7 @@ export interface AnnotationModuleConfig extends AnnotationModuleProperties {
|
|
|
25
26
|
highlighter: TextHighlighter;
|
|
26
27
|
}
|
|
27
28
|
export default class AnnotationModule implements ReaderModule {
|
|
28
|
-
|
|
29
|
+
readonly annotator: Annotator | null;
|
|
29
30
|
private rights;
|
|
30
31
|
private publication;
|
|
31
32
|
private highlightsView;
|
|
@@ -35,25 +36,35 @@ export default class AnnotationModule implements ReaderModule {
|
|
|
35
36
|
private delegate;
|
|
36
37
|
properties: AnnotationModuleProperties;
|
|
37
38
|
api: AnnotationModuleAPI;
|
|
39
|
+
activeAnnotationMarkerId?: string;
|
|
40
|
+
activeAnnotationMarkerPosition?: string;
|
|
38
41
|
static create(config: AnnotationModuleConfig): Promise<AnnotationModule>;
|
|
39
42
|
constructor(annotator: Annotator, headerMenu: HTMLElement, rights: ReaderRights, publication: Publication, delegate: IFrameNavigator, initialAnnotations: any | null, properties: AnnotationModuleProperties | null, api: AnnotationModuleAPI | null, highlighter: TextHighlighter);
|
|
40
43
|
stop(): Promise<void>;
|
|
41
44
|
protected start(): Promise<void>;
|
|
42
|
-
|
|
45
|
+
private hide;
|
|
46
|
+
private show;
|
|
47
|
+
hideAnnotationLayer(): void;
|
|
48
|
+
showAnnotationLayer(): void;
|
|
49
|
+
handleResize(): Promise<void>;
|
|
43
50
|
initialize(): Promise<unknown>;
|
|
51
|
+
private click;
|
|
44
52
|
scrollToHighlight(id: any): Promise<any>;
|
|
53
|
+
updateLocalHighlight(annotation: Annotation): Promise<any>;
|
|
45
54
|
deleteLocalHighlight(id: any): Promise<any>;
|
|
46
55
|
deleteAnnotation(highlight: Annotation): Promise<any>;
|
|
47
56
|
addAnnotation(highlight: Annotation): Promise<any>;
|
|
48
57
|
deleteHighlight(highlight: Annotation): Promise<any>;
|
|
49
58
|
deleteSelectedHighlight(highlight: Annotation): Promise<any>;
|
|
50
|
-
|
|
59
|
+
updateAnnotation(highlight: Annotation): Promise<any>;
|
|
60
|
+
saveAnnotation(highlight: IHighlight): Promise<Annotation>;
|
|
51
61
|
getAnnotations(): Promise<any>;
|
|
52
62
|
showHighlights(): Promise<void>;
|
|
53
|
-
drawHighlights(
|
|
63
|
+
drawHighlights(): Promise<void>;
|
|
54
64
|
private createTree;
|
|
55
65
|
private handleAnnotationLinkClick;
|
|
56
66
|
private handleAnnotationLinkDeleteClick;
|
|
57
67
|
private static readableTimestamp;
|
|
58
68
|
getAnnotation(highlight: IHighlight): Promise<any>;
|
|
69
|
+
getAnnotationByID(id: string): Promise<any>;
|
|
59
70
|
}
|
|
@@ -2,7 +2,8 @@ import Annotator from "../store/Annotator";
|
|
|
2
2
|
import IFrameNavigator, { ReaderRights } from "../navigator/IFrameNavigator";
|
|
3
3
|
import { Publication } from "../model/Publication";
|
|
4
4
|
import ReaderModule from "./ReaderModule";
|
|
5
|
-
import { Bookmark } from "../model/Locator";
|
|
5
|
+
import { Annotation, Bookmark } from "../model/Locator";
|
|
6
|
+
import { IHighlight } from "./highlight/common/highlight";
|
|
6
7
|
export interface BookmarkModuleAPI {
|
|
7
8
|
addBookmark: (bookmark: Bookmark) => Promise<Bookmark>;
|
|
8
9
|
deleteBookmark: (bookmark: Bookmark) => Promise<Bookmark>;
|
|
@@ -35,12 +36,22 @@ export default class BookmarkModule implements ReaderModule {
|
|
|
35
36
|
constructor(annotator: Annotator, headerMenu: HTMLElement, rights: ReaderRights, publication: Publication, delegate: IFrameNavigator, initialAnnotations?: any | null, properties?: BookmarkModuleProperties | null, api?: BookmarkModuleAPI | null);
|
|
36
37
|
stop(): Promise<void>;
|
|
37
38
|
protected start(): Promise<void>;
|
|
39
|
+
handleResize(): Promise<void>;
|
|
40
|
+
initialize(): Promise<unknown>;
|
|
38
41
|
deleteBookmark(bookmark: Bookmark): Promise<any>;
|
|
42
|
+
saveBookmarkPlus(): void;
|
|
39
43
|
saveBookmark(): Promise<any>;
|
|
44
|
+
private addBookmarkPlus;
|
|
45
|
+
saveAnnotation(highlight: IHighlight): Promise<Annotation>;
|
|
40
46
|
getBookmarks(): Promise<any>;
|
|
41
47
|
showBookmarks(): Promise<void>;
|
|
48
|
+
drawBookmarks(): Promise<void>;
|
|
49
|
+
deleteSelectedHighlight(highlight: Annotation): Promise<any>;
|
|
50
|
+
deleteLocalHighlight(id: any): Promise<any>;
|
|
42
51
|
private createTree;
|
|
43
52
|
private handleAnnotationLinkClick;
|
|
44
53
|
private handleAnnotationLinkDeleteClick;
|
|
45
54
|
private static readableTimestamp;
|
|
55
|
+
getAnnotation(highlight: IHighlight): Promise<any>;
|
|
56
|
+
getAnnotationByID(id: string): Promise<any>;
|
|
46
57
|
}
|
|
@@ -1,33 +1,8 @@
|
|
|
1
1
|
import ReaderModule from "../ReaderModule";
|
|
2
|
-
import {
|
|
3
|
-
import { TTSSettings, TTSVoice } from "./TTSSettings";
|
|
2
|
+
import { TTSModuleAPI, TTSModuleConfig, TTSModuleProperties, TTSSettings } from "./TTSSettings";
|
|
4
3
|
import IFrameNavigator, { ReaderRights } from "../../navigator/IFrameNavigator";
|
|
5
4
|
import TextHighlighter from "../highlight/TextHighlighter";
|
|
6
|
-
|
|
7
|
-
started: any;
|
|
8
|
-
stopped: any;
|
|
9
|
-
paused: any;
|
|
10
|
-
resumed: any;
|
|
11
|
-
finished: any;
|
|
12
|
-
updateSettings: any;
|
|
13
|
-
}
|
|
14
|
-
export interface TTSModuleProperties {
|
|
15
|
-
enableSplitter?: boolean;
|
|
16
|
-
color?: string;
|
|
17
|
-
autoScroll?: boolean;
|
|
18
|
-
rate?: number;
|
|
19
|
-
pitch?: number;
|
|
20
|
-
volume?: number;
|
|
21
|
-
voice?: TTSVoice;
|
|
22
|
-
}
|
|
23
|
-
export interface TTSModuleConfig extends TTSModuleProperties {
|
|
24
|
-
delegate: IFrameNavigator;
|
|
25
|
-
headerMenu: HTMLElement;
|
|
26
|
-
rights: ReaderRights;
|
|
27
|
-
tts: TTSSettings;
|
|
28
|
-
highlighter: TextHighlighter;
|
|
29
|
-
api: TTSModuleAPI;
|
|
30
|
-
}
|
|
5
|
+
import { ISelectionInfo } from "../highlight/common/selection";
|
|
31
6
|
export default class TTSModule implements ReaderModule {
|
|
32
7
|
private tts;
|
|
33
8
|
private splittingResult;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import ReaderModule from "../ReaderModule";
|
|
2
|
+
import { TTSModuleAPI, TTSModuleConfig, TTSModuleProperties, TTSSettings } from "./TTSSettings";
|
|
3
|
+
import IFrameNavigator, { ReaderRights } from "../../navigator/IFrameNavigator";
|
|
4
|
+
import TextHighlighter from "../highlight/TextHighlighter";
|
|
5
|
+
import { IHighlight } from "../highlight/common/highlight";
|
|
6
|
+
import { ISelectionInfo } from "../highlight/common/selection";
|
|
7
|
+
export default class TTSModule2 implements ReaderModule {
|
|
8
|
+
private tts;
|
|
9
|
+
private voices;
|
|
10
|
+
private clean;
|
|
11
|
+
private rights;
|
|
12
|
+
private readonly highlighter;
|
|
13
|
+
private delegate;
|
|
14
|
+
private body;
|
|
15
|
+
private hasEventListener;
|
|
16
|
+
private readonly headerMenu;
|
|
17
|
+
private readonly properties;
|
|
18
|
+
private readonly api;
|
|
19
|
+
initialize(body: any): void;
|
|
20
|
+
private click;
|
|
21
|
+
private initVoices;
|
|
22
|
+
cancel(): void;
|
|
23
|
+
index: number;
|
|
24
|
+
speak(selectionInfo: ISelectionInfo | undefined, partial: boolean, callback: () => void): Promise<any>;
|
|
25
|
+
speakPlay(): void;
|
|
26
|
+
speakPause(): void;
|
|
27
|
+
speakResume(): void;
|
|
28
|
+
static create(config: TTSModuleConfig): Promise<TTSModule2>;
|
|
29
|
+
constructor(delegate: IFrameNavigator, tts: TTSSettings, headerMenu: HTMLElement, rights: ReaderRights, highlighter: TextHighlighter, properties?: TTSModuleProperties | null, api?: TTSModuleAPI | null);
|
|
30
|
+
protected start(): Promise<void>;
|
|
31
|
+
userScrolled: boolean;
|
|
32
|
+
private wheel;
|
|
33
|
+
stop(): Promise<void>;
|
|
34
|
+
generateTtsQueue(rootElement: Element, splitSentences: boolean): ITtsQueueItem[];
|
|
35
|
+
findTtsQueueItemIndex(ttsQueue: ITtsQueueItem[], element: Element, startTextNode: Node | undefined, startTextNodeOffset: number, rootElem: Element): number;
|
|
36
|
+
speaking: boolean;
|
|
37
|
+
restartIndex: number;
|
|
38
|
+
private restart;
|
|
39
|
+
startTTSSession(ttsQueue: ITtsQueueItem[], ttsQueueIndexStart: number): void;
|
|
40
|
+
ttsPlayQueueIndex(ttsQueueIndex: number, ttsQueue: any): void;
|
|
41
|
+
ttsQueueIndex: number;
|
|
42
|
+
ttsQueue: any;
|
|
43
|
+
ttsPlayQueueIndexDebounced: ((ttsQueueIndex: number, ttsQueue: any) => void) & {
|
|
44
|
+
clear(): void;
|
|
45
|
+
};
|
|
46
|
+
updateTTSInfo(ttsQueueItem: any, charIndex: number, charLength: number, utteranceText: string | undefined): string | undefined;
|
|
47
|
+
_ttsQueueItemHighlightsWord: IHighlight | undefined;
|
|
48
|
+
wrapHighlightWord(ttsQueueItemRef: ITtsQueueItemReference, utteranceText: string, charIndex: number, charLength: number, word: string, start: number, end: number): void;
|
|
49
|
+
}
|
|
50
|
+
export interface ITtsQueueItem {
|
|
51
|
+
dir: string | undefined;
|
|
52
|
+
lang: string | undefined;
|
|
53
|
+
parentElement: Element;
|
|
54
|
+
textNodes: Node[];
|
|
55
|
+
combinedText: string;
|
|
56
|
+
combinedTextSentences: string[] | undefined;
|
|
57
|
+
combinedTextSentencesRangeBegin: number[] | undefined;
|
|
58
|
+
combinedTextSentencesRangeEnd: number[] | undefined;
|
|
59
|
+
}
|
|
60
|
+
export interface ITtsQueueItemReference {
|
|
61
|
+
item: ITtsQueueItem;
|
|
62
|
+
iArray: number;
|
|
63
|
+
iSentence: number;
|
|
64
|
+
iGlobal: number;
|
|
65
|
+
}
|
|
66
|
+
export declare function getLanguage(el: Element): string | undefined;
|
|
67
|
+
export declare function getDirection(el: Element): string | undefined;
|
|
68
|
+
export declare function combineTextNodes(textNodes: Node[], skipNormalize?: boolean): string;
|
|
69
|
+
export declare function normalizeHtmlText(str: string): string;
|
|
70
|
+
export declare function normalizeText(str: string): string;
|
|
71
|
+
export declare function getTtsQueueItemRef(items: ITtsQueueItem[], index: number): ITtsQueueItemReference | undefined;
|
|
72
|
+
export declare function getTtsQueueLength(items: ITtsQueueItem[]): number;
|
|
73
|
+
export declare function getTtsQueueItemRefText(obj: ITtsQueueItemReference): string;
|
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
import Store from "../../store/Store";
|
|
2
2
|
import { UserProperty, UserProperties } from "../../model/user-settings/UserProperties";
|
|
3
|
-
import {
|
|
3
|
+
import IFrameNavigator, { ReaderRights } from "../../navigator/IFrameNavigator";
|
|
4
|
+
import TextHighlighter from "../highlight/TextHighlighter";
|
|
5
|
+
export interface TTSModuleAPI {
|
|
6
|
+
started: any;
|
|
7
|
+
stopped: any;
|
|
8
|
+
paused: any;
|
|
9
|
+
resumed: any;
|
|
10
|
+
finished: any;
|
|
11
|
+
updateSettings: any;
|
|
12
|
+
}
|
|
13
|
+
export interface TTSModuleProperties {
|
|
14
|
+
enableSplitter?: boolean;
|
|
15
|
+
color?: string;
|
|
16
|
+
autoScroll?: boolean;
|
|
17
|
+
rate?: number;
|
|
18
|
+
pitch?: number;
|
|
19
|
+
volume?: number;
|
|
20
|
+
voice?: TTSVoice;
|
|
21
|
+
}
|
|
22
|
+
export interface TTSModuleConfig extends TTSModuleProperties {
|
|
23
|
+
delegate: IFrameNavigator;
|
|
24
|
+
headerMenu: HTMLElement;
|
|
25
|
+
rights: ReaderRights;
|
|
26
|
+
tts: TTSSettings;
|
|
27
|
+
highlighter: TextHighlighter;
|
|
28
|
+
api: TTSModuleAPI;
|
|
29
|
+
}
|
|
4
30
|
export declare class TTSREFS {
|
|
5
31
|
static readonly COLOR_REF = "color";
|
|
6
32
|
static readonly AUTO_SCROLL_REF = "autoscroll";
|
|
@@ -45,10 +71,8 @@ export declare class TTSSettings implements ITTSUserSettings {
|
|
|
45
71
|
volume: number;
|
|
46
72
|
voice: TTSVoice;
|
|
47
73
|
userProperties: UserProperties;
|
|
48
|
-
private rateButtons;
|
|
49
|
-
private pitchButtons;
|
|
50
|
-
private volumeButtons;
|
|
51
74
|
private settingsChangeCallback;
|
|
75
|
+
private restartCallback;
|
|
52
76
|
private settingsView;
|
|
53
77
|
private readonly headerMenu;
|
|
54
78
|
private speechRate;
|
|
@@ -66,7 +90,7 @@ export declare class TTSSettings implements ITTSUserSettings {
|
|
|
66
90
|
setControls(): void;
|
|
67
91
|
private renderControls;
|
|
68
92
|
onSettingsChange(callback: () => void): void;
|
|
69
|
-
|
|
93
|
+
onRestart(callback: () => void): void;
|
|
70
94
|
private storeProperty;
|
|
71
95
|
private updateUserSettings;
|
|
72
96
|
private getTTSSettings;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Publication } from "../../model/Publication";
|
|
2
|
+
import IFrameNavigator from "../../navigator/IFrameNavigator";
|
|
3
|
+
import ReaderModule from "../ReaderModule";
|
|
4
|
+
export declare enum CitationStyle {
|
|
5
|
+
Chicago = 0,
|
|
6
|
+
MLA = 1,
|
|
7
|
+
APA = 2
|
|
8
|
+
}
|
|
9
|
+
export declare enum ContributorType {
|
|
10
|
+
Author = "Author",
|
|
11
|
+
Editor = "Editor",
|
|
12
|
+
Translator = "Translator",
|
|
13
|
+
Compiler = "Compiler"
|
|
14
|
+
}
|
|
15
|
+
export interface CitationModuleProperties {
|
|
16
|
+
characters: number;
|
|
17
|
+
appName: string;
|
|
18
|
+
appLink: string;
|
|
19
|
+
library: string;
|
|
20
|
+
styles: string[];
|
|
21
|
+
}
|
|
22
|
+
export interface CitationModuleConfig extends CitationModuleProperties {
|
|
23
|
+
publication: Publication;
|
|
24
|
+
delegate: IFrameNavigator;
|
|
25
|
+
}
|
|
26
|
+
export default class CitationModule implements ReaderModule {
|
|
27
|
+
private publication;
|
|
28
|
+
private delegate;
|
|
29
|
+
private properties;
|
|
30
|
+
static create(config: CitationModuleConfig): Promise<CitationModule>;
|
|
31
|
+
private constructor();
|
|
32
|
+
stop(): Promise<void>;
|
|
33
|
+
protected start(): Promise<void>;
|
|
34
|
+
copyToClipboard(textToClipboard: any): void;
|
|
35
|
+
createElementForExecCommand(textToClipboard: any): HTMLDivElement;
|
|
36
|
+
selectContent(element: any): void;
|
|
37
|
+
}
|
|
File without changes
|
|
@@ -1,16 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HighlightType, IHighlight, IMarkerIcon, IPopupStyle, IStyle, SelectionMenuItem } from "./common/highlight";
|
|
2
2
|
import { ISelectionInfo } from "./common/selection";
|
|
3
3
|
import { IRectSimple } from "./common/rect-utils";
|
|
4
|
-
import { IReadiumIFrameWindow } from "./renderer/iframe/state";
|
|
5
4
|
import { AnnotationMarker } from "../../model/Locator";
|
|
6
|
-
import IFrameNavigator
|
|
5
|
+
import IFrameNavigator from "../../navigator/IFrameNavigator";
|
|
7
6
|
export declare const ID_HIGHLIGHTS_CONTAINER = "R2_ID_HIGHLIGHTS_CONTAINER";
|
|
7
|
+
export declare const ID_READALOUD_CONTAINER = "R2_ID_READALOUD_CONTAINER";
|
|
8
|
+
export declare const ID_PAGEBREAK_CONTAINER = "R2_ID_PAGEBREAK_CONTAINER";
|
|
9
|
+
export declare const ID_SEARCH_CONTAINER = "R2_ID_SEARCH_CONTAINER";
|
|
10
|
+
export declare const ID_POPUP_CONTAINER = "R2_ID_POPUP_CONTAINER";
|
|
8
11
|
export declare const CLASS_HIGHLIGHT_CONTAINER = "R2_CLASS_HIGHLIGHT_CONTAINER";
|
|
9
12
|
export declare const CLASS_HIGHLIGHT_AREA = "R2_CLASS_HIGHLIGHT_AREA";
|
|
13
|
+
export declare const CLASS_HIGHLIGHT_ICON = "R2_CLASS_HIGHLIGHT_ICON";
|
|
10
14
|
export declare const CLASS_HIGHLIGHT_BOUNDING_AREA = "R2_CLASS_HIGHLIGHT_BOUNDING_AREA";
|
|
15
|
+
export declare const DEFAULT_BACKGROUND_COLOR: {
|
|
16
|
+
blue: number;
|
|
17
|
+
green: number;
|
|
18
|
+
red: number;
|
|
19
|
+
};
|
|
11
20
|
export interface TextSelectorAPI {
|
|
12
21
|
selectionMenuOpen: any;
|
|
13
22
|
selectionMenuClose: any;
|
|
23
|
+
selection: any;
|
|
14
24
|
}
|
|
15
25
|
export declare const _highlights: IHighlight[];
|
|
16
26
|
interface IWithRect {
|
|
@@ -19,6 +29,14 @@ interface IWithRect {
|
|
|
19
29
|
}
|
|
20
30
|
export interface IHTMLDivElementWithRect extends HTMLDivElement, IWithRect {
|
|
21
31
|
}
|
|
32
|
+
export interface HTMLElementRect {
|
|
33
|
+
node: Element;
|
|
34
|
+
height: number;
|
|
35
|
+
top: number;
|
|
36
|
+
width: number;
|
|
37
|
+
left: number;
|
|
38
|
+
textContent: string;
|
|
39
|
+
}
|
|
22
40
|
export interface TextHighlighterProperties {
|
|
23
41
|
selectionMenuItems: Array<SelectionMenuItem>;
|
|
24
42
|
}
|
|
@@ -30,9 +48,10 @@ export default class TextHighlighter {
|
|
|
30
48
|
private options;
|
|
31
49
|
private delegate;
|
|
32
50
|
private lastSelectedHighlight;
|
|
33
|
-
|
|
51
|
+
properties: TextHighlighterProperties;
|
|
34
52
|
private api;
|
|
35
53
|
private hasEventListener;
|
|
54
|
+
activeAnnotationMarkerId?: string;
|
|
36
55
|
static create(config: TextHighlighterConfig): Promise<any>;
|
|
37
56
|
private constructor();
|
|
38
57
|
initialize(): Promise<void>;
|
|
@@ -118,7 +137,7 @@ export default class TextHighlighter {
|
|
|
118
137
|
*/
|
|
119
138
|
destroy(): void;
|
|
120
139
|
initializeToolbox(): void;
|
|
121
|
-
toolboxMode(mode: "colors" | "edit" | "add"): void;
|
|
140
|
+
toolboxMode(mode: "colors" | "edit" | "add" | "action"): void;
|
|
122
141
|
toolboxHide(): void;
|
|
123
142
|
toolboxShowDelayed(): void;
|
|
124
143
|
snapSelectionToWord(): any;
|
|
@@ -130,6 +149,9 @@ export default class TextHighlighter {
|
|
|
130
149
|
selectionMenuClosed: (() => void) & {
|
|
131
150
|
clear(): void;
|
|
132
151
|
};
|
|
152
|
+
selection: ((text: any, selection: any) => void) & {
|
|
153
|
+
clear(): void;
|
|
154
|
+
};
|
|
133
155
|
toolboxPlacement(): void;
|
|
134
156
|
toolboxHandler(): void;
|
|
135
157
|
/**
|
|
@@ -143,6 +165,7 @@ export default class TextHighlighter {
|
|
|
143
165
|
stopReadAloud(): void;
|
|
144
166
|
speakAll(): void;
|
|
145
167
|
callbackComplete(): void;
|
|
168
|
+
get visibleTextRects(): HTMLElementRect[];
|
|
146
169
|
doneSpeaking(reload?: boolean): void;
|
|
147
170
|
/**
|
|
148
171
|
* Normalizes highlights. Ensures that highlighting is done with use of the smallest possible number of
|
|
@@ -180,20 +203,6 @@ export default class TextHighlighter {
|
|
|
180
203
|
* @memberof TextHighlighter
|
|
181
204
|
*/
|
|
182
205
|
getColor(): string;
|
|
183
|
-
/**
|
|
184
|
-
* Returns highlights from given container.
|
|
185
|
-
* @param params
|
|
186
|
-
* @param {HTMLElement} [params.container] - return highlights from this element. Default: the element the
|
|
187
|
-
* highlighter is applied to.
|
|
188
|
-
* @param {boolean} [params.andSelf] - if set to true and container is a highlight itself, add container to
|
|
189
|
-
* returned results. Default: true.
|
|
190
|
-
* @param {boolean} [params.grouped] - if set to true, highlights are grouped in logical groups of highlights added
|
|
191
|
-
* in the same moment. Each group is an object which has got array of highlights, 'toString' method and 'timestamp'
|
|
192
|
-
* property. Default: false.
|
|
193
|
-
* @returns {Array} - array of highlights.
|
|
194
|
-
* @memberof TextHighlighter
|
|
195
|
-
*/
|
|
196
|
-
getHighlights(params?: any): Array<any>;
|
|
197
206
|
/**
|
|
198
207
|
* Returns true if element is a highlight.
|
|
199
208
|
* All highlights have 'data-highlighted' attribute.
|
|
@@ -202,20 +211,6 @@ export default class TextHighlighter {
|
|
|
202
211
|
* @memberof TextHighlighter
|
|
203
212
|
*/
|
|
204
213
|
isHighlight(el: any): boolean;
|
|
205
|
-
/**
|
|
206
|
-
* Serializes all highlights in the element the highlighter is applied to.
|
|
207
|
-
* @returns {string} - stringified JSON with highlights definition
|
|
208
|
-
* @memberof TextHighlighter
|
|
209
|
-
*/
|
|
210
|
-
serializeHighlights(): string;
|
|
211
|
-
/**
|
|
212
|
-
* Deserializes highlights.
|
|
213
|
-
* @throws exception when can't parse JSON or JSON has invalid structure.
|
|
214
|
-
* @param {object} json - JSON object with highlights definition.
|
|
215
|
-
* @returns {Array} - array of deserialized highlights.
|
|
216
|
-
* @memberof TextHighlighter
|
|
217
|
-
*/
|
|
218
|
-
deserializeHighlights(json: any): Array<any>;
|
|
219
214
|
/**
|
|
220
215
|
* Creates wrapper for highlights.
|
|
221
216
|
* TextHighlighter instance calls this method each time it needs to create highlights and pass options retrieved
|
|
@@ -234,25 +229,20 @@ export default class TextHighlighter {
|
|
|
234
229
|
};
|
|
235
230
|
static hexToRgbA(hex: string): string;
|
|
236
231
|
static hexToRgbAWithOpacity(hex: string, opacity: number): string;
|
|
237
|
-
resetHighlightBoundingStyle(_win:
|
|
238
|
-
resetHighlightAreaStyle(_win:
|
|
239
|
-
setHighlightAreaStyle(_win:
|
|
232
|
+
resetHighlightBoundingStyle(_win: any, highlightBounding: HTMLElement): void;
|
|
233
|
+
resetHighlightAreaStyle(_win: any, highlightArea: HTMLElement, id_container: string): void;
|
|
234
|
+
setHighlightAreaStyle(_win: any, highlightAreas: Array<HTMLElement>, highlight: IHighlight): void;
|
|
240
235
|
setAndResetSearchHighlight(highlight: any, highlights: any): void;
|
|
241
236
|
isIOS(): boolean;
|
|
242
237
|
isAndroid(): boolean;
|
|
243
238
|
getScrollingElement: (documant: Document) => Element;
|
|
244
|
-
processMouseEvent(win:
|
|
245
|
-
ensureHighlightsContainer(win:
|
|
239
|
+
processMouseEvent(win: any, ev: MouseEvent): Promise<void>;
|
|
240
|
+
ensureHighlightsContainer(win: any, id: string): HTMLElement;
|
|
246
241
|
hideAllhighlights(_documant: Document): void;
|
|
247
242
|
destroyAllhighlights(documant: Document): void;
|
|
243
|
+
destroyHighlights(type: HighlightType): void;
|
|
248
244
|
destroyHighlight(documant: Document, id: string): void;
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
clear(): void;
|
|
252
|
-
};
|
|
253
|
-
recreateAllHighlights(win: IReadiumIFrameWindow): void;
|
|
254
|
-
createSearchHighlight(selectionInfo: ISelectionInfo, color: string): IHighlight;
|
|
255
|
-
createHighlight(win: IReadiumIFrameWindow, selectionInfo: ISelectionInfo, color: IColor | undefined, pointerInteraction: boolean, marker: AnnotationMarker): IHighlight;
|
|
256
|
-
createHighlightDom(win: IReadiumIFrameWindow, highlight: IHighlight): HTMLDivElement | undefined;
|
|
245
|
+
createHighlight(win: any, selectionInfo: ISelectionInfo, color: string | undefined, pointerInteraction: boolean, marker: AnnotationMarker, icon?: IMarkerIcon | undefined, popup?: IPopupStyle | undefined, style?: IStyle | undefined, type?: HighlightType | undefined, prefix?: string | undefined): [IHighlight, HTMLDivElement];
|
|
246
|
+
createHighlightDom(win: any, highlight: IHighlight): HTMLDivElement | undefined;
|
|
257
247
|
}
|
|
258
248
|
export {};
|