teamsync-pdf-viewer 1.6.1 → 1.7.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.
- package/CHANGELOG.md +22 -0
- package/dist/src/components/DocumentViewer.d.ts +15 -2
- package/dist/src/components/PageRenderer.d.ts +2 -1
- package/dist/src/components/Sidebar.d.ts +2 -1
- package/dist/src/components/TeamSyncViewer.d.ts +28 -1
- package/dist/src/core/ViewerInstance.d.ts +38 -7
- package/dist/src/core/types.d.ts +50 -1
- package/dist/src/index.d.ts +3 -1
- package/dist/src/utils/linkUtils.d.ts +23 -0
- package/dist/teamsync-pdf-viewer.js +1843 -1531
- package/dist/teamsync-pdf-viewer.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `teamsync-pdf-viewer` are documented here.
|
|
4
4
|
|
|
5
|
+
## [1.7.1] — 2026-09-15
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- **Default Responsive Fit-Width**: Resolved an issue where omitting `initialScale` prevented `ResizeObserver` from auto-refitting the document when the browser window or viewer container resized. Now defaults to `'fit-width'` and `{ type: 'fit-width', ratio: 1.0 }` when no explicit numeric zoom is provided.
|
|
9
|
+
- **Dynamic Horizontal Page Centering**: Added live `containerDimensions` state tracking so that pages automatically re-center horizontally in real-time during window resize and sidebar toggles, eliminating stale pixel offsets and right-edge clipping.
|
|
10
|
+
- **Programmatic Zoom Tracking**: Fixed dangling programmatic scale flag when `newScale === scale` during minor resize steps so manual zoom interactions properly clear auto-fit mode.
|
|
11
|
+
- **Window Resize Event Listener**: Added window `resize` event listener alongside `ResizeObserver` for comprehensive container refitting across all viewport changes.
|
|
12
|
+
|
|
13
|
+
## [1.7.0] — 2026-09-15
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
- **Cross-Instance Document Linking**: Links referring to other documents or specific pages can now automatically load and navigate the destination document in a designated target `TeamSyncViewer` instance.
|
|
17
|
+
- **`targetViewer` Prop & Option**: Added `targetViewer` to `<TeamSyncViewer>` and `WebViewerOptions`, accepting another `WebViewerInstance`, a React ref (`useRef<WebViewerInstance>`), a getter function `() => WebViewerInstance | null`, or an instance ID string.
|
|
18
|
+
- **Static Viewer Instance Registry**: Added `WebViewerInstance.getInstance(id)`, `WebViewerInstance.registerInstance(id, inst)`, `WebViewerInstance.unregisterInstance(id)`, and automatic unregistration when the viewer is unmounted/destroyed.
|
|
19
|
+
- **`loadOrNavigate` & `openLink` APIs**: Added `instance.loadOrNavigate(documentUrl, page?)` (smoothly navigates to the page if the document is already loaded, or reloads at that page if not) and `instance.openLink(url, options?)`.
|
|
20
|
+
- **Dual Link Support (TeamSync Annotations & Embedded PDF Links)**:
|
|
21
|
+
- Native embedded PDF `/Link` annotations are now extracted from PDF.js (`page.getAnnotations({ intent: 'display' })`) and rendered with interactive SVG hitboxes and tooltip preview.
|
|
22
|
+
- Link annotations and sidebar comment links seamlessly route through the link handler.
|
|
23
|
+
- **"Other Doc" Tab in Insert Link Modal**: Added a dedicated 3rd tab to `InsertLinkModal` for configuring cross-document links with document URL and target page number.
|
|
24
|
+
- **`linkClicked` Event & Custom Handlers**: Added `linkClicked` event to `ViewerEventMap` with a cancellable `LinkClickEvent` supporting `event.preventDefault()`, plus `onLinkClick` and `resolveLinkUrl` props for URL mapping and event interception.
|
|
25
|
+
- **Public Utilities Export**: Exported `parseLinkTarget`, `isDocumentUrl`, `ParsedLinkTarget`, and `LinkClickEvent` from the library root.
|
|
26
|
+
|
|
5
27
|
## [1.6.1] — 2026-09-15
|
|
6
28
|
|
|
7
29
|
### Added
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { Annotation } from '../annotations/types';
|
|
3
3
|
import { AnnotationManager } from '../annotations/AnnotationManager';
|
|
4
|
-
import { Redaction, WatermarkOptions, SDKPermissions, PdfAssetPaths, TransientHighlight, InitialScale } from '../core/types';
|
|
4
|
+
import { Redaction, WatermarkOptions, SDKPermissions, PdfAssetPaths, TransientHighlight, InitialScale, LinkClickEvent, WebViewerInstance } from '../core/types';
|
|
5
5
|
import * as pdfjsLib from 'pdfjs-dist';
|
|
6
6
|
export interface DocumentLoadErrorInfo {
|
|
7
7
|
url: string;
|
|
@@ -59,6 +59,19 @@ interface DocumentViewerProps {
|
|
|
59
59
|
initialScale?: InitialScale;
|
|
60
60
|
initialWidthRatio?: number;
|
|
61
61
|
responsive?: boolean;
|
|
62
|
+
instance?: WebViewerInstance;
|
|
63
|
+
targetViewer?: WebViewerInstance | React.RefObject<WebViewerInstance | null> | (() => WebViewerInstance | null) | string;
|
|
64
|
+
resolveLinkUrl?: (linkUrl: string, context: {
|
|
65
|
+
sourceViewer: WebViewerInstance;
|
|
66
|
+
annotation?: Annotation;
|
|
67
|
+
}) => string | {
|
|
68
|
+
url: string;
|
|
69
|
+
page?: number;
|
|
70
|
+
} | Promise<string | {
|
|
71
|
+
url: string;
|
|
72
|
+
page?: number;
|
|
73
|
+
} | null> | null;
|
|
74
|
+
onLinkClick?: (event: LinkClickEvent) => boolean | void | Promise<void>;
|
|
62
75
|
}
|
|
63
|
-
export default function DocumentViewer({ leftSidebarOpen, rightSidebarOpen, activeTab, annotationManager, initialDoc, loadNonce, withCredentials, assets, sidebars, redactions, regexRedactions, scale, setScale, sidebarTab, setSidebarTab, onAnnotationsChange, onRedactionsChange, onRedactionsApplied, onDocumentLoaded, onLoadError, onFirstPageRendered, onPageRendered, onPageChange, pageTransition, pageLayout, rotation, setRotation, watermark, watermarkText, enableAnnotations: _enableAnnotations, initialPage, page, transientHighlights, permissions, hideAnnotationsUntilPageRendered, enableTextSelection, defaultTool, showSelectionTooltip, initialScale, initialWidthRatio, responsive, }: DocumentViewerProps): React.JSX.Element;
|
|
76
|
+
export default function DocumentViewer({ leftSidebarOpen, rightSidebarOpen, activeTab, annotationManager, initialDoc, loadNonce, withCredentials, assets, sidebars, redactions, regexRedactions, scale, setScale, sidebarTab, setSidebarTab, onAnnotationsChange, onRedactionsChange, onRedactionsApplied, onDocumentLoaded, onLoadError, onFirstPageRendered, onPageRendered, onPageChange, pageTransition, pageLayout, rotation, setRotation, watermark, watermarkText, enableAnnotations: _enableAnnotations, initialPage, page, transientHighlights, permissions, hideAnnotationsUntilPageRendered, enableTextSelection, defaultTool, showSelectionTooltip, initialScale, initialWidthRatio, responsive, instance, targetViewer, resolveLinkUrl, onLinkClick, }: DocumentViewerProps): React.JSX.Element;
|
|
64
77
|
export {};
|
|
@@ -40,7 +40,8 @@ interface PageRendererProps {
|
|
|
40
40
|
onRendered?: (pageNum: number) => void;
|
|
41
41
|
/** Whether to hide annotations and transient highlights until the page canvas has finished rendering. Default: true. */
|
|
42
42
|
hideAnnotationsUntilPageRendered?: boolean;
|
|
43
|
+
onLinkClick?: (url: string, annotation?: Annotation, e?: React.MouseEvent) => void;
|
|
43
44
|
}
|
|
44
|
-
declare function PageRendererComponent({ pageNum, pdfDoc, scale, rotation, containerWidth: _containerWidth, containerHeight: _containerHeight, scrollTop: _scrollTop, scrollLeft: _scrollLeft, pageTop, pageLeft, basePageWidth, basePageHeight, activeTab, activeTool, annotations, selectedAnnotationId, activeSearchResult, transientHighlights, onMouseDown, onMouseMove, onMouseUp, onAnnotationClick, onAnnotationDoubleClick, onStartResize, onStartMove, onAnnotationMouseEnter, onClearSelection, watermark, watermarkText, redactions, onDiscardRedaction, onRendered, hideAnnotationsUntilPageRendered }: PageRendererProps): React.JSX.Element;
|
|
45
|
+
declare function PageRendererComponent({ pageNum, pdfDoc, scale, rotation, containerWidth: _containerWidth, containerHeight: _containerHeight, scrollTop: _scrollTop, scrollLeft: _scrollLeft, pageTop, pageLeft, basePageWidth, basePageHeight, activeTab, activeTool, annotations, selectedAnnotationId, activeSearchResult, transientHighlights, onMouseDown, onMouseMove, onMouseUp, onAnnotationClick, onAnnotationDoubleClick, onStartResize, onStartMove, onAnnotationMouseEnter, onClearSelection, watermark, watermarkText, redactions, onDiscardRedaction, onRendered, hideAnnotationsUntilPageRendered, onLinkClick }: PageRendererProps): React.JSX.Element;
|
|
45
46
|
declare const PageRenderer: React.MemoExoticComponent<typeof PageRendererComponent>;
|
|
46
47
|
export default PageRenderer;
|
|
@@ -13,6 +13,7 @@ interface SidebarProps {
|
|
|
13
13
|
onResultClick: (result: SearchResult) => void;
|
|
14
14
|
activeTab: 'Comments' | 'Search';
|
|
15
15
|
setActiveTab: (tab: 'Comments' | 'Search') => void;
|
|
16
|
+
onLinkClick?: (url: string, annotation?: any, e?: React.MouseEvent) => void;
|
|
16
17
|
}
|
|
17
|
-
export default function Sidebar({ isOpen, annotations, setAnnotations, selectedAnnotationId, setSelectedAnnotationId, onSearch, searchResults, isSearching, searchProgress, onResultClick, activeTab, setActiveTab }: SidebarProps): React.JSX.Element;
|
|
18
|
+
export default function Sidebar({ isOpen, annotations, setAnnotations, selectedAnnotationId, setSelectedAnnotationId, onSearch, searchResults, isSearching, searchProgress, onResultClick, activeTab, setActiveTab, onLinkClick }: SidebarProps): React.JSX.Element;
|
|
18
19
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { DocumentLoadErrorInfo } from './DocumentViewer';
|
|
3
3
|
import { WebViewerInstance } from '../core/ViewerInstance';
|
|
4
|
-
import { WebViewerOptions, Redaction, TransientHighlight } from '../core/types';
|
|
4
|
+
import { WebViewerOptions, Redaction, TransientHighlight, LinkClickEvent } from '../core/types';
|
|
5
5
|
import { Annotation } from '../annotations/types';
|
|
6
6
|
export interface TeamSyncViewerProps extends Omit<WebViewerOptions, 'path'> {
|
|
7
7
|
/** URL of the PDF to display. Alias of `initialDoc`; `fileUrl` wins when both are set. */
|
|
@@ -47,6 +47,33 @@ export interface TeamSyncViewerProps extends Omit<WebViewerOptions, 'path'> {
|
|
|
47
47
|
onTextCopied?: (info: {
|
|
48
48
|
text: string;
|
|
49
49
|
}) => void;
|
|
50
|
+
/** Unique ID for this viewer instance, enabling other viewers to target it by name. */
|
|
51
|
+
id?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Target viewer instance, ref, getter, or instance ID to open cross-document links in.
|
|
54
|
+
* When a link annotation pointing to another PDF is clicked, the document will automatically
|
|
55
|
+
* be loaded and navigated in this target viewer instance.
|
|
56
|
+
*/
|
|
57
|
+
targetViewer?: WebViewerInstance | React.RefObject<WebViewerInstance | null> | (() => WebViewerInstance | null) | string;
|
|
58
|
+
/**
|
|
59
|
+
* Optional custom resolver for cross-document links.
|
|
60
|
+
* Allows transforming relative filenames, document IDs, or URNs into full fetchable document URLs or target pages.
|
|
61
|
+
*/
|
|
62
|
+
resolveLinkUrl?: (linkUrl: string, context: {
|
|
63
|
+
sourceViewer: WebViewerInstance;
|
|
64
|
+
annotation?: Annotation;
|
|
65
|
+
}) => string | {
|
|
66
|
+
url: string;
|
|
67
|
+
page?: number;
|
|
68
|
+
} | Promise<string | {
|
|
69
|
+
url: string;
|
|
70
|
+
page?: number;
|
|
71
|
+
} | null> | null;
|
|
72
|
+
/**
|
|
73
|
+
* Fires when a link annotation or embedded PDF link is clicked.
|
|
74
|
+
* Call `event.preventDefault()` to suppress default behavior.
|
|
75
|
+
*/
|
|
76
|
+
onLinkClick?: (event: LinkClickEvent) => boolean | void | Promise<void>;
|
|
50
77
|
className?: string;
|
|
51
78
|
style?: React.CSSProperties;
|
|
52
79
|
}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
1
2
|
import { ViewerBus } from './eventBus';
|
|
2
3
|
import { ExportOptions } from './export';
|
|
3
4
|
import { Annotation } from '../annotations/types';
|
|
4
5
|
import { AnnotationManager } from '../annotations/AnnotationManager';
|
|
5
6
|
import { Redaction, WatermarkOptions, ViewerEventMap, ViewerEventType, TransientHighlight } from './types';
|
|
6
7
|
import { SearchResult } from '../hooks/usePdfSearch';
|
|
7
|
-
/**
|
|
8
|
-
* © 2026 AngelBot Ai Pvt Ltd. All rights reserved.
|
|
9
|
-
* WebViewerInstance — the imperative handle returned by `createWebViewer()` and exposed through
|
|
10
|
-
* `<TeamSyncViewer ref>`. Keeps the legacy `UI` / `Core` facade for drop-in compatibility.
|
|
11
|
-
*/
|
|
12
8
|
import type * as pdfjsLib from 'pdfjs-dist';
|
|
13
9
|
/** Callbacks the React component installs so the instance can reach live state. */
|
|
14
10
|
export interface ViewerBinding {
|
|
@@ -29,15 +25,31 @@ export interface ViewerBinding {
|
|
|
29
25
|
setTransientHighlights(highlights: TransientHighlight[]): void;
|
|
30
26
|
}
|
|
31
27
|
export declare class WebViewerInstance {
|
|
28
|
+
private static instances;
|
|
29
|
+
/** Retrieve a registered WebViewerInstance by its ID. */
|
|
30
|
+
static getInstance(id: string): WebViewerInstance | undefined;
|
|
31
|
+
/** Register a WebViewerInstance with an ID. */
|
|
32
|
+
static registerInstance(id: string, instance: WebViewerInstance): void;
|
|
33
|
+
/** Unregister an instance by its ID. */
|
|
34
|
+
static unregisterInstance(id: string): void;
|
|
35
|
+
/** Clear all registered instances (primarily for testing). */
|
|
36
|
+
static clearInstances(): void;
|
|
32
37
|
readonly bus: ViewerBus;
|
|
33
38
|
/** Annotation list, history, permissions and XFDF import/export. */
|
|
34
39
|
readonly annotationManager: AnnotationManager;
|
|
35
40
|
/** Root element of the viewer once mounted. */
|
|
36
41
|
element: HTMLElement | null;
|
|
42
|
+
/** Unique identifier for this instance. */
|
|
43
|
+
id?: string;
|
|
37
44
|
private binding;
|
|
38
45
|
private unmountRoot;
|
|
39
46
|
private destroyed;
|
|
40
|
-
|
|
47
|
+
private targetViewerTarget;
|
|
48
|
+
constructor(bus: ViewerBus, annotationManager?: AnnotationManager, id?: string);
|
|
49
|
+
/** Sets the target viewer instance, ref, getter, or ID to receive cross-document links. */
|
|
50
|
+
setTargetViewer(target: WebViewerInstance | React.RefObject<WebViewerInstance | null> | (() => WebViewerInstance | null) | string | null): void;
|
|
51
|
+
/** Resolves the target viewer instance if configured. */
|
|
52
|
+
getTargetViewer(): WebViewerInstance | null;
|
|
41
53
|
/** @internal */
|
|
42
54
|
_bind(binding: ViewerBinding, element: HTMLElement | null): void;
|
|
43
55
|
/** @internal */
|
|
@@ -54,10 +66,29 @@ export declare class WebViewerInstance {
|
|
|
54
66
|
on<K extends ViewerEventType>(type: K, listener: (detail: ViewerEventMap[K]) => void): () => void;
|
|
55
67
|
off<K extends ViewerEventType>(type: K, listener: (detail: ViewerEventMap[K]) => void): void;
|
|
56
68
|
/** Load (or reload) a document by URL. Resolves when loaded, rejects on load error. */
|
|
57
|
-
loadDocument(url: string
|
|
69
|
+
loadDocument(url: string, options?: {
|
|
70
|
+
page?: number;
|
|
71
|
+
initialPage?: number;
|
|
72
|
+
}): Promise<{
|
|
58
73
|
url: string;
|
|
59
74
|
numPages: number;
|
|
60
75
|
}>;
|
|
76
|
+
/**
|
|
77
|
+
* Loads a document or navigates to a page within it. If the document is already loaded,
|
|
78
|
+
* directly navigates to the requested page without reloading.
|
|
79
|
+
*/
|
|
80
|
+
loadOrNavigate(url: string, options?: {
|
|
81
|
+
page?: number;
|
|
82
|
+
initialPage?: number;
|
|
83
|
+
}): Promise<{
|
|
84
|
+
url: string;
|
|
85
|
+
numPages: number;
|
|
86
|
+
} | void>;
|
|
87
|
+
/**
|
|
88
|
+
* Programmatically trigger link following for a given link URL or target,
|
|
89
|
+
* routing through targetViewer or opening appropriately.
|
|
90
|
+
*/
|
|
91
|
+
openLink(linkUrl: string): void;
|
|
61
92
|
getDocumentUrl(): string | undefined;
|
|
62
93
|
getPdfDocument(): pdfjsLib.PDFDocumentProxy | null;
|
|
63
94
|
getCurrentPage(): number;
|
package/dist/src/core/types.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
1
2
|
import { ViewerPlugin } from '../plugins/types';
|
|
2
3
|
import { Annotation } from '../annotations/types';
|
|
3
4
|
import { AnnotationChangedEvent } from '../annotations/AnnotationManager';
|
|
4
5
|
import { PdfAssetPaths } from './pdfAssets';
|
|
5
|
-
|
|
6
|
+
import { WebViewerInstance } from './ViewerInstance';
|
|
7
|
+
export type { PdfAssetPaths, WebViewerInstance };
|
|
6
8
|
export interface SearchBounds {
|
|
7
9
|
x: number;
|
|
8
10
|
y: number;
|
|
@@ -132,6 +134,52 @@ export interface WebViewerOptions {
|
|
|
132
134
|
onRedactionsChange?: (redactions: Redaction[]) => void;
|
|
133
135
|
/** Fires once per user click of Apply in the confirmation modal with all applied redactions. */
|
|
134
136
|
onRedactionsApplied?: (redactions: Redaction[]) => void;
|
|
137
|
+
/** Unique identifier for this viewer instance, allowing other viewers to target it by name. */
|
|
138
|
+
id?: string;
|
|
139
|
+
/**
|
|
140
|
+
* Target viewer instance, ref, getter, or instance ID to open cross-document links in.
|
|
141
|
+
* When a link annotation pointing to another PDF is clicked, the document will automatically
|
|
142
|
+
* be loaded and navigated in this target viewer instance.
|
|
143
|
+
*/
|
|
144
|
+
targetViewer?: WebViewerInstance | React.RefObject<WebViewerInstance | null> | (() => WebViewerInstance | null) | string;
|
|
145
|
+
/**
|
|
146
|
+
* Optional custom resolver for cross-document links.
|
|
147
|
+
* Allows transforming relative filenames, document IDs, or URNs into full fetchable document URLs or target pages.
|
|
148
|
+
*/
|
|
149
|
+
resolveLinkUrl?: (linkUrl: string, context: {
|
|
150
|
+
sourceViewer: WebViewerInstance;
|
|
151
|
+
annotation?: Annotation;
|
|
152
|
+
}) => string | {
|
|
153
|
+
url: string;
|
|
154
|
+
page?: number;
|
|
155
|
+
} | Promise<string | {
|
|
156
|
+
url: string;
|
|
157
|
+
page?: number;
|
|
158
|
+
} | null> | null;
|
|
159
|
+
/**
|
|
160
|
+
* Fires when a link annotation or embedded PDF link is clicked.
|
|
161
|
+
* Call `event.preventDefault()` to suppress default behavior.
|
|
162
|
+
*/
|
|
163
|
+
onLinkClick?: (event: LinkClickEvent) => boolean | void | Promise<void>;
|
|
164
|
+
}
|
|
165
|
+
/** Details provided when a link annotation or embedded PDF link is clicked. */
|
|
166
|
+
export interface LinkClickEvent {
|
|
167
|
+
/** The raw link URL or target string. */
|
|
168
|
+
url: string;
|
|
169
|
+
/** Target document URL if the link points to a document (clean without page hash). */
|
|
170
|
+
docUrl?: string;
|
|
171
|
+
/** Target page number (1-based), if specified in the link. */
|
|
172
|
+
pageNumber?: number;
|
|
173
|
+
/** True if the link points to an internal page in the current document. */
|
|
174
|
+
isInternalPage: boolean;
|
|
175
|
+
/** The annotation object if clicked from a link annotation. */
|
|
176
|
+
annotation?: Annotation;
|
|
177
|
+
/** Original mouse event if triggered by user interaction. */
|
|
178
|
+
originalEvent?: React.MouseEvent;
|
|
179
|
+
/** Calling this prevents default behavior (e.g. scrolling current document, auto-forwarding to targetViewer, or opening window.open). */
|
|
180
|
+
preventDefault: () => void;
|
|
181
|
+
/** Whether preventDefault() was called. */
|
|
182
|
+
readonly defaultPrevented: boolean;
|
|
135
183
|
}
|
|
136
184
|
/** Events available through `instance.on(type, listener)`. */
|
|
137
185
|
export interface ViewerEventMap {
|
|
@@ -179,6 +227,7 @@ export interface ViewerEventMap {
|
|
|
179
227
|
textCopied: {
|
|
180
228
|
text: string;
|
|
181
229
|
};
|
|
230
|
+
linkClicked: LinkClickEvent;
|
|
182
231
|
destroy: Record<string, never>;
|
|
183
232
|
}
|
|
184
233
|
export type ViewerEventType = keyof ViewerEventMap;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -17,7 +17,9 @@ export { ViewerBus } from './core/eventBus';
|
|
|
17
17
|
export type { BusListener } from './core/eventBus';
|
|
18
18
|
export { buildPdfBytes, MAX_EXPORT_BYTES } from './core/export';
|
|
19
19
|
export type { ExportInput, ExportOptions } from './core/export';
|
|
20
|
-
export type { WebViewerOptions, Redaction, WatermarkOptions, SDKPermissions, ViewerUser, InitialScale, ViewerEventMap, ViewerEventType, ToolMode, } from './core/types';
|
|
20
|
+
export type { WebViewerOptions, Redaction, WatermarkOptions, SDKPermissions, ViewerUser, InitialScale, ViewerEventMap, ViewerEventType, ToolMode, LinkClickEvent, } from './core/types';
|
|
21
|
+
export { parseLinkTarget, isDocumentUrl } from './utils/linkUtils';
|
|
22
|
+
export type { ParsedLinkTarget } from './utils/linkUtils';
|
|
21
23
|
export { copyTextToClipboard } from './utils/clipboardUtils';
|
|
22
24
|
export { TextSelectionTooltip } from './components/TextSelectionTooltip';
|
|
23
25
|
export type { Annotation, AnnotationType, AnnotationPoint, AnnotationInput } from './annotations/types';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* © 2026 AngelBot Ai Pvt Ltd. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
export interface ParsedLinkTarget {
|
|
5
|
+
/** Raw input URL or link target string. */
|
|
6
|
+
rawUrl: string;
|
|
7
|
+
/** True if the link refers only to an internal page jump within the current document (e.g. '#page=5' or '#5'). */
|
|
8
|
+
isInternalPage: boolean;
|
|
9
|
+
/** Clean document URL without page hash if referencing another document (e.g. 'supporting.pdf' or 'https://.../doc.pdf'). */
|
|
10
|
+
docUrl?: string;
|
|
11
|
+
/** Target page number (1-based) if specified (e.g. 5 from '#page=5' or 'doc.pdf#page=5'). */
|
|
12
|
+
pageNumber?: number;
|
|
13
|
+
/** True if this is an external web URL (e.g. 'https://google.com') that is not a PDF/document. */
|
|
14
|
+
isExternalWeb: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Checks whether a given URL or filename refers to a PDF / document rather than a general web page.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isDocumentUrl(url: string): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Parses any link URL into structured destination information, extracting target documents and page numbers.
|
|
22
|
+
*/
|
|
23
|
+
export declare function parseLinkTarget(linkUrl: string): ParsedLinkTarget;
|