@embedpdf/plugin-annotation 2.7.0 → 2.8.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/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +335 -82
- package/dist/index.js.map +1 -1
- package/dist/lib/annotation-plugin.d.ts +2 -0
- package/dist/lib/handlers/index.d.ts +4 -0
- package/dist/lib/handlers/insert-text.handler.d.ts +8 -0
- package/dist/lib/handlers/replace-text.handler.d.ts +9 -0
- package/dist/lib/handlers/selection-utils.d.ts +7 -0
- package/dist/lib/handlers/text-markup.handler.d.ts +7 -0
- package/dist/lib/handlers/text.handler.d.ts +3 -0
- package/dist/lib/handlers/types.d.ts +12 -0
- package/dist/lib/helpers.d.ts +2 -1
- package/dist/lib/selectors.d.ts +6 -1
- package/dist/lib/tools/default-tools.d.ts +151 -6
- package/dist/lib/tools/tools-utils.d.ts +2 -0
- package/dist/lib/tools/types.d.ts +2 -0
- package/dist/lib/types.d.ts +1 -0
- package/dist/preact/index.cjs +1 -1
- package/dist/preact/index.cjs.map +1 -1
- package/dist/preact/index.js +277 -43
- package/dist/preact/index.js.map +1 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +277 -43
- package/dist/react/index.js.map +1 -1
- package/dist/shared/annotation-bounds.d.ts +14 -0
- package/dist/shared/components/annotations/caret.d.ts +24 -0
- package/dist/shared/components/annotations/circle.d.ts +2 -2
- package/dist/shared/components/annotations/free-text.d.ts +2 -2
- package/dist/shared/components/annotations/ink.d.ts +2 -2
- package/dist/shared/components/annotations/line.d.ts +2 -2
- package/dist/shared/components/annotations/link.d.ts +2 -2
- package/dist/shared/components/annotations/polygon.d.ts +2 -2
- package/dist/shared/components/annotations/polyline.d.ts +8 -4
- package/dist/shared/components/annotations/square.d.ts +2 -2
- package/dist/shared/components/annotations/stamp.d.ts +2 -2
- package/dist/shared/components/annotations/text.d.ts +14 -0
- package/dist/shared/components/text-markup/highlight.d.ts +2 -2
- package/dist/shared/components/text-markup/squiggly.d.ts +2 -2
- package/dist/shared/components/text-markup/strikeout.d.ts +2 -2
- package/dist/shared/components/text-markup/underline.d.ts +2 -2
- package/dist/shared/components/types.d.ts +2 -2
- package/dist/shared-preact/annotation-bounds.d.ts +14 -0
- package/dist/shared-preact/components/annotations/caret.d.ts +24 -0
- package/dist/shared-preact/components/annotations/circle.d.ts +2 -2
- package/dist/shared-preact/components/annotations/free-text.d.ts +2 -2
- package/dist/shared-preact/components/annotations/ink.d.ts +2 -2
- package/dist/shared-preact/components/annotations/line.d.ts +2 -2
- package/dist/shared-preact/components/annotations/link.d.ts +2 -2
- package/dist/shared-preact/components/annotations/polygon.d.ts +2 -2
- package/dist/shared-preact/components/annotations/polyline.d.ts +8 -4
- package/dist/shared-preact/components/annotations/square.d.ts +2 -2
- package/dist/shared-preact/components/annotations/stamp.d.ts +2 -2
- package/dist/shared-preact/components/annotations/text.d.ts +14 -0
- package/dist/shared-preact/components/text-markup/highlight.d.ts +2 -2
- package/dist/shared-preact/components/text-markup/squiggly.d.ts +2 -2
- package/dist/shared-preact/components/text-markup/strikeout.d.ts +2 -2
- package/dist/shared-preact/components/text-markup/underline.d.ts +2 -2
- package/dist/shared-preact/components/types.d.ts +2 -2
- package/dist/shared-react/annotation-bounds.d.ts +14 -0
- package/dist/shared-react/components/annotations/caret.d.ts +24 -0
- package/dist/shared-react/components/annotations/circle.d.ts +2 -2
- package/dist/shared-react/components/annotations/free-text.d.ts +2 -2
- package/dist/shared-react/components/annotations/ink.d.ts +2 -2
- package/dist/shared-react/components/annotations/line.d.ts +2 -2
- package/dist/shared-react/components/annotations/link.d.ts +2 -2
- package/dist/shared-react/components/annotations/polygon.d.ts +2 -2
- package/dist/shared-react/components/annotations/polyline.d.ts +8 -4
- package/dist/shared-react/components/annotations/square.d.ts +2 -2
- package/dist/shared-react/components/annotations/stamp.d.ts +2 -2
- package/dist/shared-react/components/annotations/text.d.ts +14 -0
- package/dist/shared-react/components/text-markup/highlight.d.ts +2 -2
- package/dist/shared-react/components/text-markup/squiggly.d.ts +2 -2
- package/dist/shared-react/components/text-markup/strikeout.d.ts +2 -2
- package/dist/shared-react/components/text-markup/underline.d.ts +2 -2
- package/dist/shared-react/components/types.d.ts +2 -2
- package/dist/shared-vue/annotation-bounds.d.ts +14 -0
- package/dist/svelte/components/annotations/Caret.svelte.d.ts +13 -0
- package/dist/svelte/components/annotations/Circle.svelte.d.ts +1 -1
- package/dist/svelte/components/annotations/FreeText.svelte.d.ts +1 -1
- package/dist/svelte/components/annotations/Ink.svelte.d.ts +1 -1
- package/dist/svelte/components/annotations/Line.svelte.d.ts +1 -1
- package/dist/svelte/components/annotations/Link.svelte.d.ts +1 -1
- package/dist/svelte/components/annotations/Polygon.svelte.d.ts +1 -1
- package/dist/svelte/components/annotations/Polyline.svelte.d.ts +4 -2
- package/dist/svelte/components/annotations/Square.svelte.d.ts +1 -1
- package/dist/svelte/components/annotations/Stamp.svelte.d.ts +1 -1
- package/dist/svelte/components/annotations/Text.svelte.d.ts +10 -0
- package/dist/svelte/components/annotations/index.d.ts +1 -0
- package/dist/svelte/components/renderers/CaretRenderer.svelte.d.ts +5 -0
- package/dist/svelte/components/renderers/TextRenderer.svelte.d.ts +5 -0
- package/dist/svelte/components/text-markup/Highlight.svelte.d.ts +1 -1
- package/dist/svelte/components/text-markup/Squiggly.svelte.d.ts +1 -1
- package/dist/svelte/components/text-markup/Strikeout.svelte.d.ts +1 -1
- package/dist/svelte/components/text-markup/Underline.svelte.d.ts +1 -1
- package/dist/svelte/context/types.d.ts +1 -1
- package/dist/svelte/index.cjs +1 -1
- package/dist/svelte/index.cjs.map +1 -1
- package/dist/svelte/index.js +350 -147
- package/dist/svelte/index.js.map +1 -1
- package/dist/vue/components/annotation-container.vue.d.ts +2 -2
- package/dist/vue/components/annotation-layer.vue.d.ts +1 -1
- package/dist/vue/components/annotations/caret.vue.d.ts +24 -0
- package/dist/vue/components/annotations/circle.vue.d.ts +2 -2
- package/dist/vue/components/annotations/free-text.vue.d.ts +2 -2
- package/dist/vue/components/annotations/index.d.ts +1 -0
- package/dist/vue/components/annotations/ink.vue.d.ts +2 -2
- package/dist/vue/components/annotations/line.vue.d.ts +2 -2
- package/dist/vue/components/annotations/link.vue.d.ts +2 -2
- package/dist/vue/components/annotations/polygon.vue.d.ts +2 -2
- package/dist/vue/components/annotations/polyline.vue.d.ts +8 -3
- package/dist/vue/components/annotations/square.vue.d.ts +2 -2
- package/dist/vue/components/annotations/stamp.vue.d.ts +2 -2
- package/dist/vue/components/annotations/text.vue.d.ts +14 -0
- package/dist/vue/components/annotations.vue.d.ts +1 -1
- package/dist/vue/components/renderers/caret-renderer.vue.d.ts +6 -0
- package/dist/vue/components/renderers/text-renderer.vue.d.ts +6 -0
- package/dist/vue/components/text-markup/highlight.vue.d.ts +2 -2
- package/dist/vue/components/text-markup/squiggly.vue.d.ts +2 -2
- package/dist/vue/components/text-markup/strikeout.vue.d.ts +2 -2
- package/dist/vue/components/text-markup/underline.vue.d.ts +2 -2
- package/dist/vue/context/types.d.ts +1 -1
- package/dist/vue/index.cjs +1 -1
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.js +535 -249
- package/dist/vue/index.js.map +1 -1
- package/package.json +10 -10
|
@@ -17,6 +17,7 @@ export declare class AnnotationPlugin extends BasePlugin<AnnotationPluginConfig,
|
|
|
17
17
|
private importQueue;
|
|
18
18
|
private commitInProgress;
|
|
19
19
|
private handlerFactories;
|
|
20
|
+
private selectionHandlerFactories;
|
|
20
21
|
private readonly activeTool$;
|
|
21
22
|
private readonly events$;
|
|
22
23
|
private readonly toolsChange$;
|
|
@@ -33,6 +34,7 @@ export declare class AnnotationPlugin extends BasePlugin<AnnotationPluginConfig,
|
|
|
33
34
|
protected onDocumentLoaded(documentId: string): void;
|
|
34
35
|
protected onDocumentClosed(documentId: string): void;
|
|
35
36
|
private registerHandlerFactories;
|
|
37
|
+
private registerSelectionHandlerFactories;
|
|
36
38
|
private registerBuiltInPatches;
|
|
37
39
|
initialize(): Promise<void>;
|
|
38
40
|
private registerInteractionForTool;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './ink.handler';
|
|
2
|
+
export * from './text.handler';
|
|
2
3
|
export * from './free-text.handler';
|
|
3
4
|
export * from './line.handler';
|
|
4
5
|
export * from './polyline.handler';
|
|
@@ -6,3 +7,6 @@ export * from './polygon.handler';
|
|
|
6
7
|
export * from './square.handler';
|
|
7
8
|
export * from './stamp.handler';
|
|
8
9
|
export * from './circle.handler';
|
|
10
|
+
export * from './text-markup.handler';
|
|
11
|
+
export * from './insert-text.handler';
|
|
12
|
+
export * from './replace-text.handler';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PdfCaretAnnoObject } from '@embedpdf/models';
|
|
2
|
+
import { SelectionHandlerFactory } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Selection handler for the "Insert Text" tool.
|
|
5
|
+
* Creates a single Caret annotation at the end of the text selection
|
|
6
|
+
* with intent "Insert".
|
|
7
|
+
*/
|
|
8
|
+
export declare const insertTextSelectionHandler: SelectionHandlerFactory<PdfCaretAnnoObject>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PdfStrikeOutAnnoObject } from '@embedpdf/models';
|
|
2
|
+
import { SelectionHandlerFactory } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Selection handler for the "Replace Text" tool.
|
|
5
|
+
* Creates a Caret annotation (group leader, intent "Replace") at the end
|
|
6
|
+
* of the selection, plus a StrikeOut annotation (intent "StrikeOutTextEdit")
|
|
7
|
+
* over the full selection, linked to the Caret via IRT/RT=Group.
|
|
8
|
+
*/
|
|
9
|
+
export declare const replaceTextSelectionHandler: SelectionHandlerFactory<PdfStrikeOutAnnoObject>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Rect } from '@embedpdf/models';
|
|
2
|
+
/**
|
|
3
|
+
* Compute a caret annotation rect at the end of a text selection.
|
|
4
|
+
* The caret is half the line height, bottom-aligned with the line,
|
|
5
|
+
* and horizontally centered on the line's end edge.
|
|
6
|
+
*/
|
|
7
|
+
export declare function computeCaretRect(lastSegRect: Rect): Rect;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SelectionHandlerFactory } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Default selection handler for text-markup tools (highlight, underline,
|
|
4
|
+
* strikeout, squiggly). Used as a fallback when no tool-specific
|
|
5
|
+
* SelectionHandlerFactory is registered.
|
|
6
|
+
*/
|
|
7
|
+
export declare const textMarkupSelectionHandler: SelectionHandlerFactory;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PointerEventHandlersWithLifecycle } from '@embedpdf/plugin-interaction-manager';
|
|
2
2
|
import { PdfAnnotationObject, PdfAnnotationSubtype, Rect, Rotation, Size, AnnotationCreateContext, PdfAnnotationBorderStyle, Position, LineEndings, PdfInkListObject, PdfStandardFont, PdfTextAlignment, PdfVerticalAlignment } from '@embedpdf/models';
|
|
3
|
+
import { FormattedSelection } from '@embedpdf/plugin-selection';
|
|
3
4
|
import { AnnotationTool } from '../tools/types';
|
|
4
5
|
export interface CirclePreviewData {
|
|
5
6
|
rect: Rect;
|
|
@@ -138,4 +139,15 @@ export interface HandlerContext<A extends PdfAnnotationObject> {
|
|
|
138
139
|
onPreview: (state: AnyPreviewState | null) => void;
|
|
139
140
|
onCommit: (annotation: A, context?: AnnotationCreateContext<A>) => void;
|
|
140
141
|
}
|
|
142
|
+
export interface SelectionHandlerContext<A extends PdfAnnotationObject = PdfAnnotationObject> {
|
|
143
|
+
toolId: string;
|
|
144
|
+
documentId: string;
|
|
145
|
+
getTool: () => AnnotationTool<A> | null;
|
|
146
|
+
createAnnotation: (pageIndex: number, annotation: PdfAnnotationObject) => void;
|
|
147
|
+
selectAnnotation: (pageIndex: number, id: string) => void;
|
|
148
|
+
}
|
|
149
|
+
export interface SelectionHandlerFactory<A extends PdfAnnotationObject = PdfAnnotationObject> {
|
|
150
|
+
toolId: string;
|
|
151
|
+
handle(context: SelectionHandlerContext<A>, selections: FormattedSelection[], getText: () => Promise<string | undefined>): void;
|
|
152
|
+
}
|
|
141
153
|
export {};
|
package/dist/lib/helpers.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export type AnnoOf<S extends PdfAnnotationSubtype> = Extract<PdfAnnotationObject
|
|
|
8
8
|
type: S;
|
|
9
9
|
}>;
|
|
10
10
|
export type TextMarkupSubtype = PdfAnnotationSubtype.HIGHLIGHT | PdfAnnotationSubtype.UNDERLINE | PdfAnnotationSubtype.STRIKEOUT | PdfAnnotationSubtype.SQUIGGLY;
|
|
11
|
-
export type SidebarSubtype = TextMarkupSubtype | PdfAnnotationSubtype.INK | PdfAnnotationSubtype.SQUARE | PdfAnnotationSubtype.CIRCLE | PdfAnnotationSubtype.POLYGON | PdfAnnotationSubtype.LINE | PdfAnnotationSubtype.POLYLINE | PdfAnnotationSubtype.FREETEXT | PdfAnnotationSubtype.STAMP | PdfAnnotationSubtype.REDACT;
|
|
11
|
+
export type SidebarSubtype = TextMarkupSubtype | PdfAnnotationSubtype.TEXT | PdfAnnotationSubtype.INK | PdfAnnotationSubtype.SQUARE | PdfAnnotationSubtype.CIRCLE | PdfAnnotationSubtype.POLYGON | PdfAnnotationSubtype.LINE | PdfAnnotationSubtype.POLYLINE | PdfAnnotationSubtype.FREETEXT | PdfAnnotationSubtype.STAMP | PdfAnnotationSubtype.REDACT | PdfAnnotationSubtype.CARET;
|
|
12
12
|
/** True when `a.object.type === INK` – and narrows the generic. */
|
|
13
13
|
export declare function isInk(a: TrackedAnnotation): a is TrackedAnnotation<AnnoOf<PdfAnnotationSubtype.INK>>;
|
|
14
14
|
/** Example for Circle – create similar ones for Square, Line, etc. */
|
|
@@ -27,4 +27,5 @@ export declare function isStamp(a: TrackedAnnotation): a is TrackedAnnotation<An
|
|
|
27
27
|
export declare function isText(a: TrackedAnnotation): a is TrackedAnnotation<AnnoOf<PdfAnnotationSubtype.TEXT>>;
|
|
28
28
|
export declare function isLink(a: TrackedAnnotation): a is TrackedAnnotation<AnnoOf<PdfAnnotationSubtype.LINK>>;
|
|
29
29
|
export declare function isRedact(a: TrackedAnnotation): a is TrackedAnnotation<AnnoOf<PdfAnnotationSubtype.REDACT>>;
|
|
30
|
+
export declare function isCaret(a: TrackedAnnotation): a is TrackedAnnotation<AnnoOf<PdfAnnotationSubtype.CARET>>;
|
|
30
31
|
export declare function isSidebarAnnotation(a: TrackedAnnotation): a is TrackedAnnotation<AnnoOf<SidebarSubtype>>;
|
package/dist/lib/selectors.d.ts
CHANGED
|
@@ -40,9 +40,14 @@ export declare function getToolDefaultsById<K extends keyof ToolMap>(state: Anno
|
|
|
40
40
|
* Collect every sidebar-eligible annotation and attach its TEXT replies,
|
|
41
41
|
* grouped by page for efficient rendering.
|
|
42
42
|
*
|
|
43
|
+
* Annotations linked via IRT / RT=Group are collapsed: the group leader
|
|
44
|
+
* becomes the sidebar entry and its non-LINK group members are attached
|
|
45
|
+
* as `groupMembers`. This keeps the sidebar compact for tools like
|
|
46
|
+
* Replace Text (Caret + StrikeOut pair).
|
|
47
|
+
*
|
|
43
48
|
* Result shape:
|
|
44
49
|
* {
|
|
45
|
-
* 0: [{ page: 0, annotation: <TrackedAnnotation>, replies: [ … ] }, ...],
|
|
50
|
+
* 0: [{ page: 0, annotation: <TrackedAnnotation>, replies: [ … ], groupMembers: [ … ] }, ...],
|
|
46
51
|
* 1: [{ page: 1, annotation: <TrackedAnnotation>, replies: [ … ] }, ...],
|
|
47
52
|
* …
|
|
48
53
|
* }
|
|
@@ -8,8 +8,10 @@ export declare const defaultTools: ({
|
|
|
8
8
|
textSelection: true;
|
|
9
9
|
isDraggable: false;
|
|
10
10
|
isResizable: false;
|
|
11
|
+
isRotatable: false;
|
|
11
12
|
isGroupDraggable: false;
|
|
12
13
|
isGroupResizable: false;
|
|
14
|
+
showSelectionRects?: undefined;
|
|
13
15
|
cursor?: undefined;
|
|
14
16
|
lockAspectRatio?: undefined;
|
|
15
17
|
lockGroupAspectRatio?: undefined;
|
|
@@ -20,8 +22,8 @@ export declare const defaultTools: ({
|
|
|
20
22
|
color: string;
|
|
21
23
|
opacity: number;
|
|
22
24
|
blendMode: PdfBlendMode.Multiply;
|
|
23
|
-
strokeWidth?: undefined;
|
|
24
25
|
intent?: undefined;
|
|
26
|
+
strokeWidth?: undefined;
|
|
25
27
|
strokeStyle?: undefined;
|
|
26
28
|
lineEndings?: undefined;
|
|
27
29
|
contents?: undefined;
|
|
@@ -43,8 +45,10 @@ export declare const defaultTools: ({
|
|
|
43
45
|
textSelection: true;
|
|
44
46
|
isDraggable: false;
|
|
45
47
|
isResizable: false;
|
|
48
|
+
isRotatable: false;
|
|
46
49
|
isGroupDraggable: false;
|
|
47
50
|
isGroupResizable: false;
|
|
51
|
+
showSelectionRects?: undefined;
|
|
48
52
|
cursor?: undefined;
|
|
49
53
|
lockAspectRatio?: undefined;
|
|
50
54
|
lockGroupAspectRatio?: undefined;
|
|
@@ -55,8 +59,8 @@ export declare const defaultTools: ({
|
|
|
55
59
|
color: string;
|
|
56
60
|
opacity: number;
|
|
57
61
|
blendMode?: undefined;
|
|
58
|
-
strokeWidth?: undefined;
|
|
59
62
|
intent?: undefined;
|
|
63
|
+
strokeWidth?: undefined;
|
|
60
64
|
strokeStyle?: undefined;
|
|
61
65
|
lineEndings?: undefined;
|
|
62
66
|
contents?: undefined;
|
|
@@ -78,8 +82,10 @@ export declare const defaultTools: ({
|
|
|
78
82
|
textSelection: true;
|
|
79
83
|
isDraggable: false;
|
|
80
84
|
isResizable: false;
|
|
85
|
+
isRotatable: false;
|
|
81
86
|
isGroupDraggable: false;
|
|
82
87
|
isGroupResizable: false;
|
|
88
|
+
showSelectionRects?: undefined;
|
|
83
89
|
cursor?: undefined;
|
|
84
90
|
lockAspectRatio?: undefined;
|
|
85
91
|
lockGroupAspectRatio?: undefined;
|
|
@@ -90,8 +96,8 @@ export declare const defaultTools: ({
|
|
|
90
96
|
color: string;
|
|
91
97
|
opacity: number;
|
|
92
98
|
blendMode?: undefined;
|
|
93
|
-
strokeWidth?: undefined;
|
|
94
99
|
intent?: undefined;
|
|
100
|
+
strokeWidth?: undefined;
|
|
95
101
|
strokeStyle?: undefined;
|
|
96
102
|
lineEndings?: undefined;
|
|
97
103
|
contents?: undefined;
|
|
@@ -113,8 +119,10 @@ export declare const defaultTools: ({
|
|
|
113
119
|
textSelection: true;
|
|
114
120
|
isDraggable: false;
|
|
115
121
|
isResizable: false;
|
|
122
|
+
isRotatable: false;
|
|
116
123
|
isGroupDraggable: false;
|
|
117
124
|
isGroupResizable: false;
|
|
125
|
+
showSelectionRects?: undefined;
|
|
118
126
|
cursor?: undefined;
|
|
119
127
|
lockAspectRatio?: undefined;
|
|
120
128
|
lockGroupAspectRatio?: undefined;
|
|
@@ -125,8 +133,82 @@ export declare const defaultTools: ({
|
|
|
125
133
|
color: string;
|
|
126
134
|
opacity: number;
|
|
127
135
|
blendMode?: undefined;
|
|
128
|
-
strokeWidth?: undefined;
|
|
129
136
|
intent?: undefined;
|
|
137
|
+
strokeWidth?: undefined;
|
|
138
|
+
strokeStyle?: undefined;
|
|
139
|
+
lineEndings?: undefined;
|
|
140
|
+
contents?: undefined;
|
|
141
|
+
fontSize?: undefined;
|
|
142
|
+
fontColor?: undefined;
|
|
143
|
+
fontFamily?: undefined;
|
|
144
|
+
textAlign?: undefined;
|
|
145
|
+
verticalAlign?: undefined;
|
|
146
|
+
backgroundColor?: undefined;
|
|
147
|
+
};
|
|
148
|
+
clickBehavior?: undefined;
|
|
149
|
+
behavior?: undefined;
|
|
150
|
+
} | {
|
|
151
|
+
id: "insertText";
|
|
152
|
+
name: string;
|
|
153
|
+
matchScore: (a: import('@embedpdf/models').PdfAnnotationObject) => 1 | 0 | 2;
|
|
154
|
+
interaction: {
|
|
155
|
+
exclusive: false;
|
|
156
|
+
textSelection: true;
|
|
157
|
+
showSelectionRects: true;
|
|
158
|
+
isDraggable: false;
|
|
159
|
+
isResizable: false;
|
|
160
|
+
isRotatable: false;
|
|
161
|
+
isGroupDraggable: false;
|
|
162
|
+
isGroupResizable: false;
|
|
163
|
+
cursor?: undefined;
|
|
164
|
+
lockAspectRatio?: undefined;
|
|
165
|
+
lockGroupAspectRatio?: undefined;
|
|
166
|
+
};
|
|
167
|
+
defaults: {
|
|
168
|
+
type: PdfAnnotationSubtype.CARET;
|
|
169
|
+
strokeColor: string;
|
|
170
|
+
opacity: number;
|
|
171
|
+
intent: string;
|
|
172
|
+
color?: undefined;
|
|
173
|
+
blendMode?: undefined;
|
|
174
|
+
strokeWidth?: undefined;
|
|
175
|
+
strokeStyle?: undefined;
|
|
176
|
+
lineEndings?: undefined;
|
|
177
|
+
contents?: undefined;
|
|
178
|
+
fontSize?: undefined;
|
|
179
|
+
fontColor?: undefined;
|
|
180
|
+
fontFamily?: undefined;
|
|
181
|
+
textAlign?: undefined;
|
|
182
|
+
verticalAlign?: undefined;
|
|
183
|
+
backgroundColor?: undefined;
|
|
184
|
+
};
|
|
185
|
+
clickBehavior?: undefined;
|
|
186
|
+
behavior?: undefined;
|
|
187
|
+
} | {
|
|
188
|
+
id: "replaceText";
|
|
189
|
+
name: string;
|
|
190
|
+
matchScore: (a: import('@embedpdf/models').PdfAnnotationObject) => 0 | 2;
|
|
191
|
+
interaction: {
|
|
192
|
+
exclusive: false;
|
|
193
|
+
textSelection: true;
|
|
194
|
+
isDraggable: false;
|
|
195
|
+
isResizable: false;
|
|
196
|
+
isRotatable: false;
|
|
197
|
+
isGroupDraggable: false;
|
|
198
|
+
isGroupResizable: false;
|
|
199
|
+
showSelectionRects?: undefined;
|
|
200
|
+
cursor?: undefined;
|
|
201
|
+
lockAspectRatio?: undefined;
|
|
202
|
+
lockGroupAspectRatio?: undefined;
|
|
203
|
+
};
|
|
204
|
+
defaults: {
|
|
205
|
+
type: PdfAnnotationSubtype.STRIKEOUT;
|
|
206
|
+
strokeColor: string;
|
|
207
|
+
opacity: number;
|
|
208
|
+
intent: string;
|
|
209
|
+
color?: undefined;
|
|
210
|
+
blendMode?: undefined;
|
|
211
|
+
strokeWidth?: undefined;
|
|
130
212
|
strokeStyle?: undefined;
|
|
131
213
|
lineEndings?: undefined;
|
|
132
214
|
contents?: undefined;
|
|
@@ -150,8 +232,10 @@ export declare const defaultTools: ({
|
|
|
150
232
|
isResizable: true;
|
|
151
233
|
lockAspectRatio: false;
|
|
152
234
|
textSelection?: undefined;
|
|
235
|
+
isRotatable?: undefined;
|
|
153
236
|
isGroupDraggable?: undefined;
|
|
154
237
|
isGroupResizable?: undefined;
|
|
238
|
+
showSelectionRects?: undefined;
|
|
155
239
|
lockGroupAspectRatio?: undefined;
|
|
156
240
|
};
|
|
157
241
|
defaults: {
|
|
@@ -186,8 +270,10 @@ export declare const defaultTools: ({
|
|
|
186
270
|
lockAspectRatio: false;
|
|
187
271
|
lockGroupAspectRatio: (a: import('@embedpdf/models').PdfAnnotationObject) => boolean;
|
|
188
272
|
textSelection?: undefined;
|
|
273
|
+
isRotatable?: undefined;
|
|
189
274
|
isGroupDraggable?: undefined;
|
|
190
275
|
isGroupResizable?: undefined;
|
|
276
|
+
showSelectionRects?: undefined;
|
|
191
277
|
};
|
|
192
278
|
defaults: {
|
|
193
279
|
type: PdfAnnotationSubtype.INK;
|
|
@@ -221,8 +307,10 @@ export declare const defaultTools: ({
|
|
|
221
307
|
lockAspectRatio: false;
|
|
222
308
|
lockGroupAspectRatio: (a: import('@embedpdf/models').PdfAnnotationObject) => boolean;
|
|
223
309
|
textSelection?: undefined;
|
|
310
|
+
isRotatable?: undefined;
|
|
224
311
|
isGroupDraggable?: undefined;
|
|
225
312
|
isGroupResizable?: undefined;
|
|
313
|
+
showSelectionRects?: undefined;
|
|
226
314
|
};
|
|
227
315
|
defaults: {
|
|
228
316
|
type: PdfAnnotationSubtype.CIRCLE;
|
|
@@ -265,8 +353,10 @@ export declare const defaultTools: ({
|
|
|
265
353
|
lockAspectRatio: false;
|
|
266
354
|
lockGroupAspectRatio: (a: import('@embedpdf/models').PdfAnnotationObject) => boolean;
|
|
267
355
|
textSelection?: undefined;
|
|
356
|
+
isRotatable?: undefined;
|
|
268
357
|
isGroupDraggable?: undefined;
|
|
269
358
|
isGroupResizable?: undefined;
|
|
359
|
+
showSelectionRects?: undefined;
|
|
270
360
|
};
|
|
271
361
|
defaults: {
|
|
272
362
|
type: PdfAnnotationSubtype.SQUARE;
|
|
@@ -310,7 +400,9 @@ export declare const defaultTools: ({
|
|
|
310
400
|
isGroupResizable: true;
|
|
311
401
|
lockGroupAspectRatio: (a: import('@embedpdf/models').PdfAnnotationObject) => boolean;
|
|
312
402
|
textSelection?: undefined;
|
|
403
|
+
isRotatable?: undefined;
|
|
313
404
|
isGroupDraggable?: undefined;
|
|
405
|
+
showSelectionRects?: undefined;
|
|
314
406
|
};
|
|
315
407
|
defaults: {
|
|
316
408
|
type: PdfAnnotationSubtype.LINE;
|
|
@@ -351,7 +443,9 @@ export declare const defaultTools: ({
|
|
|
351
443
|
isGroupResizable: true;
|
|
352
444
|
lockGroupAspectRatio: (a: import('@embedpdf/models').PdfAnnotationObject) => boolean;
|
|
353
445
|
textSelection?: undefined;
|
|
446
|
+
isRotatable?: undefined;
|
|
354
447
|
isGroupDraggable?: undefined;
|
|
448
|
+
showSelectionRects?: undefined;
|
|
355
449
|
};
|
|
356
450
|
defaults: {
|
|
357
451
|
type: PdfAnnotationSubtype.LINE;
|
|
@@ -395,7 +489,9 @@ export declare const defaultTools: ({
|
|
|
395
489
|
isGroupResizable: true;
|
|
396
490
|
lockGroupAspectRatio: (a: import('@embedpdf/models').PdfAnnotationObject) => boolean;
|
|
397
491
|
textSelection?: undefined;
|
|
492
|
+
isRotatable?: undefined;
|
|
398
493
|
isGroupDraggable?: undefined;
|
|
494
|
+
showSelectionRects?: undefined;
|
|
399
495
|
};
|
|
400
496
|
defaults: {
|
|
401
497
|
type: PdfAnnotationSubtype.POLYLINE;
|
|
@@ -430,7 +526,9 @@ export declare const defaultTools: ({
|
|
|
430
526
|
isGroupResizable: true;
|
|
431
527
|
lockGroupAspectRatio: (a: import('@embedpdf/models').PdfAnnotationObject) => boolean;
|
|
432
528
|
textSelection?: undefined;
|
|
529
|
+
isRotatable?: undefined;
|
|
433
530
|
isGroupDraggable?: undefined;
|
|
531
|
+
showSelectionRects?: undefined;
|
|
434
532
|
};
|
|
435
533
|
defaults: {
|
|
436
534
|
type: PdfAnnotationSubtype.POLYGON;
|
|
@@ -452,6 +550,47 @@ export declare const defaultTools: ({
|
|
|
452
550
|
};
|
|
453
551
|
clickBehavior?: undefined;
|
|
454
552
|
behavior?: undefined;
|
|
553
|
+
} | {
|
|
554
|
+
id: "textComment";
|
|
555
|
+
name: string;
|
|
556
|
+
matchScore: (a: import('@embedpdf/models').PdfAnnotationObject) => 1 | 0;
|
|
557
|
+
interaction: {
|
|
558
|
+
exclusive: false;
|
|
559
|
+
cursor: string;
|
|
560
|
+
isDraggable: true;
|
|
561
|
+
isResizable: false;
|
|
562
|
+
isRotatable: false;
|
|
563
|
+
textSelection?: undefined;
|
|
564
|
+
isGroupDraggable?: undefined;
|
|
565
|
+
isGroupResizable?: undefined;
|
|
566
|
+
showSelectionRects?: undefined;
|
|
567
|
+
lockAspectRatio?: undefined;
|
|
568
|
+
lockGroupAspectRatio?: undefined;
|
|
569
|
+
};
|
|
570
|
+
defaults: {
|
|
571
|
+
type: PdfAnnotationSubtype.TEXT;
|
|
572
|
+
strokeColor: string;
|
|
573
|
+
opacity: number;
|
|
574
|
+
color?: undefined;
|
|
575
|
+
blendMode?: undefined;
|
|
576
|
+
intent?: undefined;
|
|
577
|
+
strokeWidth?: undefined;
|
|
578
|
+
strokeStyle?: undefined;
|
|
579
|
+
lineEndings?: undefined;
|
|
580
|
+
contents?: undefined;
|
|
581
|
+
fontSize?: undefined;
|
|
582
|
+
fontColor?: undefined;
|
|
583
|
+
fontFamily?: undefined;
|
|
584
|
+
textAlign?: undefined;
|
|
585
|
+
verticalAlign?: undefined;
|
|
586
|
+
backgroundColor?: undefined;
|
|
587
|
+
};
|
|
588
|
+
behavior: {
|
|
589
|
+
selectAfterCreate: true;
|
|
590
|
+
insertUpright?: undefined;
|
|
591
|
+
useAppearanceStream?: undefined;
|
|
592
|
+
};
|
|
593
|
+
clickBehavior?: undefined;
|
|
455
594
|
} | {
|
|
456
595
|
id: "freeText";
|
|
457
596
|
name: string;
|
|
@@ -464,8 +603,10 @@ export declare const defaultTools: ({
|
|
|
464
603
|
lockAspectRatio: false;
|
|
465
604
|
lockGroupAspectRatio: (a: import('@embedpdf/models').PdfAnnotationObject) => boolean;
|
|
466
605
|
textSelection?: undefined;
|
|
606
|
+
isRotatable?: undefined;
|
|
467
607
|
isGroupDraggable?: undefined;
|
|
468
608
|
isGroupResizable?: undefined;
|
|
609
|
+
showSelectionRects?: undefined;
|
|
469
610
|
};
|
|
470
611
|
defaults: {
|
|
471
612
|
type: PdfAnnotationSubtype.FREETEXT;
|
|
@@ -480,8 +621,8 @@ export declare const defaultTools: ({
|
|
|
480
621
|
opacity: number;
|
|
481
622
|
strokeColor?: undefined;
|
|
482
623
|
blendMode?: undefined;
|
|
483
|
-
strokeWidth?: undefined;
|
|
484
624
|
intent?: undefined;
|
|
625
|
+
strokeWidth?: undefined;
|
|
485
626
|
strokeStyle?: undefined;
|
|
486
627
|
lineEndings?: undefined;
|
|
487
628
|
};
|
|
@@ -497,6 +638,7 @@ export declare const defaultTools: ({
|
|
|
497
638
|
};
|
|
498
639
|
behavior: {
|
|
499
640
|
insertUpright: true;
|
|
641
|
+
selectAfterCreate?: undefined;
|
|
500
642
|
useAppearanceStream?: undefined;
|
|
501
643
|
};
|
|
502
644
|
} | {
|
|
@@ -511,8 +653,10 @@ export declare const defaultTools: ({
|
|
|
511
653
|
lockAspectRatio: true;
|
|
512
654
|
lockGroupAspectRatio: true;
|
|
513
655
|
textSelection?: undefined;
|
|
656
|
+
isRotatable?: undefined;
|
|
514
657
|
isGroupDraggable?: undefined;
|
|
515
658
|
isGroupResizable?: undefined;
|
|
659
|
+
showSelectionRects?: undefined;
|
|
516
660
|
};
|
|
517
661
|
defaults: {
|
|
518
662
|
type: PdfAnnotationSubtype.STAMP;
|
|
@@ -520,8 +664,8 @@ export declare const defaultTools: ({
|
|
|
520
664
|
color?: undefined;
|
|
521
665
|
opacity?: undefined;
|
|
522
666
|
blendMode?: undefined;
|
|
523
|
-
strokeWidth?: undefined;
|
|
524
667
|
intent?: undefined;
|
|
668
|
+
strokeWidth?: undefined;
|
|
525
669
|
strokeStyle?: undefined;
|
|
526
670
|
lineEndings?: undefined;
|
|
527
671
|
contents?: undefined;
|
|
@@ -535,6 +679,7 @@ export declare const defaultTools: ({
|
|
|
535
679
|
behavior: {
|
|
536
680
|
insertUpright: true;
|
|
537
681
|
useAppearanceStream: false;
|
|
682
|
+
selectAfterCreate?: undefined;
|
|
538
683
|
};
|
|
539
684
|
clickBehavior?: undefined;
|
|
540
685
|
})[];
|
|
@@ -22,4 +22,6 @@ export declare const isPolylineTool: (tool: AnnotationTool<any> | undefined) =>
|
|
|
22
22
|
export declare const isPolygonTool: (tool: AnnotationTool<any> | undefined) => tool is ToolMap["polygon"];
|
|
23
23
|
export declare const isFreeTextTool: (tool: AnnotationTool<any> | undefined) => tool is ToolMap["freeText"];
|
|
24
24
|
export declare const isStampTool: (tool: AnnotationTool<any> | undefined) => tool is ToolMap["stamp"];
|
|
25
|
+
export declare const isInsertTextTool: (tool: AnnotationTool<any> | undefined) => tool is ToolMap["insertText"];
|
|
26
|
+
export declare const isReplaceTextTool: (tool: AnnotationTool<any> | undefined) => tool is ToolMap["replaceText"];
|
|
25
27
|
export {};
|
|
@@ -109,6 +109,8 @@ export type AnnotationTool<T extends PdfAnnotationObject = PdfAnnotationObject>
|
|
|
109
109
|
cursor?: string;
|
|
110
110
|
/** If true, this interaction mode is activated by selecting text. */
|
|
111
111
|
textSelection?: boolean;
|
|
112
|
+
/** Whether to show the native text selection rectangles. Only relevant when textSelection is true. Defaults to false. */
|
|
113
|
+
showSelectionRects?: boolean;
|
|
112
114
|
/** Whether this annotation can be dragged when selected individually. Can be dynamic based on annotation. */
|
|
113
115
|
isDraggable?: DynamicBooleanProp;
|
|
114
116
|
/** Whether this annotation can be resized when selected individually. Can be dynamic based on annotation. */
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -337,6 +337,7 @@ export interface SidebarAnnotationEntry {
|
|
|
337
337
|
page: number;
|
|
338
338
|
annotation: TrackedAnnotation;
|
|
339
339
|
replies: TrackedAnnotation<PdfTextAnnoObject>[];
|
|
340
|
+
groupMembers?: TrackedAnnotation[];
|
|
340
341
|
}
|
|
341
342
|
/**
|
|
342
343
|
* Information about an annotation needed for constraint calculation.
|