@zerohive/hive-viewer 2.0.2 → 2.0.3
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 +822 -501
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +698 -377
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +11 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
// src/components/DocumentViewer.tsx
|
|
2
|
-
import { useEffect as
|
|
2
|
+
import { useEffect as useEffect9, useMemo as useMemo9, useRef as useRef7, useState as useState9 } from "react";
|
|
3
3
|
|
|
4
4
|
// src/editors/RichTextEditor.tsx
|
|
5
5
|
import mammoth from "mammoth";
|
|
6
|
-
import { useEffect as
|
|
6
|
+
import { useEffect as useEffect3, useMemo as useMemo2, useRef as useRef2, useState as useState3 } from "react";
|
|
7
7
|
import MarkdownIt from "markdown-it";
|
|
8
8
|
|
|
9
9
|
// src/components/SignatureOverlay.tsx
|
|
10
10
|
import { MessageSquare } from "lucide-react";
|
|
11
|
-
import { useEffect, useMemo, useRef, useState } from "react";
|
|
11
|
+
import { useEffect as useEffect2, useMemo, useRef, useState as useState2 } from "react";
|
|
12
|
+
|
|
13
|
+
// src/components/RenderableSignatureImage.tsx
|
|
14
|
+
import { useEffect, useState } from "react";
|
|
12
15
|
|
|
13
16
|
// src/utils/signature.ts
|
|
14
17
|
var SIGNATURE_INK_COLORS = [
|
|
@@ -89,8 +92,267 @@ function normalizeSignaturePlacement(placement) {
|
|
|
89
92
|
};
|
|
90
93
|
}
|
|
91
94
|
|
|
95
|
+
// src/utils/signatureImage.ts
|
|
96
|
+
var processedSignatureCache = /* @__PURE__ */ new Map();
|
|
97
|
+
function ensureSignatureSource(source) {
|
|
98
|
+
const trimmedSource = source.trim();
|
|
99
|
+
if (trimmedSource.startsWith("data:") || trimmedSource.startsWith("blob:") || trimmedSource.startsWith("http:") || trimmedSource.startsWith("https:")) {
|
|
100
|
+
return trimmedSource;
|
|
101
|
+
}
|
|
102
|
+
if (trimmedSource.startsWith("//") && typeof window !== "undefined") {
|
|
103
|
+
return `${window.location.protocol}${trimmedSource}`;
|
|
104
|
+
}
|
|
105
|
+
if (typeof window !== "undefined" && (trimmedSource.startsWith("/") || trimmedSource.startsWith("./") || trimmedSource.startsWith("../"))) {
|
|
106
|
+
return new URL(trimmedSource, window.location.origin).toString();
|
|
107
|
+
}
|
|
108
|
+
if (trimmedSource.startsWith("<svg") || trimmedSource.startsWith("<?xml") && trimmedSource.includes("<svg")) {
|
|
109
|
+
return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(trimmedSource)}`;
|
|
110
|
+
}
|
|
111
|
+
return `data:image/png;base64,${trimmedSource}`;
|
|
112
|
+
}
|
|
113
|
+
function createCanvas(width, height) {
|
|
114
|
+
const canvas = document.createElement("canvas");
|
|
115
|
+
canvas.width = Math.max(1, Math.round(width));
|
|
116
|
+
canvas.height = Math.max(1, Math.round(height));
|
|
117
|
+
return canvas;
|
|
118
|
+
}
|
|
119
|
+
async function loadSignatureImage(source) {
|
|
120
|
+
const image = new Image();
|
|
121
|
+
image.crossOrigin = "anonymous";
|
|
122
|
+
image.decoding = "async";
|
|
123
|
+
await new Promise((resolve, reject) => {
|
|
124
|
+
image.onload = () => resolve();
|
|
125
|
+
image.onerror = () => reject(new Error("Unable to load signature image."));
|
|
126
|
+
image.src = source;
|
|
127
|
+
});
|
|
128
|
+
if ("decode" in image) {
|
|
129
|
+
try {
|
|
130
|
+
await image.decode();
|
|
131
|
+
} catch {
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return image;
|
|
135
|
+
}
|
|
136
|
+
function colorDistance(leftRed, leftGreen, leftBlue, rightRed, rightGreen, rightBlue) {
|
|
137
|
+
const deltaRed = leftRed - rightRed;
|
|
138
|
+
const deltaGreen = leftGreen - rightGreen;
|
|
139
|
+
const deltaBlue = leftBlue - rightBlue;
|
|
140
|
+
return Math.sqrt(
|
|
141
|
+
deltaRed * deltaRed + deltaGreen * deltaGreen + deltaBlue * deltaBlue
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
function hasMeaningfulTransparency(pixels) {
|
|
145
|
+
let translucentPixels = 0;
|
|
146
|
+
const totalPixels = pixels.length / 4;
|
|
147
|
+
for (let index = 3; index < pixels.length; index += 4) {
|
|
148
|
+
if (pixels[index] < 250) {
|
|
149
|
+
translucentPixels += 1;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return translucentPixels > Math.max(12, totalPixels * 4e-3);
|
|
153
|
+
}
|
|
154
|
+
function detectUniformBackground(pixels, width, height) {
|
|
155
|
+
const sampleRadius = Math.max(2, Math.min(12, Math.floor(Math.min(width, height) / 12)));
|
|
156
|
+
const sampleOrigins = [
|
|
157
|
+
[0, 0],
|
|
158
|
+
[Math.max(0, width - sampleRadius), 0],
|
|
159
|
+
[0, Math.max(0, height - sampleRadius)],
|
|
160
|
+
[Math.max(0, width - sampleRadius), Math.max(0, height - sampleRadius)]
|
|
161
|
+
];
|
|
162
|
+
const samples = [];
|
|
163
|
+
for (const [startX, startY] of sampleOrigins) {
|
|
164
|
+
let red = 0;
|
|
165
|
+
let green = 0;
|
|
166
|
+
let blue = 0;
|
|
167
|
+
let count = 0;
|
|
168
|
+
for (let y = startY; y < Math.min(height, startY + sampleRadius); y += 1) {
|
|
169
|
+
for (let x = startX; x < Math.min(width, startX + sampleRadius); x += 1) {
|
|
170
|
+
const offset = (y * width + x) * 4;
|
|
171
|
+
const alpha = pixels[offset + 3];
|
|
172
|
+
if (alpha < 250) {
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
red += pixels[offset];
|
|
176
|
+
green += pixels[offset + 1];
|
|
177
|
+
blue += pixels[offset + 2];
|
|
178
|
+
count += 1;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (count === 0) {
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
samples.push([
|
|
185
|
+
Math.round(red / count),
|
|
186
|
+
Math.round(green / count),
|
|
187
|
+
Math.round(blue / count)
|
|
188
|
+
]);
|
|
189
|
+
}
|
|
190
|
+
if (samples.length === 0) {
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
const average = samples.reduce(
|
|
194
|
+
(accumulator, sample) => [
|
|
195
|
+
accumulator[0] + sample[0],
|
|
196
|
+
accumulator[1] + sample[1],
|
|
197
|
+
accumulator[2] + sample[2]
|
|
198
|
+
],
|
|
199
|
+
[0, 0, 0]
|
|
200
|
+
);
|
|
201
|
+
const background = [
|
|
202
|
+
Math.round(average[0] / samples.length),
|
|
203
|
+
Math.round(average[1] / samples.length),
|
|
204
|
+
Math.round(average[2] / samples.length)
|
|
205
|
+
];
|
|
206
|
+
const maxDistance = samples.reduce((highest, sample) => {
|
|
207
|
+
const distance = colorDistance(
|
|
208
|
+
sample[0],
|
|
209
|
+
sample[1],
|
|
210
|
+
sample[2],
|
|
211
|
+
background[0],
|
|
212
|
+
background[1],
|
|
213
|
+
background[2]
|
|
214
|
+
);
|
|
215
|
+
return Math.max(highest, distance);
|
|
216
|
+
}, 0);
|
|
217
|
+
return maxDistance <= 26 ? background : null;
|
|
218
|
+
}
|
|
219
|
+
function createTintedSignatureFromAlpha(pixels, width, height, inkColor) {
|
|
220
|
+
const canvas = createCanvas(width, height);
|
|
221
|
+
const context = canvas.getContext("2d");
|
|
222
|
+
if (!context) {
|
|
223
|
+
return null;
|
|
224
|
+
}
|
|
225
|
+
const output = context.createImageData(width, height);
|
|
226
|
+
for (let offset = 0; offset < pixels.length; offset += 4) {
|
|
227
|
+
output.data[offset] = inkColor[0];
|
|
228
|
+
output.data[offset + 1] = inkColor[1];
|
|
229
|
+
output.data[offset + 2] = inkColor[2];
|
|
230
|
+
output.data[offset + 3] = pixels[offset + 3];
|
|
231
|
+
}
|
|
232
|
+
context.putImageData(output, 0, 0);
|
|
233
|
+
return canvas;
|
|
234
|
+
}
|
|
235
|
+
function createTintedSignatureFromSolidBackground(pixels, width, height, background, inkColor) {
|
|
236
|
+
const canvas = createCanvas(width, height);
|
|
237
|
+
const context = canvas.getContext("2d");
|
|
238
|
+
if (!context) {
|
|
239
|
+
return null;
|
|
240
|
+
}
|
|
241
|
+
const output = context.createImageData(width, height);
|
|
242
|
+
let foregroundPixels = 0;
|
|
243
|
+
const totalPixels = width * height;
|
|
244
|
+
for (let offset = 0; offset < pixels.length; offset += 4) {
|
|
245
|
+
const alpha = pixels[offset + 3] / 255;
|
|
246
|
+
const distance = colorDistance(
|
|
247
|
+
pixels[offset],
|
|
248
|
+
pixels[offset + 1],
|
|
249
|
+
pixels[offset + 2],
|
|
250
|
+
background[0],
|
|
251
|
+
background[1],
|
|
252
|
+
background[2]
|
|
253
|
+
);
|
|
254
|
+
const normalizedStrength = Math.max(0, Math.min(1, (distance - 14) / 120));
|
|
255
|
+
const outputAlpha = Math.round(normalizedStrength * alpha * 255);
|
|
256
|
+
output.data[offset] = inkColor[0];
|
|
257
|
+
output.data[offset + 1] = inkColor[1];
|
|
258
|
+
output.data[offset + 2] = inkColor[2];
|
|
259
|
+
output.data[offset + 3] = outputAlpha;
|
|
260
|
+
if (outputAlpha > 10) {
|
|
261
|
+
foregroundPixels += 1;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
if (foregroundPixels < Math.max(24, totalPixels * 15e-4) || foregroundPixels > totalPixels * 0.42) {
|
|
265
|
+
return null;
|
|
266
|
+
}
|
|
267
|
+
context.putImageData(output, 0, 0);
|
|
268
|
+
return canvas;
|
|
269
|
+
}
|
|
270
|
+
function parseInkColor(inkColor) {
|
|
271
|
+
const hex = SIGNATURE_INK_COLOR_VALUES[inkColor];
|
|
272
|
+
return [
|
|
273
|
+
Number.parseInt(hex.slice(1, 3), 16),
|
|
274
|
+
Number.parseInt(hex.slice(3, 5), 16),
|
|
275
|
+
Number.parseInt(hex.slice(5, 7), 16)
|
|
276
|
+
];
|
|
277
|
+
}
|
|
278
|
+
async function getRenderableSignatureImage(source, inkColor) {
|
|
279
|
+
const resolvedSource = ensureSignatureSource(source);
|
|
280
|
+
const normalizedInkColor = normalizeSignatureInkColor(inkColor);
|
|
281
|
+
const cacheKey = `${normalizedInkColor}::${resolvedSource}`;
|
|
282
|
+
const cached = processedSignatureCache.get(cacheKey);
|
|
283
|
+
if (cached) {
|
|
284
|
+
return cached;
|
|
285
|
+
}
|
|
286
|
+
const pending = (async () => {
|
|
287
|
+
const image = await loadSignatureImage(resolvedSource);
|
|
288
|
+
const canvas = createCanvas(image.width, image.height);
|
|
289
|
+
const context = canvas.getContext("2d");
|
|
290
|
+
if (!context) {
|
|
291
|
+
return resolvedSource;
|
|
292
|
+
}
|
|
293
|
+
context.drawImage(image, 0, 0, image.width, image.height);
|
|
294
|
+
let imageData;
|
|
295
|
+
try {
|
|
296
|
+
imageData = context.getImageData(0, 0, canvas.width, canvas.height);
|
|
297
|
+
} catch {
|
|
298
|
+
return resolvedSource;
|
|
299
|
+
}
|
|
300
|
+
const inkRgb = parseInkColor(normalizedInkColor);
|
|
301
|
+
const transparentRender = hasMeaningfulTransparency(imageData.data) ? createTintedSignatureFromAlpha(
|
|
302
|
+
imageData.data,
|
|
303
|
+
canvas.width,
|
|
304
|
+
canvas.height,
|
|
305
|
+
inkRgb
|
|
306
|
+
) : null;
|
|
307
|
+
if (transparentRender) {
|
|
308
|
+
return transparentRender.toDataURL("image/png");
|
|
309
|
+
}
|
|
310
|
+
const background = detectUniformBackground(
|
|
311
|
+
imageData.data,
|
|
312
|
+
canvas.width,
|
|
313
|
+
canvas.height
|
|
314
|
+
);
|
|
315
|
+
if (!background) {
|
|
316
|
+
return resolvedSource;
|
|
317
|
+
}
|
|
318
|
+
const extractedRender = createTintedSignatureFromSolidBackground(
|
|
319
|
+
imageData.data,
|
|
320
|
+
canvas.width,
|
|
321
|
+
canvas.height,
|
|
322
|
+
background,
|
|
323
|
+
inkRgb
|
|
324
|
+
);
|
|
325
|
+
return extractedRender ? extractedRender.toDataURL("image/png") : resolvedSource;
|
|
326
|
+
})().catch(() => resolvedSource);
|
|
327
|
+
processedSignatureCache.set(cacheKey, pending);
|
|
328
|
+
return pending;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// src/components/RenderableSignatureImage.tsx
|
|
332
|
+
import { jsx } from "react/jsx-runtime";
|
|
333
|
+
function RenderableSignatureImage(props) {
|
|
334
|
+
const { signatureImageUrl, inkColor, ...imageProps } = props;
|
|
335
|
+
const [resolvedSrc, setResolvedSrc] = useState(signatureImageUrl);
|
|
336
|
+
useEffect(() => {
|
|
337
|
+
let cancelled = false;
|
|
338
|
+
void getRenderableSignatureImage(signatureImageUrl, inkColor).then((nextSource) => {
|
|
339
|
+
if (!cancelled) {
|
|
340
|
+
setResolvedSrc(nextSource);
|
|
341
|
+
}
|
|
342
|
+
}).catch(() => {
|
|
343
|
+
if (!cancelled) {
|
|
344
|
+
setResolvedSrc(signatureImageUrl);
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
return () => {
|
|
348
|
+
cancelled = true;
|
|
349
|
+
};
|
|
350
|
+
}, [inkColor, signatureImageUrl]);
|
|
351
|
+
return /* @__PURE__ */ jsx("img", { ...imageProps, src: resolvedSrc, decoding: "async", draggable: false });
|
|
352
|
+
}
|
|
353
|
+
|
|
92
354
|
// src/components/SignatureOverlay.tsx
|
|
93
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
355
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
94
356
|
function clamp(value, min, max) {
|
|
95
357
|
return Math.min(max, Math.max(min, value));
|
|
96
358
|
}
|
|
@@ -123,9 +385,6 @@ function getLinkedAnnotationIds(annotations) {
|
|
|
123
385
|
annotations.filter((annotation) => annotation.linkedSignaturePlacementId).map((annotation) => annotation.linkedSignaturePlacementId)
|
|
124
386
|
);
|
|
125
387
|
}
|
|
126
|
-
function buildMaskImageValue(source) {
|
|
127
|
-
return `url("${source.replaceAll('"', '\\"')}")`;
|
|
128
|
-
}
|
|
129
388
|
function SignatureOverlay(props) {
|
|
130
389
|
const {
|
|
131
390
|
surfaceKey,
|
|
@@ -163,7 +422,7 @@ function SignatureOverlay(props) {
|
|
|
163
422
|
onSelectAnnotation
|
|
164
423
|
} = props;
|
|
165
424
|
const layerRef = useRef(null);
|
|
166
|
-
const [dragState, setDragState] =
|
|
425
|
+
const [dragState, setDragState] = useState2(null);
|
|
167
426
|
const visiblePlacements = useMemo(
|
|
168
427
|
() => placements.filter((placement) => placement.surfaceKey === surfaceKey),
|
|
169
428
|
[placements, surfaceKey]
|
|
@@ -177,7 +436,7 @@ function SignatureOverlay(props) {
|
|
|
177
436
|
[visibleAnnotations]
|
|
178
437
|
);
|
|
179
438
|
const captureMode = pendingSignature ? "signature" : pendingAnnotation ? "annotation" : null;
|
|
180
|
-
|
|
439
|
+
useEffect2(() => {
|
|
181
440
|
if (captureMode || dragState) {
|
|
182
441
|
return;
|
|
183
442
|
}
|
|
@@ -196,7 +455,7 @@ function SignatureOverlay(props) {
|
|
|
196
455
|
window.removeEventListener("pointerdown", handlePointerDown, true);
|
|
197
456
|
};
|
|
198
457
|
}, [captureMode, dragState, onSelectAnnotation, onSelectPlacement]);
|
|
199
|
-
|
|
458
|
+
useEffect2(() => {
|
|
200
459
|
if (!dragState) {
|
|
201
460
|
return;
|
|
202
461
|
}
|
|
@@ -343,7 +602,7 @@ function SignatureOverlay(props) {
|
|
|
343
602
|
});
|
|
344
603
|
};
|
|
345
604
|
return /* @__PURE__ */ jsxs("div", { ref: layerRef, className: "hv-signature-overlay", children: [
|
|
346
|
-
captureMode && /* @__PURE__ */
|
|
605
|
+
captureMode && /* @__PURE__ */ jsx2("div", { className: "hv-signature-overlay-capture", onClick: handlePlace, children: /* @__PURE__ */ jsx2("div", { className: "hv-signature-overlay-hint", children: captureMode === "annotation" ? annotationHint : placeHint }) }),
|
|
347
606
|
visiblePlacements.map((placement) => {
|
|
348
607
|
const isActive = placement.id === activePlacementId;
|
|
349
608
|
const hasLinkedAnnotation = linkedAnnotationIds.has(placement.id);
|
|
@@ -351,7 +610,6 @@ function SignatureOverlay(props) {
|
|
|
351
610
|
const jobTitle = placement.signature.jobTitle?.trim();
|
|
352
611
|
const signedDate = normalizeSignatureDate(placement.signature.dateSigned);
|
|
353
612
|
const signatureColor = normalizeSignatureInkColor(placement.signatureColor);
|
|
354
|
-
const maskImage = buildMaskImageValue(placement.signature.signatureImageUrl);
|
|
355
613
|
return /* @__PURE__ */ jsxs(
|
|
356
614
|
"div",
|
|
357
615
|
{
|
|
@@ -377,7 +635,7 @@ function SignatureOverlay(props) {
|
|
|
377
635
|
onSelectAnnotation(null);
|
|
378
636
|
},
|
|
379
637
|
children: [
|
|
380
|
-
isActive && /* @__PURE__ */
|
|
638
|
+
isActive && /* @__PURE__ */ jsx2(
|
|
381
639
|
"button",
|
|
382
640
|
{
|
|
383
641
|
type: "button",
|
|
@@ -393,25 +651,21 @@ function SignatureOverlay(props) {
|
|
|
393
651
|
children: "x"
|
|
394
652
|
}
|
|
395
653
|
),
|
|
396
|
-
/* @__PURE__ */
|
|
397
|
-
|
|
654
|
+
/* @__PURE__ */ jsx2("div", { className: "hv-signature-image-wrap", children: /* @__PURE__ */ jsx2(
|
|
655
|
+
RenderableSignatureImage,
|
|
398
656
|
{
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
backgroundColor: SIGNATURE_INK_COLOR_VALUES[signatureColor],
|
|
404
|
-
maskImage,
|
|
405
|
-
WebkitMaskImage: maskImage
|
|
406
|
-
}
|
|
657
|
+
signatureImageUrl: placement.signature.signatureImageUrl,
|
|
658
|
+
inkColor: signatureColor,
|
|
659
|
+
alt: signer ? `${signatureAltByLabel} ${signer}` : signatureAltLabel,
|
|
660
|
+
className: "hv-signature-image"
|
|
407
661
|
}
|
|
408
662
|
) }),
|
|
409
663
|
/* @__PURE__ */ jsxs("div", { className: "hv-signature-meta", children: [
|
|
410
|
-
signer && /* @__PURE__ */
|
|
411
|
-
jobTitle && /* @__PURE__ */
|
|
412
|
-
/* @__PURE__ */
|
|
664
|
+
signer && /* @__PURE__ */ jsx2("span", { className: "hv-signature-meta-name", children: signer }),
|
|
665
|
+
jobTitle && /* @__PURE__ */ jsx2("span", { className: "hv-signature-meta-jobtitle", children: jobTitle }),
|
|
666
|
+
/* @__PURE__ */ jsx2("span", { className: "hv-signature-meta-date", children: signedDate })
|
|
413
667
|
] }),
|
|
414
|
-
hasLinkedAnnotation && /* @__PURE__ */
|
|
668
|
+
hasLinkedAnnotation && /* @__PURE__ */ jsx2("div", { className: "hv-signature-note-indicator", children: signatureNoteIndicatorLabel }),
|
|
415
669
|
isActive && /* @__PURE__ */ jsxs(
|
|
416
670
|
"div",
|
|
417
671
|
{
|
|
@@ -423,8 +677,8 @@ function SignatureOverlay(props) {
|
|
|
423
677
|
event.stopPropagation();
|
|
424
678
|
},
|
|
425
679
|
children: [
|
|
426
|
-
/* @__PURE__ */
|
|
427
|
-
/* @__PURE__ */
|
|
680
|
+
/* @__PURE__ */ jsx2("span", { className: "hv-signature-color-toolbar-label", children: signatureColorLabel }),
|
|
681
|
+
/* @__PURE__ */ jsx2("div", { className: "hv-signature-color-swatch-row", children: SIGNATURE_INK_COLORS.map((color) => /* @__PURE__ */ jsx2(
|
|
428
682
|
"button",
|
|
429
683
|
{
|
|
430
684
|
type: "button",
|
|
@@ -439,7 +693,7 @@ function SignatureOverlay(props) {
|
|
|
439
693
|
]
|
|
440
694
|
}
|
|
441
695
|
),
|
|
442
|
-
isActive && /* @__PURE__ */
|
|
696
|
+
isActive && /* @__PURE__ */ jsx2(
|
|
443
697
|
"div",
|
|
444
698
|
{
|
|
445
699
|
className: "hv-signature-resize",
|
|
@@ -460,7 +714,7 @@ function SignatureOverlay(props) {
|
|
|
460
714
|
const isLinked = Boolean(annotation.linkedSignaturePlacementId);
|
|
461
715
|
const hasText = annotation.text.trim().length > 0;
|
|
462
716
|
if (!isActive) {
|
|
463
|
-
return /* @__PURE__ */
|
|
717
|
+
return /* @__PURE__ */ jsx2(
|
|
464
718
|
"button",
|
|
465
719
|
{
|
|
466
720
|
type: "button",
|
|
@@ -476,7 +730,7 @@ function SignatureOverlay(props) {
|
|
|
476
730
|
onSelectAnnotation(annotation.id);
|
|
477
731
|
onSelectPlacement(null);
|
|
478
732
|
},
|
|
479
|
-
children: /* @__PURE__ */
|
|
733
|
+
children: /* @__PURE__ */ jsx2(MessageSquare, { size: 14 })
|
|
480
734
|
},
|
|
481
735
|
annotation.id
|
|
482
736
|
);
|
|
@@ -516,10 +770,10 @@ function SignatureOverlay(props) {
|
|
|
516
770
|
},
|
|
517
771
|
children: [
|
|
518
772
|
/* @__PURE__ */ jsxs("div", { className: "hv-annotation-header-copy", children: [
|
|
519
|
-
/* @__PURE__ */
|
|
520
|
-
isLinked && /* @__PURE__ */
|
|
773
|
+
/* @__PURE__ */ jsx2("span", { className: "hv-annotation-title", children: isLinked ? linkedAnnotationTitle : annotationTitle }),
|
|
774
|
+
isLinked && /* @__PURE__ */ jsx2("span", { className: "hv-annotation-badge", children: linkedAnnotationBadge })
|
|
521
775
|
] }),
|
|
522
|
-
isActive && /* @__PURE__ */
|
|
776
|
+
isActive && /* @__PURE__ */ jsx2(
|
|
523
777
|
"button",
|
|
524
778
|
{
|
|
525
779
|
type: "button",
|
|
@@ -538,7 +792,7 @@ function SignatureOverlay(props) {
|
|
|
538
792
|
]
|
|
539
793
|
}
|
|
540
794
|
),
|
|
541
|
-
/* @__PURE__ */
|
|
795
|
+
/* @__PURE__ */ jsx2("div", { className: "hv-annotation-body", children: isActive ? /* @__PURE__ */ jsx2(
|
|
542
796
|
"textarea",
|
|
543
797
|
{
|
|
544
798
|
value: annotation.text,
|
|
@@ -552,14 +806,14 @@ function SignatureOverlay(props) {
|
|
|
552
806
|
event.stopPropagation();
|
|
553
807
|
}
|
|
554
808
|
}
|
|
555
|
-
) : /* @__PURE__ */
|
|
809
|
+
) : /* @__PURE__ */ jsx2(
|
|
556
810
|
"div",
|
|
557
811
|
{
|
|
558
812
|
className: `hv-annotation-preview ${hasText ? "" : "empty"}`,
|
|
559
813
|
children: hasText ? annotation.text : annotationPlaceholder
|
|
560
814
|
}
|
|
561
815
|
) }),
|
|
562
|
-
isActive && /* @__PURE__ */
|
|
816
|
+
isActive && /* @__PURE__ */ jsx2(
|
|
563
817
|
"div",
|
|
564
818
|
{
|
|
565
819
|
className: "hv-annotation-resize",
|
|
@@ -1394,7 +1648,7 @@ function ensureImageSource(source) {
|
|
|
1394
1648
|
}
|
|
1395
1649
|
return `data:image/png;base64,${trimmedSource}`;
|
|
1396
1650
|
}
|
|
1397
|
-
function
|
|
1651
|
+
function createCanvas2(width, height) {
|
|
1398
1652
|
const canvas = document.createElement("canvas");
|
|
1399
1653
|
canvas.width = Math.max(1, Math.round(width));
|
|
1400
1654
|
canvas.height = Math.max(1, Math.round(height));
|
|
@@ -1435,7 +1689,7 @@ async function tryLoadImage(source) {
|
|
|
1435
1689
|
}
|
|
1436
1690
|
}
|
|
1437
1691
|
function getOpaqueImageBounds(image, alphaThreshold = 8) {
|
|
1438
|
-
const canvas =
|
|
1692
|
+
const canvas = createCanvas2(image.width, image.height);
|
|
1439
1693
|
const ctx = canvas.getContext("2d");
|
|
1440
1694
|
if (!ctx) {
|
|
1441
1695
|
return {
|
|
@@ -1786,7 +2040,7 @@ async function renderDecorationCanvasFromModel(model, kind) {
|
|
|
1786
2040
|
}
|
|
1787
2041
|
const canvasWidth = 1600;
|
|
1788
2042
|
const canvasHeight = kind === "header" ? 146 : 88;
|
|
1789
|
-
const canvas =
|
|
2043
|
+
const canvas = createCanvas2(canvasWidth, canvasHeight);
|
|
1790
2044
|
const ctx = canvas.getContext("2d");
|
|
1791
2045
|
if (!ctx) {
|
|
1792
2046
|
return null;
|
|
@@ -1986,7 +2240,7 @@ function applyPageDecorationsToCanvas(baseCanvas, decorations) {
|
|
|
1986
2240
|
if (!decorations?.headerCanvas && !decorations?.footerCanvas) {
|
|
1987
2241
|
return baseCanvas;
|
|
1988
2242
|
}
|
|
1989
|
-
const pageCanvas =
|
|
2243
|
+
const pageCanvas = createCanvas2(baseCanvas.width, baseCanvas.height);
|
|
1990
2244
|
const ctx = pageCanvas.getContext("2d");
|
|
1991
2245
|
if (!ctx) {
|
|
1992
2246
|
return baseCanvas;
|
|
@@ -2033,19 +2287,6 @@ function applyPageDecorationsToCanvas(baseCanvas, decorations) {
|
|
|
2033
2287
|
function formatSignedDate(value) {
|
|
2034
2288
|
return normalizeSignatureDate(value);
|
|
2035
2289
|
}
|
|
2036
|
-
function createTintedImageCanvas(image, signatureColor) {
|
|
2037
|
-
const tintedCanvas = createCanvas(image.width, image.height);
|
|
2038
|
-
const tintedCtx = tintedCanvas.getContext("2d");
|
|
2039
|
-
if (!tintedCtx) {
|
|
2040
|
-
return null;
|
|
2041
|
-
}
|
|
2042
|
-
tintedCtx.drawImage(image, 0, 0);
|
|
2043
|
-
tintedCtx.globalCompositeOperation = "source-in";
|
|
2044
|
-
tintedCtx.fillStyle = signatureColor;
|
|
2045
|
-
tintedCtx.fillRect(0, 0, tintedCanvas.width, tintedCanvas.height);
|
|
2046
|
-
tintedCtx.globalCompositeOperation = "source-over";
|
|
2047
|
-
return tintedCanvas;
|
|
2048
|
-
}
|
|
2049
2290
|
async function drawSignatureStamp(ctx, placement, x, y, width, height, options) {
|
|
2050
2291
|
const isSlideStamp = placement.surfaceKind === "slide";
|
|
2051
2292
|
const borderless = options?.borderless ?? false;
|
|
@@ -2055,12 +2296,12 @@ async function drawSignatureStamp(ctx, placement, x, y, width, height, options)
|
|
|
2055
2296
|
isSlideStamp ? 46 : 40,
|
|
2056
2297
|
height * (isSlideStamp ? 0.36 : 0.32)
|
|
2057
2298
|
);
|
|
2058
|
-
const signatureImage = await loadImage(placement.signature.signatureImageUrl);
|
|
2059
2299
|
const signatureColor = normalizeSignatureInkColor(placement.signatureColor);
|
|
2060
|
-
const
|
|
2061
|
-
|
|
2062
|
-
|
|
2300
|
+
const renderableSignatureImage = await getRenderableSignatureImage(
|
|
2301
|
+
placement.signature.signatureImageUrl,
|
|
2302
|
+
signatureColor
|
|
2063
2303
|
);
|
|
2304
|
+
const signatureImage = await loadImage(renderableSignatureImage);
|
|
2064
2305
|
const imageBounds = getOpaqueImageBounds(signatureImage);
|
|
2065
2306
|
const signer = placement.signature.signedBy?.trim() || "";
|
|
2066
2307
|
const jobTitle = placement.signature.jobTitle?.trim() || "";
|
|
@@ -2091,7 +2332,7 @@ async function drawSignatureStamp(ctx, placement, x, y, width, height, options)
|
|
|
2091
2332
|
const imageBaseY = isSlideStamp ? y : y + padding;
|
|
2092
2333
|
const imageY = imageBaseY + Math.max(imageAreaHeight - imageHeight, 0) * (isSlideStamp ? 0.7 : 0.18);
|
|
2093
2334
|
ctx.drawImage(
|
|
2094
|
-
|
|
2335
|
+
signatureImage,
|
|
2095
2336
|
imageBounds.sx,
|
|
2096
2337
|
imageBounds.sy,
|
|
2097
2338
|
imageBounds.sw,
|
|
@@ -2289,7 +2530,7 @@ async function createSignatureStampDataUrl(placement, width, height) {
|
|
|
2289
2530
|
const aspectRatio = placement.width > 0 && placement.height > 0 ? placement.width / placement.height : 3.1;
|
|
2290
2531
|
const targetHeight = height ?? (placement.surfaceKind === "slide" ? 320 : 260);
|
|
2291
2532
|
const targetWidth = width ?? Math.max(480, Math.round(targetHeight * aspectRatio));
|
|
2292
|
-
const canvas =
|
|
2533
|
+
const canvas = createCanvas2(targetWidth, targetHeight);
|
|
2293
2534
|
const ctx = canvas.getContext("2d");
|
|
2294
2535
|
if (!ctx) {
|
|
2295
2536
|
throw new Error("Unable to render the signature stamp.");
|
|
@@ -2298,7 +2539,7 @@ async function createSignatureStampDataUrl(placement, width, height) {
|
|
|
2298
2539
|
return canvas.toDataURL("image/png");
|
|
2299
2540
|
}
|
|
2300
2541
|
async function createAnnotationCardDataUrl(annotation, width = 720, height = 360, labels = defaultExportLocaleLabels) {
|
|
2301
|
-
const canvas =
|
|
2542
|
+
const canvas = createCanvas2(width, height);
|
|
2302
2543
|
const ctx = canvas.getContext("2d");
|
|
2303
2544
|
if (!ctx) {
|
|
2304
2545
|
throw new Error("Unable to render the annotation.");
|
|
@@ -2623,7 +2864,7 @@ function splitTallCanvas(canvas) {
|
|
|
2623
2864
|
}
|
|
2624
2865
|
for (let offset = 0; offset < canvas.height; offset += maxSliceHeight) {
|
|
2625
2866
|
const sliceHeight = Math.min(maxSliceHeight, canvas.height - offset);
|
|
2626
|
-
const sliceCanvas =
|
|
2867
|
+
const sliceCanvas = createCanvas2(canvas.width, sliceHeight);
|
|
2627
2868
|
const ctx = sliceCanvas.getContext("2d");
|
|
2628
2869
|
if (!ctx) {
|
|
2629
2870
|
continue;
|
|
@@ -2758,7 +2999,7 @@ async function renderSlidesToCanvases(exportState, placements, annotations, labe
|
|
|
2758
2999
|
const scale = targetWidth / slideWidth;
|
|
2759
3000
|
const canvases = [];
|
|
2760
3001
|
for (const [index, slide] of exportState.slides.entries()) {
|
|
2761
|
-
const canvas =
|
|
3002
|
+
const canvas = createCanvas2(slideWidth * scale, slideHeight * scale);
|
|
2762
3003
|
const ctx = canvas.getContext("2d");
|
|
2763
3004
|
if (!ctx) {
|
|
2764
3005
|
continue;
|
|
@@ -2876,7 +3117,7 @@ async function renderSlidesToCanvases(exportState, placements, annotations, labe
|
|
|
2876
3117
|
);
|
|
2877
3118
|
canvases.push(canvas);
|
|
2878
3119
|
}
|
|
2879
|
-
return canvases.length > 0 ? canvases : [
|
|
3120
|
+
return canvases.length > 0 ? canvases : [createCanvas2(1280, 720)];
|
|
2880
3121
|
}
|
|
2881
3122
|
function createSheetMergeLookup(merges) {
|
|
2882
3123
|
const starts = /* @__PURE__ */ new Map();
|
|
@@ -3042,7 +3283,7 @@ async function renderSheetsToCanvases(sheets, placements, annotations, labels =
|
|
|
3042
3283
|
const visibleRowHeights = sheet.rowHeights.slice(0, sheet.renderedRowCount);
|
|
3043
3284
|
const totalWidth = SHEET_ROW_HEADER_WIDTH + visibleColWidths.reduce((sum, value) => sum + value, 0);
|
|
3044
3285
|
const totalHeight = SHEET_COLUMN_HEADER_HEIGHT + visibleRowHeights.reduce((sum, value) => sum + value, 0);
|
|
3045
|
-
const canvas =
|
|
3286
|
+
const canvas = createCanvas2(totalWidth, totalHeight);
|
|
3046
3287
|
const ctx = canvas.getContext("2d");
|
|
3047
3288
|
if (!ctx) {
|
|
3048
3289
|
continue;
|
|
@@ -3167,7 +3408,7 @@ async function exportSignedPdfDocument(args) {
|
|
|
3167
3408
|
for (let pageNumber = 1; pageNumber <= pdf.numPages; pageNumber += 1) {
|
|
3168
3409
|
const page = await pdf.getPage(pageNumber);
|
|
3169
3410
|
const viewport = page.getViewport({ scale: 2 });
|
|
3170
|
-
const canvas =
|
|
3411
|
+
const canvas = createCanvas2(viewport.width, viewport.height);
|
|
3171
3412
|
const ctx = canvas.getContext("2d");
|
|
3172
3413
|
if (!ctx) {
|
|
3173
3414
|
continue;
|
|
@@ -3219,7 +3460,7 @@ async function exportSignedImageFile(args) {
|
|
|
3219
3460
|
const objectUrl = URL.createObjectURL(imageBlob);
|
|
3220
3461
|
try {
|
|
3221
3462
|
const image = await loadImage(objectUrl);
|
|
3222
|
-
const canvas =
|
|
3463
|
+
const canvas = createCanvas2(image.width, image.height);
|
|
3223
3464
|
const ctx = canvas.getContext("2d");
|
|
3224
3465
|
if (!ctx) {
|
|
3225
3466
|
throw new Error("Unable to render the image document.");
|
|
@@ -3263,7 +3504,7 @@ async function exportSignedRichTextFile(args) {
|
|
|
3263
3504
|
const canvases = [];
|
|
3264
3505
|
for (const page of args.pages) {
|
|
3265
3506
|
const image = await loadImage(page.imageUrl);
|
|
3266
|
-
const canvas2 =
|
|
3507
|
+
const canvas2 = createCanvas2(page.width, page.height);
|
|
3267
3508
|
const ctx2 = canvas2.getContext("2d");
|
|
3268
3509
|
if (!ctx2) {
|
|
3269
3510
|
continue;
|
|
@@ -3620,13 +3861,13 @@ function sanitizeHtml(html) {
|
|
|
3620
3861
|
}
|
|
3621
3862
|
|
|
3622
3863
|
// src/editors/RichTextEditor.tsx
|
|
3623
|
-
import { Fragment, jsx as
|
|
3864
|
+
import { Fragment, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
3624
3865
|
var DOC_PAGE_WIDTH = 816;
|
|
3625
3866
|
var DOC_PAGE_HEIGHT = 1056;
|
|
3626
3867
|
var PAGE_RENDER_SCALE = 2;
|
|
3627
3868
|
var PAGE_BREAK_MIN_FILL = 0.55;
|
|
3628
3869
|
var DOCX_PREVIEW_CLASS_NAME = "hv-docx-page";
|
|
3629
|
-
function
|
|
3870
|
+
function createCanvas3(width, height) {
|
|
3630
3871
|
const canvas = document.createElement("canvas");
|
|
3631
3872
|
canvas.width = Math.max(1, Math.round(width));
|
|
3632
3873
|
canvas.height = Math.max(1, Math.round(height));
|
|
@@ -3711,7 +3952,7 @@ function calculatePageBreakOffsets(container, pageHeight) {
|
|
|
3711
3952
|
function createThumbnailDataUrl(canvas) {
|
|
3712
3953
|
const thumbWidth = 160;
|
|
3713
3954
|
const thumbScale = thumbWidth / canvas.width;
|
|
3714
|
-
const thumbCanvas =
|
|
3955
|
+
const thumbCanvas = createCanvas3(thumbWidth, canvas.height * thumbScale);
|
|
3715
3956
|
const thumbCtx = thumbCanvas.getContext("2d");
|
|
3716
3957
|
if (thumbCtx) {
|
|
3717
3958
|
thumbCtx.fillStyle = "#ffffff";
|
|
@@ -3729,7 +3970,7 @@ function buildPageModels(sourceCanvas, breakOffsets) {
|
|
|
3729
3970
|
for (const [index, endOffset] of breakOffsets.entries()) {
|
|
3730
3971
|
const sourceY = previousOffset * scale;
|
|
3731
3972
|
const sourceHeight = Math.max((endOffset - previousOffset) * scale, 1);
|
|
3732
|
-
const pageCanvas =
|
|
3973
|
+
const pageCanvas = createCanvas3(pageCanvasWidth, pageCanvasHeight);
|
|
3733
3974
|
const pageCtx = pageCanvas.getContext("2d");
|
|
3734
3975
|
if (!pageCtx) {
|
|
3735
3976
|
previousOffset = endOffset;
|
|
@@ -3759,7 +4000,7 @@ function buildPageModels(sourceCanvas, breakOffsets) {
|
|
|
3759
4000
|
previousOffset = endOffset;
|
|
3760
4001
|
}
|
|
3761
4002
|
if (pages.length === 0) {
|
|
3762
|
-
const blankCanvas =
|
|
4003
|
+
const blankCanvas = createCanvas3(
|
|
3763
4004
|
DOC_PAGE_WIDTH * PAGE_RENDER_SCALE,
|
|
3764
4005
|
DOC_PAGE_HEIGHT * PAGE_RENDER_SCALE
|
|
3765
4006
|
);
|
|
@@ -4116,29 +4357,31 @@ function RichTextEditor(props) {
|
|
|
4116
4357
|
const imagePreviewRef = useRef2(null);
|
|
4117
4358
|
const savedSelectionRef = useRef2(null);
|
|
4118
4359
|
const imageDragPointerIdRef = useRef2(null);
|
|
4119
|
-
const [contentHtml, setContentHtml] =
|
|
4120
|
-
const [editableContentHtml, setEditableContentHtml] =
|
|
4121
|
-
const [selectedTemplateId, setSelectedTemplateId] =
|
|
4122
|
-
const [areTemplatesVisible, setAreTemplatesVisible] =
|
|
4123
|
-
const [isCompactToolbar, setIsCompactToolbar] =
|
|
4124
|
-
const [expandedToolbarSections, setExpandedToolbarSections] =
|
|
4360
|
+
const [contentHtml, setContentHtml] = useState3("");
|
|
4361
|
+
const [editableContentHtml, setEditableContentHtml] = useState3("");
|
|
4362
|
+
const [selectedTemplateId, setSelectedTemplateId] = useState3("blank");
|
|
4363
|
+
const [areTemplatesVisible, setAreTemplatesVisible] = useState3(true);
|
|
4364
|
+
const [isCompactToolbar, setIsCompactToolbar] = useState3(false);
|
|
4365
|
+
const [expandedToolbarSections, setExpandedToolbarSections] = useState3(
|
|
4125
4366
|
createCompactToolbarState
|
|
4126
4367
|
);
|
|
4127
|
-
const [imageEditorState, setImageEditorState] =
|
|
4128
|
-
const [toolbarState, setToolbarState] =
|
|
4368
|
+
const [imageEditorState, setImageEditorState] = useState3(null);
|
|
4369
|
+
const [toolbarState, setToolbarState] = useState3(
|
|
4129
4370
|
createDefaultToolbarState()
|
|
4130
4371
|
);
|
|
4131
|
-
const [loading, setLoading] =
|
|
4132
|
-
const [isPaginating, setIsPaginating] =
|
|
4133
|
-
const [pages, setPages] =
|
|
4134
|
-
const [docxPages, setDocxPages] =
|
|
4135
|
-
const [isRenderingDocxPreview, setIsRenderingDocxPreview] =
|
|
4136
|
-
const [docxPreviewFailed, setDocxPreviewFailed] =
|
|
4372
|
+
const [loading, setLoading] = useState3(false);
|
|
4373
|
+
const [isPaginating, setIsPaginating] = useState3(false);
|
|
4374
|
+
const [pages, setPages] = useState3([]);
|
|
4375
|
+
const [docxPages, setDocxPages] = useState3([]);
|
|
4376
|
+
const [isRenderingDocxPreview, setIsRenderingDocxPreview] = useState3(false);
|
|
4377
|
+
const [docxPreviewFailed, setDocxPreviewFailed] = useState3(false);
|
|
4137
4378
|
const mdParser = useRef2(new MarkdownIt({ html: true, linkify: true }));
|
|
4138
4379
|
const authoringTemplates = useMemo2(() => createAuthoringTemplates(), []);
|
|
4139
4380
|
const isAuthoringMode = props.mode === "edit" || props.mode === "create";
|
|
4381
|
+
const isPlainTextFile = props.fileName.toLowerCase().endsWith(".txt") || props.fileType === "txt";
|
|
4140
4382
|
const isDocxFile = props.fileName.toLowerCase().endsWith(".docx") || props.fileType === "docx";
|
|
4141
4383
|
const useDocxPreviewView = props.mode === "view" && isDocxFile && Boolean(props.arrayBuffer);
|
|
4384
|
+
const useContinuousPlainTextView = props.mode === "view" && isPlainTextFile;
|
|
4142
4385
|
const syncTemplateSelection = (nextHtml) => {
|
|
4143
4386
|
const matchedTemplate = authoringTemplates.find(
|
|
4144
4387
|
(template) => template.html === nextHtml
|
|
@@ -4182,7 +4425,7 @@ function RichTextEditor(props) {
|
|
|
4182
4425
|
}
|
|
4183
4426
|
setToolbarState(readToolbarState(editorRef.current, savedSelectionRef.current));
|
|
4184
4427
|
};
|
|
4185
|
-
|
|
4428
|
+
useEffect3(() => {
|
|
4186
4429
|
const loadDoc = async () => {
|
|
4187
4430
|
if (!props.arrayBuffer) {
|
|
4188
4431
|
const templateHtml = props.mode === "create" ? authoringTemplates[0]?.html ?? "" : "";
|
|
@@ -4243,7 +4486,7 @@ function RichTextEditor(props) {
|
|
|
4243
4486
|
props.locale,
|
|
4244
4487
|
props.mode
|
|
4245
4488
|
]);
|
|
4246
|
-
|
|
4489
|
+
useEffect3(() => {
|
|
4247
4490
|
if (!isAuthoringMode || !editorRef.current) {
|
|
4248
4491
|
return;
|
|
4249
4492
|
}
|
|
@@ -4252,7 +4495,7 @@ function RichTextEditor(props) {
|
|
|
4252
4495
|
}
|
|
4253
4496
|
refreshToolbarState();
|
|
4254
4497
|
}, [editableContentHtml, isAuthoringMode]);
|
|
4255
|
-
|
|
4498
|
+
useEffect3(() => {
|
|
4256
4499
|
if (!isAuthoringMode || typeof document === "undefined") {
|
|
4257
4500
|
return;
|
|
4258
4501
|
}
|
|
@@ -4272,12 +4515,12 @@ function RichTextEditor(props) {
|
|
|
4272
4515
|
document.removeEventListener("selectionchange", handleSelectionChange);
|
|
4273
4516
|
};
|
|
4274
4517
|
}, [isAuthoringMode]);
|
|
4275
|
-
|
|
4518
|
+
useEffect3(() => {
|
|
4276
4519
|
if (props.mode === "create") {
|
|
4277
4520
|
setAreTemplatesVisible(true);
|
|
4278
4521
|
}
|
|
4279
4522
|
}, [props.mode, props.fileName]);
|
|
4280
|
-
|
|
4523
|
+
useEffect3(() => {
|
|
4281
4524
|
if (typeof window === "undefined") {
|
|
4282
4525
|
return;
|
|
4283
4526
|
}
|
|
@@ -4294,7 +4537,7 @@ function RichTextEditor(props) {
|
|
|
4294
4537
|
mediaQuery.removeEventListener("change", syncCompactState);
|
|
4295
4538
|
};
|
|
4296
4539
|
}, []);
|
|
4297
|
-
|
|
4540
|
+
useEffect3(() => {
|
|
4298
4541
|
if (toolbarState.hasSelectedImage && toolbarState.imageSrc) {
|
|
4299
4542
|
setImageEditorState({
|
|
4300
4543
|
src: toolbarState.imageSrc,
|
|
@@ -4316,7 +4559,7 @@ function RichTextEditor(props) {
|
|
|
4316
4559
|
toolbarState.imageScale,
|
|
4317
4560
|
toolbarState.imageSrc
|
|
4318
4561
|
]);
|
|
4319
|
-
|
|
4562
|
+
useEffect3(() => {
|
|
4320
4563
|
if (!useDocxPreviewView || !docxPreviewRef.current || !props.arrayBuffer) {
|
|
4321
4564
|
setDocxPages([]);
|
|
4322
4565
|
setDocxPreviewFailed(false);
|
|
@@ -4415,13 +4658,23 @@ function RichTextEditor(props) {
|
|
|
4415
4658
|
props.onThumbs,
|
|
4416
4659
|
useDocxPreviewView
|
|
4417
4660
|
]);
|
|
4418
|
-
|
|
4661
|
+
useEffect3(() => {
|
|
4419
4662
|
if (props.mode !== "view") {
|
|
4420
4663
|
setPages([]);
|
|
4421
4664
|
props.onPageCount(1);
|
|
4422
4665
|
props.onThumbs([]);
|
|
4423
4666
|
return;
|
|
4424
4667
|
}
|
|
4668
|
+
if (useContinuousPlainTextView) {
|
|
4669
|
+
setPages([]);
|
|
4670
|
+
setIsPaginating(false);
|
|
4671
|
+
props.onPageCount(1);
|
|
4672
|
+
props.onThumbs([]);
|
|
4673
|
+
if (props.currentPage !== 1) {
|
|
4674
|
+
props.onCurrentPageChange(1);
|
|
4675
|
+
}
|
|
4676
|
+
return;
|
|
4677
|
+
}
|
|
4425
4678
|
if (useDocxPreviewView && !docxPreviewFailed) {
|
|
4426
4679
|
setPages([]);
|
|
4427
4680
|
return;
|
|
@@ -4490,17 +4743,26 @@ function RichTextEditor(props) {
|
|
|
4490
4743
|
}, [
|
|
4491
4744
|
contentHtml,
|
|
4492
4745
|
docxPreviewFailed,
|
|
4746
|
+
props.currentPage,
|
|
4493
4747
|
props.mode,
|
|
4494
4748
|
props.onCurrentPageChange,
|
|
4495
4749
|
props.onPageCount,
|
|
4496
4750
|
props.onThumbs,
|
|
4751
|
+
useContinuousPlainTextView,
|
|
4497
4752
|
useDocxPreviewView
|
|
4498
4753
|
]);
|
|
4499
4754
|
const activeViewPages = useMemo2(
|
|
4500
|
-
() => props.mode === "view" ? useDocxPreviewView && !docxPreviewFailed ? docxPages : pages : void 0,
|
|
4501
|
-
[
|
|
4755
|
+
() => props.mode === "view" ? useDocxPreviewView && !docxPreviewFailed ? docxPages : useContinuousPlainTextView ? void 0 : pages : void 0,
|
|
4756
|
+
[
|
|
4757
|
+
docxPages,
|
|
4758
|
+
docxPreviewFailed,
|
|
4759
|
+
pages,
|
|
4760
|
+
props.mode,
|
|
4761
|
+
useContinuousPlainTextView,
|
|
4762
|
+
useDocxPreviewView
|
|
4763
|
+
]
|
|
4502
4764
|
);
|
|
4503
|
-
|
|
4765
|
+
useEffect3(() => {
|
|
4504
4766
|
const container = props.mode === "view" ? useDocxPreviewView && !docxPreviewFailed ? docxPreviewRef.current : measureRef.current : editorRef.current;
|
|
4505
4767
|
props.onExportStateChange?.({
|
|
4506
4768
|
container,
|
|
@@ -4516,7 +4778,7 @@ function RichTextEditor(props) {
|
|
|
4516
4778
|
props.onExportStateChange,
|
|
4517
4779
|
useDocxPreviewView
|
|
4518
4780
|
]);
|
|
4519
|
-
|
|
4781
|
+
useEffect3(() => {
|
|
4520
4782
|
return () => {
|
|
4521
4783
|
props.onExportStateChange?.(null);
|
|
4522
4784
|
};
|
|
@@ -4822,7 +5084,7 @@ function RichTextEditor(props) {
|
|
|
4822
5084
|
};
|
|
4823
5085
|
const renderToolbarSectionHeader = (section, label) => {
|
|
4824
5086
|
if (!isCompactToolbar) {
|
|
4825
|
-
return /* @__PURE__ */
|
|
5087
|
+
return /* @__PURE__ */ jsx3("span", { className: "hv-richtext-toolbar-label", children: label });
|
|
4826
5088
|
}
|
|
4827
5089
|
const isOpen = isToolbarSectionOpen(section);
|
|
4828
5090
|
return /* @__PURE__ */ jsxs2(
|
|
@@ -4833,8 +5095,8 @@ function RichTextEditor(props) {
|
|
|
4833
5095
|
"aria-expanded": isOpen,
|
|
4834
5096
|
onClick: () => toggleToolbarSection(section),
|
|
4835
5097
|
children: [
|
|
4836
|
-
/* @__PURE__ */
|
|
4837
|
-
/* @__PURE__ */
|
|
5098
|
+
/* @__PURE__ */ jsx3("span", { className: "hv-richtext-toolbar-label", children: label }),
|
|
5099
|
+
/* @__PURE__ */ jsx3("span", { className: "hv-richtext-toolbar-toggle-copy", children: isOpen ? props.locale["documents.richText.toolbar.collapseSection"] : props.locale["documents.richText.toolbar.expandSection"] })
|
|
4838
5100
|
]
|
|
4839
5101
|
}
|
|
4840
5102
|
);
|
|
@@ -4855,7 +5117,7 @@ function RichTextEditor(props) {
|
|
|
4855
5117
|
};
|
|
4856
5118
|
if (props.mode === "view" && useDocxPreviewView && !docxPreviewFailed) {
|
|
4857
5119
|
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
4858
|
-
/* @__PURE__ */
|
|
5120
|
+
/* @__PURE__ */ jsx3("div", { className: "hv-docx-preview-shell", "aria-hidden": "true", children: /* @__PURE__ */ jsx3(
|
|
4859
5121
|
"div",
|
|
4860
5122
|
{
|
|
4861
5123
|
ref: docxPreviewRef,
|
|
@@ -4863,11 +5125,11 @@ function RichTextEditor(props) {
|
|
|
4863
5125
|
"aria-label": "DOCX document pages"
|
|
4864
5126
|
}
|
|
4865
5127
|
) }),
|
|
4866
|
-
/* @__PURE__ */
|
|
5128
|
+
/* @__PURE__ */ jsx3(
|
|
4867
5129
|
"div",
|
|
4868
5130
|
{
|
|
4869
5131
|
className: props.layout === "side-by-side" ? "hv-view-double" : "hv-view-single",
|
|
4870
|
-
children: loading || isRenderingDocxPreview ? /* @__PURE__ */
|
|
5132
|
+
children: loading || isRenderingDocxPreview ? /* @__PURE__ */ jsx3("div", { className: "hv-page-container hv-docx-page-surface", children: /* @__PURE__ */ jsx3("div", { className: "hv-loading-copy", children: props.locale["documents.richText.renderingPages"] }) }) : pagesToShow.map((pageNumber) => {
|
|
4871
5133
|
const page = docxPages[pageNumber - 1];
|
|
4872
5134
|
if (!page) {
|
|
4873
5135
|
return null;
|
|
@@ -4877,7 +5139,7 @@ function RichTextEditor(props) {
|
|
|
4877
5139
|
{
|
|
4878
5140
|
className: "hv-page-container hv-docx-page-surface",
|
|
4879
5141
|
children: [
|
|
4880
|
-
/* @__PURE__ */
|
|
5142
|
+
/* @__PURE__ */ jsx3(
|
|
4881
5143
|
"img",
|
|
4882
5144
|
{
|
|
4883
5145
|
src: page.imageUrl,
|
|
@@ -4885,7 +5147,7 @@ function RichTextEditor(props) {
|
|
|
4885
5147
|
className: "hv-docx-page-image"
|
|
4886
5148
|
}
|
|
4887
5149
|
),
|
|
4888
|
-
/* @__PURE__ */
|
|
5150
|
+
/* @__PURE__ */ jsx3(
|
|
4889
5151
|
SignatureOverlay,
|
|
4890
5152
|
{
|
|
4891
5153
|
surfaceKey: page.surfaceKey,
|
|
@@ -4930,9 +5192,66 @@ function RichTextEditor(props) {
|
|
|
4930
5192
|
)
|
|
4931
5193
|
] });
|
|
4932
5194
|
}
|
|
5195
|
+
if (props.mode === "view" && useContinuousPlainTextView) {
|
|
5196
|
+
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
5197
|
+
/* @__PURE__ */ jsx3("div", { className: "hv-docx-measure-shell", "aria-hidden": "true", children: /* @__PURE__ */ jsx3(
|
|
5198
|
+
"div",
|
|
5199
|
+
{
|
|
5200
|
+
ref: measureRef,
|
|
5201
|
+
className: "hv-docx-content hv-docx-measure-content hv-text-scroll-content",
|
|
5202
|
+
dangerouslySetInnerHTML: { __html: contentHtml }
|
|
5203
|
+
}
|
|
5204
|
+
) }),
|
|
5205
|
+
/* @__PURE__ */ jsx3("div", { className: "hv-view-single", children: loading ? /* @__PURE__ */ jsx3("div", { className: "hv-page-container hv-text-scroll-surface", children: /* @__PURE__ */ jsx3("div", { className: "hv-loading-copy", children: props.locale["documents.richText.renderingPages"] }) }) : /* @__PURE__ */ jsxs2("div", { className: "hv-page-container hv-text-scroll-surface", children: [
|
|
5206
|
+
/* @__PURE__ */ jsx3(
|
|
5207
|
+
"div",
|
|
5208
|
+
{
|
|
5209
|
+
className: "hv-docx-content hv-text-scroll-content",
|
|
5210
|
+
dangerouslySetInnerHTML: { __html: contentHtml }
|
|
5211
|
+
}
|
|
5212
|
+
),
|
|
5213
|
+
/* @__PURE__ */ jsx3(
|
|
5214
|
+
SignatureOverlay,
|
|
5215
|
+
{
|
|
5216
|
+
surfaceKey: "document:main",
|
|
5217
|
+
surfaceKind: "document",
|
|
5218
|
+
page: 1,
|
|
5219
|
+
placements: props.signatureOverlay.placements,
|
|
5220
|
+
annotations: props.signatureOverlay.annotations,
|
|
5221
|
+
pendingSignature: props.signatureOverlay.pendingSignature,
|
|
5222
|
+
pendingAnnotation: props.signatureOverlay.pendingAnnotation,
|
|
5223
|
+
activePlacementId: props.signatureOverlay.activePlacementId,
|
|
5224
|
+
activeAnnotationId: props.signatureOverlay.activeAnnotationId,
|
|
5225
|
+
placeHint: props.signatureOverlay.placeHint,
|
|
5226
|
+
annotationHint: props.signatureOverlay.annotationHint,
|
|
5227
|
+
annotationPlaceholder: props.signatureOverlay.annotationPlaceholder,
|
|
5228
|
+
signatureAltLabel: props.signatureOverlay.signatureAltLabel,
|
|
5229
|
+
signatureAltByLabel: props.signatureOverlay.signatureAltByLabel,
|
|
5230
|
+
signatureNoteIndicatorLabel: props.signatureOverlay.signatureNoteIndicatorLabel,
|
|
5231
|
+
signatureColorLabel: props.signatureOverlay.signatureColorLabel,
|
|
5232
|
+
signatureColorNames: props.signatureOverlay.signatureColorNames,
|
|
5233
|
+
removeSignatureLabel: props.signatureOverlay.removeSignatureLabel,
|
|
5234
|
+
annotationTitle: props.signatureOverlay.annotationTitle,
|
|
5235
|
+
linkedAnnotationTitle: props.signatureOverlay.linkedAnnotationTitle,
|
|
5236
|
+
linkedAnnotationBadge: props.signatureOverlay.linkedAnnotationBadge,
|
|
5237
|
+
openAnnotationLabel: props.signatureOverlay.openAnnotationLabel,
|
|
5238
|
+
removeAnnotationLabel: props.signatureOverlay.removeAnnotationLabel,
|
|
5239
|
+
onPlaceSignature: props.signatureOverlay.onPlaceSignature,
|
|
5240
|
+
onPlaceAnnotation: props.signatureOverlay.onPlaceAnnotation,
|
|
5241
|
+
onUpdatePlacement: props.signatureOverlay.onUpdatePlacement,
|
|
5242
|
+
onUpdateAnnotation: props.signatureOverlay.onUpdateAnnotation,
|
|
5243
|
+
onRemovePlacement: props.signatureOverlay.onRemovePlacement,
|
|
5244
|
+
onRemoveAnnotation: props.signatureOverlay.onRemoveAnnotation,
|
|
5245
|
+
onSelectPlacement: props.signatureOverlay.onSelectPlacement,
|
|
5246
|
+
onSelectAnnotation: props.signatureOverlay.onSelectAnnotation
|
|
5247
|
+
}
|
|
5248
|
+
)
|
|
5249
|
+
] }) })
|
|
5250
|
+
] });
|
|
5251
|
+
}
|
|
4933
5252
|
if (props.mode === "view") {
|
|
4934
5253
|
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
4935
|
-
/* @__PURE__ */
|
|
5254
|
+
/* @__PURE__ */ jsx3("div", { className: "hv-docx-measure-shell", "aria-hidden": "true", children: /* @__PURE__ */ jsx3(
|
|
4936
5255
|
"div",
|
|
4937
5256
|
{
|
|
4938
5257
|
ref: measureRef,
|
|
@@ -4940,11 +5259,11 @@ function RichTextEditor(props) {
|
|
|
4940
5259
|
dangerouslySetInnerHTML: { __html: contentHtml }
|
|
4941
5260
|
}
|
|
4942
5261
|
) }),
|
|
4943
|
-
/* @__PURE__ */
|
|
5262
|
+
/* @__PURE__ */ jsx3(
|
|
4944
5263
|
"div",
|
|
4945
5264
|
{
|
|
4946
5265
|
className: props.layout === "side-by-side" ? "hv-view-double" : "hv-view-single",
|
|
4947
|
-
children: loading || isPaginating ? /* @__PURE__ */
|
|
5266
|
+
children: loading || isPaginating ? /* @__PURE__ */ jsx3("div", { className: "hv-page-container hv-docx-page-surface", children: /* @__PURE__ */ jsx3("div", { className: "hv-loading-copy", children: props.locale["documents.richText.renderingPages"] }) }) : pagesToShow.map((pageNumber) => {
|
|
4948
5267
|
const page = pages[pageNumber - 1];
|
|
4949
5268
|
if (!page) {
|
|
4950
5269
|
return null;
|
|
@@ -4954,7 +5273,7 @@ function RichTextEditor(props) {
|
|
|
4954
5273
|
{
|
|
4955
5274
|
className: "hv-page-container hv-docx-page-surface",
|
|
4956
5275
|
children: [
|
|
4957
|
-
/* @__PURE__ */
|
|
5276
|
+
/* @__PURE__ */ jsx3(
|
|
4958
5277
|
"img",
|
|
4959
5278
|
{
|
|
4960
5279
|
src: page.imageUrl,
|
|
@@ -4962,7 +5281,7 @@ function RichTextEditor(props) {
|
|
|
4962
5281
|
className: "hv-docx-page-image"
|
|
4963
5282
|
}
|
|
4964
5283
|
),
|
|
4965
|
-
/* @__PURE__ */
|
|
5284
|
+
/* @__PURE__ */ jsx3(
|
|
4966
5285
|
SignatureOverlay,
|
|
4967
5286
|
{
|
|
4968
5287
|
surfaceKey: page.surfaceKey,
|
|
@@ -5008,7 +5327,7 @@ function RichTextEditor(props) {
|
|
|
5008
5327
|
] });
|
|
5009
5328
|
}
|
|
5010
5329
|
return /* @__PURE__ */ jsxs2("div", { className: "hv-view-single hv-richtext-authoring-shell", children: [
|
|
5011
|
-
/* @__PURE__ */
|
|
5330
|
+
/* @__PURE__ */ jsx3(
|
|
5012
5331
|
"input",
|
|
5013
5332
|
{
|
|
5014
5333
|
ref: imageInputRef,
|
|
@@ -5018,7 +5337,7 @@ function RichTextEditor(props) {
|
|
|
5018
5337
|
onChange: handleInsertImage
|
|
5019
5338
|
}
|
|
5020
5339
|
),
|
|
5021
|
-
isAuthoringMode && /* @__PURE__ */
|
|
5340
|
+
isAuthoringMode && /* @__PURE__ */ jsx3("div", { className: "hv-richtext-authoring-top", children: /* @__PURE__ */ jsxs2(
|
|
5022
5341
|
"div",
|
|
5023
5342
|
{
|
|
5024
5343
|
className: "hv-richtext-toolbar",
|
|
@@ -5041,11 +5360,11 @@ function RichTextEditor(props) {
|
|
|
5041
5360
|
event.target.value === "blockquote" ? "BLOCKQUOTE" : event.target.value.toUpperCase()
|
|
5042
5361
|
),
|
|
5043
5362
|
children: [
|
|
5044
|
-
/* @__PURE__ */
|
|
5045
|
-
/* @__PURE__ */
|
|
5046
|
-
/* @__PURE__ */
|
|
5047
|
-
/* @__PURE__ */
|
|
5048
|
-
/* @__PURE__ */
|
|
5363
|
+
/* @__PURE__ */ jsx3("option", { value: "p", children: props.locale["documents.richText.toolbar.paragraph"] }),
|
|
5364
|
+
/* @__PURE__ */ jsx3("option", { value: "h1", children: props.locale["documents.richText.toolbar.heading1"] }),
|
|
5365
|
+
/* @__PURE__ */ jsx3("option", { value: "h2", children: props.locale["documents.richText.toolbar.heading2"] }),
|
|
5366
|
+
/* @__PURE__ */ jsx3("option", { value: "h3", children: props.locale["documents.richText.toolbar.heading3"] }),
|
|
5367
|
+
/* @__PURE__ */ jsx3("option", { value: "blockquote", children: props.locale["documents.richText.toolbar.quote"] })
|
|
5049
5368
|
]
|
|
5050
5369
|
}
|
|
5051
5370
|
)
|
|
@@ -5056,7 +5375,7 @@ function RichTextEditor(props) {
|
|
|
5056
5375
|
props.locale["documents.richText.toolbar.formatLabel"]
|
|
5057
5376
|
),
|
|
5058
5377
|
isToolbarSectionOpen("format") && /* @__PURE__ */ jsxs2("div", { className: "hv-richtext-button-group", children: [
|
|
5059
|
-
/* @__PURE__ */
|
|
5378
|
+
/* @__PURE__ */ jsx3(
|
|
5060
5379
|
"button",
|
|
5061
5380
|
{
|
|
5062
5381
|
type: "button",
|
|
@@ -5066,7 +5385,7 @@ function RichTextEditor(props) {
|
|
|
5066
5385
|
children: "B"
|
|
5067
5386
|
}
|
|
5068
5387
|
),
|
|
5069
|
-
/* @__PURE__ */
|
|
5388
|
+
/* @__PURE__ */ jsx3(
|
|
5070
5389
|
"button",
|
|
5071
5390
|
{
|
|
5072
5391
|
type: "button",
|
|
@@ -5076,7 +5395,7 @@ function RichTextEditor(props) {
|
|
|
5076
5395
|
children: "I"
|
|
5077
5396
|
}
|
|
5078
5397
|
),
|
|
5079
|
-
/* @__PURE__ */
|
|
5398
|
+
/* @__PURE__ */ jsx3(
|
|
5080
5399
|
"button",
|
|
5081
5400
|
{
|
|
5082
5401
|
type: "button",
|
|
@@ -5086,7 +5405,7 @@ function RichTextEditor(props) {
|
|
|
5086
5405
|
children: "U"
|
|
5087
5406
|
}
|
|
5088
5407
|
),
|
|
5089
|
-
/* @__PURE__ */
|
|
5408
|
+
/* @__PURE__ */ jsx3(
|
|
5090
5409
|
"button",
|
|
5091
5410
|
{
|
|
5092
5411
|
type: "button",
|
|
@@ -5096,7 +5415,7 @@ function RichTextEditor(props) {
|
|
|
5096
5415
|
children: "UL"
|
|
5097
5416
|
}
|
|
5098
5417
|
),
|
|
5099
|
-
/* @__PURE__ */
|
|
5418
|
+
/* @__PURE__ */ jsx3(
|
|
5100
5419
|
"button",
|
|
5101
5420
|
{
|
|
5102
5421
|
type: "button",
|
|
@@ -5106,7 +5425,7 @@ function RichTextEditor(props) {
|
|
|
5106
5425
|
children: "1."
|
|
5107
5426
|
}
|
|
5108
5427
|
),
|
|
5109
|
-
/* @__PURE__ */
|
|
5428
|
+
/* @__PURE__ */ jsx3(
|
|
5110
5429
|
"button",
|
|
5111
5430
|
{
|
|
5112
5431
|
type: "button",
|
|
@@ -5116,7 +5435,7 @@ function RichTextEditor(props) {
|
|
|
5116
5435
|
children: "L"
|
|
5117
5436
|
}
|
|
5118
5437
|
),
|
|
5119
|
-
/* @__PURE__ */
|
|
5438
|
+
/* @__PURE__ */ jsx3(
|
|
5120
5439
|
"button",
|
|
5121
5440
|
{
|
|
5122
5441
|
type: "button",
|
|
@@ -5126,7 +5445,7 @@ function RichTextEditor(props) {
|
|
|
5126
5445
|
children: "C"
|
|
5127
5446
|
}
|
|
5128
5447
|
),
|
|
5129
|
-
/* @__PURE__ */
|
|
5448
|
+
/* @__PURE__ */ jsx3(
|
|
5130
5449
|
"button",
|
|
5131
5450
|
{
|
|
5132
5451
|
type: "button",
|
|
@@ -5136,7 +5455,7 @@ function RichTextEditor(props) {
|
|
|
5136
5455
|
children: "R"
|
|
5137
5456
|
}
|
|
5138
5457
|
),
|
|
5139
|
-
/* @__PURE__ */
|
|
5458
|
+
/* @__PURE__ */ jsx3(
|
|
5140
5459
|
"button",
|
|
5141
5460
|
{
|
|
5142
5461
|
type: "button",
|
|
@@ -5154,7 +5473,7 @@ function RichTextEditor(props) {
|
|
|
5154
5473
|
props.locale["documents.richText.toolbar.insertLabel"]
|
|
5155
5474
|
),
|
|
5156
5475
|
isToolbarSectionOpen("insert") && /* @__PURE__ */ jsxs2("div", { className: "hv-richtext-button-group", children: [
|
|
5157
|
-
/* @__PURE__ */
|
|
5476
|
+
/* @__PURE__ */ jsx3(
|
|
5158
5477
|
"button",
|
|
5159
5478
|
{
|
|
5160
5479
|
type: "button",
|
|
@@ -5164,7 +5483,7 @@ function RichTextEditor(props) {
|
|
|
5164
5483
|
children: "Link"
|
|
5165
5484
|
}
|
|
5166
5485
|
),
|
|
5167
|
-
/* @__PURE__ */
|
|
5486
|
+
/* @__PURE__ */ jsx3(
|
|
5168
5487
|
"button",
|
|
5169
5488
|
{
|
|
5170
5489
|
type: "button",
|
|
@@ -5182,7 +5501,7 @@ function RichTextEditor(props) {
|
|
|
5182
5501
|
props.locale["documents.richText.toolbar.mediaLabel"]
|
|
5183
5502
|
),
|
|
5184
5503
|
isToolbarSectionOpen("media") && /* @__PURE__ */ jsxs2("div", { className: "hv-richtext-button-group", children: [
|
|
5185
|
-
/* @__PURE__ */
|
|
5504
|
+
/* @__PURE__ */ jsx3(
|
|
5186
5505
|
"button",
|
|
5187
5506
|
{
|
|
5188
5507
|
type: "button",
|
|
@@ -5192,7 +5511,7 @@ function RichTextEditor(props) {
|
|
|
5192
5511
|
children: "Image"
|
|
5193
5512
|
}
|
|
5194
5513
|
),
|
|
5195
|
-
/* @__PURE__ */
|
|
5514
|
+
/* @__PURE__ */ jsx3(
|
|
5196
5515
|
"button",
|
|
5197
5516
|
{
|
|
5198
5517
|
type: "button",
|
|
@@ -5210,7 +5529,7 @@ function RichTextEditor(props) {
|
|
|
5210
5529
|
props.locale["documents.richText.toolbar.historyLabel"]
|
|
5211
5530
|
),
|
|
5212
5531
|
isToolbarSectionOpen("history") && /* @__PURE__ */ jsxs2("div", { className: "hv-richtext-button-group", children: [
|
|
5213
|
-
/* @__PURE__ */
|
|
5532
|
+
/* @__PURE__ */ jsx3(
|
|
5214
5533
|
"button",
|
|
5215
5534
|
{
|
|
5216
5535
|
type: "button",
|
|
@@ -5220,7 +5539,7 @@ function RichTextEditor(props) {
|
|
|
5220
5539
|
children: "Undo"
|
|
5221
5540
|
}
|
|
5222
5541
|
),
|
|
5223
|
-
/* @__PURE__ */
|
|
5542
|
+
/* @__PURE__ */ jsx3(
|
|
5224
5543
|
"button",
|
|
5225
5544
|
{
|
|
5226
5545
|
type: "button",
|
|
@@ -5234,12 +5553,12 @@ function RichTextEditor(props) {
|
|
|
5234
5553
|
] })
|
|
5235
5554
|
] }),
|
|
5236
5555
|
toolbarState.hasSelectedImage && imageEditorState && /* @__PURE__ */ jsxs2("div", { className: "hv-richtext-context-panel", children: [
|
|
5237
|
-
/* @__PURE__ */
|
|
5238
|
-
/* @__PURE__ */
|
|
5239
|
-
/* @__PURE__ */
|
|
5556
|
+
/* @__PURE__ */ jsx3("div", { className: "hv-richtext-context-header", children: /* @__PURE__ */ jsxs2("div", { children: [
|
|
5557
|
+
/* @__PURE__ */ jsx3("strong", { children: props.locale["documents.richText.imageEditorTitle"] }),
|
|
5558
|
+
/* @__PURE__ */ jsx3("p", { children: props.locale["documents.richText.imageEditorHelp"] })
|
|
5240
5559
|
] }) }),
|
|
5241
5560
|
/* @__PURE__ */ jsxs2("div", { className: "hv-richtext-image-editor", children: [
|
|
5242
|
-
/* @__PURE__ */
|
|
5561
|
+
/* @__PURE__ */ jsx3("div", { className: "hv-richtext-image-preview-card", children: /* @__PURE__ */ jsxs2(
|
|
5243
5562
|
"div",
|
|
5244
5563
|
{
|
|
5245
5564
|
ref: imagePreviewRef,
|
|
@@ -5249,7 +5568,7 @@ function RichTextEditor(props) {
|
|
|
5249
5568
|
onPointerUp: handleImagePreviewPointerUp,
|
|
5250
5569
|
onPointerCancel: handleImagePreviewPointerUp,
|
|
5251
5570
|
children: [
|
|
5252
|
-
/* @__PURE__ */
|
|
5571
|
+
/* @__PURE__ */ jsx3(
|
|
5253
5572
|
"img",
|
|
5254
5573
|
{
|
|
5255
5574
|
src: imageEditorState.src,
|
|
@@ -5260,7 +5579,7 @@ function RichTextEditor(props) {
|
|
|
5260
5579
|
}
|
|
5261
5580
|
}
|
|
5262
5581
|
),
|
|
5263
|
-
/* @__PURE__ */
|
|
5582
|
+
/* @__PURE__ */ jsx3(
|
|
5264
5583
|
"div",
|
|
5265
5584
|
{
|
|
5266
5585
|
className: "hv-richtext-image-focus-point",
|
|
@@ -5275,9 +5594,9 @@ function RichTextEditor(props) {
|
|
|
5275
5594
|
) }),
|
|
5276
5595
|
/* @__PURE__ */ jsxs2("div", { className: "hv-richtext-image-controls", children: [
|
|
5277
5596
|
/* @__PURE__ */ jsxs2("div", { className: "hv-richtext-toolbar-subgroup", children: [
|
|
5278
|
-
/* @__PURE__ */
|
|
5597
|
+
/* @__PURE__ */ jsx3("span", { className: "hv-richtext-toolbar-sublabel", children: props.locale["documents.richText.toolbar.imageSizeLabel"] }),
|
|
5279
5598
|
/* @__PURE__ */ jsxs2("div", { className: "hv-richtext-button-group", children: [
|
|
5280
|
-
/* @__PURE__ */
|
|
5599
|
+
/* @__PURE__ */ jsx3(
|
|
5281
5600
|
"button",
|
|
5282
5601
|
{
|
|
5283
5602
|
type: "button",
|
|
@@ -5286,7 +5605,7 @@ function RichTextEditor(props) {
|
|
|
5286
5605
|
children: "S"
|
|
5287
5606
|
}
|
|
5288
5607
|
),
|
|
5289
|
-
/* @__PURE__ */
|
|
5608
|
+
/* @__PURE__ */ jsx3(
|
|
5290
5609
|
"button",
|
|
5291
5610
|
{
|
|
5292
5611
|
type: "button",
|
|
@@ -5295,7 +5614,7 @@ function RichTextEditor(props) {
|
|
|
5295
5614
|
children: "M"
|
|
5296
5615
|
}
|
|
5297
5616
|
),
|
|
5298
|
-
/* @__PURE__ */
|
|
5617
|
+
/* @__PURE__ */ jsx3(
|
|
5299
5618
|
"button",
|
|
5300
5619
|
{
|
|
5301
5620
|
type: "button",
|
|
@@ -5304,7 +5623,7 @@ function RichTextEditor(props) {
|
|
|
5304
5623
|
children: "L"
|
|
5305
5624
|
}
|
|
5306
5625
|
),
|
|
5307
|
-
/* @__PURE__ */
|
|
5626
|
+
/* @__PURE__ */ jsx3(
|
|
5308
5627
|
"button",
|
|
5309
5628
|
{
|
|
5310
5629
|
type: "button",
|
|
@@ -5316,9 +5635,9 @@ function RichTextEditor(props) {
|
|
|
5316
5635
|
] })
|
|
5317
5636
|
] }),
|
|
5318
5637
|
/* @__PURE__ */ jsxs2("div", { className: "hv-richtext-toolbar-subgroup", children: [
|
|
5319
|
-
/* @__PURE__ */
|
|
5638
|
+
/* @__PURE__ */ jsx3("span", { className: "hv-richtext-toolbar-sublabel", children: props.locale["documents.richText.toolbar.imageCropLabel"] }),
|
|
5320
5639
|
/* @__PURE__ */ jsxs2("div", { className: "hv-richtext-button-group", children: [
|
|
5321
|
-
/* @__PURE__ */
|
|
5640
|
+
/* @__PURE__ */ jsx3(
|
|
5322
5641
|
"button",
|
|
5323
5642
|
{
|
|
5324
5643
|
type: "button",
|
|
@@ -5327,7 +5646,7 @@ function RichTextEditor(props) {
|
|
|
5327
5646
|
children: "Orig"
|
|
5328
5647
|
}
|
|
5329
5648
|
),
|
|
5330
|
-
/* @__PURE__ */
|
|
5649
|
+
/* @__PURE__ */ jsx3(
|
|
5331
5650
|
"button",
|
|
5332
5651
|
{
|
|
5333
5652
|
type: "button",
|
|
@@ -5336,7 +5655,7 @@ function RichTextEditor(props) {
|
|
|
5336
5655
|
children: "Wide"
|
|
5337
5656
|
}
|
|
5338
5657
|
),
|
|
5339
|
-
/* @__PURE__ */
|
|
5658
|
+
/* @__PURE__ */ jsx3(
|
|
5340
5659
|
"button",
|
|
5341
5660
|
{
|
|
5342
5661
|
type: "button",
|
|
@@ -5345,7 +5664,7 @@ function RichTextEditor(props) {
|
|
|
5345
5664
|
children: "1:1"
|
|
5346
5665
|
}
|
|
5347
5666
|
),
|
|
5348
|
-
/* @__PURE__ */
|
|
5667
|
+
/* @__PURE__ */ jsx3(
|
|
5349
5668
|
"button",
|
|
5350
5669
|
{
|
|
5351
5670
|
type: "button",
|
|
@@ -5357,9 +5676,9 @@ function RichTextEditor(props) {
|
|
|
5357
5676
|
] })
|
|
5358
5677
|
] }),
|
|
5359
5678
|
/* @__PURE__ */ jsxs2("div", { className: "hv-richtext-toolbar-subgroup", children: [
|
|
5360
|
-
/* @__PURE__ */
|
|
5679
|
+
/* @__PURE__ */ jsx3("span", { className: "hv-richtext-toolbar-sublabel", children: props.locale["documents.richText.toolbar.imageAlignLabel"] }),
|
|
5361
5680
|
/* @__PURE__ */ jsxs2("div", { className: "hv-richtext-button-group", children: [
|
|
5362
|
-
/* @__PURE__ */
|
|
5681
|
+
/* @__PURE__ */ jsx3(
|
|
5363
5682
|
"button",
|
|
5364
5683
|
{
|
|
5365
5684
|
type: "button",
|
|
@@ -5368,7 +5687,7 @@ function RichTextEditor(props) {
|
|
|
5368
5687
|
children: "Left"
|
|
5369
5688
|
}
|
|
5370
5689
|
),
|
|
5371
|
-
/* @__PURE__ */
|
|
5690
|
+
/* @__PURE__ */ jsx3(
|
|
5372
5691
|
"button",
|
|
5373
5692
|
{
|
|
5374
5693
|
type: "button",
|
|
@@ -5377,7 +5696,7 @@ function RichTextEditor(props) {
|
|
|
5377
5696
|
children: "Center"
|
|
5378
5697
|
}
|
|
5379
5698
|
),
|
|
5380
|
-
/* @__PURE__ */
|
|
5699
|
+
/* @__PURE__ */ jsx3(
|
|
5381
5700
|
"button",
|
|
5382
5701
|
{
|
|
5383
5702
|
type: "button",
|
|
@@ -5389,8 +5708,8 @@ function RichTextEditor(props) {
|
|
|
5389
5708
|
] })
|
|
5390
5709
|
] }),
|
|
5391
5710
|
/* @__PURE__ */ jsxs2("label", { className: "hv-richtext-range-group", children: [
|
|
5392
|
-
/* @__PURE__ */
|
|
5393
|
-
/* @__PURE__ */
|
|
5711
|
+
/* @__PURE__ */ jsx3("span", { children: props.locale["documents.richText.imageZoom"] }),
|
|
5712
|
+
/* @__PURE__ */ jsx3(
|
|
5394
5713
|
"input",
|
|
5395
5714
|
{
|
|
5396
5715
|
type: "range",
|
|
@@ -5433,10 +5752,10 @@ function RichTextEditor(props) {
|
|
|
5433
5752
|
] })
|
|
5434
5753
|
] })
|
|
5435
5754
|
] }),
|
|
5436
|
-
!toolbarState.hasSelectedImage && toolbarState.insideTable && /* @__PURE__ */
|
|
5437
|
-
/* @__PURE__ */
|
|
5755
|
+
!toolbarState.hasSelectedImage && toolbarState.insideTable && /* @__PURE__ */ jsx3("div", { className: "hv-richtext-context-panel hv-richtext-context-panel-compact", children: /* @__PURE__ */ jsxs2("div", { className: "hv-richtext-toolbar-subgroup", children: [
|
|
5756
|
+
/* @__PURE__ */ jsx3("span", { className: "hv-richtext-toolbar-sublabel", children: props.locale["documents.richText.toolbar.tableLabel"] }),
|
|
5438
5757
|
/* @__PURE__ */ jsxs2("div", { className: "hv-richtext-button-group", children: [
|
|
5439
|
-
/* @__PURE__ */
|
|
5758
|
+
/* @__PURE__ */ jsx3(
|
|
5440
5759
|
"button",
|
|
5441
5760
|
{
|
|
5442
5761
|
type: "button",
|
|
@@ -5446,7 +5765,7 @@ function RichTextEditor(props) {
|
|
|
5446
5765
|
children: "+Row"
|
|
5447
5766
|
}
|
|
5448
5767
|
),
|
|
5449
|
-
/* @__PURE__ */
|
|
5768
|
+
/* @__PURE__ */ jsx3(
|
|
5450
5769
|
"button",
|
|
5451
5770
|
{
|
|
5452
5771
|
type: "button",
|
|
@@ -5456,7 +5775,7 @@ function RichTextEditor(props) {
|
|
|
5456
5775
|
children: "+Col"
|
|
5457
5776
|
}
|
|
5458
5777
|
),
|
|
5459
|
-
/* @__PURE__ */
|
|
5778
|
+
/* @__PURE__ */ jsx3(
|
|
5460
5779
|
"button",
|
|
5461
5780
|
{
|
|
5462
5781
|
type: "button",
|
|
@@ -5466,7 +5785,7 @@ function RichTextEditor(props) {
|
|
|
5466
5785
|
children: "-Row"
|
|
5467
5786
|
}
|
|
5468
5787
|
),
|
|
5469
|
-
/* @__PURE__ */
|
|
5788
|
+
/* @__PURE__ */ jsx3(
|
|
5470
5789
|
"button",
|
|
5471
5790
|
{
|
|
5472
5791
|
type: "button",
|
|
@@ -5480,8 +5799,8 @@ function RichTextEditor(props) {
|
|
|
5480
5799
|
] }) }),
|
|
5481
5800
|
props.mode === "create" && /* @__PURE__ */ jsxs2("div", { className: "hv-richtext-template-panel", children: [
|
|
5482
5801
|
/* @__PURE__ */ jsxs2("div", { className: "hv-richtext-template-strip", children: [
|
|
5483
|
-
/* @__PURE__ */
|
|
5484
|
-
/* @__PURE__ */
|
|
5802
|
+
/* @__PURE__ */ jsx3("span", { className: "hv-richtext-template-label", children: props.locale["documents.richText.templates"] }),
|
|
5803
|
+
/* @__PURE__ */ jsx3(
|
|
5485
5804
|
"button",
|
|
5486
5805
|
{
|
|
5487
5806
|
type: "button",
|
|
@@ -5491,15 +5810,15 @@ function RichTextEditor(props) {
|
|
|
5491
5810
|
}
|
|
5492
5811
|
)
|
|
5493
5812
|
] }),
|
|
5494
|
-
areTemplatesVisible && /* @__PURE__ */
|
|
5813
|
+
areTemplatesVisible && /* @__PURE__ */ jsx3("div", { className: "hv-richtext-template-grid", children: authoringTemplates.map((template) => /* @__PURE__ */ jsxs2(
|
|
5495
5814
|
"button",
|
|
5496
5815
|
{
|
|
5497
5816
|
type: "button",
|
|
5498
5817
|
className: `hv-richtext-template-card ${selectedTemplateId === template.id ? "active" : ""}`,
|
|
5499
5818
|
onClick: () => applyTemplate(template.id),
|
|
5500
5819
|
children: [
|
|
5501
|
-
/* @__PURE__ */
|
|
5502
|
-
/* @__PURE__ */
|
|
5820
|
+
/* @__PURE__ */ jsx3("span", { className: "hv-richtext-template-title", children: props.locale[template.labelKey] }),
|
|
5821
|
+
/* @__PURE__ */ jsx3("span", { className: "hv-richtext-template-description", children: props.locale[template.descriptionKey] })
|
|
5503
5822
|
]
|
|
5504
5823
|
},
|
|
5505
5824
|
template.id
|
|
@@ -5508,8 +5827,8 @@ function RichTextEditor(props) {
|
|
|
5508
5827
|
]
|
|
5509
5828
|
}
|
|
5510
5829
|
) }),
|
|
5511
|
-
/* @__PURE__ */
|
|
5512
|
-
/* @__PURE__ */
|
|
5830
|
+
/* @__PURE__ */ jsx3("div", { className: "hv-page-container hv-docx-page-surface", children: loading ? /* @__PURE__ */ jsx3("div", { className: "hv-loading-copy", children: props.locale["documents.richText.processingText"] }) : /* @__PURE__ */ jsxs2("div", { className: "hv-docx-editor-stage", children: [
|
|
5831
|
+
/* @__PURE__ */ jsx3(
|
|
5513
5832
|
"div",
|
|
5514
5833
|
{
|
|
5515
5834
|
ref: editorRef,
|
|
@@ -5533,7 +5852,7 @@ function RichTextEditor(props) {
|
|
|
5533
5852
|
"aria-label": props.locale["a11y.editor"]
|
|
5534
5853
|
}
|
|
5535
5854
|
),
|
|
5536
|
-
/* @__PURE__ */
|
|
5855
|
+
/* @__PURE__ */ jsx3(
|
|
5537
5856
|
SignatureOverlay,
|
|
5538
5857
|
{
|
|
5539
5858
|
surfaceKey: "document:main",
|
|
@@ -5574,9 +5893,9 @@ function RichTextEditor(props) {
|
|
|
5574
5893
|
|
|
5575
5894
|
// src/editors/SpreadsheetEditor.tsx
|
|
5576
5895
|
import ExcelJS2 from "exceljs";
|
|
5577
|
-
import { useEffect as
|
|
5896
|
+
import { useEffect as useEffect4, useMemo as useMemo3, useState as useState4 } from "react";
|
|
5578
5897
|
import * as XLSX2 from "xlsx";
|
|
5579
|
-
import { jsx as
|
|
5898
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
5580
5899
|
var MAX_RENDER_ROWS = 400;
|
|
5581
5900
|
var MAX_RENDER_COLS = 120;
|
|
5582
5901
|
function toColumnLabel2(index) {
|
|
@@ -6160,11 +6479,11 @@ async function buildSheetModels(arrayBuffer, fileName) {
|
|
|
6160
6479
|
}
|
|
6161
6480
|
function SpreadsheetEditor(props) {
|
|
6162
6481
|
const readonly = props.mode === "view";
|
|
6163
|
-
const [sheets, setSheets] =
|
|
6164
|
-
const [activeCell, setActiveCell] =
|
|
6165
|
-
const [hasEdits, setHasEdits] =
|
|
6166
|
-
const [dirtyCellAddressesBySheet, setDirtyCellAddressesBySheet] =
|
|
6167
|
-
|
|
6482
|
+
const [sheets, setSheets] = useState4([]);
|
|
6483
|
+
const [activeCell, setActiveCell] = useState4({ row: 0, col: 0 });
|
|
6484
|
+
const [hasEdits, setHasEdits] = useState4(false);
|
|
6485
|
+
const [dirtyCellAddressesBySheet, setDirtyCellAddressesBySheet] = useState4({});
|
|
6486
|
+
useEffect4(() => {
|
|
6168
6487
|
if (!props.arrayBuffer) {
|
|
6169
6488
|
const nextSheets = props.mode === "create" ? [createBlankSheetModel("Sheet1")] : [];
|
|
6170
6489
|
setSheets(nextSheets);
|
|
@@ -6214,7 +6533,7 @@ function SpreadsheetEditor(props) {
|
|
|
6214
6533
|
props.onThumbs,
|
|
6215
6534
|
props.mode
|
|
6216
6535
|
]);
|
|
6217
|
-
|
|
6536
|
+
useEffect4(() => {
|
|
6218
6537
|
props.onExportStateChange?.(
|
|
6219
6538
|
sheets.length > 0 ? {
|
|
6220
6539
|
sheets,
|
|
@@ -6317,12 +6636,12 @@ function SpreadsheetEditor(props) {
|
|
|
6317
6636
|
);
|
|
6318
6637
|
};
|
|
6319
6638
|
if (!activeSheet) {
|
|
6320
|
-
return /* @__PURE__ */
|
|
6639
|
+
return /* @__PURE__ */ jsx4("div", { className: "hv-view-single", children: /* @__PURE__ */ jsx4("div", { className: "hv-page-container", style: { padding: "48px" }, children: /* @__PURE__ */ jsx4("p", { className: "hv-empty-state", children: props.locale["documents.sheetMissing"] }) }) });
|
|
6321
6640
|
}
|
|
6322
6641
|
const isTruncated = activeSheet.rowCount > activeSheet.renderedRowCount || activeSheet.colCount > activeSheet.renderedColCount;
|
|
6323
|
-
return /* @__PURE__ */
|
|
6642
|
+
return /* @__PURE__ */ jsx4("div", { className: "hv-view-single", children: /* @__PURE__ */ jsxs3("div", { className: "hv-page-container hv-sheet-container", children: [
|
|
6324
6643
|
/* @__PURE__ */ jsxs3("div", { className: "hv-sheet-tabs", children: [
|
|
6325
|
-
/* @__PURE__ */
|
|
6644
|
+
/* @__PURE__ */ jsx4("div", { className: "hv-sheet-tab-list", children: sheets.map((sheet, index) => /* @__PURE__ */ jsx4(
|
|
6326
6645
|
"button",
|
|
6327
6646
|
{
|
|
6328
6647
|
type: "button",
|
|
@@ -6336,7 +6655,7 @@ function SpreadsheetEditor(props) {
|
|
|
6336
6655
|
sheet.name
|
|
6337
6656
|
)) }),
|
|
6338
6657
|
!readonly && /* @__PURE__ */ jsxs3("div", { className: "hv-sheet-actions", children: [
|
|
6339
|
-
/* @__PURE__ */
|
|
6658
|
+
/* @__PURE__ */ jsx4(
|
|
6340
6659
|
"button",
|
|
6341
6660
|
{
|
|
6342
6661
|
type: "button",
|
|
@@ -6345,7 +6664,7 @@ function SpreadsheetEditor(props) {
|
|
|
6345
6664
|
children: props.locale["documents.sheetAddSheet"]
|
|
6346
6665
|
}
|
|
6347
6666
|
),
|
|
6348
|
-
/* @__PURE__ */
|
|
6667
|
+
/* @__PURE__ */ jsx4(
|
|
6349
6668
|
"button",
|
|
6350
6669
|
{
|
|
6351
6670
|
type: "button",
|
|
@@ -6354,7 +6673,7 @@ function SpreadsheetEditor(props) {
|
|
|
6354
6673
|
children: props.locale["documents.sheetAddRow"]
|
|
6355
6674
|
}
|
|
6356
6675
|
),
|
|
6357
|
-
/* @__PURE__ */
|
|
6676
|
+
/* @__PURE__ */ jsx4(
|
|
6358
6677
|
"button",
|
|
6359
6678
|
{
|
|
6360
6679
|
type: "button",
|
|
@@ -6370,7 +6689,7 @@ function SpreadsheetEditor(props) {
|
|
|
6370
6689
|
toColumnLabel2(activeCell.col),
|
|
6371
6690
|
activeCell.row + 1
|
|
6372
6691
|
] }),
|
|
6373
|
-
/* @__PURE__ */
|
|
6692
|
+
/* @__PURE__ */ jsx4(
|
|
6374
6693
|
"input",
|
|
6375
6694
|
{
|
|
6376
6695
|
value: activeCellValue,
|
|
@@ -6380,14 +6699,14 @@ function SpreadsheetEditor(props) {
|
|
|
6380
6699
|
}
|
|
6381
6700
|
)
|
|
6382
6701
|
] }),
|
|
6383
|
-
isTruncated && /* @__PURE__ */
|
|
6384
|
-
/* @__PURE__ */
|
|
6702
|
+
isTruncated && /* @__PURE__ */ jsx4("div", { className: "hv-sheet-viewport-note", children: props.locale["documents.sheetTruncated"].replace("{rows}", String(activeSheet.renderedRowCount)).replace("{cols}", String(activeSheet.renderedColCount)) }),
|
|
6703
|
+
/* @__PURE__ */ jsx4("div", { className: "hv-sheet-scroll", children: /* @__PURE__ */ jsxs3("div", { className: "hv-sheet-surface", children: [
|
|
6385
6704
|
/* @__PURE__ */ jsxs3("table", { className: "hv-sheet-table", children: [
|
|
6386
|
-
/* @__PURE__ */
|
|
6387
|
-
/* @__PURE__ */
|
|
6705
|
+
/* @__PURE__ */ jsx4("thead", { children: /* @__PURE__ */ jsxs3("tr", { children: [
|
|
6706
|
+
/* @__PURE__ */ jsx4("th", { className: "hv-sheet-corner" }),
|
|
6388
6707
|
Array.from(
|
|
6389
6708
|
{ length: activeSheet.renderedColCount },
|
|
6390
|
-
(_, colIndex) => /* @__PURE__ */
|
|
6709
|
+
(_, colIndex) => /* @__PURE__ */ jsx4(
|
|
6391
6710
|
"th",
|
|
6392
6711
|
{
|
|
6393
6712
|
className: "hv-sheet-column-header",
|
|
@@ -6401,12 +6720,12 @@ function SpreadsheetEditor(props) {
|
|
|
6401
6720
|
)
|
|
6402
6721
|
)
|
|
6403
6722
|
] }) }),
|
|
6404
|
-
/* @__PURE__ */
|
|
6723
|
+
/* @__PURE__ */ jsx4("tbody", { children: activeSheet.data.map((row, rowIndex) => /* @__PURE__ */ jsxs3(
|
|
6405
6724
|
"tr",
|
|
6406
6725
|
{
|
|
6407
6726
|
style: { height: activeSheet.rowHeights[rowIndex] ?? 32 },
|
|
6408
6727
|
children: [
|
|
6409
|
-
/* @__PURE__ */
|
|
6728
|
+
/* @__PURE__ */ jsx4("td", { className: "hv-sheet-row-header", children: rowIndex + 1 }),
|
|
6410
6729
|
row.map((cellValue, colIndex) => {
|
|
6411
6730
|
const cellKey = makeCellKey(rowIndex, colIndex);
|
|
6412
6731
|
if (mergeLookup.covered.has(cellKey)) {
|
|
@@ -6415,7 +6734,7 @@ function SpreadsheetEditor(props) {
|
|
|
6415
6734
|
const merge = mergeLookup.starts.get(cellKey);
|
|
6416
6735
|
const cellModel = activeSheet.cells[cellKey];
|
|
6417
6736
|
const width = activeSheet.colWidths[colIndex] ?? 96;
|
|
6418
|
-
return /* @__PURE__ */
|
|
6737
|
+
return /* @__PURE__ */ jsx4(
|
|
6419
6738
|
"td",
|
|
6420
6739
|
{
|
|
6421
6740
|
rowSpan: merge ? merge.endRow - merge.startRow + 1 : 1,
|
|
@@ -6442,7 +6761,7 @@ function SpreadsheetEditor(props) {
|
|
|
6442
6761
|
rowIndex
|
|
6443
6762
|
)) })
|
|
6444
6763
|
] }),
|
|
6445
|
-
/* @__PURE__ */
|
|
6764
|
+
/* @__PURE__ */ jsx4(
|
|
6446
6765
|
SignatureOverlay,
|
|
6447
6766
|
{
|
|
6448
6767
|
surfaceKey: `sheet:${activeSheet.name}`,
|
|
@@ -6483,8 +6802,8 @@ function SpreadsheetEditor(props) {
|
|
|
6483
6802
|
}
|
|
6484
6803
|
|
|
6485
6804
|
// src/renderers/ImageRenderer.tsx
|
|
6486
|
-
import { useEffect as
|
|
6487
|
-
import { jsx as
|
|
6805
|
+
import { useEffect as useEffect5, useMemo as useMemo4 } from "react";
|
|
6806
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
6488
6807
|
function ImageRenderer(props) {
|
|
6489
6808
|
const url = useMemo4(() => {
|
|
6490
6809
|
if (!props.arrayBuffer) {
|
|
@@ -6493,7 +6812,7 @@ function ImageRenderer(props) {
|
|
|
6493
6812
|
const mime = props.fileType === "svg" ? "image/svg+xml" : props.fileType === "png" ? "image/png" : "image/jpeg";
|
|
6494
6813
|
return URL.createObjectURL(new Blob([props.arrayBuffer], { type: mime }));
|
|
6495
6814
|
}, [props.arrayBuffer, props.fileType]);
|
|
6496
|
-
|
|
6815
|
+
useEffect5(() => {
|
|
6497
6816
|
return () => {
|
|
6498
6817
|
if (url) {
|
|
6499
6818
|
URL.revokeObjectURL(url);
|
|
@@ -6501,11 +6820,11 @@ function ImageRenderer(props) {
|
|
|
6501
6820
|
};
|
|
6502
6821
|
}, [url]);
|
|
6503
6822
|
if (!props.arrayBuffer || !url) {
|
|
6504
|
-
return /* @__PURE__ */
|
|
6823
|
+
return /* @__PURE__ */ jsx5("div", { className: "hv-view-single", children: /* @__PURE__ */ jsx5("div", { className: "hv-page-container", style: { padding: "48px" }, children: /* @__PURE__ */ jsx5("p", { className: "hv-empty-state", children: props.locale["documents.imageMissing"] }) }) });
|
|
6505
6824
|
}
|
|
6506
|
-
return /* @__PURE__ */
|
|
6507
|
-
/* @__PURE__ */
|
|
6508
|
-
/* @__PURE__ */
|
|
6825
|
+
return /* @__PURE__ */ jsx5("div", { className: "hv-view-single", children: /* @__PURE__ */ jsxs4("div", { className: "hv-page-container hv-image-surface", children: [
|
|
6826
|
+
/* @__PURE__ */ jsx5("img", { src: url, alt: props.fileName, className: "hv-image-renderer" }),
|
|
6827
|
+
/* @__PURE__ */ jsx5(
|
|
6509
6828
|
SignatureOverlay,
|
|
6510
6829
|
{
|
|
6511
6830
|
surfaceKey: "image:main",
|
|
@@ -6548,8 +6867,8 @@ import {
|
|
|
6548
6867
|
getDocument as getDocument2,
|
|
6549
6868
|
GlobalWorkerOptions as GlobalWorkerOptions2
|
|
6550
6869
|
} from "pdfjs-dist";
|
|
6551
|
-
import { useEffect as
|
|
6552
|
-
import { jsx as
|
|
6870
|
+
import { useEffect as useEffect6, useMemo as useMemo5, useRef as useRef3, useState as useState5 } from "react";
|
|
6871
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
6553
6872
|
var pdfWorkerBlobUrlPromise2 = null;
|
|
6554
6873
|
function yieldToBrowser() {
|
|
6555
6874
|
return new Promise((resolve) => {
|
|
@@ -6574,10 +6893,10 @@ async function resolvePdfWorkerSrc(customWorkerSrc) {
|
|
|
6574
6893
|
}
|
|
6575
6894
|
function PdfRenderer(props) {
|
|
6576
6895
|
const { url, arrayBuffer, layout, currentPage, workerSrc } = props;
|
|
6577
|
-
const [doc, setDoc] =
|
|
6578
|
-
const [error, setError] =
|
|
6896
|
+
const [doc, setDoc] = useState5(null);
|
|
6897
|
+
const [error, setError] = useState5(null);
|
|
6579
6898
|
const thumbnailJobRef = useRef3(0);
|
|
6580
|
-
|
|
6899
|
+
useEffect6(() => {
|
|
6581
6900
|
let active = true;
|
|
6582
6901
|
const thumbnailJobId = thumbnailJobRef.current + 1;
|
|
6583
6902
|
thumbnailJobRef.current = thumbnailJobId;
|
|
@@ -6652,16 +6971,16 @@ function PdfRenderer(props) {
|
|
|
6652
6971
|
return [p];
|
|
6653
6972
|
}, [doc, currentPage, layout]);
|
|
6654
6973
|
if (error) {
|
|
6655
|
-
return /* @__PURE__ */
|
|
6656
|
-
/* @__PURE__ */
|
|
6657
|
-
/* @__PURE__ */
|
|
6974
|
+
return /* @__PURE__ */ jsx6("div", { className: "hv-page-container", style: { padding: "32px" }, children: /* @__PURE__ */ jsxs5("div", { className: "hv-error-banner", children: [
|
|
6975
|
+
/* @__PURE__ */ jsx6("strong", { children: props.locale["documents.pdfLoadErrorTitle"] }),
|
|
6976
|
+
/* @__PURE__ */ jsx6("p", { children: error })
|
|
6658
6977
|
] }) });
|
|
6659
6978
|
}
|
|
6660
|
-
return /* @__PURE__ */
|
|
6979
|
+
return /* @__PURE__ */ jsx6(
|
|
6661
6980
|
"div",
|
|
6662
6981
|
{
|
|
6663
6982
|
className: `hv-doc-scroll ${layout === "side-by-side" ? "hv-view-double" : "hv-view-single"}`,
|
|
6664
|
-
children: pagesToRender.map((page) => /* @__PURE__ */
|
|
6983
|
+
children: pagesToRender.map((page) => /* @__PURE__ */ jsx6(
|
|
6665
6984
|
PdfPage,
|
|
6666
6985
|
{
|
|
6667
6986
|
doc,
|
|
@@ -6679,7 +6998,7 @@ function PdfPage({
|
|
|
6679
6998
|
signatureOverlay
|
|
6680
6999
|
}) {
|
|
6681
7000
|
const canvasRef = useRef3(null);
|
|
6682
|
-
|
|
7001
|
+
useEffect6(() => {
|
|
6683
7002
|
if (!doc || !canvasRef.current) return;
|
|
6684
7003
|
let active = true;
|
|
6685
7004
|
const render = async () => {
|
|
@@ -6716,8 +7035,8 @@ function PdfPage({
|
|
|
6716
7035
|
justifyContent: "center"
|
|
6717
7036
|
},
|
|
6718
7037
|
children: [
|
|
6719
|
-
/* @__PURE__ */
|
|
6720
|
-
/* @__PURE__ */
|
|
7038
|
+
/* @__PURE__ */ jsx6("canvas", { ref: canvasRef, className: "hv-pdf-canvas" }),
|
|
7039
|
+
/* @__PURE__ */ jsx6(
|
|
6721
7040
|
SignatureOverlay,
|
|
6722
7041
|
{
|
|
6723
7042
|
surfaceKey: `page:${pageNum}`,
|
|
@@ -6759,9 +7078,9 @@ function PdfPage({
|
|
|
6759
7078
|
}
|
|
6760
7079
|
|
|
6761
7080
|
// src/renderers/PptxRenderer.tsx
|
|
6762
|
-
import { useEffect as
|
|
7081
|
+
import { useEffect as useEffect7, useMemo as useMemo6, useRef as useRef4, useState as useState6 } from "react";
|
|
6763
7082
|
import JSZip2 from "jszip";
|
|
6764
|
-
import { jsx as
|
|
7083
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
6765
7084
|
var NS_P = "http://schemas.openxmlformats.org/presentationml/2006/main";
|
|
6766
7085
|
var NS_A = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
6767
7086
|
var NS_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
@@ -6782,11 +7101,11 @@ function isBrowserRenderableSlideImage(source) {
|
|
|
6782
7101
|
return !/^data:image\/(?:emf|wmf|tiff)/i.test(source);
|
|
6783
7102
|
}
|
|
6784
7103
|
function PresentationImage(props) {
|
|
6785
|
-
const [failed, setFailed] =
|
|
7104
|
+
const [failed, setFailed] = useState6(!isBrowserRenderableSlideImage(props.src));
|
|
6786
7105
|
if (failed) {
|
|
6787
|
-
return /* @__PURE__ */
|
|
7106
|
+
return /* @__PURE__ */ jsx7("div", { className: "hv-slide-image-fallback", children: props.alt });
|
|
6788
7107
|
}
|
|
6789
|
-
return /* @__PURE__ */
|
|
7108
|
+
return /* @__PURE__ */ jsx7(
|
|
6790
7109
|
"img",
|
|
6791
7110
|
{
|
|
6792
7111
|
src: props.src,
|
|
@@ -7049,12 +7368,12 @@ function makeSlideThumbnail(slide, index) {
|
|
|
7049
7368
|
return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
|
|
7050
7369
|
}
|
|
7051
7370
|
function PptxRenderer(props) {
|
|
7052
|
-
const [slides, setSlides] =
|
|
7053
|
-
const [slideSize, setSlideSize] =
|
|
7054
|
-
const [error, setError] =
|
|
7371
|
+
const [slides, setSlides] = useState6([]);
|
|
7372
|
+
const [slideSize, setSlideSize] = useState6({ width: 9144e3, height: 5143500 });
|
|
7373
|
+
const [error, setError] = useState6(null);
|
|
7055
7374
|
const viewRef = useRef4(null);
|
|
7056
|
-
const [viewWidth, setViewWidth] =
|
|
7057
|
-
|
|
7375
|
+
const [viewWidth, setViewWidth] = useState6(SLIDE_RENDER_MAX_VIEW_WIDTH);
|
|
7376
|
+
useEffect7(() => {
|
|
7058
7377
|
if (!props.arrayBuffer) {
|
|
7059
7378
|
setSlides([]);
|
|
7060
7379
|
props.onPageCount(1);
|
|
@@ -7106,7 +7425,7 @@ function PptxRenderer(props) {
|
|
|
7106
7425
|
};
|
|
7107
7426
|
loadPptx();
|
|
7108
7427
|
}, [props.arrayBuffer, props.onExportStateChange]);
|
|
7109
|
-
|
|
7428
|
+
useEffect7(() => {
|
|
7110
7429
|
const host = viewRef.current;
|
|
7111
7430
|
if (!host || typeof ResizeObserver === "undefined") {
|
|
7112
7431
|
return;
|
|
@@ -7154,9 +7473,9 @@ function PptxRenderer(props) {
|
|
|
7154
7473
|
const sceneHeight = Math.max(1, Math.round(slideSize.height * sceneCoordScale));
|
|
7155
7474
|
const sceneScale = slideViewportWidth / SLIDE_RENDER_BASE_WIDTH;
|
|
7156
7475
|
if (error) {
|
|
7157
|
-
return /* @__PURE__ */
|
|
7476
|
+
return /* @__PURE__ */ jsx7("div", { className: "hv-error-banner", children: error });
|
|
7158
7477
|
}
|
|
7159
|
-
return /* @__PURE__ */
|
|
7478
|
+
return /* @__PURE__ */ jsx7(
|
|
7160
7479
|
"div",
|
|
7161
7480
|
{
|
|
7162
7481
|
ref: viewRef,
|
|
@@ -7166,7 +7485,7 @@ function PptxRenderer(props) {
|
|
|
7166
7485
|
if (!slide) {
|
|
7167
7486
|
return null;
|
|
7168
7487
|
}
|
|
7169
|
-
return /* @__PURE__ */
|
|
7488
|
+
return /* @__PURE__ */ jsx7(
|
|
7170
7489
|
"div",
|
|
7171
7490
|
{
|
|
7172
7491
|
className: "hv-page-container hv-slide-surface",
|
|
@@ -7174,7 +7493,7 @@ function PptxRenderer(props) {
|
|
|
7174
7493
|
aspectRatio: `${slideSize.width}/${slideSize.height}`,
|
|
7175
7494
|
width: props.layout === "side-by-side" && pagesToShow.length > 1 ? `${slideViewportWidth}px` : void 0
|
|
7176
7495
|
},
|
|
7177
|
-
children: /* @__PURE__ */
|
|
7496
|
+
children: /* @__PURE__ */ jsx7(
|
|
7178
7497
|
"div",
|
|
7179
7498
|
{
|
|
7180
7499
|
className: "hv-slide-stage",
|
|
@@ -7189,7 +7508,7 @@ function PptxRenderer(props) {
|
|
|
7189
7508
|
transform: `scale(${sceneScale})`
|
|
7190
7509
|
},
|
|
7191
7510
|
children: [
|
|
7192
|
-
slide.elements.map((element) => /* @__PURE__ */
|
|
7511
|
+
slide.elements.map((element) => /* @__PURE__ */ jsx7(
|
|
7193
7512
|
"div",
|
|
7194
7513
|
{
|
|
7195
7514
|
className: `hv-slide-element ${element.kind}`,
|
|
@@ -7202,20 +7521,20 @@ function PptxRenderer(props) {
|
|
|
7202
7521
|
background: element.kind === "shape" ? element.fill || "transparent" : void 0,
|
|
7203
7522
|
borderColor: element.stroke
|
|
7204
7523
|
},
|
|
7205
|
-
children: element.kind === "image" && element.imageSrc ? /* @__PURE__ */
|
|
7524
|
+
children: element.kind === "image" && element.imageSrc ? /* @__PURE__ */ jsx7(
|
|
7206
7525
|
PresentationImage,
|
|
7207
7526
|
{
|
|
7208
7527
|
src: element.imageSrc,
|
|
7209
7528
|
alt: element.alt || "Slide image"
|
|
7210
7529
|
}
|
|
7211
|
-
) : /* @__PURE__ */
|
|
7530
|
+
) : /* @__PURE__ */ jsx7("div", { className: "hv-slide-textbox", children: element.paragraphs?.map((paragraph, paragraphIndex) => /* @__PURE__ */ jsxs6(
|
|
7212
7531
|
"p",
|
|
7213
7532
|
{
|
|
7214
7533
|
className: `hv-slide-paragraph ${alignToClassName(paragraph.align)}`,
|
|
7215
7534
|
style: { paddingInlineStart: `${paragraph.level * 18}px` },
|
|
7216
7535
|
children: [
|
|
7217
|
-
paragraph.bullet && /* @__PURE__ */
|
|
7218
|
-
/* @__PURE__ */
|
|
7536
|
+
paragraph.bullet && /* @__PURE__ */ jsx7("span", { className: "hv-slide-bullet", children: "\u2022" }),
|
|
7537
|
+
/* @__PURE__ */ jsx7("span", { className: "hv-slide-paragraph-copy", children: paragraph.runs.map((run, runIndex) => /* @__PURE__ */ jsx7(
|
|
7219
7538
|
"span",
|
|
7220
7539
|
{
|
|
7221
7540
|
style: {
|
|
@@ -7240,7 +7559,7 @@ function PptxRenderer(props) {
|
|
|
7240
7559
|
},
|
|
7241
7560
|
element.id
|
|
7242
7561
|
)),
|
|
7243
|
-
/* @__PURE__ */
|
|
7562
|
+
/* @__PURE__ */ jsx7(
|
|
7244
7563
|
SignatureOverlay,
|
|
7245
7564
|
{
|
|
7246
7565
|
surfaceKey: `slide:${pageNumber}`,
|
|
@@ -7416,8 +7735,8 @@ var defaultLocale = {
|
|
|
7416
7735
|
|
|
7417
7736
|
// src/components/SignaturePanel.tsx
|
|
7418
7737
|
import { Check, Plus, Trash2, X } from "lucide-react";
|
|
7419
|
-
import { useMemo as useMemo7, useRef as useRef5, useState as
|
|
7420
|
-
import { Fragment as Fragment2, jsx as
|
|
7738
|
+
import { useMemo as useMemo7, useRef as useRef5, useState as useState7 } from "react";
|
|
7739
|
+
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
7421
7740
|
function sameSignature(left, right) {
|
|
7422
7741
|
if (left.id && right.id) {
|
|
7423
7742
|
return left.id === right.id;
|
|
@@ -7488,10 +7807,10 @@ function SignaturePanel(props) {
|
|
|
7488
7807
|
locale
|
|
7489
7808
|
} = props;
|
|
7490
7809
|
const canvasRef = useRef5(null);
|
|
7491
|
-
const [localSignatures, setLocalSignatures] =
|
|
7492
|
-
const [showModal, setShowModal] =
|
|
7493
|
-
const [isDrawing, setIsDrawing] =
|
|
7494
|
-
const [hasInk, setHasInk] =
|
|
7810
|
+
const [localSignatures, setLocalSignatures] = useState7([]);
|
|
7811
|
+
const [showModal, setShowModal] = useState7(false);
|
|
7812
|
+
const [isDrawing, setIsDrawing] = useState7(false);
|
|
7813
|
+
const [hasInk, setHasInk] = useState7(false);
|
|
7495
7814
|
const signatures = useMemo7(() => {
|
|
7496
7815
|
const merged = [];
|
|
7497
7816
|
for (const signature of [...externalSignatures, ...localSignatures]) {
|
|
@@ -7601,14 +7920,14 @@ function SignaturePanel(props) {
|
|
|
7601
7920
|
className: "hv-sidebar-header",
|
|
7602
7921
|
style: { justifyContent: "space-between", padding: "12px 16px" },
|
|
7603
7922
|
children: [
|
|
7604
|
-
/* @__PURE__ */
|
|
7605
|
-
/* @__PURE__ */
|
|
7923
|
+
/* @__PURE__ */ jsx8("h3", { style: { margin: 0, fontSize: "15px", fontWeight: 600 }, children: locale["signatures.title"] }),
|
|
7924
|
+
/* @__PURE__ */ jsx8(
|
|
7606
7925
|
"button",
|
|
7607
7926
|
{
|
|
7608
7927
|
onClick: onClose,
|
|
7609
7928
|
className: "hv-btn",
|
|
7610
7929
|
style: { padding: "4px", border: "none" },
|
|
7611
|
-
children: /* @__PURE__ */
|
|
7930
|
+
children: /* @__PURE__ */ jsx8(X, { size: 18 })
|
|
7612
7931
|
}
|
|
7613
7932
|
)
|
|
7614
7933
|
]
|
|
@@ -7628,25 +7947,26 @@ function SignaturePanel(props) {
|
|
|
7628
7947
|
color: "var(--hv-primary)"
|
|
7629
7948
|
},
|
|
7630
7949
|
children: [
|
|
7631
|
-
/* @__PURE__ */
|
|
7950
|
+
/* @__PURE__ */ jsx8(Plus, { size: 18, style: { marginRight: "8px" } }),
|
|
7632
7951
|
locale["signatures.new"]
|
|
7633
7952
|
]
|
|
7634
7953
|
}
|
|
7635
7954
|
),
|
|
7636
7955
|
selectedSignature && /* @__PURE__ */ jsxs7("div", { className: "hv-signature-selection-card", children: [
|
|
7637
|
-
/* @__PURE__ */
|
|
7638
|
-
/* @__PURE__ */
|
|
7639
|
-
|
|
7956
|
+
/* @__PURE__ */ jsx8("div", { className: "hv-signature-selection-title", children: locale["signatures.ready"] }),
|
|
7957
|
+
/* @__PURE__ */ jsx8(
|
|
7958
|
+
RenderableSignatureImage,
|
|
7640
7959
|
{
|
|
7641
|
-
|
|
7960
|
+
signatureImageUrl: selectedSignature.signatureImageUrl,
|
|
7961
|
+
inkColor: selectedColor,
|
|
7642
7962
|
alt: selectedSignature.signedBy ? `Selected signature by ${selectedSignature.signedBy}` : "Selected signature",
|
|
7643
7963
|
className: "hv-signature-selection-image"
|
|
7644
7964
|
}
|
|
7645
7965
|
),
|
|
7646
|
-
/* @__PURE__ */
|
|
7966
|
+
/* @__PURE__ */ jsx8("div", { className: "hv-signature-selection-copy", children: locale["signatures.placeHint"] }),
|
|
7647
7967
|
/* @__PURE__ */ jsxs7("div", { className: "hv-signature-color-picker", children: [
|
|
7648
|
-
/* @__PURE__ */
|
|
7649
|
-
/* @__PURE__ */
|
|
7968
|
+
/* @__PURE__ */ jsx8("span", { className: "hv-signature-color-picker-label", children: locale["signatures.color"] }),
|
|
7969
|
+
/* @__PURE__ */ jsx8("div", { className: "hv-signature-color-swatch-row", children: SIGNATURE_INK_COLORS.map((color) => /* @__PURE__ */ jsx8(
|
|
7650
7970
|
"button",
|
|
7651
7971
|
{
|
|
7652
7972
|
type: "button",
|
|
@@ -7659,7 +7979,7 @@ function SignaturePanel(props) {
|
|
|
7659
7979
|
color
|
|
7660
7980
|
)) })
|
|
7661
7981
|
] }),
|
|
7662
|
-
/* @__PURE__ */
|
|
7982
|
+
/* @__PURE__ */ jsx8(
|
|
7663
7983
|
"button",
|
|
7664
7984
|
{
|
|
7665
7985
|
type: "button",
|
|
@@ -7670,7 +7990,7 @@ function SignaturePanel(props) {
|
|
|
7670
7990
|
}
|
|
7671
7991
|
)
|
|
7672
7992
|
] }),
|
|
7673
|
-
signatures.length === 0 && /* @__PURE__ */
|
|
7993
|
+
signatures.length === 0 && /* @__PURE__ */ jsx8("div", { className: "hv-signature-empty", children: locale["signatures.empty"] }),
|
|
7674
7994
|
signatures.map((signature, index) => {
|
|
7675
7995
|
const isLocal = localSignatures.some(
|
|
7676
7996
|
(item) => sameSignature(item, signature)
|
|
@@ -7689,26 +8009,27 @@ function SignaturePanel(props) {
|
|
|
7689
8009
|
onClick: () => onSelectSignature(signature),
|
|
7690
8010
|
children: [
|
|
7691
8011
|
/* @__PURE__ */ jsxs7("div", { className: "hv-signature-item-stack", children: [
|
|
7692
|
-
/* @__PURE__ */
|
|
7693
|
-
|
|
8012
|
+
/* @__PURE__ */ jsx8(
|
|
8013
|
+
RenderableSignatureImage,
|
|
7694
8014
|
{
|
|
7695
|
-
|
|
8015
|
+
signatureImageUrl: signature.signatureImageUrl,
|
|
8016
|
+
inkColor: "black",
|
|
7696
8017
|
alt: signature.signedBy ? `Signature by ${signature.signedBy}` : "Signature",
|
|
7697
8018
|
className: "hv-signature-item-image"
|
|
7698
8019
|
}
|
|
7699
8020
|
),
|
|
7700
8021
|
/* @__PURE__ */ jsxs7("div", { className: "hv-signature-item-copy", children: [
|
|
7701
|
-
signature.signedBy && /* @__PURE__ */
|
|
7702
|
-
signature.jobTitle && /* @__PURE__ */
|
|
7703
|
-
/* @__PURE__ */
|
|
7704
|
-
signature.comment && /* @__PURE__ */
|
|
8022
|
+
signature.signedBy && /* @__PURE__ */ jsx8("strong", { children: signature.signedBy }),
|
|
8023
|
+
signature.jobTitle && /* @__PURE__ */ jsx8("span", { children: signature.jobTitle }),
|
|
8024
|
+
/* @__PURE__ */ jsx8("span", { children: normalizeSignatureDate(signature.dateSigned) }),
|
|
8025
|
+
signature.comment && /* @__PURE__ */ jsx8("em", { children: signature.comment })
|
|
7705
8026
|
] })
|
|
7706
8027
|
] }),
|
|
7707
|
-
isSelected && /* @__PURE__ */
|
|
8028
|
+
isSelected && /* @__PURE__ */ jsx8("span", { className: "hv-signature-item-check", children: /* @__PURE__ */ jsx8(Check, { size: 14 }) })
|
|
7708
8029
|
]
|
|
7709
8030
|
}
|
|
7710
8031
|
),
|
|
7711
|
-
isLocal && /* @__PURE__ */
|
|
8032
|
+
isLocal && /* @__PURE__ */ jsx8(
|
|
7712
8033
|
"button",
|
|
7713
8034
|
{
|
|
7714
8035
|
type: "button",
|
|
@@ -7731,7 +8052,7 @@ function SignaturePanel(props) {
|
|
|
7731
8052
|
onClearSelection();
|
|
7732
8053
|
}
|
|
7733
8054
|
},
|
|
7734
|
-
children: /* @__PURE__ */
|
|
8055
|
+
children: /* @__PURE__ */ jsx8(Trash2, { size: 12 })
|
|
7735
8056
|
}
|
|
7736
8057
|
)
|
|
7737
8058
|
]
|
|
@@ -7743,7 +8064,7 @@ function SignaturePanel(props) {
|
|
|
7743
8064
|
]
|
|
7744
8065
|
}
|
|
7745
8066
|
),
|
|
7746
|
-
showModal && /* @__PURE__ */
|
|
8067
|
+
showModal && /* @__PURE__ */ jsx8("div", { className: "hv-modal-overlay", children: /* @__PURE__ */ jsxs7("div", { className: "hv-modal", style: { width: "450px", maxWidth: "90vw" }, children: [
|
|
7747
8068
|
/* @__PURE__ */ jsxs7(
|
|
7748
8069
|
"div",
|
|
7749
8070
|
{
|
|
@@ -7755,14 +8076,14 @@ function SignaturePanel(props) {
|
|
|
7755
8076
|
alignItems: "center"
|
|
7756
8077
|
},
|
|
7757
8078
|
children: [
|
|
7758
|
-
/* @__PURE__ */
|
|
7759
|
-
/* @__PURE__ */
|
|
8079
|
+
/* @__PURE__ */ jsx8("h3", { style: { margin: 0, fontSize: "18px", fontWeight: 600 }, children: locale["signatures.drawTitle"] }),
|
|
8080
|
+
/* @__PURE__ */ jsx8(
|
|
7760
8081
|
"button",
|
|
7761
8082
|
{
|
|
7762
8083
|
onClick: () => setShowModal(false),
|
|
7763
8084
|
className: "hv-btn",
|
|
7764
8085
|
style: { border: "none" },
|
|
7765
|
-
children: /* @__PURE__ */
|
|
8086
|
+
children: /* @__PURE__ */ jsx8(X, { size: 20 })
|
|
7766
8087
|
}
|
|
7767
8088
|
)
|
|
7768
8089
|
]
|
|
@@ -7779,7 +8100,7 @@ function SignaturePanel(props) {
|
|
|
7779
8100
|
alignItems: "center"
|
|
7780
8101
|
},
|
|
7781
8102
|
children: [
|
|
7782
|
-
/* @__PURE__ */
|
|
8103
|
+
/* @__PURE__ */ jsx8(
|
|
7783
8104
|
"div",
|
|
7784
8105
|
{
|
|
7785
8106
|
style: {
|
|
@@ -7789,7 +8110,7 @@ function SignaturePanel(props) {
|
|
|
7789
8110
|
overflow: "hidden",
|
|
7790
8111
|
boxShadow: "inset 0 2px 4px 0 rgba(0,0,0,0.05)"
|
|
7791
8112
|
},
|
|
7792
|
-
children: /* @__PURE__ */
|
|
8113
|
+
children: /* @__PURE__ */ jsx8(
|
|
7793
8114
|
"canvas",
|
|
7794
8115
|
{
|
|
7795
8116
|
ref: canvasRef,
|
|
@@ -7811,7 +8132,7 @@ function SignaturePanel(props) {
|
|
|
7811
8132
|
)
|
|
7812
8133
|
}
|
|
7813
8134
|
),
|
|
7814
|
-
/* @__PURE__ */
|
|
8135
|
+
/* @__PURE__ */ jsx8(
|
|
7815
8136
|
"p",
|
|
7816
8137
|
{
|
|
7817
8138
|
style: {
|
|
@@ -7836,8 +8157,8 @@ function SignaturePanel(props) {
|
|
|
7836
8157
|
gap: "12px"
|
|
7837
8158
|
},
|
|
7838
8159
|
children: [
|
|
7839
|
-
/* @__PURE__ */
|
|
7840
|
-
/* @__PURE__ */
|
|
8160
|
+
/* @__PURE__ */ jsx8("button", { onClick: clearCanvas, className: "hv-btn", children: locale["signatures.clear"] }),
|
|
8161
|
+
/* @__PURE__ */ jsx8(
|
|
7841
8162
|
"button",
|
|
7842
8163
|
{
|
|
7843
8164
|
onClick: saveSignature,
|
|
@@ -7854,16 +8175,16 @@ function SignaturePanel(props) {
|
|
|
7854
8175
|
}
|
|
7855
8176
|
|
|
7856
8177
|
// src/components/ThumbnailsSidebar.tsx
|
|
7857
|
-
import { useEffect as
|
|
7858
|
-
import { jsx as
|
|
8178
|
+
import { useEffect as useEffect8, useMemo as useMemo8, useRef as useRef6, useState as useState8 } from "react";
|
|
8179
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
7859
8180
|
var THUMB_ITEM_HEIGHT = 184;
|
|
7860
8181
|
var THUMB_OVERSCAN = 4;
|
|
7861
8182
|
function ThumbnailsSidebar(props) {
|
|
7862
8183
|
const { isOpen, thumbnails, currentPage, onSelectPage, locale } = props;
|
|
7863
8184
|
const listRef = useRef6(null);
|
|
7864
|
-
const [scrollTop, setScrollTop] =
|
|
7865
|
-
const [viewportHeight, setViewportHeight] =
|
|
7866
|
-
|
|
8185
|
+
const [scrollTop, setScrollTop] = useState8(0);
|
|
8186
|
+
const [viewportHeight, setViewportHeight] = useState8(0);
|
|
8187
|
+
useEffect8(() => {
|
|
7867
8188
|
const element = listRef.current;
|
|
7868
8189
|
if (!element || !isOpen) {
|
|
7869
8190
|
return;
|
|
@@ -7884,7 +8205,7 @@ function ThumbnailsSidebar(props) {
|
|
|
7884
8205
|
behavior: "smooth"
|
|
7885
8206
|
});
|
|
7886
8207
|
}, [currentPage, isOpen]);
|
|
7887
|
-
|
|
8208
|
+
useEffect8(() => {
|
|
7888
8209
|
const element = listRef.current;
|
|
7889
8210
|
if (!element) {
|
|
7890
8211
|
return;
|
|
@@ -7946,8 +8267,8 @@ function ThumbnailsSidebar(props) {
|
|
|
7946
8267
|
),
|
|
7947
8268
|
[thumbnails, virtualWindow.endIndex, virtualWindow.startIndex]
|
|
7948
8269
|
);
|
|
7949
|
-
return /* @__PURE__ */
|
|
7950
|
-
thumbnails.length > 0 && /* @__PURE__ */
|
|
8270
|
+
return /* @__PURE__ */ jsx9("div", { className: `hv-sidebar ${!isOpen ? "collapsed" : ""}`, children: /* @__PURE__ */ jsxs8("div", { ref: listRef, className: "hv-thumb-list", children: [
|
|
8271
|
+
thumbnails.length > 0 && /* @__PURE__ */ jsx9(
|
|
7951
8272
|
"div",
|
|
7952
8273
|
{
|
|
7953
8274
|
className: "hv-thumb-viewport",
|
|
@@ -7963,14 +8284,14 @@ function ThumbnailsSidebar(props) {
|
|
|
7963
8284
|
style: { top: `${absoluteIndex * THUMB_ITEM_HEIGHT}px` },
|
|
7964
8285
|
onClick: () => onSelectPage(pageNum),
|
|
7965
8286
|
children: [
|
|
7966
|
-
/* @__PURE__ */
|
|
8287
|
+
/* @__PURE__ */ jsx9("div", { className: "hv-thumb-preview", children: src ? /* @__PURE__ */ jsx9(
|
|
7967
8288
|
"img",
|
|
7968
8289
|
{
|
|
7969
8290
|
src,
|
|
7970
8291
|
alt: `Page ${pageNum}`,
|
|
7971
8292
|
className: "hv-thumb-img"
|
|
7972
8293
|
}
|
|
7973
|
-
) : /* @__PURE__ */
|
|
8294
|
+
) : /* @__PURE__ */ jsx9("div", { className: "hv-thumb-skeleton", children: /* @__PURE__ */ jsx9("span", { children: "..." }) }) }),
|
|
7974
8295
|
/* @__PURE__ */ jsxs8("span", { className: "hv-thumb-label", children: [
|
|
7975
8296
|
locale["thumbnails.page"],
|
|
7976
8297
|
" ",
|
|
@@ -7983,7 +8304,7 @@ function ThumbnailsSidebar(props) {
|
|
|
7983
8304
|
})
|
|
7984
8305
|
}
|
|
7985
8306
|
),
|
|
7986
|
-
thumbnails.length === 0 && /* @__PURE__ */
|
|
8307
|
+
thumbnails.length === 0 && /* @__PURE__ */ jsx9("div", { className: "hv-thumb-empty", children: locale["thumbnails.empty"] })
|
|
7987
8308
|
] }) });
|
|
7988
8309
|
}
|
|
7989
8310
|
|
|
@@ -8002,7 +8323,7 @@ import {
|
|
|
8002
8323
|
ZoomIn,
|
|
8003
8324
|
ZoomOut
|
|
8004
8325
|
} from "lucide-react";
|
|
8005
|
-
import { Fragment as Fragment3, jsx as
|
|
8326
|
+
import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
8006
8327
|
function Toolbar(props) {
|
|
8007
8328
|
const {
|
|
8008
8329
|
fileName,
|
|
@@ -8040,16 +8361,16 @@ function Toolbar(props) {
|
|
|
8040
8361
|
};
|
|
8041
8362
|
return /* @__PURE__ */ jsxs9("div", { className: "hv-toolbar", children: [
|
|
8042
8363
|
/* @__PURE__ */ jsxs9("div", { className: "hv-toolbar-group", children: [
|
|
8043
|
-
/* @__PURE__ */
|
|
8364
|
+
/* @__PURE__ */ jsx10(
|
|
8044
8365
|
"button",
|
|
8045
8366
|
{
|
|
8046
8367
|
className: `hv-btn ${props.showThumbnails ? "hv-btn-active" : ""}`,
|
|
8047
8368
|
onClick: props.onToggleThumbnails,
|
|
8048
8369
|
title: locale["toolbar.thumbs"],
|
|
8049
|
-
children: props.showThumbnails ? /* @__PURE__ */
|
|
8370
|
+
children: props.showThumbnails ? /* @__PURE__ */ jsx10(PanelLeftClose, { size: 20 }) : /* @__PURE__ */ jsx10(PanelLeftOpen, { size: 20 })
|
|
8050
8371
|
}
|
|
8051
8372
|
),
|
|
8052
|
-
/* @__PURE__ */
|
|
8373
|
+
/* @__PURE__ */ jsx10(
|
|
8053
8374
|
"div",
|
|
8054
8375
|
{
|
|
8055
8376
|
className: "hv-sep",
|
|
@@ -8061,7 +8382,7 @@ function Toolbar(props) {
|
|
|
8061
8382
|
}
|
|
8062
8383
|
}
|
|
8063
8384
|
),
|
|
8064
|
-
/* @__PURE__ */
|
|
8385
|
+
/* @__PURE__ */ jsx10(
|
|
8065
8386
|
"span",
|
|
8066
8387
|
{
|
|
8067
8388
|
style: {
|
|
@@ -8077,17 +8398,17 @@ function Toolbar(props) {
|
|
|
8077
8398
|
)
|
|
8078
8399
|
] }),
|
|
8079
8400
|
/* @__PURE__ */ jsxs9("div", { className: "hv-toolbar-group", children: [
|
|
8080
|
-
/* @__PURE__ */
|
|
8401
|
+
/* @__PURE__ */ jsx10(
|
|
8081
8402
|
"button",
|
|
8082
8403
|
{
|
|
8083
8404
|
className: "hv-btn",
|
|
8084
8405
|
disabled: currentPage <= 1,
|
|
8085
8406
|
onClick: handlePrev,
|
|
8086
|
-
children: /* @__PURE__ */
|
|
8407
|
+
children: /* @__PURE__ */ jsx10(ChevronLeft, { size: 20 })
|
|
8087
8408
|
}
|
|
8088
8409
|
),
|
|
8089
8410
|
/* @__PURE__ */ jsxs9("div", { className: "hv-toolbar-page-group", children: [
|
|
8090
|
-
/* @__PURE__ */
|
|
8411
|
+
/* @__PURE__ */ jsx10(
|
|
8091
8412
|
"input",
|
|
8092
8413
|
{
|
|
8093
8414
|
type: "number",
|
|
@@ -8098,31 +8419,31 @@ function Toolbar(props) {
|
|
|
8098
8419
|
max: pageCount
|
|
8099
8420
|
}
|
|
8100
8421
|
),
|
|
8101
|
-
/* @__PURE__ */
|
|
8102
|
-
/* @__PURE__ */
|
|
8422
|
+
/* @__PURE__ */ jsx10("span", { className: "hv-toolbar-page-sep", children: "/" }),
|
|
8423
|
+
/* @__PURE__ */ jsx10("span", { children: pageCount })
|
|
8103
8424
|
] }),
|
|
8104
|
-
/* @__PURE__ */
|
|
8425
|
+
/* @__PURE__ */ jsx10(
|
|
8105
8426
|
"button",
|
|
8106
8427
|
{
|
|
8107
8428
|
className: "hv-btn",
|
|
8108
8429
|
disabled: currentPage >= pageCount,
|
|
8109
8430
|
onClick: handleNext,
|
|
8110
|
-
children: /* @__PURE__ */
|
|
8431
|
+
children: /* @__PURE__ */ jsx10(ChevronRight, { size: 20 })
|
|
8111
8432
|
}
|
|
8112
8433
|
)
|
|
8113
8434
|
] }),
|
|
8114
8435
|
/* @__PURE__ */ jsxs9("div", { className: "hv-toolbar-group", children: [
|
|
8115
|
-
/* @__PURE__ */
|
|
8436
|
+
/* @__PURE__ */ jsx10(
|
|
8116
8437
|
"button",
|
|
8117
8438
|
{
|
|
8118
8439
|
className: "hv-btn",
|
|
8119
8440
|
onClick: onZoomOut,
|
|
8120
8441
|
title: locale["toolbar.zoomOut"],
|
|
8121
8442
|
disabled: zoom <= 0.5,
|
|
8122
|
-
children: /* @__PURE__ */
|
|
8443
|
+
children: /* @__PURE__ */ jsx10(ZoomOut, { size: 18 })
|
|
8123
8444
|
}
|
|
8124
8445
|
),
|
|
8125
|
-
/* @__PURE__ */
|
|
8446
|
+
/* @__PURE__ */ jsx10(
|
|
8126
8447
|
"button",
|
|
8127
8448
|
{
|
|
8128
8449
|
className: "hv-btn",
|
|
@@ -8134,17 +8455,17 @@ function Toolbar(props) {
|
|
|
8134
8455
|
] })
|
|
8135
8456
|
}
|
|
8136
8457
|
),
|
|
8137
|
-
/* @__PURE__ */
|
|
8458
|
+
/* @__PURE__ */ jsx10(
|
|
8138
8459
|
"button",
|
|
8139
8460
|
{
|
|
8140
8461
|
className: "hv-btn",
|
|
8141
8462
|
onClick: onZoomIn,
|
|
8142
8463
|
title: locale["toolbar.zoomIn"],
|
|
8143
8464
|
disabled: zoom >= 2,
|
|
8144
|
-
children: /* @__PURE__ */
|
|
8465
|
+
children: /* @__PURE__ */ jsx10(ZoomIn, { size: 18 })
|
|
8145
8466
|
}
|
|
8146
8467
|
),
|
|
8147
|
-
/* @__PURE__ */
|
|
8468
|
+
/* @__PURE__ */ jsx10(
|
|
8148
8469
|
"div",
|
|
8149
8470
|
{
|
|
8150
8471
|
className: "hv-sep",
|
|
@@ -8156,22 +8477,22 @@ function Toolbar(props) {
|
|
|
8156
8477
|
}
|
|
8157
8478
|
}
|
|
8158
8479
|
),
|
|
8159
|
-
/* @__PURE__ */
|
|
8480
|
+
/* @__PURE__ */ jsx10(
|
|
8160
8481
|
"button",
|
|
8161
8482
|
{
|
|
8162
8483
|
className: `hv-btn ${layout === "single" ? "hv-btn-active" : ""}`,
|
|
8163
8484
|
onClick: () => onLayoutChange("single"),
|
|
8164
8485
|
title: locale["toolbar.layout.single"],
|
|
8165
|
-
children: /* @__PURE__ */
|
|
8486
|
+
children: /* @__PURE__ */ jsx10(LayoutTemplate, { size: 18 })
|
|
8166
8487
|
}
|
|
8167
8488
|
),
|
|
8168
|
-
/* @__PURE__ */
|
|
8489
|
+
/* @__PURE__ */ jsx10(
|
|
8169
8490
|
"button",
|
|
8170
8491
|
{
|
|
8171
8492
|
className: `hv-btn ${layout === "side-by-side" ? "hv-btn-active" : ""}`,
|
|
8172
8493
|
onClick: () => onLayoutChange("side-by-side"),
|
|
8173
8494
|
title: locale["toolbar.layout.two"],
|
|
8174
|
-
children: /* @__PURE__ */
|
|
8495
|
+
children: /* @__PURE__ */ jsx10(Grid2X2, { size: 18 })
|
|
8175
8496
|
}
|
|
8176
8497
|
),
|
|
8177
8498
|
showHeaderFooterToggle && /* @__PURE__ */ jsxs9(
|
|
@@ -8181,12 +8502,12 @@ function Toolbar(props) {
|
|
|
8181
8502
|
onClick: onToggleHeaderFooter,
|
|
8182
8503
|
title: locale["toolbar.headerFooter"],
|
|
8183
8504
|
children: [
|
|
8184
|
-
/* @__PURE__ */
|
|
8185
|
-
/* @__PURE__ */
|
|
8505
|
+
/* @__PURE__ */ jsx10("span", { style: { fontSize: "12px", fontWeight: 700, marginRight: "8px" }, children: "HF" }),
|
|
8506
|
+
/* @__PURE__ */ jsx10("span", { className: "hv-btn-label", children: locale["toolbar.headerFooter"] })
|
|
8186
8507
|
]
|
|
8187
8508
|
}
|
|
8188
8509
|
),
|
|
8189
|
-
/* @__PURE__ */
|
|
8510
|
+
/* @__PURE__ */ jsx10(
|
|
8190
8511
|
"div",
|
|
8191
8512
|
{
|
|
8192
8513
|
className: "hv-sep",
|
|
@@ -8199,14 +8520,14 @@ function Toolbar(props) {
|
|
|
8199
8520
|
}
|
|
8200
8521
|
),
|
|
8201
8522
|
saveEnabled && /* @__PURE__ */ jsxs9(Fragment3, { children: [
|
|
8202
|
-
showExportPdfAction && /* @__PURE__ */
|
|
8523
|
+
showExportPdfAction && /* @__PURE__ */ jsx10(
|
|
8203
8524
|
"button",
|
|
8204
8525
|
{
|
|
8205
8526
|
className: "hv-btn",
|
|
8206
8527
|
onClick: onExportPdf,
|
|
8207
8528
|
title: locale["toolbar.exportPdf"],
|
|
8208
8529
|
disabled: isSaving,
|
|
8209
|
-
children: /* @__PURE__ */
|
|
8530
|
+
children: /* @__PURE__ */ jsx10(FileDown, { size: 18 })
|
|
8210
8531
|
}
|
|
8211
8532
|
),
|
|
8212
8533
|
/* @__PURE__ */ jsxs9(
|
|
@@ -8217,12 +8538,12 @@ function Toolbar(props) {
|
|
|
8217
8538
|
title: saveLabel ?? locale["toolbar.save"],
|
|
8218
8539
|
disabled: isSaving,
|
|
8219
8540
|
children: [
|
|
8220
|
-
/* @__PURE__ */
|
|
8221
|
-
/* @__PURE__ */
|
|
8541
|
+
/* @__PURE__ */ jsx10(Save, { size: 18, style: { marginRight: "8px" } }),
|
|
8542
|
+
/* @__PURE__ */ jsx10("span", { className: "hv-btn-label", children: isSaving ? locale.loading : saveLabel ?? locale["toolbar.save"] })
|
|
8222
8543
|
]
|
|
8223
8544
|
}
|
|
8224
8545
|
),
|
|
8225
|
-
/* @__PURE__ */
|
|
8546
|
+
/* @__PURE__ */ jsx10(
|
|
8226
8547
|
"div",
|
|
8227
8548
|
{
|
|
8228
8549
|
className: "hv-sep",
|
|
@@ -8242,8 +8563,8 @@ function Toolbar(props) {
|
|
|
8242
8563
|
onClick: props.onToggleAnnotationMode,
|
|
8243
8564
|
title: locale["toolbar.annotate"],
|
|
8244
8565
|
children: [
|
|
8245
|
-
/* @__PURE__ */
|
|
8246
|
-
/* @__PURE__ */
|
|
8566
|
+
/* @__PURE__ */ jsx10(MessageSquarePlus, { size: 18, style: { marginRight: "8px" } }),
|
|
8567
|
+
/* @__PURE__ */ jsx10("span", { className: "hv-btn-label", children: locale["toolbar.annotate"] })
|
|
8247
8568
|
]
|
|
8248
8569
|
}
|
|
8249
8570
|
),
|
|
@@ -8254,8 +8575,8 @@ function Toolbar(props) {
|
|
|
8254
8575
|
onClick: props.onToggleSignatures,
|
|
8255
8576
|
title: locale["toolbar.sign"],
|
|
8256
8577
|
children: [
|
|
8257
|
-
/* @__PURE__ */
|
|
8258
|
-
/* @__PURE__ */
|
|
8578
|
+
/* @__PURE__ */ jsx10(PenLine, { size: 18, style: { marginRight: "8px" } }),
|
|
8579
|
+
/* @__PURE__ */ jsx10("span", { className: "hv-btn-label", children: locale["toolbar.sign"] })
|
|
8259
8580
|
]
|
|
8260
8581
|
}
|
|
8261
8582
|
)
|
|
@@ -8264,7 +8585,7 @@ function Toolbar(props) {
|
|
|
8264
8585
|
}
|
|
8265
8586
|
|
|
8266
8587
|
// src/components/DocumentViewer.tsx
|
|
8267
|
-
import { Fragment as Fragment4, jsx as
|
|
8588
|
+
import { Fragment as Fragment4, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
8268
8589
|
function createPlacementId() {
|
|
8269
8590
|
return `sig-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
8270
8591
|
}
|
|
@@ -8352,44 +8673,44 @@ function DocumentViewer(props) {
|
|
|
8352
8673
|
() => ({ ...defaultLocale, ...props.locale }),
|
|
8353
8674
|
[props.locale]
|
|
8354
8675
|
);
|
|
8355
|
-
const [layout, setLayout] =
|
|
8676
|
+
const [layout, setLayout] = useState9(
|
|
8356
8677
|
props.defaultLayout ?? "single"
|
|
8357
8678
|
);
|
|
8358
|
-
const [showThumbnails, setShowThumbnails] =
|
|
8679
|
+
const [showThumbnails, setShowThumbnails] = useState9(
|
|
8359
8680
|
props.defaultShowThumbnails ?? true
|
|
8360
8681
|
);
|
|
8361
|
-
const [showHeaderFooterSlots, setShowHeaderFooterSlots] =
|
|
8362
|
-
const [showSignatures, setShowSignatures] =
|
|
8363
|
-
const [zoom, setZoom] =
|
|
8682
|
+
const [showHeaderFooterSlots, setShowHeaderFooterSlots] = useState9(true);
|
|
8683
|
+
const [showSignatures, setShowSignatures] = useState9(false);
|
|
8684
|
+
const [zoom, setZoom] = useState9(1);
|
|
8364
8685
|
const mainRef = useRef7(null);
|
|
8365
8686
|
const zoomStageRef = useRef7(null);
|
|
8366
8687
|
const exportHeaderRef = useRef7(null);
|
|
8367
8688
|
const exportFooterRef = useRef7(null);
|
|
8368
|
-
const [selectedSignature, setSelectedSignature] =
|
|
8689
|
+
const [selectedSignature, setSelectedSignature] = useState9(
|
|
8369
8690
|
null
|
|
8370
8691
|
);
|
|
8371
|
-
const [selectedSignatureColor, setSelectedSignatureColor] =
|
|
8372
|
-
const [isPlacingAnnotation, setIsPlacingAnnotation] =
|
|
8373
|
-
const [activePlacementId, setActivePlacementId] =
|
|
8692
|
+
const [selectedSignatureColor, setSelectedSignatureColor] = useState9("black");
|
|
8693
|
+
const [isPlacingAnnotation, setIsPlacingAnnotation] = useState9(false);
|
|
8694
|
+
const [activePlacementId, setActivePlacementId] = useState9(
|
|
8374
8695
|
null
|
|
8375
8696
|
);
|
|
8376
|
-
const [activeAnnotationId, setActiveAnnotationId] =
|
|
8697
|
+
const [activeAnnotationId, setActiveAnnotationId] = useState9(
|
|
8377
8698
|
null
|
|
8378
8699
|
);
|
|
8379
|
-
const [resolved, setResolved] =
|
|
8380
|
-
const [loading, setLoading] =
|
|
8381
|
-
const [error, setError] =
|
|
8382
|
-
const [isSaving, setIsSaving] =
|
|
8383
|
-
const [pageCount, setPageCount] =
|
|
8384
|
-
const [currentPage, setCurrentPage] =
|
|
8385
|
-
const [thumbnails, setThumbnails] =
|
|
8386
|
-
const [richTextExportState, setRichTextExportState] =
|
|
8387
|
-
const [spreadsheetExportState, setSpreadsheetExportState] =
|
|
8388
|
-
const [pptxExportState, setPptxExportState] =
|
|
8389
|
-
const [internalPlacements, setInternalPlacements] =
|
|
8390
|
-
const [internalAnnotations, setInternalAnnotations] =
|
|
8391
|
-
const [zoomStageSize, setZoomStageSize] =
|
|
8392
|
-
const [mainContentWidth, setMainContentWidth] =
|
|
8700
|
+
const [resolved, setResolved] = useState9(null);
|
|
8701
|
+
const [loading, setLoading] = useState9(true);
|
|
8702
|
+
const [error, setError] = useState9("");
|
|
8703
|
+
const [isSaving, setIsSaving] = useState9(false);
|
|
8704
|
+
const [pageCount, setPageCount] = useState9(1);
|
|
8705
|
+
const [currentPage, setCurrentPage] = useState9(1);
|
|
8706
|
+
const [thumbnails, setThumbnails] = useState9([]);
|
|
8707
|
+
const [richTextExportState, setRichTextExportState] = useState9(null);
|
|
8708
|
+
const [spreadsheetExportState, setSpreadsheetExportState] = useState9(null);
|
|
8709
|
+
const [pptxExportState, setPptxExportState] = useState9(null);
|
|
8710
|
+
const [internalPlacements, setInternalPlacements] = useState9(props.signaturePlacements ?? []);
|
|
8711
|
+
const [internalAnnotations, setInternalAnnotations] = useState9(props.annotations ?? []);
|
|
8712
|
+
const [zoomStageSize, setZoomStageSize] = useState9({ width: 0, height: 0 });
|
|
8713
|
+
const [mainContentWidth, setMainContentWidth] = useState9(0);
|
|
8393
8714
|
const placements = useMemo9(
|
|
8394
8715
|
() => (props.signaturePlacements ?? internalPlacements).map(
|
|
8395
8716
|
(placement) => normalizeSignaturePlacement(placement)
|
|
@@ -8459,41 +8780,41 @@ function DocumentViewer(props) {
|
|
|
8459
8780
|
})),
|
|
8460
8781
|
[placements]
|
|
8461
8782
|
);
|
|
8462
|
-
|
|
8783
|
+
useEffect9(() => {
|
|
8463
8784
|
if (props.signaturePlacements) {
|
|
8464
8785
|
setInternalPlacements(props.signaturePlacements);
|
|
8465
8786
|
}
|
|
8466
8787
|
}, [props.signaturePlacements]);
|
|
8467
|
-
|
|
8788
|
+
useEffect9(() => {
|
|
8468
8789
|
if (props.annotations) {
|
|
8469
8790
|
setInternalAnnotations(props.annotations);
|
|
8470
8791
|
}
|
|
8471
8792
|
}, [props.annotations]);
|
|
8472
|
-
|
|
8793
|
+
useEffect9(() => {
|
|
8473
8794
|
setShowThumbnails(props.defaultShowThumbnails ?? true);
|
|
8474
8795
|
}, [props.defaultShowThumbnails]);
|
|
8475
|
-
|
|
8796
|
+
useEffect9(() => {
|
|
8476
8797
|
setLayout(props.defaultLayout ?? "single");
|
|
8477
8798
|
}, [props.defaultLayout]);
|
|
8478
|
-
|
|
8799
|
+
useEffect9(() => {
|
|
8479
8800
|
if (!signingEnabled) {
|
|
8480
8801
|
setShowSignatures(false);
|
|
8481
8802
|
setSelectedSignature(null);
|
|
8482
8803
|
setActivePlacementId(null);
|
|
8483
8804
|
}
|
|
8484
8805
|
}, [signingEnabled]);
|
|
8485
|
-
|
|
8806
|
+
useEffect9(() => {
|
|
8486
8807
|
if (!annotationEnabled) {
|
|
8487
8808
|
setIsPlacingAnnotation(false);
|
|
8488
8809
|
setActiveAnnotationId(null);
|
|
8489
8810
|
}
|
|
8490
8811
|
}, [annotationEnabled]);
|
|
8491
|
-
|
|
8812
|
+
useEffect9(() => {
|
|
8492
8813
|
if (!headerFooterToggleEnabled) {
|
|
8493
8814
|
setShowHeaderFooterSlots(true);
|
|
8494
8815
|
}
|
|
8495
8816
|
}, [headerFooterToggleEnabled]);
|
|
8496
|
-
|
|
8817
|
+
useEffect9(() => {
|
|
8497
8818
|
let active = true;
|
|
8498
8819
|
let cleanupSource;
|
|
8499
8820
|
const loadFile = async () => {
|
|
@@ -8552,7 +8873,7 @@ function DocumentViewer(props) {
|
|
|
8552
8873
|
props.fileUrl,
|
|
8553
8874
|
requestedFileType
|
|
8554
8875
|
]);
|
|
8555
|
-
|
|
8876
|
+
useEffect9(() => {
|
|
8556
8877
|
setZoom(1);
|
|
8557
8878
|
setCurrentPage(1);
|
|
8558
8879
|
setSelectedSignature(null);
|
|
@@ -8570,7 +8891,7 @@ function DocumentViewer(props) {
|
|
|
8570
8891
|
setInternalAnnotations([]);
|
|
8571
8892
|
}
|
|
8572
8893
|
}, [mode, props.fileUrl, props.fileName, props.fileType, props.blob, props.base64]);
|
|
8573
|
-
|
|
8894
|
+
useEffect9(() => {
|
|
8574
8895
|
const element = zoomStageRef.current;
|
|
8575
8896
|
if (!element) {
|
|
8576
8897
|
return;
|
|
@@ -8628,7 +8949,7 @@ function DocumentViewer(props) {
|
|
|
8628
8949
|
showSignatures,
|
|
8629
8950
|
showThumbnails
|
|
8630
8951
|
]);
|
|
8631
|
-
|
|
8952
|
+
useEffect9(() => {
|
|
8632
8953
|
const element = mainRef.current;
|
|
8633
8954
|
if (!element) {
|
|
8634
8955
|
return;
|
|
@@ -9008,20 +9329,20 @@ function DocumentViewer(props) {
|
|
|
9008
9329
|
};
|
|
9009
9330
|
const renderContent = () => {
|
|
9010
9331
|
if (error) {
|
|
9011
|
-
return /* @__PURE__ */
|
|
9012
|
-
/* @__PURE__ */
|
|
9013
|
-
/* @__PURE__ */
|
|
9332
|
+
return /* @__PURE__ */ jsx11("div", { className: "hv-status-shell", children: /* @__PURE__ */ jsxs10("div", { className: "hv-error-banner", children: [
|
|
9333
|
+
/* @__PURE__ */ jsx11("strong", { children: locale["error.title"] }),
|
|
9334
|
+
/* @__PURE__ */ jsx11("p", { children: error })
|
|
9014
9335
|
] }) });
|
|
9015
9336
|
}
|
|
9016
9337
|
if (loading || !resolved) {
|
|
9017
|
-
return /* @__PURE__ */
|
|
9018
|
-
/* @__PURE__ */
|
|
9019
|
-
/* @__PURE__ */
|
|
9338
|
+
return /* @__PURE__ */ jsx11("div", { className: "hv-status-shell", children: /* @__PURE__ */ jsxs10("div", { className: "hv-loader", children: [
|
|
9339
|
+
/* @__PURE__ */ jsx11("div", { className: "hv-spinner" }),
|
|
9340
|
+
/* @__PURE__ */ jsx11("span", { children: locale.loading })
|
|
9020
9341
|
] }) });
|
|
9021
9342
|
}
|
|
9022
9343
|
const renderCapabilityNotice = (title, description, variant = "info") => /* @__PURE__ */ jsxs10("div", { className: `hv-info-banner${variant === "warning" ? " warning" : ""}`, children: [
|
|
9023
|
-
/* @__PURE__ */
|
|
9024
|
-
/* @__PURE__ */
|
|
9344
|
+
/* @__PURE__ */ jsx11("strong", { children: title }),
|
|
9345
|
+
/* @__PURE__ */ jsx11("p", { children: description })
|
|
9025
9346
|
] });
|
|
9026
9347
|
const shouldShowModeAdjustedNotice = showModeFallbackNotice || showCreateUnsupportedNotice && hasRenderableSource;
|
|
9027
9348
|
const modeAdjustedNotice = shouldShowModeAdjustedNotice ? renderCapabilityNotice(
|
|
@@ -9032,7 +9353,7 @@ function DocumentViewer(props) {
|
|
|
9032
9353
|
).replace("{fileType}", getReadableFileTypeLabel(resolved.fileType))
|
|
9033
9354
|
) : null;
|
|
9034
9355
|
if (showCreateUnsupportedNotice && !hasRenderableSource) {
|
|
9035
|
-
return /* @__PURE__ */
|
|
9356
|
+
return /* @__PURE__ */ jsx11("div", { className: "hv-page-container", style: { padding: "32px" }, children: renderCapabilityNotice(
|
|
9036
9357
|
locale["documents.createUnsupportedTitle"],
|
|
9037
9358
|
locale["documents.createUnsupportedDescription"].replace(
|
|
9038
9359
|
"{formats}",
|
|
@@ -9057,7 +9378,7 @@ function DocumentViewer(props) {
|
|
|
9057
9378
|
case "pdf":
|
|
9058
9379
|
return /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
9059
9380
|
modeAdjustedNotice,
|
|
9060
|
-
/* @__PURE__ */
|
|
9381
|
+
/* @__PURE__ */ jsx11(
|
|
9061
9382
|
PdfRenderer,
|
|
9062
9383
|
{
|
|
9063
9384
|
url: resolved.url,
|
|
@@ -9073,7 +9394,7 @@ function DocumentViewer(props) {
|
|
|
9073
9394
|
case "md":
|
|
9074
9395
|
return /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
9075
9396
|
modeAdjustedNotice,
|
|
9076
|
-
/* @__PURE__ */
|
|
9397
|
+
/* @__PURE__ */ jsx11(
|
|
9077
9398
|
RichTextEditor,
|
|
9078
9399
|
{
|
|
9079
9400
|
mode: effectiveMode,
|
|
@@ -9087,7 +9408,7 @@ function DocumentViewer(props) {
|
|
|
9087
9408
|
case "xls":
|
|
9088
9409
|
return /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
9089
9410
|
modeAdjustedNotice,
|
|
9090
|
-
/* @__PURE__ */
|
|
9411
|
+
/* @__PURE__ */ jsx11(
|
|
9091
9412
|
SpreadsheetEditor,
|
|
9092
9413
|
{
|
|
9093
9414
|
mode: effectiveMode,
|
|
@@ -9100,7 +9421,7 @@ function DocumentViewer(props) {
|
|
|
9100
9421
|
case "ppt":
|
|
9101
9422
|
return /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
9102
9423
|
modeAdjustedNotice,
|
|
9103
|
-
/* @__PURE__ */
|
|
9424
|
+
/* @__PURE__ */ jsx11(
|
|
9104
9425
|
PptxRenderer,
|
|
9105
9426
|
{
|
|
9106
9427
|
onExportStateChange: setPptxExportState,
|
|
@@ -9116,10 +9437,10 @@ function DocumentViewer(props) {
|
|
|
9116
9437
|
case "svg":
|
|
9117
9438
|
return /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
9118
9439
|
modeAdjustedNotice,
|
|
9119
|
-
/* @__PURE__ */
|
|
9440
|
+
/* @__PURE__ */ jsx11(ImageRenderer, { ...commonProps, fileType: resolved.fileType })
|
|
9120
9441
|
] });
|
|
9121
9442
|
default:
|
|
9122
|
-
return /* @__PURE__ */
|
|
9443
|
+
return /* @__PURE__ */ jsx11("div", { className: "hv-status-shell", children: /* @__PURE__ */ jsxs10("div", { className: "hv-error-banner", children: [
|
|
9123
9444
|
locale["documents.unsupportedFileType"],
|
|
9124
9445
|
": ",
|
|
9125
9446
|
resolved.fileType
|
|
@@ -9127,7 +9448,7 @@ function DocumentViewer(props) {
|
|
|
9127
9448
|
}
|
|
9128
9449
|
};
|
|
9129
9450
|
return /* @__PURE__ */ jsxs10("div", { className: "hv-root", "data-hv-theme": theme, children: [
|
|
9130
|
-
/* @__PURE__ */
|
|
9451
|
+
/* @__PURE__ */ jsx11(
|
|
9131
9452
|
Toolbar,
|
|
9132
9453
|
{
|
|
9133
9454
|
fileName: resolved?.fileName,
|
|
@@ -9175,7 +9496,7 @@ function DocumentViewer(props) {
|
|
|
9175
9496
|
}
|
|
9176
9497
|
),
|
|
9177
9498
|
(props.headerComponent || props.footerComponent) && /* @__PURE__ */ jsxs10("div", { className: "hv-export-slot-host", "aria-hidden": "true", children: [
|
|
9178
|
-
props.headerComponent && /* @__PURE__ */
|
|
9499
|
+
props.headerComponent && /* @__PURE__ */ jsx11(
|
|
9179
9500
|
"div",
|
|
9180
9501
|
{
|
|
9181
9502
|
ref: exportHeaderRef,
|
|
@@ -9183,7 +9504,7 @@ function DocumentViewer(props) {
|
|
|
9183
9504
|
children: props.headerComponent
|
|
9184
9505
|
}
|
|
9185
9506
|
),
|
|
9186
|
-
props.footerComponent && /* @__PURE__ */
|
|
9507
|
+
props.footerComponent && /* @__PURE__ */ jsx11(
|
|
9187
9508
|
"div",
|
|
9188
9509
|
{
|
|
9189
9510
|
ref: exportFooterRef,
|
|
@@ -9193,7 +9514,7 @@ function DocumentViewer(props) {
|
|
|
9193
9514
|
)
|
|
9194
9515
|
] }),
|
|
9195
9516
|
/* @__PURE__ */ jsxs10("div", { className: "hv-shell", children: [
|
|
9196
|
-
/* @__PURE__ */
|
|
9517
|
+
/* @__PURE__ */ jsx11(
|
|
9197
9518
|
ThumbnailsSidebar,
|
|
9198
9519
|
{
|
|
9199
9520
|
isOpen: showThumbnails,
|
|
@@ -9203,15 +9524,15 @@ function DocumentViewer(props) {
|
|
|
9203
9524
|
locale
|
|
9204
9525
|
}
|
|
9205
9526
|
),
|
|
9206
|
-
/* @__PURE__ */
|
|
9527
|
+
/* @__PURE__ */ jsx11(
|
|
9207
9528
|
"main",
|
|
9208
9529
|
{
|
|
9209
9530
|
ref: mainRef,
|
|
9210
9531
|
className: `hv-main${isRichTextAuthoringMode ? " hv-main-richtext-authoring" : ""}`,
|
|
9211
|
-
children: /* @__PURE__ */
|
|
9532
|
+
children: /* @__PURE__ */ jsx11("div", { className: "hv-zoom-shell", style: zoomShellStyle, children: /* @__PURE__ */ jsx11("div", { ref: zoomStageRef, className: "hv-zoom-stage", style: zoomStageStyle, children: renderContent() }) })
|
|
9212
9533
|
}
|
|
9213
9534
|
),
|
|
9214
|
-
signingEnabled && /* @__PURE__ */
|
|
9535
|
+
signingEnabled && /* @__PURE__ */ jsx11(
|
|
9215
9536
|
SignaturePanel,
|
|
9216
9537
|
{
|
|
9217
9538
|
isOpen: showSignatures,
|