react-pdf-editor-1 1.2.46 → 1.2.48
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.js +38 -14
- package/package.json +1 -1
- package/src/index.d.ts +7 -0
- package/src/index.js +19 -1
package/dist/index.js
CHANGED
|
@@ -27,10 +27,12 @@ var useCreateIframeAndLoadViewer = function useCreateIframeAndLoadViewer(_ref) {
|
|
|
27
27
|
mode = _ref.mode,
|
|
28
28
|
container = _ref.container,
|
|
29
29
|
iframeSrc = _ref.iframeSrc,
|
|
30
|
+
role = _ref.role,
|
|
30
31
|
onFileFailed = _ref.onFileFailed,
|
|
31
32
|
defaultAnnotationEditorMode = _ref.defaultAnnotationEditorMode,
|
|
32
33
|
initialAnnotations = _ref.initialAnnotations,
|
|
33
34
|
notarySeal = _ref.notarySeal,
|
|
35
|
+
notaryStamp = _ref.notaryStamp,
|
|
34
36
|
initialSigners = _ref.initialSigners,
|
|
35
37
|
modifiedUiElements = _ref.modifiedUiElements,
|
|
36
38
|
textTagDefaults = _ref.textTagDefaults,
|
|
@@ -57,18 +59,26 @@ var useCreateIframeAndLoadViewer = function useCreateIframeAndLoadViewer(_ref) {
|
|
|
57
59
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
58
60
|
hasSeal = _useState10[0],
|
|
59
61
|
setHasSeal = _useState10[1];
|
|
60
|
-
var _useState11 = (0, _react.useState)(
|
|
62
|
+
var _useState11 = (0, _react.useState)(false),
|
|
61
63
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
var _useState13 = (0, _react.useState)(
|
|
64
|
+
hasNotaryStamp = _useState12[0],
|
|
65
|
+
setHasNotaryStamp = _useState12[1];
|
|
66
|
+
var _useState13 = (0, _react.useState)([]),
|
|
65
67
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
var _useState15 = (0, _react.useState)(
|
|
68
|
+
notarySealIds = _useState14[0],
|
|
69
|
+
setNotarySealIds = _useState14[1];
|
|
70
|
+
var _useState15 = (0, _react.useState)([]),
|
|
69
71
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
notaryStampIds = _useState16[0],
|
|
73
|
+
setNotaryStampIds = _useState16[1];
|
|
74
|
+
var _useState17 = (0, _react.useState)(null),
|
|
75
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
76
|
+
authTokens = _useState18[0],
|
|
77
|
+
setAuthTokens = _useState18[1];
|
|
78
|
+
var _useState19 = (0, _react.useState)(false),
|
|
79
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
|
80
|
+
signatureModalOpen = _useState20[0],
|
|
81
|
+
setSignatureModalOpen = _useState20[1];
|
|
72
82
|
var documentUpdatedListeners = (0, _react.useRef)(new Set());
|
|
73
83
|
var createIframe = function createIframe() {
|
|
74
84
|
var iframe = document.createElement('iframe');
|
|
@@ -106,8 +116,12 @@ var useCreateIframeAndLoadViewer = function useCreateIframeAndLoadViewer(_ref) {
|
|
|
106
116
|
authInfo: authInfo,
|
|
107
117
|
defaultAnnotationEditorMode: defaultAnnotationEditorMode,
|
|
108
118
|
textTagDefaults: textTagDefaults,
|
|
109
|
-
hideUndoRedoButtons: hideUndoRedoButtons
|
|
119
|
+
hideUndoRedoButtons: hideUndoRedoButtons,
|
|
120
|
+
role: role
|
|
110
121
|
};
|
|
122
|
+
if (typeof notaryStamp !== 'undefined') {
|
|
123
|
+
message.notaryStamp = notaryStamp;
|
|
124
|
+
}
|
|
111
125
|
|
|
112
126
|
// Set up a function to send the message
|
|
113
127
|
var sendMessage = function sendMessage() {
|
|
@@ -145,10 +159,18 @@ var useCreateIframeAndLoadViewer = function useCreateIframeAndLoadViewer(_ref) {
|
|
|
145
159
|
console.log('has-seal-change', event.data.message);
|
|
146
160
|
setHasSeal(!!event.data.message);
|
|
147
161
|
}
|
|
162
|
+
if (event.data.type === 'has-stamp-change') {
|
|
163
|
+
console.log('has-stamp-change', event.data.message);
|
|
164
|
+
setHasNotaryStamp(!!event.data.message);
|
|
165
|
+
}
|
|
148
166
|
if (event.data.type === 'notary-seal-ids-change') {
|
|
149
167
|
var ids = Array.isArray(event.data.message) ? event.data.message : [];
|
|
150
168
|
setNotarySealIds(ids);
|
|
151
169
|
}
|
|
170
|
+
if (event.data.type === 'stamp-ids-change') {
|
|
171
|
+
var _ids = Array.isArray(event.data.message) ? event.data.message : [];
|
|
172
|
+
setNotaryStampIds(_ids);
|
|
173
|
+
}
|
|
152
174
|
if (event.data.type === "annotation-modal-open-change") {
|
|
153
175
|
setSignatureModalOpen(event.data.message);
|
|
154
176
|
}
|
|
@@ -204,10 +226,10 @@ var useCreateIframeAndLoadViewer = function useCreateIframeAndLoadViewer(_ref) {
|
|
|
204
226
|
documentUpdatedListeners.current.clear();
|
|
205
227
|
};
|
|
206
228
|
}, []);
|
|
207
|
-
var
|
|
208
|
-
|
|
209
|
-
clickedTag =
|
|
210
|
-
setClickedTag =
|
|
229
|
+
var _useState21 = (0, _react.useState)(null),
|
|
230
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
|
231
|
+
clickedTag = _useState22[0],
|
|
232
|
+
setClickedTag = _useState22[1];
|
|
211
233
|
var handleTagClicked = function handleTagClicked(event) {
|
|
212
234
|
if (event.data.type === 'click-tag') {
|
|
213
235
|
setClickedTag(event.data);
|
|
@@ -626,7 +648,9 @@ var useCreateIframeAndLoadViewer = function useCreateIframeAndLoadViewer(_ref) {
|
|
|
626
648
|
selectedPages: selectedPages,
|
|
627
649
|
annotations: annotations,
|
|
628
650
|
notarySealIds: notarySealIds,
|
|
651
|
+
notaryStampIds: notaryStampIds,
|
|
629
652
|
hasSeal: hasSeal,
|
|
653
|
+
hasNotaryStamp: hasNotaryStamp,
|
|
630
654
|
authTokens: authTokens,
|
|
631
655
|
signatureModalOpen: signatureModalOpen,
|
|
632
656
|
onDocumentUpdated: onDocumentUpdated
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -11,12 +11,15 @@ declare module 'pdf_editor_aleon35_react_plugin' {
|
|
|
11
11
|
general?: ("zoom" | "search" | "download" | "thumbnails" | "panel-toggle")[];
|
|
12
12
|
editing?: ("remove" | "rotation" | "extract" | "move")[];
|
|
13
13
|
};
|
|
14
|
+
role?: string;
|
|
14
15
|
container: React.MutableRefObject<HTMLElement | null> | (HTMLElement | null);
|
|
15
16
|
locale?: "en" | "es" | "ru",
|
|
16
17
|
mode?: "split" | "regular",
|
|
17
18
|
fileName?: string;
|
|
18
19
|
onFileFailed?: (message: string) => void;
|
|
19
20
|
hideUndoRedoButtons?: boolean;
|
|
21
|
+
notarySeal?: unknown;
|
|
22
|
+
notaryStamp?: unknown;
|
|
20
23
|
}
|
|
21
24
|
) => {
|
|
22
25
|
combineFiles: () => void;
|
|
@@ -30,6 +33,10 @@ declare module 'pdf_editor_aleon35_react_plugin' {
|
|
|
30
33
|
splitPages: () => void;
|
|
31
34
|
extractPages: () => void;
|
|
32
35
|
selectedPages: number[];
|
|
36
|
+
hasSeal: boolean;
|
|
37
|
+
hasNotaryStamp: boolean;
|
|
38
|
+
notarySealIds: string[];
|
|
39
|
+
notaryStampIds: string[];
|
|
33
40
|
onDocumentUpdated: (listener: (pdfData: Uint8Array) => void) => () => void;
|
|
34
41
|
};
|
|
35
42
|
}
|
package/src/index.js
CHANGED
|
@@ -12,10 +12,12 @@ export const useCreateIframeAndLoadViewer = ({
|
|
|
12
12
|
mode,
|
|
13
13
|
container,
|
|
14
14
|
iframeSrc,
|
|
15
|
+
role,
|
|
15
16
|
onFileFailed,
|
|
16
17
|
defaultAnnotationEditorMode,
|
|
17
18
|
initialAnnotations,
|
|
18
19
|
notarySeal,
|
|
20
|
+
notaryStamp,
|
|
19
21
|
initialSigners,
|
|
20
22
|
modifiedUiElements,
|
|
21
23
|
textTagDefaults,
|
|
@@ -28,7 +30,9 @@ export const useCreateIframeAndLoadViewer = ({
|
|
|
28
30
|
const [pagesLoaded, setPagesLoaded] = useState(null);
|
|
29
31
|
const [annotations, setAnnotations] = useState([]);
|
|
30
32
|
const [hasSeal, setHasSeal] = useState(false);
|
|
33
|
+
const [hasNotaryStamp, setHasNotaryStamp] = useState(false);
|
|
31
34
|
const [notarySealIds, setNotarySealIds] = useState([]);
|
|
35
|
+
const [notaryStampIds, setNotaryStampIds] = useState([]);
|
|
32
36
|
const [authTokens, setAuthTokens] = useState(null);
|
|
33
37
|
const [signatureModalOpen, setSignatureModalOpen] = useState(false);
|
|
34
38
|
const documentUpdatedListeners = useRef(new Set());
|
|
@@ -56,7 +60,11 @@ export const useCreateIframeAndLoadViewer = ({
|
|
|
56
60
|
// When the iframe is loaded, post the file to it
|
|
57
61
|
iframe.onload = function() {
|
|
58
62
|
const targetOrigin = window.location.origin;
|
|
59
|
-
const message = { files, fileName, tools, locale, licenseKey, mode, uuid, customData, initialAnnotations, notarySeal, initialSigners, modifiedUiElements, authInfo, defaultAnnotationEditorMode, textTagDefaults, hideUndoRedoButtons };
|
|
63
|
+
const message = { files, fileName, tools, locale, licenseKey, mode, uuid, customData, initialAnnotations, notarySeal, initialSigners, modifiedUiElements, authInfo, defaultAnnotationEditorMode, textTagDefaults, hideUndoRedoButtons, role };
|
|
64
|
+
|
|
65
|
+
if (typeof notaryStamp !== 'undefined') {
|
|
66
|
+
message.notaryStamp = notaryStamp;
|
|
67
|
+
}
|
|
60
68
|
|
|
61
69
|
// Set up a function to send the message
|
|
62
70
|
const sendMessage = () => {
|
|
@@ -93,10 +101,18 @@ export const useCreateIframeAndLoadViewer = ({
|
|
|
93
101
|
console.log('has-seal-change', event.data.message);
|
|
94
102
|
setHasSeal(!!event.data.message);
|
|
95
103
|
}
|
|
104
|
+
if (event.data.type === 'has-stamp-change') {
|
|
105
|
+
console.log('has-stamp-change', event.data.message);
|
|
106
|
+
setHasNotaryStamp(!!event.data.message);
|
|
107
|
+
}
|
|
96
108
|
if (event.data.type === 'notary-seal-ids-change') {
|
|
97
109
|
const ids = Array.isArray(event.data.message) ? event.data.message : [];
|
|
98
110
|
setNotarySealIds(ids);
|
|
99
111
|
}
|
|
112
|
+
if (event.data.type === 'stamp-ids-change') {
|
|
113
|
+
const ids = Array.isArray(event.data.message) ? event.data.message : [];
|
|
114
|
+
setNotaryStampIds(ids);
|
|
115
|
+
}
|
|
100
116
|
if (event.data.type === "annotation-modal-open-change") {
|
|
101
117
|
setSignatureModalOpen(event.data.message);
|
|
102
118
|
}
|
|
@@ -451,7 +467,9 @@ export const useCreateIframeAndLoadViewer = ({
|
|
|
451
467
|
selectedPages,
|
|
452
468
|
annotations,
|
|
453
469
|
notarySealIds,
|
|
470
|
+
notaryStampIds,
|
|
454
471
|
hasSeal,
|
|
472
|
+
hasNotaryStamp,
|
|
455
473
|
authTokens,
|
|
456
474
|
signatureModalOpen,
|
|
457
475
|
onDocumentUpdated
|