@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.cjs
CHANGED
|
@@ -65,15 +65,18 @@ __export(index_exports, {
|
|
|
65
65
|
module.exports = __toCommonJS(index_exports);
|
|
66
66
|
|
|
67
67
|
// src/components/DocumentViewer.tsx
|
|
68
|
-
var
|
|
68
|
+
var import_react10 = require("react");
|
|
69
69
|
|
|
70
70
|
// src/editors/RichTextEditor.tsx
|
|
71
71
|
var import_mammoth = __toESM(require("mammoth"), 1);
|
|
72
|
-
var
|
|
72
|
+
var import_react3 = require("react");
|
|
73
73
|
var import_markdown_it = __toESM(require("markdown-it"), 1);
|
|
74
74
|
|
|
75
75
|
// src/components/SignatureOverlay.tsx
|
|
76
76
|
var import_lucide_react = require("lucide-react");
|
|
77
|
+
var import_react2 = require("react");
|
|
78
|
+
|
|
79
|
+
// src/components/RenderableSignatureImage.tsx
|
|
77
80
|
var import_react = require("react");
|
|
78
81
|
|
|
79
82
|
// src/utils/signature.ts
|
|
@@ -155,8 +158,267 @@ function normalizeSignaturePlacement(placement) {
|
|
|
155
158
|
};
|
|
156
159
|
}
|
|
157
160
|
|
|
158
|
-
// src/
|
|
161
|
+
// src/utils/signatureImage.ts
|
|
162
|
+
var processedSignatureCache = /* @__PURE__ */ new Map();
|
|
163
|
+
function ensureSignatureSource(source) {
|
|
164
|
+
const trimmedSource = source.trim();
|
|
165
|
+
if (trimmedSource.startsWith("data:") || trimmedSource.startsWith("blob:") || trimmedSource.startsWith("http:") || trimmedSource.startsWith("https:")) {
|
|
166
|
+
return trimmedSource;
|
|
167
|
+
}
|
|
168
|
+
if (trimmedSource.startsWith("//") && typeof window !== "undefined") {
|
|
169
|
+
return `${window.location.protocol}${trimmedSource}`;
|
|
170
|
+
}
|
|
171
|
+
if (typeof window !== "undefined" && (trimmedSource.startsWith("/") || trimmedSource.startsWith("./") || trimmedSource.startsWith("../"))) {
|
|
172
|
+
return new URL(trimmedSource, window.location.origin).toString();
|
|
173
|
+
}
|
|
174
|
+
if (trimmedSource.startsWith("<svg") || trimmedSource.startsWith("<?xml") && trimmedSource.includes("<svg")) {
|
|
175
|
+
return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(trimmedSource)}`;
|
|
176
|
+
}
|
|
177
|
+
return `data:image/png;base64,${trimmedSource}`;
|
|
178
|
+
}
|
|
179
|
+
function createCanvas(width, height) {
|
|
180
|
+
const canvas = document.createElement("canvas");
|
|
181
|
+
canvas.width = Math.max(1, Math.round(width));
|
|
182
|
+
canvas.height = Math.max(1, Math.round(height));
|
|
183
|
+
return canvas;
|
|
184
|
+
}
|
|
185
|
+
async function loadSignatureImage(source) {
|
|
186
|
+
const image = new Image();
|
|
187
|
+
image.crossOrigin = "anonymous";
|
|
188
|
+
image.decoding = "async";
|
|
189
|
+
await new Promise((resolve, reject) => {
|
|
190
|
+
image.onload = () => resolve();
|
|
191
|
+
image.onerror = () => reject(new Error("Unable to load signature image."));
|
|
192
|
+
image.src = source;
|
|
193
|
+
});
|
|
194
|
+
if ("decode" in image) {
|
|
195
|
+
try {
|
|
196
|
+
await image.decode();
|
|
197
|
+
} catch {
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return image;
|
|
201
|
+
}
|
|
202
|
+
function colorDistance(leftRed, leftGreen, leftBlue, rightRed, rightGreen, rightBlue) {
|
|
203
|
+
const deltaRed = leftRed - rightRed;
|
|
204
|
+
const deltaGreen = leftGreen - rightGreen;
|
|
205
|
+
const deltaBlue = leftBlue - rightBlue;
|
|
206
|
+
return Math.sqrt(
|
|
207
|
+
deltaRed * deltaRed + deltaGreen * deltaGreen + deltaBlue * deltaBlue
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
function hasMeaningfulTransparency(pixels) {
|
|
211
|
+
let translucentPixels = 0;
|
|
212
|
+
const totalPixels = pixels.length / 4;
|
|
213
|
+
for (let index = 3; index < pixels.length; index += 4) {
|
|
214
|
+
if (pixels[index] < 250) {
|
|
215
|
+
translucentPixels += 1;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return translucentPixels > Math.max(12, totalPixels * 4e-3);
|
|
219
|
+
}
|
|
220
|
+
function detectUniformBackground(pixels, width, height) {
|
|
221
|
+
const sampleRadius = Math.max(2, Math.min(12, Math.floor(Math.min(width, height) / 12)));
|
|
222
|
+
const sampleOrigins = [
|
|
223
|
+
[0, 0],
|
|
224
|
+
[Math.max(0, width - sampleRadius), 0],
|
|
225
|
+
[0, Math.max(0, height - sampleRadius)],
|
|
226
|
+
[Math.max(0, width - sampleRadius), Math.max(0, height - sampleRadius)]
|
|
227
|
+
];
|
|
228
|
+
const samples = [];
|
|
229
|
+
for (const [startX, startY] of sampleOrigins) {
|
|
230
|
+
let red = 0;
|
|
231
|
+
let green = 0;
|
|
232
|
+
let blue = 0;
|
|
233
|
+
let count = 0;
|
|
234
|
+
for (let y = startY; y < Math.min(height, startY + sampleRadius); y += 1) {
|
|
235
|
+
for (let x = startX; x < Math.min(width, startX + sampleRadius); x += 1) {
|
|
236
|
+
const offset = (y * width + x) * 4;
|
|
237
|
+
const alpha = pixels[offset + 3];
|
|
238
|
+
if (alpha < 250) {
|
|
239
|
+
continue;
|
|
240
|
+
}
|
|
241
|
+
red += pixels[offset];
|
|
242
|
+
green += pixels[offset + 1];
|
|
243
|
+
blue += pixels[offset + 2];
|
|
244
|
+
count += 1;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
if (count === 0) {
|
|
248
|
+
return null;
|
|
249
|
+
}
|
|
250
|
+
samples.push([
|
|
251
|
+
Math.round(red / count),
|
|
252
|
+
Math.round(green / count),
|
|
253
|
+
Math.round(blue / count)
|
|
254
|
+
]);
|
|
255
|
+
}
|
|
256
|
+
if (samples.length === 0) {
|
|
257
|
+
return null;
|
|
258
|
+
}
|
|
259
|
+
const average = samples.reduce(
|
|
260
|
+
(accumulator, sample) => [
|
|
261
|
+
accumulator[0] + sample[0],
|
|
262
|
+
accumulator[1] + sample[1],
|
|
263
|
+
accumulator[2] + sample[2]
|
|
264
|
+
],
|
|
265
|
+
[0, 0, 0]
|
|
266
|
+
);
|
|
267
|
+
const background = [
|
|
268
|
+
Math.round(average[0] / samples.length),
|
|
269
|
+
Math.round(average[1] / samples.length),
|
|
270
|
+
Math.round(average[2] / samples.length)
|
|
271
|
+
];
|
|
272
|
+
const maxDistance = samples.reduce((highest, sample) => {
|
|
273
|
+
const distance = colorDistance(
|
|
274
|
+
sample[0],
|
|
275
|
+
sample[1],
|
|
276
|
+
sample[2],
|
|
277
|
+
background[0],
|
|
278
|
+
background[1],
|
|
279
|
+
background[2]
|
|
280
|
+
);
|
|
281
|
+
return Math.max(highest, distance);
|
|
282
|
+
}, 0);
|
|
283
|
+
return maxDistance <= 26 ? background : null;
|
|
284
|
+
}
|
|
285
|
+
function createTintedSignatureFromAlpha(pixels, width, height, inkColor) {
|
|
286
|
+
const canvas = createCanvas(width, height);
|
|
287
|
+
const context = canvas.getContext("2d");
|
|
288
|
+
if (!context) {
|
|
289
|
+
return null;
|
|
290
|
+
}
|
|
291
|
+
const output = context.createImageData(width, height);
|
|
292
|
+
for (let offset = 0; offset < pixels.length; offset += 4) {
|
|
293
|
+
output.data[offset] = inkColor[0];
|
|
294
|
+
output.data[offset + 1] = inkColor[1];
|
|
295
|
+
output.data[offset + 2] = inkColor[2];
|
|
296
|
+
output.data[offset + 3] = pixels[offset + 3];
|
|
297
|
+
}
|
|
298
|
+
context.putImageData(output, 0, 0);
|
|
299
|
+
return canvas;
|
|
300
|
+
}
|
|
301
|
+
function createTintedSignatureFromSolidBackground(pixels, width, height, background, inkColor) {
|
|
302
|
+
const canvas = createCanvas(width, height);
|
|
303
|
+
const context = canvas.getContext("2d");
|
|
304
|
+
if (!context) {
|
|
305
|
+
return null;
|
|
306
|
+
}
|
|
307
|
+
const output = context.createImageData(width, height);
|
|
308
|
+
let foregroundPixels = 0;
|
|
309
|
+
const totalPixels = width * height;
|
|
310
|
+
for (let offset = 0; offset < pixels.length; offset += 4) {
|
|
311
|
+
const alpha = pixels[offset + 3] / 255;
|
|
312
|
+
const distance = colorDistance(
|
|
313
|
+
pixels[offset],
|
|
314
|
+
pixels[offset + 1],
|
|
315
|
+
pixels[offset + 2],
|
|
316
|
+
background[0],
|
|
317
|
+
background[1],
|
|
318
|
+
background[2]
|
|
319
|
+
);
|
|
320
|
+
const normalizedStrength = Math.max(0, Math.min(1, (distance - 14) / 120));
|
|
321
|
+
const outputAlpha = Math.round(normalizedStrength * alpha * 255);
|
|
322
|
+
output.data[offset] = inkColor[0];
|
|
323
|
+
output.data[offset + 1] = inkColor[1];
|
|
324
|
+
output.data[offset + 2] = inkColor[2];
|
|
325
|
+
output.data[offset + 3] = outputAlpha;
|
|
326
|
+
if (outputAlpha > 10) {
|
|
327
|
+
foregroundPixels += 1;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
if (foregroundPixels < Math.max(24, totalPixels * 15e-4) || foregroundPixels > totalPixels * 0.42) {
|
|
331
|
+
return null;
|
|
332
|
+
}
|
|
333
|
+
context.putImageData(output, 0, 0);
|
|
334
|
+
return canvas;
|
|
335
|
+
}
|
|
336
|
+
function parseInkColor(inkColor) {
|
|
337
|
+
const hex = SIGNATURE_INK_COLOR_VALUES[inkColor];
|
|
338
|
+
return [
|
|
339
|
+
Number.parseInt(hex.slice(1, 3), 16),
|
|
340
|
+
Number.parseInt(hex.slice(3, 5), 16),
|
|
341
|
+
Number.parseInt(hex.slice(5, 7), 16)
|
|
342
|
+
];
|
|
343
|
+
}
|
|
344
|
+
async function getRenderableSignatureImage(source, inkColor) {
|
|
345
|
+
const resolvedSource = ensureSignatureSource(source);
|
|
346
|
+
const normalizedInkColor = normalizeSignatureInkColor(inkColor);
|
|
347
|
+
const cacheKey = `${normalizedInkColor}::${resolvedSource}`;
|
|
348
|
+
const cached = processedSignatureCache.get(cacheKey);
|
|
349
|
+
if (cached) {
|
|
350
|
+
return cached;
|
|
351
|
+
}
|
|
352
|
+
const pending = (async () => {
|
|
353
|
+
const image = await loadSignatureImage(resolvedSource);
|
|
354
|
+
const canvas = createCanvas(image.width, image.height);
|
|
355
|
+
const context = canvas.getContext("2d");
|
|
356
|
+
if (!context) {
|
|
357
|
+
return resolvedSource;
|
|
358
|
+
}
|
|
359
|
+
context.drawImage(image, 0, 0, image.width, image.height);
|
|
360
|
+
let imageData;
|
|
361
|
+
try {
|
|
362
|
+
imageData = context.getImageData(0, 0, canvas.width, canvas.height);
|
|
363
|
+
} catch {
|
|
364
|
+
return resolvedSource;
|
|
365
|
+
}
|
|
366
|
+
const inkRgb = parseInkColor(normalizedInkColor);
|
|
367
|
+
const transparentRender = hasMeaningfulTransparency(imageData.data) ? createTintedSignatureFromAlpha(
|
|
368
|
+
imageData.data,
|
|
369
|
+
canvas.width,
|
|
370
|
+
canvas.height,
|
|
371
|
+
inkRgb
|
|
372
|
+
) : null;
|
|
373
|
+
if (transparentRender) {
|
|
374
|
+
return transparentRender.toDataURL("image/png");
|
|
375
|
+
}
|
|
376
|
+
const background = detectUniformBackground(
|
|
377
|
+
imageData.data,
|
|
378
|
+
canvas.width,
|
|
379
|
+
canvas.height
|
|
380
|
+
);
|
|
381
|
+
if (!background) {
|
|
382
|
+
return resolvedSource;
|
|
383
|
+
}
|
|
384
|
+
const extractedRender = createTintedSignatureFromSolidBackground(
|
|
385
|
+
imageData.data,
|
|
386
|
+
canvas.width,
|
|
387
|
+
canvas.height,
|
|
388
|
+
background,
|
|
389
|
+
inkRgb
|
|
390
|
+
);
|
|
391
|
+
return extractedRender ? extractedRender.toDataURL("image/png") : resolvedSource;
|
|
392
|
+
})().catch(() => resolvedSource);
|
|
393
|
+
processedSignatureCache.set(cacheKey, pending);
|
|
394
|
+
return pending;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// src/components/RenderableSignatureImage.tsx
|
|
159
398
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
399
|
+
function RenderableSignatureImage(props) {
|
|
400
|
+
const { signatureImageUrl, inkColor, ...imageProps } = props;
|
|
401
|
+
const [resolvedSrc, setResolvedSrc] = (0, import_react.useState)(signatureImageUrl);
|
|
402
|
+
(0, import_react.useEffect)(() => {
|
|
403
|
+
let cancelled = false;
|
|
404
|
+
void getRenderableSignatureImage(signatureImageUrl, inkColor).then((nextSource) => {
|
|
405
|
+
if (!cancelled) {
|
|
406
|
+
setResolvedSrc(nextSource);
|
|
407
|
+
}
|
|
408
|
+
}).catch(() => {
|
|
409
|
+
if (!cancelled) {
|
|
410
|
+
setResolvedSrc(signatureImageUrl);
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
return () => {
|
|
414
|
+
cancelled = true;
|
|
415
|
+
};
|
|
416
|
+
}, [inkColor, signatureImageUrl]);
|
|
417
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { ...imageProps, src: resolvedSrc, decoding: "async", draggable: false });
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
// src/components/SignatureOverlay.tsx
|
|
421
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
160
422
|
function clamp(value, min, max) {
|
|
161
423
|
return Math.min(max, Math.max(min, value));
|
|
162
424
|
}
|
|
@@ -189,9 +451,6 @@ function getLinkedAnnotationIds(annotations) {
|
|
|
189
451
|
annotations.filter((annotation) => annotation.linkedSignaturePlacementId).map((annotation) => annotation.linkedSignaturePlacementId)
|
|
190
452
|
);
|
|
191
453
|
}
|
|
192
|
-
function buildMaskImageValue(source) {
|
|
193
|
-
return `url("${source.replaceAll('"', '\\"')}")`;
|
|
194
|
-
}
|
|
195
454
|
function SignatureOverlay(props) {
|
|
196
455
|
const {
|
|
197
456
|
surfaceKey,
|
|
@@ -228,22 +487,22 @@ function SignatureOverlay(props) {
|
|
|
228
487
|
onSelectPlacement,
|
|
229
488
|
onSelectAnnotation
|
|
230
489
|
} = props;
|
|
231
|
-
const layerRef = (0,
|
|
232
|
-
const [dragState, setDragState] = (0,
|
|
233
|
-
const visiblePlacements = (0,
|
|
490
|
+
const layerRef = (0, import_react2.useRef)(null);
|
|
491
|
+
const [dragState, setDragState] = (0, import_react2.useState)(null);
|
|
492
|
+
const visiblePlacements = (0, import_react2.useMemo)(
|
|
234
493
|
() => placements.filter((placement) => placement.surfaceKey === surfaceKey),
|
|
235
494
|
[placements, surfaceKey]
|
|
236
495
|
);
|
|
237
|
-
const visibleAnnotations = (0,
|
|
496
|
+
const visibleAnnotations = (0, import_react2.useMemo)(
|
|
238
497
|
() => annotations.filter((annotation) => annotation.surfaceKey === surfaceKey),
|
|
239
498
|
[annotations, surfaceKey]
|
|
240
499
|
);
|
|
241
|
-
const linkedAnnotationIds = (0,
|
|
500
|
+
const linkedAnnotationIds = (0, import_react2.useMemo)(
|
|
242
501
|
() => getLinkedAnnotationIds(visibleAnnotations),
|
|
243
502
|
[visibleAnnotations]
|
|
244
503
|
);
|
|
245
504
|
const captureMode = pendingSignature ? "signature" : pendingAnnotation ? "annotation" : null;
|
|
246
|
-
(0,
|
|
505
|
+
(0, import_react2.useEffect)(() => {
|
|
247
506
|
if (captureMode || dragState) {
|
|
248
507
|
return;
|
|
249
508
|
}
|
|
@@ -262,7 +521,7 @@ function SignatureOverlay(props) {
|
|
|
262
521
|
window.removeEventListener("pointerdown", handlePointerDown, true);
|
|
263
522
|
};
|
|
264
523
|
}, [captureMode, dragState, onSelectAnnotation, onSelectPlacement]);
|
|
265
|
-
(0,
|
|
524
|
+
(0, import_react2.useEffect)(() => {
|
|
266
525
|
if (!dragState) {
|
|
267
526
|
return;
|
|
268
527
|
}
|
|
@@ -408,8 +667,8 @@ function SignatureOverlay(props) {
|
|
|
408
667
|
rect: layerRef.current.getBoundingClientRect()
|
|
409
668
|
});
|
|
410
669
|
};
|
|
411
|
-
return /* @__PURE__ */ (0,
|
|
412
|
-
captureMode && /* @__PURE__ */ (0,
|
|
670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { ref: layerRef, className: "hv-signature-overlay", children: [
|
|
671
|
+
captureMode && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "hv-signature-overlay-capture", onClick: handlePlace, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "hv-signature-overlay-hint", children: captureMode === "annotation" ? annotationHint : placeHint }) }),
|
|
413
672
|
visiblePlacements.map((placement) => {
|
|
414
673
|
const isActive = placement.id === activePlacementId;
|
|
415
674
|
const hasLinkedAnnotation = linkedAnnotationIds.has(placement.id);
|
|
@@ -417,8 +676,7 @@ function SignatureOverlay(props) {
|
|
|
417
676
|
const jobTitle = placement.signature.jobTitle?.trim();
|
|
418
677
|
const signedDate = normalizeSignatureDate(placement.signature.dateSigned);
|
|
419
678
|
const signatureColor = normalizeSignatureInkColor(placement.signatureColor);
|
|
420
|
-
|
|
421
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
679
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
422
680
|
"div",
|
|
423
681
|
{
|
|
424
682
|
className: `hv-signature-stamp ${isActive ? "active" : ""}`,
|
|
@@ -443,7 +701,7 @@ function SignatureOverlay(props) {
|
|
|
443
701
|
onSelectAnnotation(null);
|
|
444
702
|
},
|
|
445
703
|
children: [
|
|
446
|
-
isActive && /* @__PURE__ */ (0,
|
|
704
|
+
isActive && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
447
705
|
"button",
|
|
448
706
|
{
|
|
449
707
|
type: "button",
|
|
@@ -459,26 +717,22 @@ function SignatureOverlay(props) {
|
|
|
459
717
|
children: "x"
|
|
460
718
|
}
|
|
461
719
|
),
|
|
462
|
-
/* @__PURE__ */ (0,
|
|
463
|
-
|
|
720
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "hv-signature-image-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
721
|
+
RenderableSignatureImage,
|
|
464
722
|
{
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
backgroundColor: SIGNATURE_INK_COLOR_VALUES[signatureColor],
|
|
470
|
-
maskImage,
|
|
471
|
-
WebkitMaskImage: maskImage
|
|
472
|
-
}
|
|
723
|
+
signatureImageUrl: placement.signature.signatureImageUrl,
|
|
724
|
+
inkColor: signatureColor,
|
|
725
|
+
alt: signer ? `${signatureAltByLabel} ${signer}` : signatureAltLabel,
|
|
726
|
+
className: "hv-signature-image"
|
|
473
727
|
}
|
|
474
728
|
) }),
|
|
475
|
-
/* @__PURE__ */ (0,
|
|
476
|
-
signer && /* @__PURE__ */ (0,
|
|
477
|
-
jobTitle && /* @__PURE__ */ (0,
|
|
478
|
-
/* @__PURE__ */ (0,
|
|
729
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "hv-signature-meta", children: [
|
|
730
|
+
signer && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "hv-signature-meta-name", children: signer }),
|
|
731
|
+
jobTitle && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "hv-signature-meta-jobtitle", children: jobTitle }),
|
|
732
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "hv-signature-meta-date", children: signedDate })
|
|
479
733
|
] }),
|
|
480
|
-
hasLinkedAnnotation && /* @__PURE__ */ (0,
|
|
481
|
-
isActive && /* @__PURE__ */ (0,
|
|
734
|
+
hasLinkedAnnotation && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "hv-signature-note-indicator", children: signatureNoteIndicatorLabel }),
|
|
735
|
+
isActive && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
482
736
|
"div",
|
|
483
737
|
{
|
|
484
738
|
className: "hv-signature-color-toolbar",
|
|
@@ -489,8 +743,8 @@ function SignatureOverlay(props) {
|
|
|
489
743
|
event.stopPropagation();
|
|
490
744
|
},
|
|
491
745
|
children: [
|
|
492
|
-
/* @__PURE__ */ (0,
|
|
493
|
-
/* @__PURE__ */ (0,
|
|
746
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "hv-signature-color-toolbar-label", children: signatureColorLabel }),
|
|
747
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "hv-signature-color-swatch-row", children: SIGNATURE_INK_COLORS.map((color) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
494
748
|
"button",
|
|
495
749
|
{
|
|
496
750
|
type: "button",
|
|
@@ -505,7 +759,7 @@ function SignatureOverlay(props) {
|
|
|
505
759
|
]
|
|
506
760
|
}
|
|
507
761
|
),
|
|
508
|
-
isActive && /* @__PURE__ */ (0,
|
|
762
|
+
isActive && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
509
763
|
"div",
|
|
510
764
|
{
|
|
511
765
|
className: "hv-signature-resize",
|
|
@@ -526,7 +780,7 @@ function SignatureOverlay(props) {
|
|
|
526
780
|
const isLinked = Boolean(annotation.linkedSignaturePlacementId);
|
|
527
781
|
const hasText = annotation.text.trim().length > 0;
|
|
528
782
|
if (!isActive) {
|
|
529
|
-
return /* @__PURE__ */ (0,
|
|
783
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
530
784
|
"button",
|
|
531
785
|
{
|
|
532
786
|
type: "button",
|
|
@@ -542,12 +796,12 @@ function SignatureOverlay(props) {
|
|
|
542
796
|
onSelectAnnotation(annotation.id);
|
|
543
797
|
onSelectPlacement(null);
|
|
544
798
|
},
|
|
545
|
-
children: /* @__PURE__ */ (0,
|
|
799
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react.MessageSquare, { size: 14 })
|
|
546
800
|
},
|
|
547
801
|
annotation.id
|
|
548
802
|
);
|
|
549
803
|
}
|
|
550
|
-
return /* @__PURE__ */ (0,
|
|
804
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
551
805
|
"div",
|
|
552
806
|
{
|
|
553
807
|
className: `hv-annotation-card ${isActive ? "active" : ""} ${isLinked ? "linked" : ""}`,
|
|
@@ -563,7 +817,7 @@ function SignatureOverlay(props) {
|
|
|
563
817
|
onSelectPlacement(null);
|
|
564
818
|
},
|
|
565
819
|
children: [
|
|
566
|
-
/* @__PURE__ */ (0,
|
|
820
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
567
821
|
"div",
|
|
568
822
|
{
|
|
569
823
|
className: "hv-annotation-header",
|
|
@@ -581,11 +835,11 @@ function SignatureOverlay(props) {
|
|
|
581
835
|
);
|
|
582
836
|
},
|
|
583
837
|
children: [
|
|
584
|
-
/* @__PURE__ */ (0,
|
|
585
|
-
/* @__PURE__ */ (0,
|
|
586
|
-
isLinked && /* @__PURE__ */ (0,
|
|
838
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "hv-annotation-header-copy", children: [
|
|
839
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "hv-annotation-title", children: isLinked ? linkedAnnotationTitle : annotationTitle }),
|
|
840
|
+
isLinked && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "hv-annotation-badge", children: linkedAnnotationBadge })
|
|
587
841
|
] }),
|
|
588
|
-
isActive && /* @__PURE__ */ (0,
|
|
842
|
+
isActive && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
589
843
|
"button",
|
|
590
844
|
{
|
|
591
845
|
type: "button",
|
|
@@ -604,7 +858,7 @@ function SignatureOverlay(props) {
|
|
|
604
858
|
]
|
|
605
859
|
}
|
|
606
860
|
),
|
|
607
|
-
/* @__PURE__ */ (0,
|
|
861
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "hv-annotation-body", children: isActive ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
608
862
|
"textarea",
|
|
609
863
|
{
|
|
610
864
|
value: annotation.text,
|
|
@@ -618,14 +872,14 @@ function SignatureOverlay(props) {
|
|
|
618
872
|
event.stopPropagation();
|
|
619
873
|
}
|
|
620
874
|
}
|
|
621
|
-
) : /* @__PURE__ */ (0,
|
|
875
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
622
876
|
"div",
|
|
623
877
|
{
|
|
624
878
|
className: `hv-annotation-preview ${hasText ? "" : "empty"}`,
|
|
625
879
|
children: hasText ? annotation.text : annotationPlaceholder
|
|
626
880
|
}
|
|
627
881
|
) }),
|
|
628
|
-
isActive && /* @__PURE__ */ (0,
|
|
882
|
+
isActive && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
629
883
|
"div",
|
|
630
884
|
{
|
|
631
885
|
className: "hv-annotation-resize",
|
|
@@ -1460,7 +1714,7 @@ function ensureImageSource(source) {
|
|
|
1460
1714
|
}
|
|
1461
1715
|
return `data:image/png;base64,${trimmedSource}`;
|
|
1462
1716
|
}
|
|
1463
|
-
function
|
|
1717
|
+
function createCanvas2(width, height) {
|
|
1464
1718
|
const canvas = document.createElement("canvas");
|
|
1465
1719
|
canvas.width = Math.max(1, Math.round(width));
|
|
1466
1720
|
canvas.height = Math.max(1, Math.round(height));
|
|
@@ -1501,7 +1755,7 @@ async function tryLoadImage(source) {
|
|
|
1501
1755
|
}
|
|
1502
1756
|
}
|
|
1503
1757
|
function getOpaqueImageBounds(image, alphaThreshold = 8) {
|
|
1504
|
-
const canvas =
|
|
1758
|
+
const canvas = createCanvas2(image.width, image.height);
|
|
1505
1759
|
const ctx = canvas.getContext("2d");
|
|
1506
1760
|
if (!ctx) {
|
|
1507
1761
|
return {
|
|
@@ -1852,7 +2106,7 @@ async function renderDecorationCanvasFromModel(model, kind) {
|
|
|
1852
2106
|
}
|
|
1853
2107
|
const canvasWidth = 1600;
|
|
1854
2108
|
const canvasHeight = kind === "header" ? 146 : 88;
|
|
1855
|
-
const canvas =
|
|
2109
|
+
const canvas = createCanvas2(canvasWidth, canvasHeight);
|
|
1856
2110
|
const ctx = canvas.getContext("2d");
|
|
1857
2111
|
if (!ctx) {
|
|
1858
2112
|
return null;
|
|
@@ -2052,7 +2306,7 @@ function applyPageDecorationsToCanvas(baseCanvas, decorations) {
|
|
|
2052
2306
|
if (!decorations?.headerCanvas && !decorations?.footerCanvas) {
|
|
2053
2307
|
return baseCanvas;
|
|
2054
2308
|
}
|
|
2055
|
-
const pageCanvas =
|
|
2309
|
+
const pageCanvas = createCanvas2(baseCanvas.width, baseCanvas.height);
|
|
2056
2310
|
const ctx = pageCanvas.getContext("2d");
|
|
2057
2311
|
if (!ctx) {
|
|
2058
2312
|
return baseCanvas;
|
|
@@ -2099,19 +2353,6 @@ function applyPageDecorationsToCanvas(baseCanvas, decorations) {
|
|
|
2099
2353
|
function formatSignedDate(value) {
|
|
2100
2354
|
return normalizeSignatureDate(value);
|
|
2101
2355
|
}
|
|
2102
|
-
function createTintedImageCanvas(image, signatureColor) {
|
|
2103
|
-
const tintedCanvas = createCanvas(image.width, image.height);
|
|
2104
|
-
const tintedCtx = tintedCanvas.getContext("2d");
|
|
2105
|
-
if (!tintedCtx) {
|
|
2106
|
-
return null;
|
|
2107
|
-
}
|
|
2108
|
-
tintedCtx.drawImage(image, 0, 0);
|
|
2109
|
-
tintedCtx.globalCompositeOperation = "source-in";
|
|
2110
|
-
tintedCtx.fillStyle = signatureColor;
|
|
2111
|
-
tintedCtx.fillRect(0, 0, tintedCanvas.width, tintedCanvas.height);
|
|
2112
|
-
tintedCtx.globalCompositeOperation = "source-over";
|
|
2113
|
-
return tintedCanvas;
|
|
2114
|
-
}
|
|
2115
2356
|
async function drawSignatureStamp(ctx, placement, x, y, width, height, options) {
|
|
2116
2357
|
const isSlideStamp = placement.surfaceKind === "slide";
|
|
2117
2358
|
const borderless = options?.borderless ?? false;
|
|
@@ -2121,12 +2362,12 @@ async function drawSignatureStamp(ctx, placement, x, y, width, height, options)
|
|
|
2121
2362
|
isSlideStamp ? 46 : 40,
|
|
2122
2363
|
height * (isSlideStamp ? 0.36 : 0.32)
|
|
2123
2364
|
);
|
|
2124
|
-
const signatureImage = await loadImage(placement.signature.signatureImageUrl);
|
|
2125
2365
|
const signatureColor = normalizeSignatureInkColor(placement.signatureColor);
|
|
2126
|
-
const
|
|
2127
|
-
|
|
2128
|
-
|
|
2366
|
+
const renderableSignatureImage = await getRenderableSignatureImage(
|
|
2367
|
+
placement.signature.signatureImageUrl,
|
|
2368
|
+
signatureColor
|
|
2129
2369
|
);
|
|
2370
|
+
const signatureImage = await loadImage(renderableSignatureImage);
|
|
2130
2371
|
const imageBounds = getOpaqueImageBounds(signatureImage);
|
|
2131
2372
|
const signer = placement.signature.signedBy?.trim() || "";
|
|
2132
2373
|
const jobTitle = placement.signature.jobTitle?.trim() || "";
|
|
@@ -2157,7 +2398,7 @@ async function drawSignatureStamp(ctx, placement, x, y, width, height, options)
|
|
|
2157
2398
|
const imageBaseY = isSlideStamp ? y : y + padding;
|
|
2158
2399
|
const imageY = imageBaseY + Math.max(imageAreaHeight - imageHeight, 0) * (isSlideStamp ? 0.7 : 0.18);
|
|
2159
2400
|
ctx.drawImage(
|
|
2160
|
-
|
|
2401
|
+
signatureImage,
|
|
2161
2402
|
imageBounds.sx,
|
|
2162
2403
|
imageBounds.sy,
|
|
2163
2404
|
imageBounds.sw,
|
|
@@ -2355,7 +2596,7 @@ async function createSignatureStampDataUrl(placement, width, height) {
|
|
|
2355
2596
|
const aspectRatio = placement.width > 0 && placement.height > 0 ? placement.width / placement.height : 3.1;
|
|
2356
2597
|
const targetHeight = height ?? (placement.surfaceKind === "slide" ? 320 : 260);
|
|
2357
2598
|
const targetWidth = width ?? Math.max(480, Math.round(targetHeight * aspectRatio));
|
|
2358
|
-
const canvas =
|
|
2599
|
+
const canvas = createCanvas2(targetWidth, targetHeight);
|
|
2359
2600
|
const ctx = canvas.getContext("2d");
|
|
2360
2601
|
if (!ctx) {
|
|
2361
2602
|
throw new Error("Unable to render the signature stamp.");
|
|
@@ -2364,7 +2605,7 @@ async function createSignatureStampDataUrl(placement, width, height) {
|
|
|
2364
2605
|
return canvas.toDataURL("image/png");
|
|
2365
2606
|
}
|
|
2366
2607
|
async function createAnnotationCardDataUrl(annotation, width = 720, height = 360, labels = defaultExportLocaleLabels) {
|
|
2367
|
-
const canvas =
|
|
2608
|
+
const canvas = createCanvas2(width, height);
|
|
2368
2609
|
const ctx = canvas.getContext("2d");
|
|
2369
2610
|
if (!ctx) {
|
|
2370
2611
|
throw new Error("Unable to render the annotation.");
|
|
@@ -2689,7 +2930,7 @@ function splitTallCanvas(canvas) {
|
|
|
2689
2930
|
}
|
|
2690
2931
|
for (let offset = 0; offset < canvas.height; offset += maxSliceHeight) {
|
|
2691
2932
|
const sliceHeight = Math.min(maxSliceHeight, canvas.height - offset);
|
|
2692
|
-
const sliceCanvas =
|
|
2933
|
+
const sliceCanvas = createCanvas2(canvas.width, sliceHeight);
|
|
2693
2934
|
const ctx = sliceCanvas.getContext("2d");
|
|
2694
2935
|
if (!ctx) {
|
|
2695
2936
|
continue;
|
|
@@ -2824,7 +3065,7 @@ async function renderSlidesToCanvases(exportState, placements, annotations, labe
|
|
|
2824
3065
|
const scale = targetWidth / slideWidth;
|
|
2825
3066
|
const canvases = [];
|
|
2826
3067
|
for (const [index, slide] of exportState.slides.entries()) {
|
|
2827
|
-
const canvas =
|
|
3068
|
+
const canvas = createCanvas2(slideWidth * scale, slideHeight * scale);
|
|
2828
3069
|
const ctx = canvas.getContext("2d");
|
|
2829
3070
|
if (!ctx) {
|
|
2830
3071
|
continue;
|
|
@@ -2942,7 +3183,7 @@ async function renderSlidesToCanvases(exportState, placements, annotations, labe
|
|
|
2942
3183
|
);
|
|
2943
3184
|
canvases.push(canvas);
|
|
2944
3185
|
}
|
|
2945
|
-
return canvases.length > 0 ? canvases : [
|
|
3186
|
+
return canvases.length > 0 ? canvases : [createCanvas2(1280, 720)];
|
|
2946
3187
|
}
|
|
2947
3188
|
function createSheetMergeLookup(merges) {
|
|
2948
3189
|
const starts = /* @__PURE__ */ new Map();
|
|
@@ -3108,7 +3349,7 @@ async function renderSheetsToCanvases(sheets, placements, annotations, labels =
|
|
|
3108
3349
|
const visibleRowHeights = sheet.rowHeights.slice(0, sheet.renderedRowCount);
|
|
3109
3350
|
const totalWidth = SHEET_ROW_HEADER_WIDTH + visibleColWidths.reduce((sum, value) => sum + value, 0);
|
|
3110
3351
|
const totalHeight = SHEET_COLUMN_HEADER_HEIGHT + visibleRowHeights.reduce((sum, value) => sum + value, 0);
|
|
3111
|
-
const canvas =
|
|
3352
|
+
const canvas = createCanvas2(totalWidth, totalHeight);
|
|
3112
3353
|
const ctx = canvas.getContext("2d");
|
|
3113
3354
|
if (!ctx) {
|
|
3114
3355
|
continue;
|
|
@@ -3233,7 +3474,7 @@ async function exportSignedPdfDocument(args) {
|
|
|
3233
3474
|
for (let pageNumber = 1; pageNumber <= pdf.numPages; pageNumber += 1) {
|
|
3234
3475
|
const page = await pdf.getPage(pageNumber);
|
|
3235
3476
|
const viewport = page.getViewport({ scale: 2 });
|
|
3236
|
-
const canvas =
|
|
3477
|
+
const canvas = createCanvas2(viewport.width, viewport.height);
|
|
3237
3478
|
const ctx = canvas.getContext("2d");
|
|
3238
3479
|
if (!ctx) {
|
|
3239
3480
|
continue;
|
|
@@ -3285,7 +3526,7 @@ async function exportSignedImageFile(args) {
|
|
|
3285
3526
|
const objectUrl = URL.createObjectURL(imageBlob);
|
|
3286
3527
|
try {
|
|
3287
3528
|
const image = await loadImage(objectUrl);
|
|
3288
|
-
const canvas =
|
|
3529
|
+
const canvas = createCanvas2(image.width, image.height);
|
|
3289
3530
|
const ctx = canvas.getContext("2d");
|
|
3290
3531
|
if (!ctx) {
|
|
3291
3532
|
throw new Error("Unable to render the image document.");
|
|
@@ -3329,7 +3570,7 @@ async function exportSignedRichTextFile(args) {
|
|
|
3329
3570
|
const canvases = [];
|
|
3330
3571
|
for (const page of args.pages) {
|
|
3331
3572
|
const image = await loadImage(page.imageUrl);
|
|
3332
|
-
const canvas2 =
|
|
3573
|
+
const canvas2 = createCanvas2(page.width, page.height);
|
|
3333
3574
|
const ctx2 = canvas2.getContext("2d");
|
|
3334
3575
|
if (!ctx2) {
|
|
3335
3576
|
continue;
|
|
@@ -3686,13 +3927,13 @@ function sanitizeHtml(html) {
|
|
|
3686
3927
|
}
|
|
3687
3928
|
|
|
3688
3929
|
// src/editors/RichTextEditor.tsx
|
|
3689
|
-
var
|
|
3930
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
3690
3931
|
var DOC_PAGE_WIDTH = 816;
|
|
3691
3932
|
var DOC_PAGE_HEIGHT = 1056;
|
|
3692
3933
|
var PAGE_RENDER_SCALE = 2;
|
|
3693
3934
|
var PAGE_BREAK_MIN_FILL = 0.55;
|
|
3694
3935
|
var DOCX_PREVIEW_CLASS_NAME = "hv-docx-page";
|
|
3695
|
-
function
|
|
3936
|
+
function createCanvas3(width, height) {
|
|
3696
3937
|
const canvas = document.createElement("canvas");
|
|
3697
3938
|
canvas.width = Math.max(1, Math.round(width));
|
|
3698
3939
|
canvas.height = Math.max(1, Math.round(height));
|
|
@@ -3777,7 +4018,7 @@ function calculatePageBreakOffsets(container, pageHeight) {
|
|
|
3777
4018
|
function createThumbnailDataUrl(canvas) {
|
|
3778
4019
|
const thumbWidth = 160;
|
|
3779
4020
|
const thumbScale = thumbWidth / canvas.width;
|
|
3780
|
-
const thumbCanvas =
|
|
4021
|
+
const thumbCanvas = createCanvas3(thumbWidth, canvas.height * thumbScale);
|
|
3781
4022
|
const thumbCtx = thumbCanvas.getContext("2d");
|
|
3782
4023
|
if (thumbCtx) {
|
|
3783
4024
|
thumbCtx.fillStyle = "#ffffff";
|
|
@@ -3795,7 +4036,7 @@ function buildPageModels(sourceCanvas, breakOffsets) {
|
|
|
3795
4036
|
for (const [index, endOffset] of breakOffsets.entries()) {
|
|
3796
4037
|
const sourceY = previousOffset * scale;
|
|
3797
4038
|
const sourceHeight = Math.max((endOffset - previousOffset) * scale, 1);
|
|
3798
|
-
const pageCanvas =
|
|
4039
|
+
const pageCanvas = createCanvas3(pageCanvasWidth, pageCanvasHeight);
|
|
3799
4040
|
const pageCtx = pageCanvas.getContext("2d");
|
|
3800
4041
|
if (!pageCtx) {
|
|
3801
4042
|
previousOffset = endOffset;
|
|
@@ -3825,7 +4066,7 @@ function buildPageModels(sourceCanvas, breakOffsets) {
|
|
|
3825
4066
|
previousOffset = endOffset;
|
|
3826
4067
|
}
|
|
3827
4068
|
if (pages.length === 0) {
|
|
3828
|
-
const blankCanvas =
|
|
4069
|
+
const blankCanvas = createCanvas3(
|
|
3829
4070
|
DOC_PAGE_WIDTH * PAGE_RENDER_SCALE,
|
|
3830
4071
|
DOC_PAGE_HEIGHT * PAGE_RENDER_SCALE
|
|
3831
4072
|
);
|
|
@@ -4175,36 +4416,38 @@ function RichTextEditor(props) {
|
|
|
4175
4416
|
media: false,
|
|
4176
4417
|
history: false
|
|
4177
4418
|
});
|
|
4178
|
-
const editorRef = (0,
|
|
4179
|
-
const measureRef = (0,
|
|
4180
|
-
const docxPreviewRef = (0,
|
|
4181
|
-
const imageInputRef = (0,
|
|
4182
|
-
const imagePreviewRef = (0,
|
|
4183
|
-
const savedSelectionRef = (0,
|
|
4184
|
-
const imageDragPointerIdRef = (0,
|
|
4185
|
-
const [contentHtml, setContentHtml] = (0,
|
|
4186
|
-
const [editableContentHtml, setEditableContentHtml] = (0,
|
|
4187
|
-
const [selectedTemplateId, setSelectedTemplateId] = (0,
|
|
4188
|
-
const [areTemplatesVisible, setAreTemplatesVisible] = (0,
|
|
4189
|
-
const [isCompactToolbar, setIsCompactToolbar] = (0,
|
|
4190
|
-
const [expandedToolbarSections, setExpandedToolbarSections] = (0,
|
|
4419
|
+
const editorRef = (0, import_react3.useRef)(null);
|
|
4420
|
+
const measureRef = (0, import_react3.useRef)(null);
|
|
4421
|
+
const docxPreviewRef = (0, import_react3.useRef)(null);
|
|
4422
|
+
const imageInputRef = (0, import_react3.useRef)(null);
|
|
4423
|
+
const imagePreviewRef = (0, import_react3.useRef)(null);
|
|
4424
|
+
const savedSelectionRef = (0, import_react3.useRef)(null);
|
|
4425
|
+
const imageDragPointerIdRef = (0, import_react3.useRef)(null);
|
|
4426
|
+
const [contentHtml, setContentHtml] = (0, import_react3.useState)("");
|
|
4427
|
+
const [editableContentHtml, setEditableContentHtml] = (0, import_react3.useState)("");
|
|
4428
|
+
const [selectedTemplateId, setSelectedTemplateId] = (0, import_react3.useState)("blank");
|
|
4429
|
+
const [areTemplatesVisible, setAreTemplatesVisible] = (0, import_react3.useState)(true);
|
|
4430
|
+
const [isCompactToolbar, setIsCompactToolbar] = (0, import_react3.useState)(false);
|
|
4431
|
+
const [expandedToolbarSections, setExpandedToolbarSections] = (0, import_react3.useState)(
|
|
4191
4432
|
createCompactToolbarState
|
|
4192
4433
|
);
|
|
4193
|
-
const [imageEditorState, setImageEditorState] = (0,
|
|
4194
|
-
const [toolbarState, setToolbarState] = (0,
|
|
4434
|
+
const [imageEditorState, setImageEditorState] = (0, import_react3.useState)(null);
|
|
4435
|
+
const [toolbarState, setToolbarState] = (0, import_react3.useState)(
|
|
4195
4436
|
createDefaultToolbarState()
|
|
4196
4437
|
);
|
|
4197
|
-
const [loading, setLoading] = (0,
|
|
4198
|
-
const [isPaginating, setIsPaginating] = (0,
|
|
4199
|
-
const [pages, setPages] = (0,
|
|
4200
|
-
const [docxPages, setDocxPages] = (0,
|
|
4201
|
-
const [isRenderingDocxPreview, setIsRenderingDocxPreview] = (0,
|
|
4202
|
-
const [docxPreviewFailed, setDocxPreviewFailed] = (0,
|
|
4203
|
-
const mdParser = (0,
|
|
4204
|
-
const authoringTemplates = (0,
|
|
4438
|
+
const [loading, setLoading] = (0, import_react3.useState)(false);
|
|
4439
|
+
const [isPaginating, setIsPaginating] = (0, import_react3.useState)(false);
|
|
4440
|
+
const [pages, setPages] = (0, import_react3.useState)([]);
|
|
4441
|
+
const [docxPages, setDocxPages] = (0, import_react3.useState)([]);
|
|
4442
|
+
const [isRenderingDocxPreview, setIsRenderingDocxPreview] = (0, import_react3.useState)(false);
|
|
4443
|
+
const [docxPreviewFailed, setDocxPreviewFailed] = (0, import_react3.useState)(false);
|
|
4444
|
+
const mdParser = (0, import_react3.useRef)(new import_markdown_it.default({ html: true, linkify: true }));
|
|
4445
|
+
const authoringTemplates = (0, import_react3.useMemo)(() => createAuthoringTemplates(), []);
|
|
4205
4446
|
const isAuthoringMode = props.mode === "edit" || props.mode === "create";
|
|
4447
|
+
const isPlainTextFile = props.fileName.toLowerCase().endsWith(".txt") || props.fileType === "txt";
|
|
4206
4448
|
const isDocxFile = props.fileName.toLowerCase().endsWith(".docx") || props.fileType === "docx";
|
|
4207
4449
|
const useDocxPreviewView = props.mode === "view" && isDocxFile && Boolean(props.arrayBuffer);
|
|
4450
|
+
const useContinuousPlainTextView = props.mode === "view" && isPlainTextFile;
|
|
4208
4451
|
const syncTemplateSelection = (nextHtml) => {
|
|
4209
4452
|
const matchedTemplate = authoringTemplates.find(
|
|
4210
4453
|
(template) => template.html === nextHtml
|
|
@@ -4248,7 +4491,7 @@ function RichTextEditor(props) {
|
|
|
4248
4491
|
}
|
|
4249
4492
|
setToolbarState(readToolbarState(editorRef.current, savedSelectionRef.current));
|
|
4250
4493
|
};
|
|
4251
|
-
(0,
|
|
4494
|
+
(0, import_react3.useEffect)(() => {
|
|
4252
4495
|
const loadDoc = async () => {
|
|
4253
4496
|
if (!props.arrayBuffer) {
|
|
4254
4497
|
const templateHtml = props.mode === "create" ? authoringTemplates[0]?.html ?? "" : "";
|
|
@@ -4309,7 +4552,7 @@ function RichTextEditor(props) {
|
|
|
4309
4552
|
props.locale,
|
|
4310
4553
|
props.mode
|
|
4311
4554
|
]);
|
|
4312
|
-
(0,
|
|
4555
|
+
(0, import_react3.useEffect)(() => {
|
|
4313
4556
|
if (!isAuthoringMode || !editorRef.current) {
|
|
4314
4557
|
return;
|
|
4315
4558
|
}
|
|
@@ -4318,7 +4561,7 @@ function RichTextEditor(props) {
|
|
|
4318
4561
|
}
|
|
4319
4562
|
refreshToolbarState();
|
|
4320
4563
|
}, [editableContentHtml, isAuthoringMode]);
|
|
4321
|
-
(0,
|
|
4564
|
+
(0, import_react3.useEffect)(() => {
|
|
4322
4565
|
if (!isAuthoringMode || typeof document === "undefined") {
|
|
4323
4566
|
return;
|
|
4324
4567
|
}
|
|
@@ -4338,12 +4581,12 @@ function RichTextEditor(props) {
|
|
|
4338
4581
|
document.removeEventListener("selectionchange", handleSelectionChange);
|
|
4339
4582
|
};
|
|
4340
4583
|
}, [isAuthoringMode]);
|
|
4341
|
-
(0,
|
|
4584
|
+
(0, import_react3.useEffect)(() => {
|
|
4342
4585
|
if (props.mode === "create") {
|
|
4343
4586
|
setAreTemplatesVisible(true);
|
|
4344
4587
|
}
|
|
4345
4588
|
}, [props.mode, props.fileName]);
|
|
4346
|
-
(0,
|
|
4589
|
+
(0, import_react3.useEffect)(() => {
|
|
4347
4590
|
if (typeof window === "undefined") {
|
|
4348
4591
|
return;
|
|
4349
4592
|
}
|
|
@@ -4360,7 +4603,7 @@ function RichTextEditor(props) {
|
|
|
4360
4603
|
mediaQuery.removeEventListener("change", syncCompactState);
|
|
4361
4604
|
};
|
|
4362
4605
|
}, []);
|
|
4363
|
-
(0,
|
|
4606
|
+
(0, import_react3.useEffect)(() => {
|
|
4364
4607
|
if (toolbarState.hasSelectedImage && toolbarState.imageSrc) {
|
|
4365
4608
|
setImageEditorState({
|
|
4366
4609
|
src: toolbarState.imageSrc,
|
|
@@ -4382,7 +4625,7 @@ function RichTextEditor(props) {
|
|
|
4382
4625
|
toolbarState.imageScale,
|
|
4383
4626
|
toolbarState.imageSrc
|
|
4384
4627
|
]);
|
|
4385
|
-
(0,
|
|
4628
|
+
(0, import_react3.useEffect)(() => {
|
|
4386
4629
|
if (!useDocxPreviewView || !docxPreviewRef.current || !props.arrayBuffer) {
|
|
4387
4630
|
setDocxPages([]);
|
|
4388
4631
|
setDocxPreviewFailed(false);
|
|
@@ -4481,13 +4724,23 @@ function RichTextEditor(props) {
|
|
|
4481
4724
|
props.onThumbs,
|
|
4482
4725
|
useDocxPreviewView
|
|
4483
4726
|
]);
|
|
4484
|
-
(0,
|
|
4727
|
+
(0, import_react3.useEffect)(() => {
|
|
4485
4728
|
if (props.mode !== "view") {
|
|
4486
4729
|
setPages([]);
|
|
4487
4730
|
props.onPageCount(1);
|
|
4488
4731
|
props.onThumbs([]);
|
|
4489
4732
|
return;
|
|
4490
4733
|
}
|
|
4734
|
+
if (useContinuousPlainTextView) {
|
|
4735
|
+
setPages([]);
|
|
4736
|
+
setIsPaginating(false);
|
|
4737
|
+
props.onPageCount(1);
|
|
4738
|
+
props.onThumbs([]);
|
|
4739
|
+
if (props.currentPage !== 1) {
|
|
4740
|
+
props.onCurrentPageChange(1);
|
|
4741
|
+
}
|
|
4742
|
+
return;
|
|
4743
|
+
}
|
|
4491
4744
|
if (useDocxPreviewView && !docxPreviewFailed) {
|
|
4492
4745
|
setPages([]);
|
|
4493
4746
|
return;
|
|
@@ -4556,17 +4809,26 @@ function RichTextEditor(props) {
|
|
|
4556
4809
|
}, [
|
|
4557
4810
|
contentHtml,
|
|
4558
4811
|
docxPreviewFailed,
|
|
4812
|
+
props.currentPage,
|
|
4559
4813
|
props.mode,
|
|
4560
4814
|
props.onCurrentPageChange,
|
|
4561
4815
|
props.onPageCount,
|
|
4562
4816
|
props.onThumbs,
|
|
4817
|
+
useContinuousPlainTextView,
|
|
4563
4818
|
useDocxPreviewView
|
|
4564
4819
|
]);
|
|
4565
|
-
const activeViewPages = (0,
|
|
4566
|
-
() => props.mode === "view" ? useDocxPreviewView && !docxPreviewFailed ? docxPages : pages : void 0,
|
|
4567
|
-
[
|
|
4820
|
+
const activeViewPages = (0, import_react3.useMemo)(
|
|
4821
|
+
() => props.mode === "view" ? useDocxPreviewView && !docxPreviewFailed ? docxPages : useContinuousPlainTextView ? void 0 : pages : void 0,
|
|
4822
|
+
[
|
|
4823
|
+
docxPages,
|
|
4824
|
+
docxPreviewFailed,
|
|
4825
|
+
pages,
|
|
4826
|
+
props.mode,
|
|
4827
|
+
useContinuousPlainTextView,
|
|
4828
|
+
useDocxPreviewView
|
|
4829
|
+
]
|
|
4568
4830
|
);
|
|
4569
|
-
(0,
|
|
4831
|
+
(0, import_react3.useEffect)(() => {
|
|
4570
4832
|
const container = props.mode === "view" ? useDocxPreviewView && !docxPreviewFailed ? docxPreviewRef.current : measureRef.current : editorRef.current;
|
|
4571
4833
|
props.onExportStateChange?.({
|
|
4572
4834
|
container,
|
|
@@ -4582,12 +4844,12 @@ function RichTextEditor(props) {
|
|
|
4582
4844
|
props.onExportStateChange,
|
|
4583
4845
|
useDocxPreviewView
|
|
4584
4846
|
]);
|
|
4585
|
-
(0,
|
|
4847
|
+
(0, import_react3.useEffect)(() => {
|
|
4586
4848
|
return () => {
|
|
4587
4849
|
props.onExportStateChange?.(null);
|
|
4588
4850
|
};
|
|
4589
4851
|
}, [props.onExportStateChange]);
|
|
4590
|
-
const pagesToShow = (0,
|
|
4852
|
+
const pagesToShow = (0, import_react3.useMemo)(
|
|
4591
4853
|
() => getPagesToShow(
|
|
4592
4854
|
useDocxPreviewView && !docxPreviewFailed ? docxPages.length : pages.length,
|
|
4593
4855
|
props.currentPage,
|
|
@@ -4888,10 +5150,10 @@ function RichTextEditor(props) {
|
|
|
4888
5150
|
};
|
|
4889
5151
|
const renderToolbarSectionHeader = (section, label) => {
|
|
4890
5152
|
if (!isCompactToolbar) {
|
|
4891
|
-
return /* @__PURE__ */ (0,
|
|
5153
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "hv-richtext-toolbar-label", children: label });
|
|
4892
5154
|
}
|
|
4893
5155
|
const isOpen = isToolbarSectionOpen(section);
|
|
4894
|
-
return /* @__PURE__ */ (0,
|
|
5156
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
4895
5157
|
"button",
|
|
4896
5158
|
{
|
|
4897
5159
|
type: "button",
|
|
@@ -4899,8 +5161,8 @@ function RichTextEditor(props) {
|
|
|
4899
5161
|
"aria-expanded": isOpen,
|
|
4900
5162
|
onClick: () => toggleToolbarSection(section),
|
|
4901
5163
|
children: [
|
|
4902
|
-
/* @__PURE__ */ (0,
|
|
4903
|
-
/* @__PURE__ */ (0,
|
|
5164
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "hv-richtext-toolbar-label", children: label }),
|
|
5165
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "hv-richtext-toolbar-toggle-copy", children: isOpen ? props.locale["documents.richText.toolbar.collapseSection"] : props.locale["documents.richText.toolbar.expandSection"] })
|
|
4904
5166
|
]
|
|
4905
5167
|
}
|
|
4906
5168
|
);
|
|
@@ -4920,8 +5182,8 @@ function RichTextEditor(props) {
|
|
|
4920
5182
|
});
|
|
4921
5183
|
};
|
|
4922
5184
|
if (props.mode === "view" && useDocxPreviewView && !docxPreviewFailed) {
|
|
4923
|
-
return /* @__PURE__ */ (0,
|
|
4924
|
-
/* @__PURE__ */ (0,
|
|
5185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
5186
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "hv-docx-preview-shell", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4925
5187
|
"div",
|
|
4926
5188
|
{
|
|
4927
5189
|
ref: docxPreviewRef,
|
|
@@ -4929,21 +5191,21 @@ function RichTextEditor(props) {
|
|
|
4929
5191
|
"aria-label": "DOCX document pages"
|
|
4930
5192
|
}
|
|
4931
5193
|
) }),
|
|
4932
|
-
/* @__PURE__ */ (0,
|
|
5194
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4933
5195
|
"div",
|
|
4934
5196
|
{
|
|
4935
5197
|
className: props.layout === "side-by-side" ? "hv-view-double" : "hv-view-single",
|
|
4936
|
-
children: loading || isRenderingDocxPreview ? /* @__PURE__ */ (0,
|
|
5198
|
+
children: loading || isRenderingDocxPreview ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "hv-page-container hv-docx-page-surface", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "hv-loading-copy", children: props.locale["documents.richText.renderingPages"] }) }) : pagesToShow.map((pageNumber) => {
|
|
4937
5199
|
const page = docxPages[pageNumber - 1];
|
|
4938
5200
|
if (!page) {
|
|
4939
5201
|
return null;
|
|
4940
5202
|
}
|
|
4941
|
-
return /* @__PURE__ */ (0,
|
|
5203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
4942
5204
|
"div",
|
|
4943
5205
|
{
|
|
4944
5206
|
className: "hv-page-container hv-docx-page-surface",
|
|
4945
5207
|
children: [
|
|
4946
|
-
/* @__PURE__ */ (0,
|
|
5208
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4947
5209
|
"img",
|
|
4948
5210
|
{
|
|
4949
5211
|
src: page.imageUrl,
|
|
@@ -4951,7 +5213,7 @@ function RichTextEditor(props) {
|
|
|
4951
5213
|
className: "hv-docx-page-image"
|
|
4952
5214
|
}
|
|
4953
5215
|
),
|
|
4954
|
-
/* @__PURE__ */ (0,
|
|
5216
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4955
5217
|
SignatureOverlay,
|
|
4956
5218
|
{
|
|
4957
5219
|
surfaceKey: page.surfaceKey,
|
|
@@ -4996,9 +5258,66 @@ function RichTextEditor(props) {
|
|
|
4996
5258
|
)
|
|
4997
5259
|
] });
|
|
4998
5260
|
}
|
|
5261
|
+
if (props.mode === "view" && useContinuousPlainTextView) {
|
|
5262
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
5263
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "hv-docx-measure-shell", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5264
|
+
"div",
|
|
5265
|
+
{
|
|
5266
|
+
ref: measureRef,
|
|
5267
|
+
className: "hv-docx-content hv-docx-measure-content hv-text-scroll-content",
|
|
5268
|
+
dangerouslySetInnerHTML: { __html: contentHtml }
|
|
5269
|
+
}
|
|
5270
|
+
) }),
|
|
5271
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "hv-view-single", children: loading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "hv-page-container hv-text-scroll-surface", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "hv-loading-copy", children: props.locale["documents.richText.renderingPages"] }) }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-page-container hv-text-scroll-surface", children: [
|
|
5272
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5273
|
+
"div",
|
|
5274
|
+
{
|
|
5275
|
+
className: "hv-docx-content hv-text-scroll-content",
|
|
5276
|
+
dangerouslySetInnerHTML: { __html: contentHtml }
|
|
5277
|
+
}
|
|
5278
|
+
),
|
|
5279
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5280
|
+
SignatureOverlay,
|
|
5281
|
+
{
|
|
5282
|
+
surfaceKey: "document:main",
|
|
5283
|
+
surfaceKind: "document",
|
|
5284
|
+
page: 1,
|
|
5285
|
+
placements: props.signatureOverlay.placements,
|
|
5286
|
+
annotations: props.signatureOverlay.annotations,
|
|
5287
|
+
pendingSignature: props.signatureOverlay.pendingSignature,
|
|
5288
|
+
pendingAnnotation: props.signatureOverlay.pendingAnnotation,
|
|
5289
|
+
activePlacementId: props.signatureOverlay.activePlacementId,
|
|
5290
|
+
activeAnnotationId: props.signatureOverlay.activeAnnotationId,
|
|
5291
|
+
placeHint: props.signatureOverlay.placeHint,
|
|
5292
|
+
annotationHint: props.signatureOverlay.annotationHint,
|
|
5293
|
+
annotationPlaceholder: props.signatureOverlay.annotationPlaceholder,
|
|
5294
|
+
signatureAltLabel: props.signatureOverlay.signatureAltLabel,
|
|
5295
|
+
signatureAltByLabel: props.signatureOverlay.signatureAltByLabel,
|
|
5296
|
+
signatureNoteIndicatorLabel: props.signatureOverlay.signatureNoteIndicatorLabel,
|
|
5297
|
+
signatureColorLabel: props.signatureOverlay.signatureColorLabel,
|
|
5298
|
+
signatureColorNames: props.signatureOverlay.signatureColorNames,
|
|
5299
|
+
removeSignatureLabel: props.signatureOverlay.removeSignatureLabel,
|
|
5300
|
+
annotationTitle: props.signatureOverlay.annotationTitle,
|
|
5301
|
+
linkedAnnotationTitle: props.signatureOverlay.linkedAnnotationTitle,
|
|
5302
|
+
linkedAnnotationBadge: props.signatureOverlay.linkedAnnotationBadge,
|
|
5303
|
+
openAnnotationLabel: props.signatureOverlay.openAnnotationLabel,
|
|
5304
|
+
removeAnnotationLabel: props.signatureOverlay.removeAnnotationLabel,
|
|
5305
|
+
onPlaceSignature: props.signatureOverlay.onPlaceSignature,
|
|
5306
|
+
onPlaceAnnotation: props.signatureOverlay.onPlaceAnnotation,
|
|
5307
|
+
onUpdatePlacement: props.signatureOverlay.onUpdatePlacement,
|
|
5308
|
+
onUpdateAnnotation: props.signatureOverlay.onUpdateAnnotation,
|
|
5309
|
+
onRemovePlacement: props.signatureOverlay.onRemovePlacement,
|
|
5310
|
+
onRemoveAnnotation: props.signatureOverlay.onRemoveAnnotation,
|
|
5311
|
+
onSelectPlacement: props.signatureOverlay.onSelectPlacement,
|
|
5312
|
+
onSelectAnnotation: props.signatureOverlay.onSelectAnnotation
|
|
5313
|
+
}
|
|
5314
|
+
)
|
|
5315
|
+
] }) })
|
|
5316
|
+
] });
|
|
5317
|
+
}
|
|
4999
5318
|
if (props.mode === "view") {
|
|
5000
|
-
return /* @__PURE__ */ (0,
|
|
5001
|
-
/* @__PURE__ */ (0,
|
|
5319
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
5320
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "hv-docx-measure-shell", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5002
5321
|
"div",
|
|
5003
5322
|
{
|
|
5004
5323
|
ref: measureRef,
|
|
@@ -5006,21 +5325,21 @@ function RichTextEditor(props) {
|
|
|
5006
5325
|
dangerouslySetInnerHTML: { __html: contentHtml }
|
|
5007
5326
|
}
|
|
5008
5327
|
) }),
|
|
5009
|
-
/* @__PURE__ */ (0,
|
|
5328
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5010
5329
|
"div",
|
|
5011
5330
|
{
|
|
5012
5331
|
className: props.layout === "side-by-side" ? "hv-view-double" : "hv-view-single",
|
|
5013
|
-
children: loading || isPaginating ? /* @__PURE__ */ (0,
|
|
5332
|
+
children: loading || isPaginating ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "hv-page-container hv-docx-page-surface", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "hv-loading-copy", children: props.locale["documents.richText.renderingPages"] }) }) : pagesToShow.map((pageNumber) => {
|
|
5014
5333
|
const page = pages[pageNumber - 1];
|
|
5015
5334
|
if (!page) {
|
|
5016
5335
|
return null;
|
|
5017
5336
|
}
|
|
5018
|
-
return /* @__PURE__ */ (0,
|
|
5337
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
5019
5338
|
"div",
|
|
5020
5339
|
{
|
|
5021
5340
|
className: "hv-page-container hv-docx-page-surface",
|
|
5022
5341
|
children: [
|
|
5023
|
-
/* @__PURE__ */ (0,
|
|
5342
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5024
5343
|
"img",
|
|
5025
5344
|
{
|
|
5026
5345
|
src: page.imageUrl,
|
|
@@ -5028,7 +5347,7 @@ function RichTextEditor(props) {
|
|
|
5028
5347
|
className: "hv-docx-page-image"
|
|
5029
5348
|
}
|
|
5030
5349
|
),
|
|
5031
|
-
/* @__PURE__ */ (0,
|
|
5350
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5032
5351
|
SignatureOverlay,
|
|
5033
5352
|
{
|
|
5034
5353
|
surfaceKey: page.surfaceKey,
|
|
@@ -5073,8 +5392,8 @@ function RichTextEditor(props) {
|
|
|
5073
5392
|
)
|
|
5074
5393
|
] });
|
|
5075
5394
|
}
|
|
5076
|
-
return /* @__PURE__ */ (0,
|
|
5077
|
-
/* @__PURE__ */ (0,
|
|
5395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-view-single hv-richtext-authoring-shell", children: [
|
|
5396
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5078
5397
|
"input",
|
|
5079
5398
|
{
|
|
5080
5399
|
ref: imageInputRef,
|
|
@@ -5084,20 +5403,20 @@ function RichTextEditor(props) {
|
|
|
5084
5403
|
onChange: handleInsertImage
|
|
5085
5404
|
}
|
|
5086
5405
|
),
|
|
5087
|
-
isAuthoringMode && /* @__PURE__ */ (0,
|
|
5406
|
+
isAuthoringMode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "hv-richtext-authoring-top", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
5088
5407
|
"div",
|
|
5089
5408
|
{
|
|
5090
5409
|
className: "hv-richtext-toolbar",
|
|
5091
5410
|
role: "toolbar",
|
|
5092
5411
|
"aria-label": props.locale["a11y.ribbon"],
|
|
5093
5412
|
children: [
|
|
5094
|
-
/* @__PURE__ */ (0,
|
|
5095
|
-
/* @__PURE__ */ (0,
|
|
5413
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-toolbar-row", children: [
|
|
5414
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-toolbar-section", children: [
|
|
5096
5415
|
renderToolbarSectionHeader(
|
|
5097
5416
|
"style",
|
|
5098
5417
|
props.locale["documents.richText.toolbar.styleLabel"]
|
|
5099
5418
|
),
|
|
5100
|
-
isToolbarSectionOpen("style") && /* @__PURE__ */ (0,
|
|
5419
|
+
isToolbarSectionOpen("style") && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
5101
5420
|
"select",
|
|
5102
5421
|
{
|
|
5103
5422
|
className: "hv-richtext-select",
|
|
@@ -5107,22 +5426,22 @@ function RichTextEditor(props) {
|
|
|
5107
5426
|
event.target.value === "blockquote" ? "BLOCKQUOTE" : event.target.value.toUpperCase()
|
|
5108
5427
|
),
|
|
5109
5428
|
children: [
|
|
5110
|
-
/* @__PURE__ */ (0,
|
|
5111
|
-
/* @__PURE__ */ (0,
|
|
5112
|
-
/* @__PURE__ */ (0,
|
|
5113
|
-
/* @__PURE__ */ (0,
|
|
5114
|
-
/* @__PURE__ */ (0,
|
|
5429
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "p", children: props.locale["documents.richText.toolbar.paragraph"] }),
|
|
5430
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "h1", children: props.locale["documents.richText.toolbar.heading1"] }),
|
|
5431
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "h2", children: props.locale["documents.richText.toolbar.heading2"] }),
|
|
5432
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "h3", children: props.locale["documents.richText.toolbar.heading3"] }),
|
|
5433
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "blockquote", children: props.locale["documents.richText.toolbar.quote"] })
|
|
5115
5434
|
]
|
|
5116
5435
|
}
|
|
5117
5436
|
)
|
|
5118
5437
|
] }),
|
|
5119
|
-
/* @__PURE__ */ (0,
|
|
5438
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-toolbar-section", children: [
|
|
5120
5439
|
renderToolbarSectionHeader(
|
|
5121
5440
|
"format",
|
|
5122
5441
|
props.locale["documents.richText.toolbar.formatLabel"]
|
|
5123
5442
|
),
|
|
5124
|
-
isToolbarSectionOpen("format") && /* @__PURE__ */ (0,
|
|
5125
|
-
/* @__PURE__ */ (0,
|
|
5443
|
+
isToolbarSectionOpen("format") && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-button-group", children: [
|
|
5444
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5126
5445
|
"button",
|
|
5127
5446
|
{
|
|
5128
5447
|
type: "button",
|
|
@@ -5132,7 +5451,7 @@ function RichTextEditor(props) {
|
|
|
5132
5451
|
children: "B"
|
|
5133
5452
|
}
|
|
5134
5453
|
),
|
|
5135
|
-
/* @__PURE__ */ (0,
|
|
5454
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5136
5455
|
"button",
|
|
5137
5456
|
{
|
|
5138
5457
|
type: "button",
|
|
@@ -5142,7 +5461,7 @@ function RichTextEditor(props) {
|
|
|
5142
5461
|
children: "I"
|
|
5143
5462
|
}
|
|
5144
5463
|
),
|
|
5145
|
-
/* @__PURE__ */ (0,
|
|
5464
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5146
5465
|
"button",
|
|
5147
5466
|
{
|
|
5148
5467
|
type: "button",
|
|
@@ -5152,7 +5471,7 @@ function RichTextEditor(props) {
|
|
|
5152
5471
|
children: "U"
|
|
5153
5472
|
}
|
|
5154
5473
|
),
|
|
5155
|
-
/* @__PURE__ */ (0,
|
|
5474
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5156
5475
|
"button",
|
|
5157
5476
|
{
|
|
5158
5477
|
type: "button",
|
|
@@ -5162,7 +5481,7 @@ function RichTextEditor(props) {
|
|
|
5162
5481
|
children: "UL"
|
|
5163
5482
|
}
|
|
5164
5483
|
),
|
|
5165
|
-
/* @__PURE__ */ (0,
|
|
5484
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5166
5485
|
"button",
|
|
5167
5486
|
{
|
|
5168
5487
|
type: "button",
|
|
@@ -5172,7 +5491,7 @@ function RichTextEditor(props) {
|
|
|
5172
5491
|
children: "1."
|
|
5173
5492
|
}
|
|
5174
5493
|
),
|
|
5175
|
-
/* @__PURE__ */ (0,
|
|
5494
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5176
5495
|
"button",
|
|
5177
5496
|
{
|
|
5178
5497
|
type: "button",
|
|
@@ -5182,7 +5501,7 @@ function RichTextEditor(props) {
|
|
|
5182
5501
|
children: "L"
|
|
5183
5502
|
}
|
|
5184
5503
|
),
|
|
5185
|
-
/* @__PURE__ */ (0,
|
|
5504
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5186
5505
|
"button",
|
|
5187
5506
|
{
|
|
5188
5507
|
type: "button",
|
|
@@ -5192,7 +5511,7 @@ function RichTextEditor(props) {
|
|
|
5192
5511
|
children: "C"
|
|
5193
5512
|
}
|
|
5194
5513
|
),
|
|
5195
|
-
/* @__PURE__ */ (0,
|
|
5514
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5196
5515
|
"button",
|
|
5197
5516
|
{
|
|
5198
5517
|
type: "button",
|
|
@@ -5202,7 +5521,7 @@ function RichTextEditor(props) {
|
|
|
5202
5521
|
children: "R"
|
|
5203
5522
|
}
|
|
5204
5523
|
),
|
|
5205
|
-
/* @__PURE__ */ (0,
|
|
5524
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5206
5525
|
"button",
|
|
5207
5526
|
{
|
|
5208
5527
|
type: "button",
|
|
@@ -5214,13 +5533,13 @@ function RichTextEditor(props) {
|
|
|
5214
5533
|
)
|
|
5215
5534
|
] })
|
|
5216
5535
|
] }),
|
|
5217
|
-
/* @__PURE__ */ (0,
|
|
5536
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-toolbar-section", children: [
|
|
5218
5537
|
renderToolbarSectionHeader(
|
|
5219
5538
|
"insert",
|
|
5220
5539
|
props.locale["documents.richText.toolbar.insertLabel"]
|
|
5221
5540
|
),
|
|
5222
|
-
isToolbarSectionOpen("insert") && /* @__PURE__ */ (0,
|
|
5223
|
-
/* @__PURE__ */ (0,
|
|
5541
|
+
isToolbarSectionOpen("insert") && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-button-group", children: [
|
|
5542
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5224
5543
|
"button",
|
|
5225
5544
|
{
|
|
5226
5545
|
type: "button",
|
|
@@ -5230,7 +5549,7 @@ function RichTextEditor(props) {
|
|
|
5230
5549
|
children: "Link"
|
|
5231
5550
|
}
|
|
5232
5551
|
),
|
|
5233
|
-
/* @__PURE__ */ (0,
|
|
5552
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5234
5553
|
"button",
|
|
5235
5554
|
{
|
|
5236
5555
|
type: "button",
|
|
@@ -5242,13 +5561,13 @@ function RichTextEditor(props) {
|
|
|
5242
5561
|
)
|
|
5243
5562
|
] })
|
|
5244
5563
|
] }),
|
|
5245
|
-
/* @__PURE__ */ (0,
|
|
5564
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-toolbar-section", children: [
|
|
5246
5565
|
renderToolbarSectionHeader(
|
|
5247
5566
|
"media",
|
|
5248
5567
|
props.locale["documents.richText.toolbar.mediaLabel"]
|
|
5249
5568
|
),
|
|
5250
|
-
isToolbarSectionOpen("media") && /* @__PURE__ */ (0,
|
|
5251
|
-
/* @__PURE__ */ (0,
|
|
5569
|
+
isToolbarSectionOpen("media") && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-button-group", children: [
|
|
5570
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5252
5571
|
"button",
|
|
5253
5572
|
{
|
|
5254
5573
|
type: "button",
|
|
@@ -5258,7 +5577,7 @@ function RichTextEditor(props) {
|
|
|
5258
5577
|
children: "Image"
|
|
5259
5578
|
}
|
|
5260
5579
|
),
|
|
5261
|
-
/* @__PURE__ */ (0,
|
|
5580
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5262
5581
|
"button",
|
|
5263
5582
|
{
|
|
5264
5583
|
type: "button",
|
|
@@ -5270,13 +5589,13 @@ function RichTextEditor(props) {
|
|
|
5270
5589
|
)
|
|
5271
5590
|
] })
|
|
5272
5591
|
] }),
|
|
5273
|
-
/* @__PURE__ */ (0,
|
|
5592
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-toolbar-section", children: [
|
|
5274
5593
|
renderToolbarSectionHeader(
|
|
5275
5594
|
"history",
|
|
5276
5595
|
props.locale["documents.richText.toolbar.historyLabel"]
|
|
5277
5596
|
),
|
|
5278
|
-
isToolbarSectionOpen("history") && /* @__PURE__ */ (0,
|
|
5279
|
-
/* @__PURE__ */ (0,
|
|
5597
|
+
isToolbarSectionOpen("history") && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-button-group", children: [
|
|
5598
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5280
5599
|
"button",
|
|
5281
5600
|
{
|
|
5282
5601
|
type: "button",
|
|
@@ -5286,7 +5605,7 @@ function RichTextEditor(props) {
|
|
|
5286
5605
|
children: "Undo"
|
|
5287
5606
|
}
|
|
5288
5607
|
),
|
|
5289
|
-
/* @__PURE__ */ (0,
|
|
5608
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5290
5609
|
"button",
|
|
5291
5610
|
{
|
|
5292
5611
|
type: "button",
|
|
@@ -5299,13 +5618,13 @@ function RichTextEditor(props) {
|
|
|
5299
5618
|
] })
|
|
5300
5619
|
] })
|
|
5301
5620
|
] }),
|
|
5302
|
-
toolbarState.hasSelectedImage && imageEditorState && /* @__PURE__ */ (0,
|
|
5303
|
-
/* @__PURE__ */ (0,
|
|
5304
|
-
/* @__PURE__ */ (0,
|
|
5305
|
-
/* @__PURE__ */ (0,
|
|
5621
|
+
toolbarState.hasSelectedImage && imageEditorState && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-context-panel", children: [
|
|
5622
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "hv-richtext-context-header", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
5623
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: props.locale["documents.richText.imageEditorTitle"] }),
|
|
5624
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { children: props.locale["documents.richText.imageEditorHelp"] })
|
|
5306
5625
|
] }) }),
|
|
5307
|
-
/* @__PURE__ */ (0,
|
|
5308
|
-
/* @__PURE__ */ (0,
|
|
5626
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-image-editor", children: [
|
|
5627
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "hv-richtext-image-preview-card", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
5309
5628
|
"div",
|
|
5310
5629
|
{
|
|
5311
5630
|
ref: imagePreviewRef,
|
|
@@ -5315,7 +5634,7 @@ function RichTextEditor(props) {
|
|
|
5315
5634
|
onPointerUp: handleImagePreviewPointerUp,
|
|
5316
5635
|
onPointerCancel: handleImagePreviewPointerUp,
|
|
5317
5636
|
children: [
|
|
5318
|
-
/* @__PURE__ */ (0,
|
|
5637
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5319
5638
|
"img",
|
|
5320
5639
|
{
|
|
5321
5640
|
src: imageEditorState.src,
|
|
@@ -5326,7 +5645,7 @@ function RichTextEditor(props) {
|
|
|
5326
5645
|
}
|
|
5327
5646
|
}
|
|
5328
5647
|
),
|
|
5329
|
-
/* @__PURE__ */ (0,
|
|
5648
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5330
5649
|
"div",
|
|
5331
5650
|
{
|
|
5332
5651
|
className: "hv-richtext-image-focus-point",
|
|
@@ -5339,11 +5658,11 @@ function RichTextEditor(props) {
|
|
|
5339
5658
|
]
|
|
5340
5659
|
}
|
|
5341
5660
|
) }),
|
|
5342
|
-
/* @__PURE__ */ (0,
|
|
5343
|
-
/* @__PURE__ */ (0,
|
|
5344
|
-
/* @__PURE__ */ (0,
|
|
5345
|
-
/* @__PURE__ */ (0,
|
|
5346
|
-
/* @__PURE__ */ (0,
|
|
5661
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-image-controls", children: [
|
|
5662
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-toolbar-subgroup", children: [
|
|
5663
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "hv-richtext-toolbar-sublabel", children: props.locale["documents.richText.toolbar.imageSizeLabel"] }),
|
|
5664
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-button-group", children: [
|
|
5665
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5347
5666
|
"button",
|
|
5348
5667
|
{
|
|
5349
5668
|
type: "button",
|
|
@@ -5352,7 +5671,7 @@ function RichTextEditor(props) {
|
|
|
5352
5671
|
children: "S"
|
|
5353
5672
|
}
|
|
5354
5673
|
),
|
|
5355
|
-
/* @__PURE__ */ (0,
|
|
5674
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5356
5675
|
"button",
|
|
5357
5676
|
{
|
|
5358
5677
|
type: "button",
|
|
@@ -5361,7 +5680,7 @@ function RichTextEditor(props) {
|
|
|
5361
5680
|
children: "M"
|
|
5362
5681
|
}
|
|
5363
5682
|
),
|
|
5364
|
-
/* @__PURE__ */ (0,
|
|
5683
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5365
5684
|
"button",
|
|
5366
5685
|
{
|
|
5367
5686
|
type: "button",
|
|
@@ -5370,7 +5689,7 @@ function RichTextEditor(props) {
|
|
|
5370
5689
|
children: "L"
|
|
5371
5690
|
}
|
|
5372
5691
|
),
|
|
5373
|
-
/* @__PURE__ */ (0,
|
|
5692
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5374
5693
|
"button",
|
|
5375
5694
|
{
|
|
5376
5695
|
type: "button",
|
|
@@ -5381,10 +5700,10 @@ function RichTextEditor(props) {
|
|
|
5381
5700
|
)
|
|
5382
5701
|
] })
|
|
5383
5702
|
] }),
|
|
5384
|
-
/* @__PURE__ */ (0,
|
|
5385
|
-
/* @__PURE__ */ (0,
|
|
5386
|
-
/* @__PURE__ */ (0,
|
|
5387
|
-
/* @__PURE__ */ (0,
|
|
5703
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-toolbar-subgroup", children: [
|
|
5704
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "hv-richtext-toolbar-sublabel", children: props.locale["documents.richText.toolbar.imageCropLabel"] }),
|
|
5705
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-button-group", children: [
|
|
5706
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5388
5707
|
"button",
|
|
5389
5708
|
{
|
|
5390
5709
|
type: "button",
|
|
@@ -5393,7 +5712,7 @@ function RichTextEditor(props) {
|
|
|
5393
5712
|
children: "Orig"
|
|
5394
5713
|
}
|
|
5395
5714
|
),
|
|
5396
|
-
/* @__PURE__ */ (0,
|
|
5715
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5397
5716
|
"button",
|
|
5398
5717
|
{
|
|
5399
5718
|
type: "button",
|
|
@@ -5402,7 +5721,7 @@ function RichTextEditor(props) {
|
|
|
5402
5721
|
children: "Wide"
|
|
5403
5722
|
}
|
|
5404
5723
|
),
|
|
5405
|
-
/* @__PURE__ */ (0,
|
|
5724
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5406
5725
|
"button",
|
|
5407
5726
|
{
|
|
5408
5727
|
type: "button",
|
|
@@ -5411,7 +5730,7 @@ function RichTextEditor(props) {
|
|
|
5411
5730
|
children: "1:1"
|
|
5412
5731
|
}
|
|
5413
5732
|
),
|
|
5414
|
-
/* @__PURE__ */ (0,
|
|
5733
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5415
5734
|
"button",
|
|
5416
5735
|
{
|
|
5417
5736
|
type: "button",
|
|
@@ -5422,10 +5741,10 @@ function RichTextEditor(props) {
|
|
|
5422
5741
|
)
|
|
5423
5742
|
] })
|
|
5424
5743
|
] }),
|
|
5425
|
-
/* @__PURE__ */ (0,
|
|
5426
|
-
/* @__PURE__ */ (0,
|
|
5427
|
-
/* @__PURE__ */ (0,
|
|
5428
|
-
/* @__PURE__ */ (0,
|
|
5744
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-toolbar-subgroup", children: [
|
|
5745
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "hv-richtext-toolbar-sublabel", children: props.locale["documents.richText.toolbar.imageAlignLabel"] }),
|
|
5746
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-button-group", children: [
|
|
5747
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5429
5748
|
"button",
|
|
5430
5749
|
{
|
|
5431
5750
|
type: "button",
|
|
@@ -5434,7 +5753,7 @@ function RichTextEditor(props) {
|
|
|
5434
5753
|
children: "Left"
|
|
5435
5754
|
}
|
|
5436
5755
|
),
|
|
5437
|
-
/* @__PURE__ */ (0,
|
|
5756
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5438
5757
|
"button",
|
|
5439
5758
|
{
|
|
5440
5759
|
type: "button",
|
|
@@ -5443,7 +5762,7 @@ function RichTextEditor(props) {
|
|
|
5443
5762
|
children: "Center"
|
|
5444
5763
|
}
|
|
5445
5764
|
),
|
|
5446
|
-
/* @__PURE__ */ (0,
|
|
5765
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5447
5766
|
"button",
|
|
5448
5767
|
{
|
|
5449
5768
|
type: "button",
|
|
@@ -5454,9 +5773,9 @@ function RichTextEditor(props) {
|
|
|
5454
5773
|
)
|
|
5455
5774
|
] })
|
|
5456
5775
|
] }),
|
|
5457
|
-
/* @__PURE__ */ (0,
|
|
5458
|
-
/* @__PURE__ */ (0,
|
|
5459
|
-
/* @__PURE__ */ (0,
|
|
5776
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "hv-richtext-range-group", children: [
|
|
5777
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: props.locale["documents.richText.imageZoom"] }),
|
|
5778
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5460
5779
|
"input",
|
|
5461
5780
|
{
|
|
5462
5781
|
type: "range",
|
|
@@ -5479,18 +5798,18 @@ function RichTextEditor(props) {
|
|
|
5479
5798
|
)
|
|
5480
5799
|
}
|
|
5481
5800
|
),
|
|
5482
|
-
/* @__PURE__ */ (0,
|
|
5801
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("strong", { children: [
|
|
5483
5802
|
imageEditorState.scale.toFixed(2),
|
|
5484
5803
|
"x"
|
|
5485
5804
|
] })
|
|
5486
5805
|
] }),
|
|
5487
|
-
/* @__PURE__ */ (0,
|
|
5488
|
-
/* @__PURE__ */ (0,
|
|
5806
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-focus-readout", children: [
|
|
5807
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { children: [
|
|
5489
5808
|
"X ",
|
|
5490
5809
|
Math.round(imageEditorState.focusX),
|
|
5491
5810
|
"%"
|
|
5492
5811
|
] }),
|
|
5493
|
-
/* @__PURE__ */ (0,
|
|
5812
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { children: [
|
|
5494
5813
|
"Y ",
|
|
5495
5814
|
Math.round(imageEditorState.focusY),
|
|
5496
5815
|
"%"
|
|
@@ -5499,10 +5818,10 @@ function RichTextEditor(props) {
|
|
|
5499
5818
|
] })
|
|
5500
5819
|
] })
|
|
5501
5820
|
] }),
|
|
5502
|
-
!toolbarState.hasSelectedImage && toolbarState.insideTable && /* @__PURE__ */ (0,
|
|
5503
|
-
/* @__PURE__ */ (0,
|
|
5504
|
-
/* @__PURE__ */ (0,
|
|
5505
|
-
/* @__PURE__ */ (0,
|
|
5821
|
+
!toolbarState.hasSelectedImage && toolbarState.insideTable && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "hv-richtext-context-panel hv-richtext-context-panel-compact", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-toolbar-subgroup", children: [
|
|
5822
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "hv-richtext-toolbar-sublabel", children: props.locale["documents.richText.toolbar.tableLabel"] }),
|
|
5823
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-button-group", children: [
|
|
5824
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5506
5825
|
"button",
|
|
5507
5826
|
{
|
|
5508
5827
|
type: "button",
|
|
@@ -5512,7 +5831,7 @@ function RichTextEditor(props) {
|
|
|
5512
5831
|
children: "+Row"
|
|
5513
5832
|
}
|
|
5514
5833
|
),
|
|
5515
|
-
/* @__PURE__ */ (0,
|
|
5834
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5516
5835
|
"button",
|
|
5517
5836
|
{
|
|
5518
5837
|
type: "button",
|
|
@@ -5522,7 +5841,7 @@ function RichTextEditor(props) {
|
|
|
5522
5841
|
children: "+Col"
|
|
5523
5842
|
}
|
|
5524
5843
|
),
|
|
5525
|
-
/* @__PURE__ */ (0,
|
|
5844
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5526
5845
|
"button",
|
|
5527
5846
|
{
|
|
5528
5847
|
type: "button",
|
|
@@ -5532,7 +5851,7 @@ function RichTextEditor(props) {
|
|
|
5532
5851
|
children: "-Row"
|
|
5533
5852
|
}
|
|
5534
5853
|
),
|
|
5535
|
-
/* @__PURE__ */ (0,
|
|
5854
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5536
5855
|
"button",
|
|
5537
5856
|
{
|
|
5538
5857
|
type: "button",
|
|
@@ -5544,10 +5863,10 @@ function RichTextEditor(props) {
|
|
|
5544
5863
|
)
|
|
5545
5864
|
] })
|
|
5546
5865
|
] }) }),
|
|
5547
|
-
props.mode === "create" && /* @__PURE__ */ (0,
|
|
5548
|
-
/* @__PURE__ */ (0,
|
|
5549
|
-
/* @__PURE__ */ (0,
|
|
5550
|
-
/* @__PURE__ */ (0,
|
|
5866
|
+
props.mode === "create" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-template-panel", children: [
|
|
5867
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-template-strip", children: [
|
|
5868
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "hv-richtext-template-label", children: props.locale["documents.richText.templates"] }),
|
|
5869
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5551
5870
|
"button",
|
|
5552
5871
|
{
|
|
5553
5872
|
type: "button",
|
|
@@ -5557,15 +5876,15 @@ function RichTextEditor(props) {
|
|
|
5557
5876
|
}
|
|
5558
5877
|
)
|
|
5559
5878
|
] }),
|
|
5560
|
-
areTemplatesVisible && /* @__PURE__ */ (0,
|
|
5879
|
+
areTemplatesVisible && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "hv-richtext-template-grid", children: authoringTemplates.map((template) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
5561
5880
|
"button",
|
|
5562
5881
|
{
|
|
5563
5882
|
type: "button",
|
|
5564
5883
|
className: `hv-richtext-template-card ${selectedTemplateId === template.id ? "active" : ""}`,
|
|
5565
5884
|
onClick: () => applyTemplate(template.id),
|
|
5566
5885
|
children: [
|
|
5567
|
-
/* @__PURE__ */ (0,
|
|
5568
|
-
/* @__PURE__ */ (0,
|
|
5886
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "hv-richtext-template-title", children: props.locale[template.labelKey] }),
|
|
5887
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "hv-richtext-template-description", children: props.locale[template.descriptionKey] })
|
|
5569
5888
|
]
|
|
5570
5889
|
},
|
|
5571
5890
|
template.id
|
|
@@ -5574,8 +5893,8 @@ function RichTextEditor(props) {
|
|
|
5574
5893
|
]
|
|
5575
5894
|
}
|
|
5576
5895
|
) }),
|
|
5577
|
-
/* @__PURE__ */ (0,
|
|
5578
|
-
/* @__PURE__ */ (0,
|
|
5896
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "hv-page-container hv-docx-page-surface", children: loading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "hv-loading-copy", children: props.locale["documents.richText.processingText"] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-docx-editor-stage", children: [
|
|
5897
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5579
5898
|
"div",
|
|
5580
5899
|
{
|
|
5581
5900
|
ref: editorRef,
|
|
@@ -5599,7 +5918,7 @@ function RichTextEditor(props) {
|
|
|
5599
5918
|
"aria-label": props.locale["a11y.editor"]
|
|
5600
5919
|
}
|
|
5601
5920
|
),
|
|
5602
|
-
/* @__PURE__ */ (0,
|
|
5921
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5603
5922
|
SignatureOverlay,
|
|
5604
5923
|
{
|
|
5605
5924
|
surfaceKey: "document:main",
|
|
@@ -5640,9 +5959,9 @@ function RichTextEditor(props) {
|
|
|
5640
5959
|
|
|
5641
5960
|
// src/editors/SpreadsheetEditor.tsx
|
|
5642
5961
|
var import_exceljs2 = __toESM(require("exceljs"), 1);
|
|
5643
|
-
var
|
|
5962
|
+
var import_react4 = require("react");
|
|
5644
5963
|
var XLSX2 = __toESM(require("xlsx"), 1);
|
|
5645
|
-
var
|
|
5964
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
5646
5965
|
var MAX_RENDER_ROWS = 400;
|
|
5647
5966
|
var MAX_RENDER_COLS = 120;
|
|
5648
5967
|
function toColumnLabel2(index) {
|
|
@@ -6226,11 +6545,11 @@ async function buildSheetModels(arrayBuffer, fileName) {
|
|
|
6226
6545
|
}
|
|
6227
6546
|
function SpreadsheetEditor(props) {
|
|
6228
6547
|
const readonly = props.mode === "view";
|
|
6229
|
-
const [sheets, setSheets] = (0,
|
|
6230
|
-
const [activeCell, setActiveCell] = (0,
|
|
6231
|
-
const [hasEdits, setHasEdits] = (0,
|
|
6232
|
-
const [dirtyCellAddressesBySheet, setDirtyCellAddressesBySheet] = (0,
|
|
6233
|
-
(0,
|
|
6548
|
+
const [sheets, setSheets] = (0, import_react4.useState)([]);
|
|
6549
|
+
const [activeCell, setActiveCell] = (0, import_react4.useState)({ row: 0, col: 0 });
|
|
6550
|
+
const [hasEdits, setHasEdits] = (0, import_react4.useState)(false);
|
|
6551
|
+
const [dirtyCellAddressesBySheet, setDirtyCellAddressesBySheet] = (0, import_react4.useState)({});
|
|
6552
|
+
(0, import_react4.useEffect)(() => {
|
|
6234
6553
|
if (!props.arrayBuffer) {
|
|
6235
6554
|
const nextSheets = props.mode === "create" ? [createBlankSheetModel("Sheet1")] : [];
|
|
6236
6555
|
setSheets(nextSheets);
|
|
@@ -6280,7 +6599,7 @@ function SpreadsheetEditor(props) {
|
|
|
6280
6599
|
props.onThumbs,
|
|
6281
6600
|
props.mode
|
|
6282
6601
|
]);
|
|
6283
|
-
(0,
|
|
6602
|
+
(0, import_react4.useEffect)(() => {
|
|
6284
6603
|
props.onExportStateChange?.(
|
|
6285
6604
|
sheets.length > 0 ? {
|
|
6286
6605
|
sheets,
|
|
@@ -6306,7 +6625,7 @@ function SpreadsheetEditor(props) {
|
|
|
6306
6625
|
Math.min(props.currentPage - 1, Math.max(sheets.length - 1, 0))
|
|
6307
6626
|
);
|
|
6308
6627
|
const activeSheet = sheets[activeSheetIndex];
|
|
6309
|
-
const mergeLookup = (0,
|
|
6628
|
+
const mergeLookup = (0, import_react4.useMemo)(
|
|
6310
6629
|
() => createMergeLookup(activeSheet?.merges ?? []),
|
|
6311
6630
|
[activeSheet]
|
|
6312
6631
|
);
|
|
@@ -6383,12 +6702,12 @@ function SpreadsheetEditor(props) {
|
|
|
6383
6702
|
);
|
|
6384
6703
|
};
|
|
6385
6704
|
if (!activeSheet) {
|
|
6386
|
-
return /* @__PURE__ */ (0,
|
|
6705
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "hv-view-single", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "hv-page-container", style: { padding: "48px" }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "hv-empty-state", children: props.locale["documents.sheetMissing"] }) }) });
|
|
6387
6706
|
}
|
|
6388
6707
|
const isTruncated = activeSheet.rowCount > activeSheet.renderedRowCount || activeSheet.colCount > activeSheet.renderedColCount;
|
|
6389
|
-
return /* @__PURE__ */ (0,
|
|
6390
|
-
/* @__PURE__ */ (0,
|
|
6391
|
-
/* @__PURE__ */ (0,
|
|
6708
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "hv-view-single", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "hv-page-container hv-sheet-container", children: [
|
|
6709
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "hv-sheet-tabs", children: [
|
|
6710
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "hv-sheet-tab-list", children: sheets.map((sheet, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
6392
6711
|
"button",
|
|
6393
6712
|
{
|
|
6394
6713
|
type: "button",
|
|
@@ -6401,8 +6720,8 @@ function SpreadsheetEditor(props) {
|
|
|
6401
6720
|
},
|
|
6402
6721
|
sheet.name
|
|
6403
6722
|
)) }),
|
|
6404
|
-
!readonly && /* @__PURE__ */ (0,
|
|
6405
|
-
/* @__PURE__ */ (0,
|
|
6723
|
+
!readonly && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "hv-sheet-actions", children: [
|
|
6724
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
6406
6725
|
"button",
|
|
6407
6726
|
{
|
|
6408
6727
|
type: "button",
|
|
@@ -6411,7 +6730,7 @@ function SpreadsheetEditor(props) {
|
|
|
6411
6730
|
children: props.locale["documents.sheetAddSheet"]
|
|
6412
6731
|
}
|
|
6413
6732
|
),
|
|
6414
|
-
/* @__PURE__ */ (0,
|
|
6733
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
6415
6734
|
"button",
|
|
6416
6735
|
{
|
|
6417
6736
|
type: "button",
|
|
@@ -6420,7 +6739,7 @@ function SpreadsheetEditor(props) {
|
|
|
6420
6739
|
children: props.locale["documents.sheetAddRow"]
|
|
6421
6740
|
}
|
|
6422
6741
|
),
|
|
6423
|
-
/* @__PURE__ */ (0,
|
|
6742
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
6424
6743
|
"button",
|
|
6425
6744
|
{
|
|
6426
6745
|
type: "button",
|
|
@@ -6431,12 +6750,12 @@ function SpreadsheetEditor(props) {
|
|
|
6431
6750
|
)
|
|
6432
6751
|
] })
|
|
6433
6752
|
] }),
|
|
6434
|
-
/* @__PURE__ */ (0,
|
|
6435
|
-
/* @__PURE__ */ (0,
|
|
6753
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "hv-sheet-formula-bar", children: [
|
|
6754
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "hv-sheet-formula-cell", children: [
|
|
6436
6755
|
toColumnLabel2(activeCell.col),
|
|
6437
6756
|
activeCell.row + 1
|
|
6438
6757
|
] }),
|
|
6439
|
-
/* @__PURE__ */ (0,
|
|
6758
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
6440
6759
|
"input",
|
|
6441
6760
|
{
|
|
6442
6761
|
value: activeCellValue,
|
|
@@ -6446,14 +6765,14 @@ function SpreadsheetEditor(props) {
|
|
|
6446
6765
|
}
|
|
6447
6766
|
)
|
|
6448
6767
|
] }),
|
|
6449
|
-
isTruncated && /* @__PURE__ */ (0,
|
|
6450
|
-
/* @__PURE__ */ (0,
|
|
6451
|
-
/* @__PURE__ */ (0,
|
|
6452
|
-
/* @__PURE__ */ (0,
|
|
6453
|
-
/* @__PURE__ */ (0,
|
|
6768
|
+
isTruncated && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "hv-sheet-viewport-note", children: props.locale["documents.sheetTruncated"].replace("{rows}", String(activeSheet.renderedRowCount)).replace("{cols}", String(activeSheet.renderedColCount)) }),
|
|
6769
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "hv-sheet-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "hv-sheet-surface", children: [
|
|
6770
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("table", { className: "hv-sheet-table", children: [
|
|
6771
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("tr", { children: [
|
|
6772
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("th", { className: "hv-sheet-corner" }),
|
|
6454
6773
|
Array.from(
|
|
6455
6774
|
{ length: activeSheet.renderedColCount },
|
|
6456
|
-
(_, colIndex) => /* @__PURE__ */ (0,
|
|
6775
|
+
(_, colIndex) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
6457
6776
|
"th",
|
|
6458
6777
|
{
|
|
6459
6778
|
className: "hv-sheet-column-header",
|
|
@@ -6467,12 +6786,12 @@ function SpreadsheetEditor(props) {
|
|
|
6467
6786
|
)
|
|
6468
6787
|
)
|
|
6469
6788
|
] }) }),
|
|
6470
|
-
/* @__PURE__ */ (0,
|
|
6789
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("tbody", { children: activeSheet.data.map((row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
6471
6790
|
"tr",
|
|
6472
6791
|
{
|
|
6473
6792
|
style: { height: activeSheet.rowHeights[rowIndex] ?? 32 },
|
|
6474
6793
|
children: [
|
|
6475
|
-
/* @__PURE__ */ (0,
|
|
6794
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("td", { className: "hv-sheet-row-header", children: rowIndex + 1 }),
|
|
6476
6795
|
row.map((cellValue, colIndex) => {
|
|
6477
6796
|
const cellKey = makeCellKey(rowIndex, colIndex);
|
|
6478
6797
|
if (mergeLookup.covered.has(cellKey)) {
|
|
@@ -6481,7 +6800,7 @@ function SpreadsheetEditor(props) {
|
|
|
6481
6800
|
const merge = mergeLookup.starts.get(cellKey);
|
|
6482
6801
|
const cellModel = activeSheet.cells[cellKey];
|
|
6483
6802
|
const width = activeSheet.colWidths[colIndex] ?? 96;
|
|
6484
|
-
return /* @__PURE__ */ (0,
|
|
6803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
6485
6804
|
"td",
|
|
6486
6805
|
{
|
|
6487
6806
|
rowSpan: merge ? merge.endRow - merge.startRow + 1 : 1,
|
|
@@ -6508,7 +6827,7 @@ function SpreadsheetEditor(props) {
|
|
|
6508
6827
|
rowIndex
|
|
6509
6828
|
)) })
|
|
6510
6829
|
] }),
|
|
6511
|
-
/* @__PURE__ */ (0,
|
|
6830
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
6512
6831
|
SignatureOverlay,
|
|
6513
6832
|
{
|
|
6514
6833
|
surfaceKey: `sheet:${activeSheet.name}`,
|
|
@@ -6549,17 +6868,17 @@ function SpreadsheetEditor(props) {
|
|
|
6549
6868
|
}
|
|
6550
6869
|
|
|
6551
6870
|
// src/renderers/ImageRenderer.tsx
|
|
6552
|
-
var
|
|
6553
|
-
var
|
|
6871
|
+
var import_react5 = require("react");
|
|
6872
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
6554
6873
|
function ImageRenderer(props) {
|
|
6555
|
-
const url = (0,
|
|
6874
|
+
const url = (0, import_react5.useMemo)(() => {
|
|
6556
6875
|
if (!props.arrayBuffer) {
|
|
6557
6876
|
return void 0;
|
|
6558
6877
|
}
|
|
6559
6878
|
const mime = props.fileType === "svg" ? "image/svg+xml" : props.fileType === "png" ? "image/png" : "image/jpeg";
|
|
6560
6879
|
return URL.createObjectURL(new Blob([props.arrayBuffer], { type: mime }));
|
|
6561
6880
|
}, [props.arrayBuffer, props.fileType]);
|
|
6562
|
-
(0,
|
|
6881
|
+
(0, import_react5.useEffect)(() => {
|
|
6563
6882
|
return () => {
|
|
6564
6883
|
if (url) {
|
|
6565
6884
|
URL.revokeObjectURL(url);
|
|
@@ -6567,11 +6886,11 @@ function ImageRenderer(props) {
|
|
|
6567
6886
|
};
|
|
6568
6887
|
}, [url]);
|
|
6569
6888
|
if (!props.arrayBuffer || !url) {
|
|
6570
|
-
return /* @__PURE__ */ (0,
|
|
6889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "hv-view-single", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "hv-page-container", style: { padding: "48px" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "hv-empty-state", children: props.locale["documents.imageMissing"] }) }) });
|
|
6571
6890
|
}
|
|
6572
|
-
return /* @__PURE__ */ (0,
|
|
6573
|
-
/* @__PURE__ */ (0,
|
|
6574
|
-
/* @__PURE__ */ (0,
|
|
6891
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "hv-view-single", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "hv-page-container hv-image-surface", children: [
|
|
6892
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("img", { src: url, alt: props.fileName, className: "hv-image-renderer" }),
|
|
6893
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
6575
6894
|
SignatureOverlay,
|
|
6576
6895
|
{
|
|
6577
6896
|
surfaceKey: "image:main",
|
|
@@ -6611,8 +6930,8 @@ function ImageRenderer(props) {
|
|
|
6611
6930
|
|
|
6612
6931
|
// src/renderers/PdfRenderer.tsx
|
|
6613
6932
|
var import_pdfjs_dist2 = require("pdfjs-dist");
|
|
6614
|
-
var
|
|
6615
|
-
var
|
|
6933
|
+
var import_react6 = require("react");
|
|
6934
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
6616
6935
|
var pdfWorkerBlobUrlPromise2 = null;
|
|
6617
6936
|
function yieldToBrowser() {
|
|
6618
6937
|
return new Promise((resolve) => {
|
|
@@ -6637,10 +6956,10 @@ async function resolvePdfWorkerSrc(customWorkerSrc) {
|
|
|
6637
6956
|
}
|
|
6638
6957
|
function PdfRenderer(props) {
|
|
6639
6958
|
const { url, arrayBuffer, layout, currentPage, workerSrc } = props;
|
|
6640
|
-
const [doc, setDoc] = (0,
|
|
6641
|
-
const [error, setError] = (0,
|
|
6642
|
-
const thumbnailJobRef = (0,
|
|
6643
|
-
(0,
|
|
6959
|
+
const [doc, setDoc] = (0, import_react6.useState)(null);
|
|
6960
|
+
const [error, setError] = (0, import_react6.useState)(null);
|
|
6961
|
+
const thumbnailJobRef = (0, import_react6.useRef)(0);
|
|
6962
|
+
(0, import_react6.useEffect)(() => {
|
|
6644
6963
|
let active = true;
|
|
6645
6964
|
const thumbnailJobId = thumbnailJobRef.current + 1;
|
|
6646
6965
|
thumbnailJobRef.current = thumbnailJobId;
|
|
@@ -6704,7 +7023,7 @@ function PdfRenderer(props) {
|
|
|
6704
7023
|
} catch (e) {
|
|
6705
7024
|
}
|
|
6706
7025
|
};
|
|
6707
|
-
const pagesToRender = (0,
|
|
7026
|
+
const pagesToRender = (0, import_react6.useMemo)(() => {
|
|
6708
7027
|
if (!doc) return [];
|
|
6709
7028
|
const p = Math.max(1, Math.min(currentPage, doc.numPages));
|
|
6710
7029
|
if (layout === "side-by-side" && doc.numPages > 1) {
|
|
@@ -6715,16 +7034,16 @@ function PdfRenderer(props) {
|
|
|
6715
7034
|
return [p];
|
|
6716
7035
|
}, [doc, currentPage, layout]);
|
|
6717
7036
|
if (error) {
|
|
6718
|
-
return /* @__PURE__ */ (0,
|
|
6719
|
-
/* @__PURE__ */ (0,
|
|
6720
|
-
/* @__PURE__ */ (0,
|
|
7037
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "hv-page-container", style: { padding: "32px" }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "hv-error-banner", children: [
|
|
7038
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("strong", { children: props.locale["documents.pdfLoadErrorTitle"] }),
|
|
7039
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: error })
|
|
6721
7040
|
] }) });
|
|
6722
7041
|
}
|
|
6723
|
-
return /* @__PURE__ */ (0,
|
|
7042
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
6724
7043
|
"div",
|
|
6725
7044
|
{
|
|
6726
7045
|
className: `hv-doc-scroll ${layout === "side-by-side" ? "hv-view-double" : "hv-view-single"}`,
|
|
6727
|
-
children: pagesToRender.map((page) => /* @__PURE__ */ (0,
|
|
7046
|
+
children: pagesToRender.map((page) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
6728
7047
|
PdfPage,
|
|
6729
7048
|
{
|
|
6730
7049
|
doc,
|
|
@@ -6741,8 +7060,8 @@ function PdfPage({
|
|
|
6741
7060
|
pageNum,
|
|
6742
7061
|
signatureOverlay
|
|
6743
7062
|
}) {
|
|
6744
|
-
const canvasRef = (0,
|
|
6745
|
-
(0,
|
|
7063
|
+
const canvasRef = (0, import_react6.useRef)(null);
|
|
7064
|
+
(0, import_react6.useEffect)(() => {
|
|
6746
7065
|
if (!doc || !canvasRef.current) return;
|
|
6747
7066
|
let active = true;
|
|
6748
7067
|
const render = async () => {
|
|
@@ -6768,7 +7087,7 @@ function PdfPage({
|
|
|
6768
7087
|
active = false;
|
|
6769
7088
|
};
|
|
6770
7089
|
}, [doc, pageNum]);
|
|
6771
|
-
return /* @__PURE__ */ (0,
|
|
7090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
6772
7091
|
"div",
|
|
6773
7092
|
{
|
|
6774
7093
|
className: "hv-page-container",
|
|
@@ -6779,8 +7098,8 @@ function PdfPage({
|
|
|
6779
7098
|
justifyContent: "center"
|
|
6780
7099
|
},
|
|
6781
7100
|
children: [
|
|
6782
|
-
/* @__PURE__ */ (0,
|
|
6783
|
-
/* @__PURE__ */ (0,
|
|
7101
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("canvas", { ref: canvasRef, className: "hv-pdf-canvas" }),
|
|
7102
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
6784
7103
|
SignatureOverlay,
|
|
6785
7104
|
{
|
|
6786
7105
|
surfaceKey: `page:${pageNum}`,
|
|
@@ -6822,9 +7141,9 @@ function PdfPage({
|
|
|
6822
7141
|
}
|
|
6823
7142
|
|
|
6824
7143
|
// src/renderers/PptxRenderer.tsx
|
|
6825
|
-
var
|
|
7144
|
+
var import_react7 = require("react");
|
|
6826
7145
|
var import_jszip2 = __toESM(require("jszip"), 1);
|
|
6827
|
-
var
|
|
7146
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
6828
7147
|
var NS_P = "http://schemas.openxmlformats.org/presentationml/2006/main";
|
|
6829
7148
|
var NS_A = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
6830
7149
|
var NS_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
@@ -6845,11 +7164,11 @@ function isBrowserRenderableSlideImage(source) {
|
|
|
6845
7164
|
return !/^data:image\/(?:emf|wmf|tiff)/i.test(source);
|
|
6846
7165
|
}
|
|
6847
7166
|
function PresentationImage(props) {
|
|
6848
|
-
const [failed, setFailed] = (0,
|
|
7167
|
+
const [failed, setFailed] = (0, import_react7.useState)(!isBrowserRenderableSlideImage(props.src));
|
|
6849
7168
|
if (failed) {
|
|
6850
|
-
return /* @__PURE__ */ (0,
|
|
7169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hv-slide-image-fallback", children: props.alt });
|
|
6851
7170
|
}
|
|
6852
|
-
return /* @__PURE__ */ (0,
|
|
7171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
6853
7172
|
"img",
|
|
6854
7173
|
{
|
|
6855
7174
|
src: props.src,
|
|
@@ -7112,12 +7431,12 @@ function makeSlideThumbnail(slide, index) {
|
|
|
7112
7431
|
return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
|
|
7113
7432
|
}
|
|
7114
7433
|
function PptxRenderer(props) {
|
|
7115
|
-
const [slides, setSlides] = (0,
|
|
7116
|
-
const [slideSize, setSlideSize] = (0,
|
|
7117
|
-
const [error, setError] = (0,
|
|
7118
|
-
const viewRef = (0,
|
|
7119
|
-
const [viewWidth, setViewWidth] = (0,
|
|
7120
|
-
(0,
|
|
7434
|
+
const [slides, setSlides] = (0, import_react7.useState)([]);
|
|
7435
|
+
const [slideSize, setSlideSize] = (0, import_react7.useState)({ width: 9144e3, height: 5143500 });
|
|
7436
|
+
const [error, setError] = (0, import_react7.useState)(null);
|
|
7437
|
+
const viewRef = (0, import_react7.useRef)(null);
|
|
7438
|
+
const [viewWidth, setViewWidth] = (0, import_react7.useState)(SLIDE_RENDER_MAX_VIEW_WIDTH);
|
|
7439
|
+
(0, import_react7.useEffect)(() => {
|
|
7121
7440
|
if (!props.arrayBuffer) {
|
|
7122
7441
|
setSlides([]);
|
|
7123
7442
|
props.onPageCount(1);
|
|
@@ -7169,7 +7488,7 @@ function PptxRenderer(props) {
|
|
|
7169
7488
|
};
|
|
7170
7489
|
loadPptx();
|
|
7171
7490
|
}, [props.arrayBuffer, props.onExportStateChange]);
|
|
7172
|
-
(0,
|
|
7491
|
+
(0, import_react7.useEffect)(() => {
|
|
7173
7492
|
const host = viewRef.current;
|
|
7174
7493
|
if (!host || typeof ResizeObserver === "undefined") {
|
|
7175
7494
|
return;
|
|
@@ -7183,7 +7502,7 @@ function PptxRenderer(props) {
|
|
|
7183
7502
|
observer.observe(host);
|
|
7184
7503
|
return () => observer.disconnect();
|
|
7185
7504
|
}, []);
|
|
7186
|
-
const pagesToShow = (0,
|
|
7505
|
+
const pagesToShow = (0, import_react7.useMemo)(() => {
|
|
7187
7506
|
if (slides.length === 0) {
|
|
7188
7507
|
return [];
|
|
7189
7508
|
}
|
|
@@ -7197,7 +7516,7 @@ function PptxRenderer(props) {
|
|
|
7197
7516
|
}
|
|
7198
7517
|
return [validPage];
|
|
7199
7518
|
}, [slides.length, props.currentPage, props.layout]);
|
|
7200
|
-
const slideViewportWidth = (0,
|
|
7519
|
+
const slideViewportWidth = (0, import_react7.useMemo)(() => {
|
|
7201
7520
|
const boundedWidth = Math.max(
|
|
7202
7521
|
SLIDE_RENDER_MIN_VIEW_WIDTH,
|
|
7203
7522
|
Math.min(viewWidth, SLIDE_RENDER_MAX_VIEW_WIDTH * 2 + SLIDE_RENDER_GAP)
|
|
@@ -7217,9 +7536,9 @@ function PptxRenderer(props) {
|
|
|
7217
7536
|
const sceneHeight = Math.max(1, Math.round(slideSize.height * sceneCoordScale));
|
|
7218
7537
|
const sceneScale = slideViewportWidth / SLIDE_RENDER_BASE_WIDTH;
|
|
7219
7538
|
if (error) {
|
|
7220
|
-
return /* @__PURE__ */ (0,
|
|
7539
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hv-error-banner", children: error });
|
|
7221
7540
|
}
|
|
7222
|
-
return /* @__PURE__ */ (0,
|
|
7541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
7223
7542
|
"div",
|
|
7224
7543
|
{
|
|
7225
7544
|
ref: viewRef,
|
|
@@ -7229,7 +7548,7 @@ function PptxRenderer(props) {
|
|
|
7229
7548
|
if (!slide) {
|
|
7230
7549
|
return null;
|
|
7231
7550
|
}
|
|
7232
|
-
return /* @__PURE__ */ (0,
|
|
7551
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
7233
7552
|
"div",
|
|
7234
7553
|
{
|
|
7235
7554
|
className: "hv-page-container hv-slide-surface",
|
|
@@ -7237,12 +7556,12 @@ function PptxRenderer(props) {
|
|
|
7237
7556
|
aspectRatio: `${slideSize.width}/${slideSize.height}`,
|
|
7238
7557
|
width: props.layout === "side-by-side" && pagesToShow.length > 1 ? `${slideViewportWidth}px` : void 0
|
|
7239
7558
|
},
|
|
7240
|
-
children: /* @__PURE__ */ (0,
|
|
7559
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
7241
7560
|
"div",
|
|
7242
7561
|
{
|
|
7243
7562
|
className: "hv-slide-stage",
|
|
7244
7563
|
style: { background: slide.background || "#ffffff" },
|
|
7245
|
-
children: /* @__PURE__ */ (0,
|
|
7564
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
7246
7565
|
"div",
|
|
7247
7566
|
{
|
|
7248
7567
|
className: "hv-slide-scene",
|
|
@@ -7252,7 +7571,7 @@ function PptxRenderer(props) {
|
|
|
7252
7571
|
transform: `scale(${sceneScale})`
|
|
7253
7572
|
},
|
|
7254
7573
|
children: [
|
|
7255
|
-
slide.elements.map((element) => /* @__PURE__ */ (0,
|
|
7574
|
+
slide.elements.map((element) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
7256
7575
|
"div",
|
|
7257
7576
|
{
|
|
7258
7577
|
className: `hv-slide-element ${element.kind}`,
|
|
@@ -7265,20 +7584,20 @@ function PptxRenderer(props) {
|
|
|
7265
7584
|
background: element.kind === "shape" ? element.fill || "transparent" : void 0,
|
|
7266
7585
|
borderColor: element.stroke
|
|
7267
7586
|
},
|
|
7268
|
-
children: element.kind === "image" && element.imageSrc ? /* @__PURE__ */ (0,
|
|
7587
|
+
children: element.kind === "image" && element.imageSrc ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
7269
7588
|
PresentationImage,
|
|
7270
7589
|
{
|
|
7271
7590
|
src: element.imageSrc,
|
|
7272
7591
|
alt: element.alt || "Slide image"
|
|
7273
7592
|
}
|
|
7274
|
-
) : /* @__PURE__ */ (0,
|
|
7593
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hv-slide-textbox", children: element.paragraphs?.map((paragraph, paragraphIndex) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
7275
7594
|
"p",
|
|
7276
7595
|
{
|
|
7277
7596
|
className: `hv-slide-paragraph ${alignToClassName(paragraph.align)}`,
|
|
7278
7597
|
style: { paddingInlineStart: `${paragraph.level * 18}px` },
|
|
7279
7598
|
children: [
|
|
7280
|
-
paragraph.bullet && /* @__PURE__ */ (0,
|
|
7281
|
-
/* @__PURE__ */ (0,
|
|
7599
|
+
paragraph.bullet && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hv-slide-bullet", children: "\u2022" }),
|
|
7600
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hv-slide-paragraph-copy", children: paragraph.runs.map((run, runIndex) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
7282
7601
|
"span",
|
|
7283
7602
|
{
|
|
7284
7603
|
style: {
|
|
@@ -7303,7 +7622,7 @@ function PptxRenderer(props) {
|
|
|
7303
7622
|
},
|
|
7304
7623
|
element.id
|
|
7305
7624
|
)),
|
|
7306
|
-
/* @__PURE__ */ (0,
|
|
7625
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
7307
7626
|
SignatureOverlay,
|
|
7308
7627
|
{
|
|
7309
7628
|
surfaceKey: `slide:${pageNumber}`,
|
|
@@ -7479,8 +7798,8 @@ var defaultLocale = {
|
|
|
7479
7798
|
|
|
7480
7799
|
// src/components/SignaturePanel.tsx
|
|
7481
7800
|
var import_lucide_react2 = require("lucide-react");
|
|
7482
|
-
var
|
|
7483
|
-
var
|
|
7801
|
+
var import_react8 = require("react");
|
|
7802
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
7484
7803
|
function sameSignature(left, right) {
|
|
7485
7804
|
if (left.id && right.id) {
|
|
7486
7805
|
return left.id === right.id;
|
|
@@ -7550,12 +7869,12 @@ function SignaturePanel(props) {
|
|
|
7550
7869
|
onSignRequest,
|
|
7551
7870
|
locale
|
|
7552
7871
|
} = props;
|
|
7553
|
-
const canvasRef = (0,
|
|
7554
|
-
const [localSignatures, setLocalSignatures] = (0,
|
|
7555
|
-
const [showModal, setShowModal] = (0,
|
|
7556
|
-
const [isDrawing, setIsDrawing] = (0,
|
|
7557
|
-
const [hasInk, setHasInk] = (0,
|
|
7558
|
-
const signatures = (0,
|
|
7872
|
+
const canvasRef = (0, import_react8.useRef)(null);
|
|
7873
|
+
const [localSignatures, setLocalSignatures] = (0, import_react8.useState)([]);
|
|
7874
|
+
const [showModal, setShowModal] = (0, import_react8.useState)(false);
|
|
7875
|
+
const [isDrawing, setIsDrawing] = (0, import_react8.useState)(false);
|
|
7876
|
+
const [hasInk, setHasInk] = (0, import_react8.useState)(false);
|
|
7877
|
+
const signatures = (0, import_react8.useMemo)(() => {
|
|
7559
7878
|
const merged = [];
|
|
7560
7879
|
for (const signature of [...externalSignatures, ...localSignatures]) {
|
|
7561
7880
|
if (!merged.some((item) => sameSignature(item, signature))) {
|
|
@@ -7651,34 +7970,34 @@ function SignaturePanel(props) {
|
|
|
7651
7970
|
ctx.lineTo(x, y);
|
|
7652
7971
|
ctx.stroke();
|
|
7653
7972
|
};
|
|
7654
|
-
return /* @__PURE__ */ (0,
|
|
7655
|
-
/* @__PURE__ */ (0,
|
|
7973
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
7974
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
7656
7975
|
"div",
|
|
7657
7976
|
{
|
|
7658
7977
|
className: `hv-sidebar hv-sidebar-right ${!isOpen ? "collapsed" : ""}`,
|
|
7659
7978
|
style: { width: isOpen ? "300px" : "0" },
|
|
7660
7979
|
children: [
|
|
7661
|
-
/* @__PURE__ */ (0,
|
|
7980
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
7662
7981
|
"div",
|
|
7663
7982
|
{
|
|
7664
7983
|
className: "hv-sidebar-header",
|
|
7665
7984
|
style: { justifyContent: "space-between", padding: "12px 16px" },
|
|
7666
7985
|
children: [
|
|
7667
|
-
/* @__PURE__ */ (0,
|
|
7668
|
-
/* @__PURE__ */ (0,
|
|
7986
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("h3", { style: { margin: 0, fontSize: "15px", fontWeight: 600 }, children: locale["signatures.title"] }),
|
|
7987
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
7669
7988
|
"button",
|
|
7670
7989
|
{
|
|
7671
7990
|
onClick: onClose,
|
|
7672
7991
|
className: "hv-btn",
|
|
7673
7992
|
style: { padding: "4px", border: "none" },
|
|
7674
|
-
children: /* @__PURE__ */ (0,
|
|
7993
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.X, { size: 18 })
|
|
7675
7994
|
}
|
|
7676
7995
|
)
|
|
7677
7996
|
]
|
|
7678
7997
|
}
|
|
7679
7998
|
),
|
|
7680
|
-
/* @__PURE__ */ (0,
|
|
7681
|
-
/* @__PURE__ */ (0,
|
|
7999
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "hv-thumb-list", children: [
|
|
8000
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
7682
8001
|
"button",
|
|
7683
8002
|
{
|
|
7684
8003
|
onClick: handleCreateClick,
|
|
@@ -7691,25 +8010,26 @@ function SignaturePanel(props) {
|
|
|
7691
8010
|
color: "var(--hv-primary)"
|
|
7692
8011
|
},
|
|
7693
8012
|
children: [
|
|
7694
|
-
/* @__PURE__ */ (0,
|
|
8013
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Plus, { size: 18, style: { marginRight: "8px" } }),
|
|
7695
8014
|
locale["signatures.new"]
|
|
7696
8015
|
]
|
|
7697
8016
|
}
|
|
7698
8017
|
),
|
|
7699
|
-
selectedSignature && /* @__PURE__ */ (0,
|
|
7700
|
-
/* @__PURE__ */ (0,
|
|
7701
|
-
/* @__PURE__ */ (0,
|
|
7702
|
-
|
|
8018
|
+
selectedSignature && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "hv-signature-selection-card", children: [
|
|
8019
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "hv-signature-selection-title", children: locale["signatures.ready"] }),
|
|
8020
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
8021
|
+
RenderableSignatureImage,
|
|
7703
8022
|
{
|
|
7704
|
-
|
|
8023
|
+
signatureImageUrl: selectedSignature.signatureImageUrl,
|
|
8024
|
+
inkColor: selectedColor,
|
|
7705
8025
|
alt: selectedSignature.signedBy ? `Selected signature by ${selectedSignature.signedBy}` : "Selected signature",
|
|
7706
8026
|
className: "hv-signature-selection-image"
|
|
7707
8027
|
}
|
|
7708
8028
|
),
|
|
7709
|
-
/* @__PURE__ */ (0,
|
|
7710
|
-
/* @__PURE__ */ (0,
|
|
7711
|
-
/* @__PURE__ */ (0,
|
|
7712
|
-
/* @__PURE__ */ (0,
|
|
8029
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "hv-signature-selection-copy", children: locale["signatures.placeHint"] }),
|
|
8030
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "hv-signature-color-picker", children: [
|
|
8031
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "hv-signature-color-picker-label", children: locale["signatures.color"] }),
|
|
8032
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "hv-signature-color-swatch-row", children: SIGNATURE_INK_COLORS.map((color) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
7713
8033
|
"button",
|
|
7714
8034
|
{
|
|
7715
8035
|
type: "button",
|
|
@@ -7722,7 +8042,7 @@ function SignaturePanel(props) {
|
|
|
7722
8042
|
color
|
|
7723
8043
|
)) })
|
|
7724
8044
|
] }),
|
|
7725
|
-
/* @__PURE__ */ (0,
|
|
8045
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
7726
8046
|
"button",
|
|
7727
8047
|
{
|
|
7728
8048
|
type: "button",
|
|
@@ -7733,45 +8053,46 @@ function SignaturePanel(props) {
|
|
|
7733
8053
|
}
|
|
7734
8054
|
)
|
|
7735
8055
|
] }),
|
|
7736
|
-
signatures.length === 0 && /* @__PURE__ */ (0,
|
|
8056
|
+
signatures.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "hv-signature-empty", children: locale["signatures.empty"] }),
|
|
7737
8057
|
signatures.map((signature, index) => {
|
|
7738
8058
|
const isLocal = localSignatures.some(
|
|
7739
8059
|
(item) => sameSignature(item, signature)
|
|
7740
8060
|
);
|
|
7741
8061
|
const isSelected = selectedSignature ? sameSignature(selectedSignature, signature) : false;
|
|
7742
|
-
return /* @__PURE__ */ (0,
|
|
8062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
7743
8063
|
"div",
|
|
7744
8064
|
{
|
|
7745
8065
|
className: `hv-thumb-item hv-signature-item ${isSelected ? "active" : ""}`,
|
|
7746
8066
|
children: [
|
|
7747
|
-
/* @__PURE__ */ (0,
|
|
8067
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
7748
8068
|
"button",
|
|
7749
8069
|
{
|
|
7750
8070
|
type: "button",
|
|
7751
8071
|
className: "hv-signature-item-main",
|
|
7752
8072
|
onClick: () => onSelectSignature(signature),
|
|
7753
8073
|
children: [
|
|
7754
|
-
/* @__PURE__ */ (0,
|
|
7755
|
-
/* @__PURE__ */ (0,
|
|
7756
|
-
|
|
8074
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "hv-signature-item-stack", children: [
|
|
8075
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
8076
|
+
RenderableSignatureImage,
|
|
7757
8077
|
{
|
|
7758
|
-
|
|
8078
|
+
signatureImageUrl: signature.signatureImageUrl,
|
|
8079
|
+
inkColor: "black",
|
|
7759
8080
|
alt: signature.signedBy ? `Signature by ${signature.signedBy}` : "Signature",
|
|
7760
8081
|
className: "hv-signature-item-image"
|
|
7761
8082
|
}
|
|
7762
8083
|
),
|
|
7763
|
-
/* @__PURE__ */ (0,
|
|
7764
|
-
signature.signedBy && /* @__PURE__ */ (0,
|
|
7765
|
-
signature.jobTitle && /* @__PURE__ */ (0,
|
|
7766
|
-
/* @__PURE__ */ (0,
|
|
7767
|
-
signature.comment && /* @__PURE__ */ (0,
|
|
8084
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "hv-signature-item-copy", children: [
|
|
8085
|
+
signature.signedBy && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("strong", { children: signature.signedBy }),
|
|
8086
|
+
signature.jobTitle && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: signature.jobTitle }),
|
|
8087
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: normalizeSignatureDate(signature.dateSigned) }),
|
|
8088
|
+
signature.comment && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("em", { children: signature.comment })
|
|
7768
8089
|
] })
|
|
7769
8090
|
] }),
|
|
7770
|
-
isSelected && /* @__PURE__ */ (0,
|
|
8091
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "hv-signature-item-check", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Check, { size: 14 }) })
|
|
7771
8092
|
]
|
|
7772
8093
|
}
|
|
7773
8094
|
),
|
|
7774
|
-
isLocal && /* @__PURE__ */ (0,
|
|
8095
|
+
isLocal && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
7775
8096
|
"button",
|
|
7776
8097
|
{
|
|
7777
8098
|
type: "button",
|
|
@@ -7794,7 +8115,7 @@ function SignaturePanel(props) {
|
|
|
7794
8115
|
onClearSelection();
|
|
7795
8116
|
}
|
|
7796
8117
|
},
|
|
7797
|
-
children: /* @__PURE__ */ (0,
|
|
8118
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Trash2, { size: 12 })
|
|
7798
8119
|
}
|
|
7799
8120
|
)
|
|
7800
8121
|
]
|
|
@@ -7806,8 +8127,8 @@ function SignaturePanel(props) {
|
|
|
7806
8127
|
]
|
|
7807
8128
|
}
|
|
7808
8129
|
),
|
|
7809
|
-
showModal && /* @__PURE__ */ (0,
|
|
7810
|
-
/* @__PURE__ */ (0,
|
|
8130
|
+
showModal && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "hv-modal-overlay", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "hv-modal", style: { width: "450px", maxWidth: "90vw" }, children: [
|
|
8131
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
7811
8132
|
"div",
|
|
7812
8133
|
{
|
|
7813
8134
|
style: {
|
|
@@ -7818,20 +8139,20 @@ function SignaturePanel(props) {
|
|
|
7818
8139
|
alignItems: "center"
|
|
7819
8140
|
},
|
|
7820
8141
|
children: [
|
|
7821
|
-
/* @__PURE__ */ (0,
|
|
7822
|
-
/* @__PURE__ */ (0,
|
|
8142
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("h3", { style: { margin: 0, fontSize: "18px", fontWeight: 600 }, children: locale["signatures.drawTitle"] }),
|
|
8143
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
7823
8144
|
"button",
|
|
7824
8145
|
{
|
|
7825
8146
|
onClick: () => setShowModal(false),
|
|
7826
8147
|
className: "hv-btn",
|
|
7827
8148
|
style: { border: "none" },
|
|
7828
|
-
children: /* @__PURE__ */ (0,
|
|
8149
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.X, { size: 20 })
|
|
7829
8150
|
}
|
|
7830
8151
|
)
|
|
7831
8152
|
]
|
|
7832
8153
|
}
|
|
7833
8154
|
),
|
|
7834
|
-
/* @__PURE__ */ (0,
|
|
8155
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
7835
8156
|
"div",
|
|
7836
8157
|
{
|
|
7837
8158
|
style: {
|
|
@@ -7842,7 +8163,7 @@ function SignaturePanel(props) {
|
|
|
7842
8163
|
alignItems: "center"
|
|
7843
8164
|
},
|
|
7844
8165
|
children: [
|
|
7845
|
-
/* @__PURE__ */ (0,
|
|
8166
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
7846
8167
|
"div",
|
|
7847
8168
|
{
|
|
7848
8169
|
style: {
|
|
@@ -7852,7 +8173,7 @@ function SignaturePanel(props) {
|
|
|
7852
8173
|
overflow: "hidden",
|
|
7853
8174
|
boxShadow: "inset 0 2px 4px 0 rgba(0,0,0,0.05)"
|
|
7854
8175
|
},
|
|
7855
|
-
children: /* @__PURE__ */ (0,
|
|
8176
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
7856
8177
|
"canvas",
|
|
7857
8178
|
{
|
|
7858
8179
|
ref: canvasRef,
|
|
@@ -7874,7 +8195,7 @@ function SignaturePanel(props) {
|
|
|
7874
8195
|
)
|
|
7875
8196
|
}
|
|
7876
8197
|
),
|
|
7877
|
-
/* @__PURE__ */ (0,
|
|
8198
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
7878
8199
|
"p",
|
|
7879
8200
|
{
|
|
7880
8201
|
style: {
|
|
@@ -7888,7 +8209,7 @@ function SignaturePanel(props) {
|
|
|
7888
8209
|
]
|
|
7889
8210
|
}
|
|
7890
8211
|
),
|
|
7891
|
-
/* @__PURE__ */ (0,
|
|
8212
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
7892
8213
|
"div",
|
|
7893
8214
|
{
|
|
7894
8215
|
style: {
|
|
@@ -7899,8 +8220,8 @@ function SignaturePanel(props) {
|
|
|
7899
8220
|
gap: "12px"
|
|
7900
8221
|
},
|
|
7901
8222
|
children: [
|
|
7902
|
-
/* @__PURE__ */ (0,
|
|
7903
|
-
/* @__PURE__ */ (0,
|
|
8223
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { onClick: clearCanvas, className: "hv-btn", children: locale["signatures.clear"] }),
|
|
8224
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
7904
8225
|
"button",
|
|
7905
8226
|
{
|
|
7906
8227
|
onClick: saveSignature,
|
|
@@ -7917,16 +8238,16 @@ function SignaturePanel(props) {
|
|
|
7917
8238
|
}
|
|
7918
8239
|
|
|
7919
8240
|
// src/components/ThumbnailsSidebar.tsx
|
|
7920
|
-
var
|
|
7921
|
-
var
|
|
8241
|
+
var import_react9 = require("react");
|
|
8242
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
7922
8243
|
var THUMB_ITEM_HEIGHT = 184;
|
|
7923
8244
|
var THUMB_OVERSCAN = 4;
|
|
7924
8245
|
function ThumbnailsSidebar(props) {
|
|
7925
8246
|
const { isOpen, thumbnails, currentPage, onSelectPage, locale } = props;
|
|
7926
|
-
const listRef = (0,
|
|
7927
|
-
const [scrollTop, setScrollTop] = (0,
|
|
7928
|
-
const [viewportHeight, setViewportHeight] = (0,
|
|
7929
|
-
(0,
|
|
8247
|
+
const listRef = (0, import_react9.useRef)(null);
|
|
8248
|
+
const [scrollTop, setScrollTop] = (0, import_react9.useState)(0);
|
|
8249
|
+
const [viewportHeight, setViewportHeight] = (0, import_react9.useState)(0);
|
|
8250
|
+
(0, import_react9.useEffect)(() => {
|
|
7930
8251
|
const element = listRef.current;
|
|
7931
8252
|
if (!element || !isOpen) {
|
|
7932
8253
|
return;
|
|
@@ -7947,7 +8268,7 @@ function ThumbnailsSidebar(props) {
|
|
|
7947
8268
|
behavior: "smooth"
|
|
7948
8269
|
});
|
|
7949
8270
|
}, [currentPage, isOpen]);
|
|
7950
|
-
(0,
|
|
8271
|
+
(0, import_react9.useEffect)(() => {
|
|
7951
8272
|
const element = listRef.current;
|
|
7952
8273
|
if (!element) {
|
|
7953
8274
|
return;
|
|
@@ -7976,7 +8297,7 @@ function ThumbnailsSidebar(props) {
|
|
|
7976
8297
|
window.removeEventListener("resize", updateViewport);
|
|
7977
8298
|
};
|
|
7978
8299
|
}, []);
|
|
7979
|
-
const virtualWindow = (0,
|
|
8300
|
+
const virtualWindow = (0, import_react9.useMemo)(() => {
|
|
7980
8301
|
if (thumbnails.length === 0) {
|
|
7981
8302
|
return {
|
|
7982
8303
|
startIndex: 0,
|
|
@@ -8002,15 +8323,15 @@ function ThumbnailsSidebar(props) {
|
|
|
8002
8323
|
totalHeight: thumbnails.length * THUMB_ITEM_HEIGHT
|
|
8003
8324
|
};
|
|
8004
8325
|
}, [scrollTop, thumbnails.length, viewportHeight]);
|
|
8005
|
-
const visibleItems = (0,
|
|
8326
|
+
const visibleItems = (0, import_react9.useMemo)(
|
|
8006
8327
|
() => thumbnails.slice(
|
|
8007
8328
|
virtualWindow.startIndex,
|
|
8008
8329
|
virtualWindow.endIndex >= virtualWindow.startIndex ? virtualWindow.endIndex + 1 : virtualWindow.startIndex
|
|
8009
8330
|
),
|
|
8010
8331
|
[thumbnails, virtualWindow.endIndex, virtualWindow.startIndex]
|
|
8011
8332
|
);
|
|
8012
|
-
return /* @__PURE__ */ (0,
|
|
8013
|
-
thumbnails.length > 0 && /* @__PURE__ */ (0,
|
|
8333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `hv-sidebar ${!isOpen ? "collapsed" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { ref: listRef, className: "hv-thumb-list", children: [
|
|
8334
|
+
thumbnails.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
8014
8335
|
"div",
|
|
8015
8336
|
{
|
|
8016
8337
|
className: "hv-thumb-viewport",
|
|
@@ -8019,22 +8340,22 @@ function ThumbnailsSidebar(props) {
|
|
|
8019
8340
|
const absoluteIndex = virtualWindow.startIndex + index;
|
|
8020
8341
|
const pageNum = absoluteIndex + 1;
|
|
8021
8342
|
const isActive = pageNum === currentPage;
|
|
8022
|
-
return /* @__PURE__ */ (0,
|
|
8343
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
8023
8344
|
"div",
|
|
8024
8345
|
{
|
|
8025
8346
|
className: `hv-thumb-item ${isActive ? "active" : ""}`,
|
|
8026
8347
|
style: { top: `${absoluteIndex * THUMB_ITEM_HEIGHT}px` },
|
|
8027
8348
|
onClick: () => onSelectPage(pageNum),
|
|
8028
8349
|
children: [
|
|
8029
|
-
/* @__PURE__ */ (0,
|
|
8350
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "hv-thumb-preview", children: src ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
8030
8351
|
"img",
|
|
8031
8352
|
{
|
|
8032
8353
|
src,
|
|
8033
8354
|
alt: `Page ${pageNum}`,
|
|
8034
8355
|
className: "hv-thumb-img"
|
|
8035
8356
|
}
|
|
8036
|
-
) : /* @__PURE__ */ (0,
|
|
8037
|
-
/* @__PURE__ */ (0,
|
|
8357
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "hv-thumb-skeleton", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: "..." }) }) }),
|
|
8358
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "hv-thumb-label", children: [
|
|
8038
8359
|
locale["thumbnails.page"],
|
|
8039
8360
|
" ",
|
|
8040
8361
|
pageNum
|
|
@@ -8046,13 +8367,13 @@ function ThumbnailsSidebar(props) {
|
|
|
8046
8367
|
})
|
|
8047
8368
|
}
|
|
8048
8369
|
),
|
|
8049
|
-
thumbnails.length === 0 && /* @__PURE__ */ (0,
|
|
8370
|
+
thumbnails.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "hv-thumb-empty", children: locale["thumbnails.empty"] })
|
|
8050
8371
|
] }) });
|
|
8051
8372
|
}
|
|
8052
8373
|
|
|
8053
8374
|
// src/components/Toolbar.tsx
|
|
8054
8375
|
var import_lucide_react3 = require("lucide-react");
|
|
8055
|
-
var
|
|
8376
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
8056
8377
|
function Toolbar(props) {
|
|
8057
8378
|
const {
|
|
8058
8379
|
fileName,
|
|
@@ -8088,18 +8409,18 @@ function Toolbar(props) {
|
|
|
8088
8409
|
onPageChange(val);
|
|
8089
8410
|
}
|
|
8090
8411
|
};
|
|
8091
|
-
return /* @__PURE__ */ (0,
|
|
8092
|
-
/* @__PURE__ */ (0,
|
|
8093
|
-
/* @__PURE__ */ (0,
|
|
8412
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "hv-toolbar", children: [
|
|
8413
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "hv-toolbar-group", children: [
|
|
8414
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
8094
8415
|
"button",
|
|
8095
8416
|
{
|
|
8096
8417
|
className: `hv-btn ${props.showThumbnails ? "hv-btn-active" : ""}`,
|
|
8097
8418
|
onClick: props.onToggleThumbnails,
|
|
8098
8419
|
title: locale["toolbar.thumbs"],
|
|
8099
|
-
children: props.showThumbnails ? /* @__PURE__ */ (0,
|
|
8420
|
+
children: props.showThumbnails ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.PanelLeftClose, { size: 20 }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.PanelLeftOpen, { size: 20 })
|
|
8100
8421
|
}
|
|
8101
8422
|
),
|
|
8102
|
-
/* @__PURE__ */ (0,
|
|
8423
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
8103
8424
|
"div",
|
|
8104
8425
|
{
|
|
8105
8426
|
className: "hv-sep",
|
|
@@ -8111,7 +8432,7 @@ function Toolbar(props) {
|
|
|
8111
8432
|
}
|
|
8112
8433
|
}
|
|
8113
8434
|
),
|
|
8114
|
-
/* @__PURE__ */ (0,
|
|
8435
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
8115
8436
|
"span",
|
|
8116
8437
|
{
|
|
8117
8438
|
style: {
|
|
@@ -8126,18 +8447,18 @@ function Toolbar(props) {
|
|
|
8126
8447
|
}
|
|
8127
8448
|
)
|
|
8128
8449
|
] }),
|
|
8129
|
-
/* @__PURE__ */ (0,
|
|
8130
|
-
/* @__PURE__ */ (0,
|
|
8450
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "hv-toolbar-group", children: [
|
|
8451
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
8131
8452
|
"button",
|
|
8132
8453
|
{
|
|
8133
8454
|
className: "hv-btn",
|
|
8134
8455
|
disabled: currentPage <= 1,
|
|
8135
8456
|
onClick: handlePrev,
|
|
8136
|
-
children: /* @__PURE__ */ (0,
|
|
8457
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.ChevronLeft, { size: 20 })
|
|
8137
8458
|
}
|
|
8138
8459
|
),
|
|
8139
|
-
/* @__PURE__ */ (0,
|
|
8140
|
-
/* @__PURE__ */ (0,
|
|
8460
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "hv-toolbar-page-group", children: [
|
|
8461
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
8141
8462
|
"input",
|
|
8142
8463
|
{
|
|
8143
8464
|
type: "number",
|
|
@@ -8148,53 +8469,53 @@ function Toolbar(props) {
|
|
|
8148
8469
|
max: pageCount
|
|
8149
8470
|
}
|
|
8150
8471
|
),
|
|
8151
|
-
/* @__PURE__ */ (0,
|
|
8152
|
-
/* @__PURE__ */ (0,
|
|
8472
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "hv-toolbar-page-sep", children: "/" }),
|
|
8473
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: pageCount })
|
|
8153
8474
|
] }),
|
|
8154
|
-
/* @__PURE__ */ (0,
|
|
8475
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
8155
8476
|
"button",
|
|
8156
8477
|
{
|
|
8157
8478
|
className: "hv-btn",
|
|
8158
8479
|
disabled: currentPage >= pageCount,
|
|
8159
8480
|
onClick: handleNext,
|
|
8160
|
-
children: /* @__PURE__ */ (0,
|
|
8481
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.ChevronRight, { size: 20 })
|
|
8161
8482
|
}
|
|
8162
8483
|
)
|
|
8163
8484
|
] }),
|
|
8164
|
-
/* @__PURE__ */ (0,
|
|
8165
|
-
/* @__PURE__ */ (0,
|
|
8485
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "hv-toolbar-group", children: [
|
|
8486
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
8166
8487
|
"button",
|
|
8167
8488
|
{
|
|
8168
8489
|
className: "hv-btn",
|
|
8169
8490
|
onClick: onZoomOut,
|
|
8170
8491
|
title: locale["toolbar.zoomOut"],
|
|
8171
8492
|
disabled: zoom <= 0.5,
|
|
8172
|
-
children: /* @__PURE__ */ (0,
|
|
8493
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.ZoomOut, { size: 18 })
|
|
8173
8494
|
}
|
|
8174
8495
|
),
|
|
8175
|
-
/* @__PURE__ */ (0,
|
|
8496
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
8176
8497
|
"button",
|
|
8177
8498
|
{
|
|
8178
8499
|
className: "hv-btn",
|
|
8179
8500
|
onClick: onZoomReset,
|
|
8180
8501
|
title: locale["toolbar.zoomReset"],
|
|
8181
|
-
children: /* @__PURE__ */ (0,
|
|
8502
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { style: { fontSize: "12px", fontWeight: 600 }, children: [
|
|
8182
8503
|
Math.round(zoom * 100),
|
|
8183
8504
|
"%"
|
|
8184
8505
|
] })
|
|
8185
8506
|
}
|
|
8186
8507
|
),
|
|
8187
|
-
/* @__PURE__ */ (0,
|
|
8508
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
8188
8509
|
"button",
|
|
8189
8510
|
{
|
|
8190
8511
|
className: "hv-btn",
|
|
8191
8512
|
onClick: onZoomIn,
|
|
8192
8513
|
title: locale["toolbar.zoomIn"],
|
|
8193
8514
|
disabled: zoom >= 2,
|
|
8194
|
-
children: /* @__PURE__ */ (0,
|
|
8515
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.ZoomIn, { size: 18 })
|
|
8195
8516
|
}
|
|
8196
8517
|
),
|
|
8197
|
-
/* @__PURE__ */ (0,
|
|
8518
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
8198
8519
|
"div",
|
|
8199
8520
|
{
|
|
8200
8521
|
className: "hv-sep",
|
|
@@ -8206,37 +8527,37 @@ function Toolbar(props) {
|
|
|
8206
8527
|
}
|
|
8207
8528
|
}
|
|
8208
8529
|
),
|
|
8209
|
-
/* @__PURE__ */ (0,
|
|
8530
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
8210
8531
|
"button",
|
|
8211
8532
|
{
|
|
8212
8533
|
className: `hv-btn ${layout === "single" ? "hv-btn-active" : ""}`,
|
|
8213
8534
|
onClick: () => onLayoutChange("single"),
|
|
8214
8535
|
title: locale["toolbar.layout.single"],
|
|
8215
|
-
children: /* @__PURE__ */ (0,
|
|
8536
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.LayoutTemplate, { size: 18 })
|
|
8216
8537
|
}
|
|
8217
8538
|
),
|
|
8218
|
-
/* @__PURE__ */ (0,
|
|
8539
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
8219
8540
|
"button",
|
|
8220
8541
|
{
|
|
8221
8542
|
className: `hv-btn ${layout === "side-by-side" ? "hv-btn-active" : ""}`,
|
|
8222
8543
|
onClick: () => onLayoutChange("side-by-side"),
|
|
8223
8544
|
title: locale["toolbar.layout.two"],
|
|
8224
|
-
children: /* @__PURE__ */ (0,
|
|
8545
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.Grid2X2, { size: 18 })
|
|
8225
8546
|
}
|
|
8226
8547
|
),
|
|
8227
|
-
showHeaderFooterToggle && /* @__PURE__ */ (0,
|
|
8548
|
+
showHeaderFooterToggle && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
8228
8549
|
"button",
|
|
8229
8550
|
{
|
|
8230
8551
|
className: `hv-btn ${headerFooterVisible ? "hv-btn-active" : ""}`,
|
|
8231
8552
|
onClick: onToggleHeaderFooter,
|
|
8232
8553
|
title: locale["toolbar.headerFooter"],
|
|
8233
8554
|
children: [
|
|
8234
|
-
/* @__PURE__ */ (0,
|
|
8235
|
-
/* @__PURE__ */ (0,
|
|
8555
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: "12px", fontWeight: 700, marginRight: "8px" }, children: "HF" }),
|
|
8556
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "hv-btn-label", children: locale["toolbar.headerFooter"] })
|
|
8236
8557
|
]
|
|
8237
8558
|
}
|
|
8238
8559
|
),
|
|
8239
|
-
/* @__PURE__ */ (0,
|
|
8560
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
8240
8561
|
"div",
|
|
8241
8562
|
{
|
|
8242
8563
|
className: "hv-sep",
|
|
@@ -8248,18 +8569,18 @@ function Toolbar(props) {
|
|
|
8248
8569
|
}
|
|
8249
8570
|
}
|
|
8250
8571
|
),
|
|
8251
|
-
saveEnabled && /* @__PURE__ */ (0,
|
|
8252
|
-
showExportPdfAction && /* @__PURE__ */ (0,
|
|
8572
|
+
saveEnabled && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
8573
|
+
showExportPdfAction && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
8253
8574
|
"button",
|
|
8254
8575
|
{
|
|
8255
8576
|
className: "hv-btn",
|
|
8256
8577
|
onClick: onExportPdf,
|
|
8257
8578
|
title: locale["toolbar.exportPdf"],
|
|
8258
8579
|
disabled: isSaving,
|
|
8259
|
-
children: /* @__PURE__ */ (0,
|
|
8580
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.FileDown, { size: 18 })
|
|
8260
8581
|
}
|
|
8261
8582
|
),
|
|
8262
|
-
/* @__PURE__ */ (0,
|
|
8583
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
8263
8584
|
"button",
|
|
8264
8585
|
{
|
|
8265
8586
|
className: "hv-btn hv-btn-primary",
|
|
@@ -8267,12 +8588,12 @@ function Toolbar(props) {
|
|
|
8267
8588
|
title: saveLabel ?? locale["toolbar.save"],
|
|
8268
8589
|
disabled: isSaving,
|
|
8269
8590
|
children: [
|
|
8270
|
-
/* @__PURE__ */ (0,
|
|
8271
|
-
/* @__PURE__ */ (0,
|
|
8591
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.Save, { size: 18, style: { marginRight: "8px" } }),
|
|
8592
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "hv-btn-label", children: isSaving ? locale.loading : saveLabel ?? locale["toolbar.save"] })
|
|
8272
8593
|
]
|
|
8273
8594
|
}
|
|
8274
8595
|
),
|
|
8275
|
-
/* @__PURE__ */ (0,
|
|
8596
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
8276
8597
|
"div",
|
|
8277
8598
|
{
|
|
8278
8599
|
className: "hv-sep",
|
|
@@ -8285,27 +8606,27 @@ function Toolbar(props) {
|
|
|
8285
8606
|
}
|
|
8286
8607
|
)
|
|
8287
8608
|
] }),
|
|
8288
|
-
props.annotationEnabled && /* @__PURE__ */ (0,
|
|
8609
|
+
props.annotationEnabled && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
8289
8610
|
"button",
|
|
8290
8611
|
{
|
|
8291
8612
|
className: `hv-btn ${props.annotationMode ? "hv-btn-active" : ""}`,
|
|
8292
8613
|
onClick: props.onToggleAnnotationMode,
|
|
8293
8614
|
title: locale["toolbar.annotate"],
|
|
8294
8615
|
children: [
|
|
8295
|
-
/* @__PURE__ */ (0,
|
|
8296
|
-
/* @__PURE__ */ (0,
|
|
8616
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.MessageSquarePlus, { size: 18, style: { marginRight: "8px" } }),
|
|
8617
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "hv-btn-label", children: locale["toolbar.annotate"] })
|
|
8297
8618
|
]
|
|
8298
8619
|
}
|
|
8299
8620
|
),
|
|
8300
|
-
props.signingEnabled && /* @__PURE__ */ (0,
|
|
8621
|
+
props.signingEnabled && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
8301
8622
|
"button",
|
|
8302
8623
|
{
|
|
8303
8624
|
className: `hv-btn hv-btn-primary ${props.showSignatures ? "hv-btn-active" : ""}`,
|
|
8304
8625
|
onClick: props.onToggleSignatures,
|
|
8305
8626
|
title: locale["toolbar.sign"],
|
|
8306
8627
|
children: [
|
|
8307
|
-
/* @__PURE__ */ (0,
|
|
8308
|
-
/* @__PURE__ */ (0,
|
|
8628
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.PenLine, { size: 18, style: { marginRight: "8px" } }),
|
|
8629
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "hv-btn-label", children: locale["toolbar.sign"] })
|
|
8309
8630
|
]
|
|
8310
8631
|
}
|
|
8311
8632
|
)
|
|
@@ -8314,7 +8635,7 @@ function Toolbar(props) {
|
|
|
8314
8635
|
}
|
|
8315
8636
|
|
|
8316
8637
|
// src/components/DocumentViewer.tsx
|
|
8317
|
-
var
|
|
8638
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
8318
8639
|
function createPlacementId() {
|
|
8319
8640
|
return `sig-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
8320
8641
|
}
|
|
@@ -8398,56 +8719,56 @@ function getFileNameHint(fileUrl, fileName) {
|
|
|
8398
8719
|
function DocumentViewer(props) {
|
|
8399
8720
|
const mode = props.mode ?? "view";
|
|
8400
8721
|
const theme = props.theme ?? "light";
|
|
8401
|
-
const locale = (0,
|
|
8722
|
+
const locale = (0, import_react10.useMemo)(
|
|
8402
8723
|
() => ({ ...defaultLocale, ...props.locale }),
|
|
8403
8724
|
[props.locale]
|
|
8404
8725
|
);
|
|
8405
|
-
const [layout, setLayout] = (0,
|
|
8726
|
+
const [layout, setLayout] = (0, import_react10.useState)(
|
|
8406
8727
|
props.defaultLayout ?? "single"
|
|
8407
8728
|
);
|
|
8408
|
-
const [showThumbnails, setShowThumbnails] = (0,
|
|
8729
|
+
const [showThumbnails, setShowThumbnails] = (0, import_react10.useState)(
|
|
8409
8730
|
props.defaultShowThumbnails ?? true
|
|
8410
8731
|
);
|
|
8411
|
-
const [showHeaderFooterSlots, setShowHeaderFooterSlots] = (0,
|
|
8412
|
-
const [showSignatures, setShowSignatures] = (0,
|
|
8413
|
-
const [zoom, setZoom] = (0,
|
|
8414
|
-
const mainRef = (0,
|
|
8415
|
-
const zoomStageRef = (0,
|
|
8416
|
-
const exportHeaderRef = (0,
|
|
8417
|
-
const exportFooterRef = (0,
|
|
8418
|
-
const [selectedSignature, setSelectedSignature] = (0,
|
|
8732
|
+
const [showHeaderFooterSlots, setShowHeaderFooterSlots] = (0, import_react10.useState)(true);
|
|
8733
|
+
const [showSignatures, setShowSignatures] = (0, import_react10.useState)(false);
|
|
8734
|
+
const [zoom, setZoom] = (0, import_react10.useState)(1);
|
|
8735
|
+
const mainRef = (0, import_react10.useRef)(null);
|
|
8736
|
+
const zoomStageRef = (0, import_react10.useRef)(null);
|
|
8737
|
+
const exportHeaderRef = (0, import_react10.useRef)(null);
|
|
8738
|
+
const exportFooterRef = (0, import_react10.useRef)(null);
|
|
8739
|
+
const [selectedSignature, setSelectedSignature] = (0, import_react10.useState)(
|
|
8419
8740
|
null
|
|
8420
8741
|
);
|
|
8421
|
-
const [selectedSignatureColor, setSelectedSignatureColor] = (0,
|
|
8422
|
-
const [isPlacingAnnotation, setIsPlacingAnnotation] = (0,
|
|
8423
|
-
const [activePlacementId, setActivePlacementId] = (0,
|
|
8742
|
+
const [selectedSignatureColor, setSelectedSignatureColor] = (0, import_react10.useState)("black");
|
|
8743
|
+
const [isPlacingAnnotation, setIsPlacingAnnotation] = (0, import_react10.useState)(false);
|
|
8744
|
+
const [activePlacementId, setActivePlacementId] = (0, import_react10.useState)(
|
|
8424
8745
|
null
|
|
8425
8746
|
);
|
|
8426
|
-
const [activeAnnotationId, setActiveAnnotationId] = (0,
|
|
8747
|
+
const [activeAnnotationId, setActiveAnnotationId] = (0, import_react10.useState)(
|
|
8427
8748
|
null
|
|
8428
8749
|
);
|
|
8429
|
-
const [resolved, setResolved] = (0,
|
|
8430
|
-
const [loading, setLoading] = (0,
|
|
8431
|
-
const [error, setError] = (0,
|
|
8432
|
-
const [isSaving, setIsSaving] = (0,
|
|
8433
|
-
const [pageCount, setPageCount] = (0,
|
|
8434
|
-
const [currentPage, setCurrentPage] = (0,
|
|
8435
|
-
const [thumbnails, setThumbnails] = (0,
|
|
8436
|
-
const [richTextExportState, setRichTextExportState] = (0,
|
|
8437
|
-
const [spreadsheetExportState, setSpreadsheetExportState] = (0,
|
|
8438
|
-
const [pptxExportState, setPptxExportState] = (0,
|
|
8439
|
-
const [internalPlacements, setInternalPlacements] = (0,
|
|
8440
|
-
const [internalAnnotations, setInternalAnnotations] = (0,
|
|
8441
|
-
const [zoomStageSize, setZoomStageSize] = (0,
|
|
8442
|
-
const [mainContentWidth, setMainContentWidth] = (0,
|
|
8443
|
-
const placements = (0,
|
|
8750
|
+
const [resolved, setResolved] = (0, import_react10.useState)(null);
|
|
8751
|
+
const [loading, setLoading] = (0, import_react10.useState)(true);
|
|
8752
|
+
const [error, setError] = (0, import_react10.useState)("");
|
|
8753
|
+
const [isSaving, setIsSaving] = (0, import_react10.useState)(false);
|
|
8754
|
+
const [pageCount, setPageCount] = (0, import_react10.useState)(1);
|
|
8755
|
+
const [currentPage, setCurrentPage] = (0, import_react10.useState)(1);
|
|
8756
|
+
const [thumbnails, setThumbnails] = (0, import_react10.useState)([]);
|
|
8757
|
+
const [richTextExportState, setRichTextExportState] = (0, import_react10.useState)(null);
|
|
8758
|
+
const [spreadsheetExportState, setSpreadsheetExportState] = (0, import_react10.useState)(null);
|
|
8759
|
+
const [pptxExportState, setPptxExportState] = (0, import_react10.useState)(null);
|
|
8760
|
+
const [internalPlacements, setInternalPlacements] = (0, import_react10.useState)(props.signaturePlacements ?? []);
|
|
8761
|
+
const [internalAnnotations, setInternalAnnotations] = (0, import_react10.useState)(props.annotations ?? []);
|
|
8762
|
+
const [zoomStageSize, setZoomStageSize] = (0, import_react10.useState)({ width: 0, height: 0 });
|
|
8763
|
+
const [mainContentWidth, setMainContentWidth] = (0, import_react10.useState)(0);
|
|
8764
|
+
const placements = (0, import_react10.useMemo)(
|
|
8444
8765
|
() => (props.signaturePlacements ?? internalPlacements).map(
|
|
8445
8766
|
(placement) => normalizeSignaturePlacement(placement)
|
|
8446
8767
|
),
|
|
8447
8768
|
[internalPlacements, props.signaturePlacements]
|
|
8448
8769
|
);
|
|
8449
8770
|
const annotations = props.annotations ?? internalAnnotations;
|
|
8450
|
-
const availableSignatures = (0,
|
|
8771
|
+
const availableSignatures = (0, import_react10.useMemo)(
|
|
8451
8772
|
() => (props.signatures ?? []).map((signature) => normalizeSignature(signature)),
|
|
8452
8773
|
[props.signatures]
|
|
8453
8774
|
);
|
|
@@ -8482,7 +8803,7 @@ function DocumentViewer(props) {
|
|
|
8482
8803
|
const isRichTextAuthoringMode = Boolean(
|
|
8483
8804
|
resolved && ["docx", "doc", "rtf", "txt", "md"].includes(resolved.fileType) && effectiveMode !== "view"
|
|
8484
8805
|
);
|
|
8485
|
-
const finalizedSignatures = (0,
|
|
8806
|
+
const finalizedSignatures = (0, import_react10.useMemo)(() => {
|
|
8486
8807
|
const seen = /* @__PURE__ */ new Set();
|
|
8487
8808
|
return placements.flatMap((placement) => {
|
|
8488
8809
|
const signature = placement.signature;
|
|
@@ -8494,7 +8815,7 @@ function DocumentViewer(props) {
|
|
|
8494
8815
|
return [signature];
|
|
8495
8816
|
});
|
|
8496
8817
|
}, [placements]);
|
|
8497
|
-
const signatureList = (0,
|
|
8818
|
+
const signatureList = (0, import_react10.useMemo)(
|
|
8498
8819
|
() => placements.map((placement) => ({
|
|
8499
8820
|
placementId: placement.id,
|
|
8500
8821
|
signatureId: placement.signatureId,
|
|
@@ -8509,41 +8830,41 @@ function DocumentViewer(props) {
|
|
|
8509
8830
|
})),
|
|
8510
8831
|
[placements]
|
|
8511
8832
|
);
|
|
8512
|
-
(0,
|
|
8833
|
+
(0, import_react10.useEffect)(() => {
|
|
8513
8834
|
if (props.signaturePlacements) {
|
|
8514
8835
|
setInternalPlacements(props.signaturePlacements);
|
|
8515
8836
|
}
|
|
8516
8837
|
}, [props.signaturePlacements]);
|
|
8517
|
-
(0,
|
|
8838
|
+
(0, import_react10.useEffect)(() => {
|
|
8518
8839
|
if (props.annotations) {
|
|
8519
8840
|
setInternalAnnotations(props.annotations);
|
|
8520
8841
|
}
|
|
8521
8842
|
}, [props.annotations]);
|
|
8522
|
-
(0,
|
|
8843
|
+
(0, import_react10.useEffect)(() => {
|
|
8523
8844
|
setShowThumbnails(props.defaultShowThumbnails ?? true);
|
|
8524
8845
|
}, [props.defaultShowThumbnails]);
|
|
8525
|
-
(0,
|
|
8846
|
+
(0, import_react10.useEffect)(() => {
|
|
8526
8847
|
setLayout(props.defaultLayout ?? "single");
|
|
8527
8848
|
}, [props.defaultLayout]);
|
|
8528
|
-
(0,
|
|
8849
|
+
(0, import_react10.useEffect)(() => {
|
|
8529
8850
|
if (!signingEnabled) {
|
|
8530
8851
|
setShowSignatures(false);
|
|
8531
8852
|
setSelectedSignature(null);
|
|
8532
8853
|
setActivePlacementId(null);
|
|
8533
8854
|
}
|
|
8534
8855
|
}, [signingEnabled]);
|
|
8535
|
-
(0,
|
|
8856
|
+
(0, import_react10.useEffect)(() => {
|
|
8536
8857
|
if (!annotationEnabled) {
|
|
8537
8858
|
setIsPlacingAnnotation(false);
|
|
8538
8859
|
setActiveAnnotationId(null);
|
|
8539
8860
|
}
|
|
8540
8861
|
}, [annotationEnabled]);
|
|
8541
|
-
(0,
|
|
8862
|
+
(0, import_react10.useEffect)(() => {
|
|
8542
8863
|
if (!headerFooterToggleEnabled) {
|
|
8543
8864
|
setShowHeaderFooterSlots(true);
|
|
8544
8865
|
}
|
|
8545
8866
|
}, [headerFooterToggleEnabled]);
|
|
8546
|
-
(0,
|
|
8867
|
+
(0, import_react10.useEffect)(() => {
|
|
8547
8868
|
let active = true;
|
|
8548
8869
|
let cleanupSource;
|
|
8549
8870
|
const loadFile = async () => {
|
|
@@ -8602,7 +8923,7 @@ function DocumentViewer(props) {
|
|
|
8602
8923
|
props.fileUrl,
|
|
8603
8924
|
requestedFileType
|
|
8604
8925
|
]);
|
|
8605
|
-
(0,
|
|
8926
|
+
(0, import_react10.useEffect)(() => {
|
|
8606
8927
|
setZoom(1);
|
|
8607
8928
|
setCurrentPage(1);
|
|
8608
8929
|
setSelectedSignature(null);
|
|
@@ -8620,7 +8941,7 @@ function DocumentViewer(props) {
|
|
|
8620
8941
|
setInternalAnnotations([]);
|
|
8621
8942
|
}
|
|
8622
8943
|
}, [mode, props.fileUrl, props.fileName, props.fileType, props.blob, props.base64]);
|
|
8623
|
-
(0,
|
|
8944
|
+
(0, import_react10.useEffect)(() => {
|
|
8624
8945
|
const element = zoomStageRef.current;
|
|
8625
8946
|
if (!element) {
|
|
8626
8947
|
return;
|
|
@@ -8678,7 +8999,7 @@ function DocumentViewer(props) {
|
|
|
8678
8999
|
showSignatures,
|
|
8679
9000
|
showThumbnails
|
|
8680
9001
|
]);
|
|
8681
|
-
(0,
|
|
9002
|
+
(0, import_react10.useEffect)(() => {
|
|
8682
9003
|
const element = mainRef.current;
|
|
8683
9004
|
if (!element) {
|
|
8684
9005
|
return;
|
|
@@ -8712,7 +9033,7 @@ function DocumentViewer(props) {
|
|
|
8712
9033
|
window.removeEventListener("resize", scheduleMeasure);
|
|
8713
9034
|
};
|
|
8714
9035
|
}, []);
|
|
8715
|
-
const zoomShellStyle = (0,
|
|
9036
|
+
const zoomShellStyle = (0, import_react10.useMemo)(
|
|
8716
9037
|
() => {
|
|
8717
9038
|
const baseWidth = isRichTextAuthoringMode && mainContentWidth > 0 ? mainContentWidth : zoomStageSize.width;
|
|
8718
9039
|
return {
|
|
@@ -8723,7 +9044,7 @@ function DocumentViewer(props) {
|
|
|
8723
9044
|
},
|
|
8724
9045
|
[isRichTextAuthoringMode, mainContentWidth, zoom, zoomStageSize.height, zoomStageSize.width]
|
|
8725
9046
|
);
|
|
8726
|
-
const zoomStageStyle = (0,
|
|
9047
|
+
const zoomStageStyle = (0, import_react10.useMemo)(
|
|
8727
9048
|
() => {
|
|
8728
9049
|
const baseWidth = isRichTextAuthoringMode && mainContentWidth > 0 ? mainContentWidth : zoomStageSize.width;
|
|
8729
9050
|
return {
|
|
@@ -8869,7 +9190,7 @@ function DocumentViewer(props) {
|
|
|
8869
9190
|
}
|
|
8870
9191
|
}
|
|
8871
9192
|
};
|
|
8872
|
-
const saveReady = (0,
|
|
9193
|
+
const saveReady = (0, import_react10.useMemo)(() => {
|
|
8873
9194
|
if (!resolved) {
|
|
8874
9195
|
return false;
|
|
8875
9196
|
}
|
|
@@ -8904,7 +9225,7 @@ function DocumentViewer(props) {
|
|
|
8904
9225
|
spreadsheetExportState
|
|
8905
9226
|
]);
|
|
8906
9227
|
const saveEnabled = Boolean(props.onSave) && Boolean(resolved) && !loading && saveReady;
|
|
8907
|
-
const exportLabels = (0,
|
|
9228
|
+
const exportLabels = (0, import_react10.useMemo)(
|
|
8908
9229
|
() => ({
|
|
8909
9230
|
annotationTitle: locale["annotations.title"],
|
|
8910
9231
|
linkedAnnotationTitle: locale["annotations.linkedTitle"],
|
|
@@ -9058,20 +9379,20 @@ function DocumentViewer(props) {
|
|
|
9058
9379
|
};
|
|
9059
9380
|
const renderContent = () => {
|
|
9060
9381
|
if (error) {
|
|
9061
|
-
return /* @__PURE__ */ (0,
|
|
9062
|
-
/* @__PURE__ */ (0,
|
|
9063
|
-
/* @__PURE__ */ (0,
|
|
9382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "hv-status-shell", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "hv-error-banner", children: [
|
|
9383
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("strong", { children: locale["error.title"] }),
|
|
9384
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { children: error })
|
|
9064
9385
|
] }) });
|
|
9065
9386
|
}
|
|
9066
9387
|
if (loading || !resolved) {
|
|
9067
|
-
return /* @__PURE__ */ (0,
|
|
9068
|
-
/* @__PURE__ */ (0,
|
|
9069
|
-
/* @__PURE__ */ (0,
|
|
9388
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "hv-status-shell", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "hv-loader", children: [
|
|
9389
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "hv-spinner" }),
|
|
9390
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: locale.loading })
|
|
9070
9391
|
] }) });
|
|
9071
9392
|
}
|
|
9072
|
-
const renderCapabilityNotice = (title, description, variant = "info") => /* @__PURE__ */ (0,
|
|
9073
|
-
/* @__PURE__ */ (0,
|
|
9074
|
-
/* @__PURE__ */ (0,
|
|
9393
|
+
const renderCapabilityNotice = (title, description, variant = "info") => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: `hv-info-banner${variant === "warning" ? " warning" : ""}`, children: [
|
|
9394
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("strong", { children: title }),
|
|
9395
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { children: description })
|
|
9075
9396
|
] });
|
|
9076
9397
|
const shouldShowModeAdjustedNotice = showModeFallbackNotice || showCreateUnsupportedNotice && hasRenderableSource;
|
|
9077
9398
|
const modeAdjustedNotice = shouldShowModeAdjustedNotice ? renderCapabilityNotice(
|
|
@@ -9082,7 +9403,7 @@ function DocumentViewer(props) {
|
|
|
9082
9403
|
).replace("{fileType}", getReadableFileTypeLabel(resolved.fileType))
|
|
9083
9404
|
) : null;
|
|
9084
9405
|
if (showCreateUnsupportedNotice && !hasRenderableSource) {
|
|
9085
|
-
return /* @__PURE__ */ (0,
|
|
9406
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "hv-page-container", style: { padding: "32px" }, children: renderCapabilityNotice(
|
|
9086
9407
|
locale["documents.createUnsupportedTitle"],
|
|
9087
9408
|
locale["documents.createUnsupportedDescription"].replace(
|
|
9088
9409
|
"{formats}",
|
|
@@ -9105,9 +9426,9 @@ function DocumentViewer(props) {
|
|
|
9105
9426
|
};
|
|
9106
9427
|
switch (resolved.fileType) {
|
|
9107
9428
|
case "pdf":
|
|
9108
|
-
return /* @__PURE__ */ (0,
|
|
9429
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
9109
9430
|
modeAdjustedNotice,
|
|
9110
|
-
/* @__PURE__ */ (0,
|
|
9431
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
9111
9432
|
PdfRenderer,
|
|
9112
9433
|
{
|
|
9113
9434
|
url: resolved.url,
|
|
@@ -9121,9 +9442,9 @@ function DocumentViewer(props) {
|
|
|
9121
9442
|
case "rtf":
|
|
9122
9443
|
case "txt":
|
|
9123
9444
|
case "md":
|
|
9124
|
-
return /* @__PURE__ */ (0,
|
|
9445
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
9125
9446
|
modeAdjustedNotice,
|
|
9126
|
-
/* @__PURE__ */ (0,
|
|
9447
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
9127
9448
|
RichTextEditor,
|
|
9128
9449
|
{
|
|
9129
9450
|
mode: effectiveMode,
|
|
@@ -9135,9 +9456,9 @@ function DocumentViewer(props) {
|
|
|
9135
9456
|
case "xlsx":
|
|
9136
9457
|
case "csv":
|
|
9137
9458
|
case "xls":
|
|
9138
|
-
return /* @__PURE__ */ (0,
|
|
9459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
9139
9460
|
modeAdjustedNotice,
|
|
9140
|
-
/* @__PURE__ */ (0,
|
|
9461
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
9141
9462
|
SpreadsheetEditor,
|
|
9142
9463
|
{
|
|
9143
9464
|
mode: effectiveMode,
|
|
@@ -9148,9 +9469,9 @@ function DocumentViewer(props) {
|
|
|
9148
9469
|
] });
|
|
9149
9470
|
case "pptx":
|
|
9150
9471
|
case "ppt":
|
|
9151
|
-
return /* @__PURE__ */ (0,
|
|
9472
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
9152
9473
|
modeAdjustedNotice,
|
|
9153
|
-
/* @__PURE__ */ (0,
|
|
9474
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
9154
9475
|
PptxRenderer,
|
|
9155
9476
|
{
|
|
9156
9477
|
onExportStateChange: setPptxExportState,
|
|
@@ -9164,20 +9485,20 @@ function DocumentViewer(props) {
|
|
|
9164
9485
|
case "gif":
|
|
9165
9486
|
case "bmp":
|
|
9166
9487
|
case "svg":
|
|
9167
|
-
return /* @__PURE__ */ (0,
|
|
9488
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
9168
9489
|
modeAdjustedNotice,
|
|
9169
|
-
/* @__PURE__ */ (0,
|
|
9490
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ImageRenderer, { ...commonProps, fileType: resolved.fileType })
|
|
9170
9491
|
] });
|
|
9171
9492
|
default:
|
|
9172
|
-
return /* @__PURE__ */ (0,
|
|
9493
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "hv-status-shell", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "hv-error-banner", children: [
|
|
9173
9494
|
locale["documents.unsupportedFileType"],
|
|
9174
9495
|
": ",
|
|
9175
9496
|
resolved.fileType
|
|
9176
9497
|
] }) });
|
|
9177
9498
|
}
|
|
9178
9499
|
};
|
|
9179
|
-
return /* @__PURE__ */ (0,
|
|
9180
|
-
/* @__PURE__ */ (0,
|
|
9500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "hv-root", "data-hv-theme": theme, children: [
|
|
9501
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
9181
9502
|
Toolbar,
|
|
9182
9503
|
{
|
|
9183
9504
|
fileName: resolved?.fileName,
|
|
@@ -9224,8 +9545,8 @@ function DocumentViewer(props) {
|
|
|
9224
9545
|
locale
|
|
9225
9546
|
}
|
|
9226
9547
|
),
|
|
9227
|
-
(props.headerComponent || props.footerComponent) && /* @__PURE__ */ (0,
|
|
9228
|
-
props.headerComponent && /* @__PURE__ */ (0,
|
|
9548
|
+
(props.headerComponent || props.footerComponent) && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "hv-export-slot-host", "aria-hidden": "true", children: [
|
|
9549
|
+
props.headerComponent && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
9229
9550
|
"div",
|
|
9230
9551
|
{
|
|
9231
9552
|
ref: exportHeaderRef,
|
|
@@ -9233,7 +9554,7 @@ function DocumentViewer(props) {
|
|
|
9233
9554
|
children: props.headerComponent
|
|
9234
9555
|
}
|
|
9235
9556
|
),
|
|
9236
|
-
props.footerComponent && /* @__PURE__ */ (0,
|
|
9557
|
+
props.footerComponent && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
9237
9558
|
"div",
|
|
9238
9559
|
{
|
|
9239
9560
|
ref: exportFooterRef,
|
|
@@ -9242,8 +9563,8 @@ function DocumentViewer(props) {
|
|
|
9242
9563
|
}
|
|
9243
9564
|
)
|
|
9244
9565
|
] }),
|
|
9245
|
-
/* @__PURE__ */ (0,
|
|
9246
|
-
/* @__PURE__ */ (0,
|
|
9566
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "hv-shell", children: [
|
|
9567
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
9247
9568
|
ThumbnailsSidebar,
|
|
9248
9569
|
{
|
|
9249
9570
|
isOpen: showThumbnails,
|
|
@@ -9253,15 +9574,15 @@ function DocumentViewer(props) {
|
|
|
9253
9574
|
locale
|
|
9254
9575
|
}
|
|
9255
9576
|
),
|
|
9256
|
-
/* @__PURE__ */ (0,
|
|
9577
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
9257
9578
|
"main",
|
|
9258
9579
|
{
|
|
9259
9580
|
ref: mainRef,
|
|
9260
9581
|
className: `hv-main${isRichTextAuthoringMode ? " hv-main-richtext-authoring" : ""}`,
|
|
9261
|
-
children: /* @__PURE__ */ (0,
|
|
9582
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "hv-zoom-shell", style: zoomShellStyle, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { ref: zoomStageRef, className: "hv-zoom-stage", style: zoomStageStyle, children: renderContent() }) })
|
|
9262
9583
|
}
|
|
9263
9584
|
),
|
|
9264
|
-
signingEnabled && /* @__PURE__ */ (0,
|
|
9585
|
+
signingEnabled && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
9265
9586
|
SignaturePanel,
|
|
9266
9587
|
{
|
|
9267
9588
|
isOpen: showSignatures,
|