@zerohive/hive-viewer 2.0.2 → 2.0.4
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 +1305 -551
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.mjs +1181 -427
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +86 -9
- 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,23 +158,449 @@ function normalizeSignaturePlacement(placement) {
|
|
|
155
158
|
};
|
|
156
159
|
}
|
|
157
160
|
|
|
158
|
-
// src/
|
|
161
|
+
// src/utils/signatureImage.ts
|
|
162
|
+
var signatureAlphaSourceCache = /* @__PURE__ */ new Map();
|
|
163
|
+
var renderedSignatureCache = /* @__PURE__ */ new Map();
|
|
164
|
+
function ensureSignatureSource(source) {
|
|
165
|
+
const trimmedSource = source.trim();
|
|
166
|
+
if (trimmedSource.startsWith("data:") || trimmedSource.startsWith("blob:") || trimmedSource.startsWith("http:") || trimmedSource.startsWith("https:")) {
|
|
167
|
+
return trimmedSource;
|
|
168
|
+
}
|
|
169
|
+
if (trimmedSource.startsWith("//") && typeof window !== "undefined") {
|
|
170
|
+
return `${window.location.protocol}${trimmedSource}`;
|
|
171
|
+
}
|
|
172
|
+
if (typeof window !== "undefined" && (trimmedSource.startsWith("/") || trimmedSource.startsWith("./") || trimmedSource.startsWith("../"))) {
|
|
173
|
+
return new URL(trimmedSource, window.location.origin).toString();
|
|
174
|
+
}
|
|
175
|
+
if (trimmedSource.startsWith("<svg") || trimmedSource.startsWith("<?xml") && trimmedSource.includes("<svg")) {
|
|
176
|
+
return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(trimmedSource)}`;
|
|
177
|
+
}
|
|
178
|
+
return `data:image/png;base64,${trimmedSource}`;
|
|
179
|
+
}
|
|
180
|
+
function createCanvas(width, height) {
|
|
181
|
+
const canvas = document.createElement("canvas");
|
|
182
|
+
canvas.width = Math.max(1, Math.round(width));
|
|
183
|
+
canvas.height = Math.max(1, Math.round(height));
|
|
184
|
+
return canvas;
|
|
185
|
+
}
|
|
186
|
+
async function loadSignatureImage(source) {
|
|
187
|
+
const image = new Image();
|
|
188
|
+
image.crossOrigin = "anonymous";
|
|
189
|
+
image.decoding = "async";
|
|
190
|
+
await new Promise((resolve, reject) => {
|
|
191
|
+
image.onload = () => resolve();
|
|
192
|
+
image.onerror = () => reject(new Error("Unable to load signature image."));
|
|
193
|
+
image.src = source;
|
|
194
|
+
});
|
|
195
|
+
if ("decode" in image) {
|
|
196
|
+
try {
|
|
197
|
+
await image.decode();
|
|
198
|
+
} catch {
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return image;
|
|
202
|
+
}
|
|
203
|
+
function colorDistance(leftRed, leftGreen, leftBlue, rightRed, rightGreen, rightBlue) {
|
|
204
|
+
const deltaRed = leftRed - rightRed;
|
|
205
|
+
const deltaGreen = leftGreen - rightGreen;
|
|
206
|
+
const deltaBlue = leftBlue - rightBlue;
|
|
207
|
+
return Math.sqrt(
|
|
208
|
+
deltaRed * deltaRed + deltaGreen * deltaGreen + deltaBlue * deltaBlue
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
function computeLuminance(red, green, blue) {
|
|
212
|
+
return red * 0.2126 + green * 0.7152 + blue * 0.0722;
|
|
213
|
+
}
|
|
214
|
+
function clamp01(value) {
|
|
215
|
+
return Math.min(1, Math.max(0, value));
|
|
216
|
+
}
|
|
217
|
+
function hasMeaningfulTransparency(pixels) {
|
|
218
|
+
let translucentPixels = 0;
|
|
219
|
+
const totalPixels = pixels.length / 4;
|
|
220
|
+
for (let index = 3; index < pixels.length; index += 4) {
|
|
221
|
+
if (pixels[index] < 250) {
|
|
222
|
+
translucentPixels += 1;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return translucentPixels > Math.max(12, totalPixels * 4e-3);
|
|
226
|
+
}
|
|
227
|
+
function detectUniformBackground(pixels, width, height) {
|
|
228
|
+
const sampleRadius = Math.max(
|
|
229
|
+
2,
|
|
230
|
+
Math.min(12, Math.floor(Math.min(width, height) / 12))
|
|
231
|
+
);
|
|
232
|
+
const sampleOrigins = [
|
|
233
|
+
[0, 0],
|
|
234
|
+
[Math.max(0, width - sampleRadius), 0],
|
|
235
|
+
[0, Math.max(0, height - sampleRadius)],
|
|
236
|
+
[Math.max(0, width - sampleRadius), Math.max(0, height - sampleRadius)]
|
|
237
|
+
];
|
|
238
|
+
const samples = [];
|
|
239
|
+
for (const [startX, startY] of sampleOrigins) {
|
|
240
|
+
let red = 0;
|
|
241
|
+
let green = 0;
|
|
242
|
+
let blue = 0;
|
|
243
|
+
let count = 0;
|
|
244
|
+
for (let y = startY; y < Math.min(height, startY + sampleRadius); y += 1) {
|
|
245
|
+
for (let x = startX; x < Math.min(width, startX + sampleRadius); x += 1) {
|
|
246
|
+
const offset = (y * width + x) * 4;
|
|
247
|
+
const alpha = pixels[offset + 3];
|
|
248
|
+
if (alpha < 250) {
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
red += pixels[offset];
|
|
252
|
+
green += pixels[offset + 1];
|
|
253
|
+
blue += pixels[offset + 2];
|
|
254
|
+
count += 1;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
if (count === 0) {
|
|
258
|
+
return null;
|
|
259
|
+
}
|
|
260
|
+
samples.push([
|
|
261
|
+
Math.round(red / count),
|
|
262
|
+
Math.round(green / count),
|
|
263
|
+
Math.round(blue / count)
|
|
264
|
+
]);
|
|
265
|
+
}
|
|
266
|
+
if (samples.length === 0) {
|
|
267
|
+
return null;
|
|
268
|
+
}
|
|
269
|
+
const average = samples.reduce(
|
|
270
|
+
(accumulator, sample) => [
|
|
271
|
+
accumulator[0] + sample[0],
|
|
272
|
+
accumulator[1] + sample[1],
|
|
273
|
+
accumulator[2] + sample[2]
|
|
274
|
+
],
|
|
275
|
+
[0, 0, 0]
|
|
276
|
+
);
|
|
277
|
+
const background = [
|
|
278
|
+
Math.round(average[0] / samples.length),
|
|
279
|
+
Math.round(average[1] / samples.length),
|
|
280
|
+
Math.round(average[2] / samples.length)
|
|
281
|
+
];
|
|
282
|
+
const maxDistance = samples.reduce((highest, sample) => {
|
|
283
|
+
const distance = colorDistance(
|
|
284
|
+
sample[0],
|
|
285
|
+
sample[1],
|
|
286
|
+
sample[2],
|
|
287
|
+
background[0],
|
|
288
|
+
background[1],
|
|
289
|
+
background[2]
|
|
290
|
+
);
|
|
291
|
+
return Math.max(highest, distance);
|
|
292
|
+
}, 0);
|
|
293
|
+
return maxDistance <= 26 ? background : null;
|
|
294
|
+
}
|
|
295
|
+
function measureAlphaBounds(alphaMask, width, height, alphaThreshold = 8) {
|
|
296
|
+
let minX = width;
|
|
297
|
+
let minY = height;
|
|
298
|
+
let maxX = -1;
|
|
299
|
+
let maxY = -1;
|
|
300
|
+
for (let y = 0; y < height; y += 1) {
|
|
301
|
+
for (let x = 0; x < width; x += 1) {
|
|
302
|
+
const alpha = alphaMask[y * width + x];
|
|
303
|
+
if (alpha <= alphaThreshold) {
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
minX = Math.min(minX, x);
|
|
307
|
+
minY = Math.min(minY, y);
|
|
308
|
+
maxX = Math.max(maxX, x);
|
|
309
|
+
maxY = Math.max(maxY, y);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
if (maxX < minX || maxY < minY) {
|
|
313
|
+
return { sx: 0, sy: 0, sw: width, sh: height };
|
|
314
|
+
}
|
|
315
|
+
const padding = Math.max(6, Math.round(Math.max(width, height) * 0.04));
|
|
316
|
+
const sx = Math.max(0, minX - padding);
|
|
317
|
+
const sy = Math.max(0, minY - padding);
|
|
318
|
+
const sw = Math.min(width - sx, maxX - minX + 1 + padding * 2);
|
|
319
|
+
const sh = Math.min(height - sy, maxY - minY + 1 + padding * 2);
|
|
320
|
+
return { sx, sy, sw, sh };
|
|
321
|
+
}
|
|
322
|
+
function createAlphaMaskFromTransparency(pixels) {
|
|
323
|
+
const alphaMask = new Uint8ClampedArray(pixels.length / 4);
|
|
324
|
+
for (let pixelIndex = 0; pixelIndex < alphaMask.length; pixelIndex += 1) {
|
|
325
|
+
alphaMask[pixelIndex] = pixels[pixelIndex * 4 + 3];
|
|
326
|
+
}
|
|
327
|
+
return alphaMask;
|
|
328
|
+
}
|
|
329
|
+
function createAlphaMaskFromSolidBackground(pixels, width, height, background) {
|
|
330
|
+
const alphaMask = new Uint8ClampedArray(width * height);
|
|
331
|
+
let foregroundPixels = 0;
|
|
332
|
+
let maxAlpha = 0;
|
|
333
|
+
const backgroundLuminance = computeLuminance(
|
|
334
|
+
background[0],
|
|
335
|
+
background[1],
|
|
336
|
+
background[2]
|
|
337
|
+
);
|
|
338
|
+
for (let pixelIndex = 0; pixelIndex < alphaMask.length; pixelIndex += 1) {
|
|
339
|
+
const offset = pixelIndex * 4;
|
|
340
|
+
const red = pixels[offset];
|
|
341
|
+
const green = pixels[offset + 1];
|
|
342
|
+
const blue = pixels[offset + 2];
|
|
343
|
+
const alpha = pixels[offset + 3] / 255;
|
|
344
|
+
const distance = colorDistance(
|
|
345
|
+
red,
|
|
346
|
+
green,
|
|
347
|
+
blue,
|
|
348
|
+
background[0],
|
|
349
|
+
background[1],
|
|
350
|
+
background[2]
|
|
351
|
+
);
|
|
352
|
+
const channelDelta = Math.max(
|
|
353
|
+
Math.abs(red - background[0]),
|
|
354
|
+
Math.abs(green - background[1]),
|
|
355
|
+
Math.abs(blue - background[2])
|
|
356
|
+
);
|
|
357
|
+
const luminance = computeLuminance(red, green, blue);
|
|
358
|
+
const luminanceDelta = Math.abs(luminance - backgroundLuminance);
|
|
359
|
+
const strength = clamp01(
|
|
360
|
+
Math.max(distance / 120, channelDelta / 90, luminanceDelta / 72)
|
|
361
|
+
);
|
|
362
|
+
const sharpened = strength <= 0.06 ? 0 : Math.pow(strength, 0.68);
|
|
363
|
+
const outputAlpha = Math.round(sharpened * alpha * 255);
|
|
364
|
+
alphaMask[pixelIndex] = outputAlpha;
|
|
365
|
+
if (outputAlpha > 10) {
|
|
366
|
+
foregroundPixels += 1;
|
|
367
|
+
maxAlpha = Math.max(maxAlpha, outputAlpha);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
const totalPixels = width * height;
|
|
371
|
+
if (foregroundPixels < Math.max(24, totalPixels * 15e-4) || foregroundPixels > totalPixels * 0.42 || maxAlpha === 0) {
|
|
372
|
+
return null;
|
|
373
|
+
}
|
|
374
|
+
const normalizeScale = 255 / maxAlpha;
|
|
375
|
+
for (let pixelIndex = 0; pixelIndex < alphaMask.length; pixelIndex += 1) {
|
|
376
|
+
const alpha = alphaMask[pixelIndex];
|
|
377
|
+
if (alpha === 0) {
|
|
378
|
+
continue;
|
|
379
|
+
}
|
|
380
|
+
const normalized = Math.min(
|
|
381
|
+
255,
|
|
382
|
+
Math.round(Math.pow(alpha * normalizeScale / 255, 0.92) * 255)
|
|
383
|
+
);
|
|
384
|
+
alphaMask[pixelIndex] = normalized <= 10 ? 0 : normalized;
|
|
385
|
+
}
|
|
386
|
+
return alphaMask;
|
|
387
|
+
}
|
|
388
|
+
function parseInkColor(inkColor) {
|
|
389
|
+
const hex = SIGNATURE_INK_COLOR_VALUES[inkColor];
|
|
390
|
+
return [
|
|
391
|
+
Number.parseInt(hex.slice(1, 3), 16),
|
|
392
|
+
Number.parseInt(hex.slice(3, 5), 16),
|
|
393
|
+
Number.parseInt(hex.slice(5, 7), 16)
|
|
394
|
+
];
|
|
395
|
+
}
|
|
396
|
+
function createTintedSignatureCanvas(alphaSource, inkColor) {
|
|
397
|
+
if (!alphaSource.alphaMask) {
|
|
398
|
+
return null;
|
|
399
|
+
}
|
|
400
|
+
const { bounds } = alphaSource;
|
|
401
|
+
const canvas = createCanvas(bounds.sw, bounds.sh);
|
|
402
|
+
const context = canvas.getContext("2d");
|
|
403
|
+
if (!context) {
|
|
404
|
+
return null;
|
|
405
|
+
}
|
|
406
|
+
const output = context.createImageData(bounds.sw, bounds.sh);
|
|
407
|
+
const ink = parseInkColor(inkColor);
|
|
408
|
+
for (let y = 0; y < bounds.sh; y += 1) {
|
|
409
|
+
for (let x = 0; x < bounds.sw; x += 1) {
|
|
410
|
+
const sourceIndex = (bounds.sy + y) * alphaSource.width + bounds.sx + x;
|
|
411
|
+
const targetIndex = (y * bounds.sw + x) * 4;
|
|
412
|
+
output.data[targetIndex] = ink[0];
|
|
413
|
+
output.data[targetIndex + 1] = ink[1];
|
|
414
|
+
output.data[targetIndex + 2] = ink[2];
|
|
415
|
+
output.data[targetIndex + 3] = alphaSource.alphaMask[sourceIndex];
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
context.putImageData(output, 0, 0);
|
|
419
|
+
return canvas;
|
|
420
|
+
}
|
|
421
|
+
async function getSignatureAlphaSource(source) {
|
|
422
|
+
const resolvedSource = ensureSignatureSource(source);
|
|
423
|
+
const cached = signatureAlphaSourceCache.get(resolvedSource);
|
|
424
|
+
if (cached) {
|
|
425
|
+
return cached;
|
|
426
|
+
}
|
|
427
|
+
const pending = (async () => {
|
|
428
|
+
const image = await loadSignatureImage(resolvedSource);
|
|
429
|
+
const fallbackBounds = {
|
|
430
|
+
sx: 0,
|
|
431
|
+
sy: 0,
|
|
432
|
+
sw: image.width,
|
|
433
|
+
sh: image.height
|
|
434
|
+
};
|
|
435
|
+
const canvas = createCanvas(image.width, image.height);
|
|
436
|
+
const context = canvas.getContext("2d");
|
|
437
|
+
if (!context) {
|
|
438
|
+
return {
|
|
439
|
+
source: resolvedSource,
|
|
440
|
+
width: image.width,
|
|
441
|
+
height: image.height,
|
|
442
|
+
alphaMask: null,
|
|
443
|
+
bounds: fallbackBounds
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
context.drawImage(image, 0, 0, image.width, image.height);
|
|
447
|
+
let imageData;
|
|
448
|
+
try {
|
|
449
|
+
imageData = context.getImageData(0, 0, canvas.width, canvas.height);
|
|
450
|
+
} catch {
|
|
451
|
+
return {
|
|
452
|
+
source: resolvedSource,
|
|
453
|
+
width: image.width,
|
|
454
|
+
height: image.height,
|
|
455
|
+
alphaMask: null,
|
|
456
|
+
bounds: fallbackBounds
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
const alphaMask = hasMeaningfulTransparency(imageData.data) ? createAlphaMaskFromTransparency(imageData.data) : (() => {
|
|
460
|
+
const background = detectUniformBackground(
|
|
461
|
+
imageData.data,
|
|
462
|
+
canvas.width,
|
|
463
|
+
canvas.height
|
|
464
|
+
);
|
|
465
|
+
return background ? createAlphaMaskFromSolidBackground(
|
|
466
|
+
imageData.data,
|
|
467
|
+
canvas.width,
|
|
468
|
+
canvas.height,
|
|
469
|
+
background
|
|
470
|
+
) : null;
|
|
471
|
+
})();
|
|
472
|
+
if (!alphaMask) {
|
|
473
|
+
return {
|
|
474
|
+
source: resolvedSource,
|
|
475
|
+
width: image.width,
|
|
476
|
+
height: image.height,
|
|
477
|
+
alphaMask: null,
|
|
478
|
+
bounds: fallbackBounds
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
return {
|
|
482
|
+
source: resolvedSource,
|
|
483
|
+
width: image.width,
|
|
484
|
+
height: image.height,
|
|
485
|
+
alphaMask,
|
|
486
|
+
bounds: measureAlphaBounds(alphaMask, image.width, image.height)
|
|
487
|
+
};
|
|
488
|
+
})().catch(async () => {
|
|
489
|
+
const image = await loadSignatureImage(resolvedSource);
|
|
490
|
+
return {
|
|
491
|
+
source: resolvedSource,
|
|
492
|
+
width: image.width,
|
|
493
|
+
height: image.height,
|
|
494
|
+
alphaMask: null,
|
|
495
|
+
bounds: { sx: 0, sy: 0, sw: image.width, sh: image.height }
|
|
496
|
+
};
|
|
497
|
+
});
|
|
498
|
+
signatureAlphaSourceCache.set(resolvedSource, pending);
|
|
499
|
+
return pending;
|
|
500
|
+
}
|
|
501
|
+
async function getSignatureRenderMetrics(source) {
|
|
502
|
+
const alphaSource = await getSignatureAlphaSource(source);
|
|
503
|
+
const width = alphaSource.alphaMask ? alphaSource.bounds.sw : alphaSource.width;
|
|
504
|
+
const height = alphaSource.alphaMask ? alphaSource.bounds.sh : alphaSource.height;
|
|
505
|
+
return {
|
|
506
|
+
width,
|
|
507
|
+
height,
|
|
508
|
+
aspectRatio: width > 0 && height > 0 ? width / height : 3.1,
|
|
509
|
+
canTint: Boolean(alphaSource.alphaMask)
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
async function getRenderableSignatureImage(source, inkColor) {
|
|
513
|
+
const resolvedSource = ensureSignatureSource(source);
|
|
514
|
+
const normalizedInkColor = normalizeSignatureInkColor(inkColor);
|
|
515
|
+
const cacheKey = `${normalizedInkColor}::${resolvedSource}`;
|
|
516
|
+
const cached = renderedSignatureCache.get(cacheKey);
|
|
517
|
+
if (cached) {
|
|
518
|
+
return cached;
|
|
519
|
+
}
|
|
520
|
+
const pending = (async () => {
|
|
521
|
+
const alphaSource = await getSignatureAlphaSource(resolvedSource);
|
|
522
|
+
if (!alphaSource.alphaMask) {
|
|
523
|
+
return alphaSource.source;
|
|
524
|
+
}
|
|
525
|
+
const tintedCanvas = createTintedSignatureCanvas(
|
|
526
|
+
alphaSource,
|
|
527
|
+
normalizedInkColor
|
|
528
|
+
);
|
|
529
|
+
return tintedCanvas ? tintedCanvas.toDataURL("image/png") : alphaSource.source;
|
|
530
|
+
})().catch(() => resolvedSource);
|
|
531
|
+
renderedSignatureCache.set(cacheKey, pending);
|
|
532
|
+
return pending;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
// src/components/RenderableSignatureImage.tsx
|
|
159
536
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
537
|
+
var RenderableSignatureImage = (0, import_react.memo)(function RenderableSignatureImage2(props) {
|
|
538
|
+
const { signatureImageUrl, inkColor, ...imageProps } = props;
|
|
539
|
+
const [resolvedSrc, setResolvedSrc] = (0, import_react.useState)(signatureImageUrl);
|
|
540
|
+
(0, import_react.useEffect)(() => {
|
|
541
|
+
let cancelled = false;
|
|
542
|
+
void getRenderableSignatureImage(signatureImageUrl, inkColor).then((nextSource) => {
|
|
543
|
+
if (!cancelled) {
|
|
544
|
+
setResolvedSrc(nextSource);
|
|
545
|
+
}
|
|
546
|
+
}).catch(() => {
|
|
547
|
+
if (!cancelled) {
|
|
548
|
+
setResolvedSrc(signatureImageUrl);
|
|
549
|
+
}
|
|
550
|
+
});
|
|
551
|
+
return () => {
|
|
552
|
+
cancelled = true;
|
|
553
|
+
};
|
|
554
|
+
}, [inkColor, signatureImageUrl]);
|
|
555
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { ...imageProps, src: resolvedSrc, decoding: "async", draggable: false });
|
|
556
|
+
});
|
|
557
|
+
RenderableSignatureImage.displayName = "RenderableSignatureImage";
|
|
558
|
+
|
|
559
|
+
// src/components/SignatureOverlay.tsx
|
|
560
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
561
|
+
var DEFAULT_SIGNATURE_ASPECT_RATIO = 3.1;
|
|
160
562
|
function clamp(value, min, max) {
|
|
161
563
|
return Math.min(max, Math.max(min, value));
|
|
162
564
|
}
|
|
163
|
-
function
|
|
565
|
+
function clampAspectRatio(value) {
|
|
566
|
+
return clamp(value, 1.8, 6.2);
|
|
567
|
+
}
|
|
568
|
+
function getDefaultSurfaceAspectRatio(kind) {
|
|
164
569
|
switch (kind) {
|
|
165
|
-
case "sheet":
|
|
166
|
-
return { width: 0.3, height: 0.16 };
|
|
167
570
|
case "slide":
|
|
168
|
-
return
|
|
571
|
+
return 16 / 9;
|
|
572
|
+
case "sheet":
|
|
573
|
+
return 1.9;
|
|
169
574
|
case "image":
|
|
170
|
-
return
|
|
575
|
+
return 1;
|
|
171
576
|
default:
|
|
172
|
-
return
|
|
577
|
+
return 816 / 1056;
|
|
173
578
|
}
|
|
174
579
|
}
|
|
580
|
+
function getSignatureCardAspectRatio(aspectRatio = DEFAULT_SIGNATURE_ASPECT_RATIO) {
|
|
581
|
+
return clamp(aspectRatio * 0.78, 1.35, 4.8);
|
|
582
|
+
}
|
|
583
|
+
function getDefaultPlacementSize(kind, aspectRatio = DEFAULT_SIGNATURE_ASPECT_RATIO, surfaceAspectRatio = getDefaultSurfaceAspectRatio(kind)) {
|
|
584
|
+
const effectiveAspectRatio = getSignatureCardAspectRatio(
|
|
585
|
+
clampAspectRatio(aspectRatio)
|
|
586
|
+
);
|
|
587
|
+
const effectiveSurfaceAspectRatio = clamp(surfaceAspectRatio, 0.45, 2.8);
|
|
588
|
+
const heightTarget = kind === "sheet" ? 0.11 : kind === "slide" ? 0.135 : kind === "image" ? 0.14 : 0.115;
|
|
589
|
+
const widthMin = kind === "sheet" ? 0.2 : kind === "slide" ? 0.22 : kind === "image" ? 0.24 : 0.22;
|
|
590
|
+
const widthMax = kind === "sheet" ? 0.38 : kind === "slide" ? 0.44 : kind === "image" ? 0.48 : 0.4;
|
|
591
|
+
const heightMax = kind === "sheet" ? 0.18 : kind === "slide" ? 0.2 : kind === "image" ? 0.22 : 0.19;
|
|
592
|
+
const width = clamp(
|
|
593
|
+
heightTarget * effectiveAspectRatio / effectiveSurfaceAspectRatio,
|
|
594
|
+
widthMin,
|
|
595
|
+
widthMax
|
|
596
|
+
);
|
|
597
|
+
const height = clamp(
|
|
598
|
+
width * effectiveSurfaceAspectRatio / effectiveAspectRatio,
|
|
599
|
+
0.075,
|
|
600
|
+
heightMax
|
|
601
|
+
);
|
|
602
|
+
return { width, height };
|
|
603
|
+
}
|
|
175
604
|
function getDefaultAnnotationSize(kind) {
|
|
176
605
|
switch (kind) {
|
|
177
606
|
case "sheet":
|
|
@@ -189,9 +618,6 @@ function getLinkedAnnotationIds(annotations) {
|
|
|
189
618
|
annotations.filter((annotation) => annotation.linkedSignaturePlacementId).map((annotation) => annotation.linkedSignaturePlacementId)
|
|
190
619
|
);
|
|
191
620
|
}
|
|
192
|
-
function buildMaskImageValue(source) {
|
|
193
|
-
return `url("${source.replaceAll('"', '\\"')}")`;
|
|
194
|
-
}
|
|
195
621
|
function SignatureOverlay(props) {
|
|
196
622
|
const {
|
|
197
623
|
surfaceKey,
|
|
@@ -202,11 +628,13 @@ function SignatureOverlay(props) {
|
|
|
202
628
|
placements,
|
|
203
629
|
annotations,
|
|
204
630
|
pendingSignature,
|
|
631
|
+
pendingSignatureColor,
|
|
205
632
|
pendingAnnotation,
|
|
206
633
|
activePlacementId,
|
|
207
634
|
activeAnnotationId,
|
|
208
635
|
placeHint,
|
|
209
636
|
annotationHint,
|
|
637
|
+
cancelPlacementLabel,
|
|
210
638
|
annotationPlaceholder,
|
|
211
639
|
signatureAltLabel,
|
|
212
640
|
signatureAltByLabel,
|
|
@@ -226,24 +654,134 @@ function SignatureOverlay(props) {
|
|
|
226
654
|
onRemovePlacement,
|
|
227
655
|
onRemoveAnnotation,
|
|
228
656
|
onSelectPlacement,
|
|
229
|
-
onSelectAnnotation
|
|
657
|
+
onSelectAnnotation,
|
|
658
|
+
onCancelPlacementMode
|
|
230
659
|
} = props;
|
|
231
|
-
const layerRef = (0,
|
|
232
|
-
const [dragState, setDragState] = (0,
|
|
233
|
-
const
|
|
660
|
+
const layerRef = (0, import_react2.useRef)(null);
|
|
661
|
+
const [dragState, setDragState] = (0, import_react2.useState)(null);
|
|
662
|
+
const [dragPreview, setDragPreview] = (0, import_react2.useState)(null);
|
|
663
|
+
const [placementPreview, setPlacementPreview] = (0, import_react2.useState)(
|
|
664
|
+
null
|
|
665
|
+
);
|
|
666
|
+
const [pendingSignatureAspectRatio, setPendingSignatureAspectRatio] = (0, import_react2.useState)(
|
|
667
|
+
DEFAULT_SIGNATURE_ASPECT_RATIO
|
|
668
|
+
);
|
|
669
|
+
const [surfaceAspectRatio, setSurfaceAspectRatio] = (0, import_react2.useState)(
|
|
670
|
+
() => getDefaultSurfaceAspectRatio(surfaceKind)
|
|
671
|
+
);
|
|
672
|
+
const visiblePlacements = (0, import_react2.useMemo)(
|
|
234
673
|
() => placements.filter((placement) => placement.surfaceKey === surfaceKey),
|
|
235
674
|
[placements, surfaceKey]
|
|
236
675
|
);
|
|
237
|
-
const visibleAnnotations = (0,
|
|
676
|
+
const visibleAnnotations = (0, import_react2.useMemo)(
|
|
238
677
|
() => annotations.filter((annotation) => annotation.surfaceKey === surfaceKey),
|
|
239
678
|
[annotations, surfaceKey]
|
|
240
679
|
);
|
|
241
|
-
const linkedAnnotationIds = (0,
|
|
680
|
+
const linkedAnnotationIds = (0, import_react2.useMemo)(
|
|
242
681
|
() => getLinkedAnnotationIds(visibleAnnotations),
|
|
243
682
|
[visibleAnnotations]
|
|
244
683
|
);
|
|
245
684
|
const captureMode = pendingSignature ? "signature" : pendingAnnotation ? "annotation" : null;
|
|
246
|
-
(0,
|
|
685
|
+
const defaultSignatureSize = (0, import_react2.useMemo)(
|
|
686
|
+
() => getDefaultPlacementSize(
|
|
687
|
+
surfaceKind,
|
|
688
|
+
pendingSignatureAspectRatio,
|
|
689
|
+
surfaceAspectRatio
|
|
690
|
+
),
|
|
691
|
+
[pendingSignatureAspectRatio, surfaceAspectRatio, surfaceKind]
|
|
692
|
+
);
|
|
693
|
+
const defaultAnnotationSize = (0, import_react2.useMemo)(
|
|
694
|
+
() => getDefaultAnnotationSize(surfaceKind),
|
|
695
|
+
[surfaceKind]
|
|
696
|
+
);
|
|
697
|
+
const previewGeometry = (0, import_react2.useMemo)(() => {
|
|
698
|
+
if (!placementPreview || !captureMode) {
|
|
699
|
+
return null;
|
|
700
|
+
}
|
|
701
|
+
const size = captureMode === "signature" ? defaultSignatureSize : defaultAnnotationSize;
|
|
702
|
+
return {
|
|
703
|
+
width: size.width,
|
|
704
|
+
height: size.height,
|
|
705
|
+
x: clamp(placementPreview.x - size.width / 2, 0, 1 - size.width),
|
|
706
|
+
y: clamp(placementPreview.y - size.height / 2, 0, 1 - size.height)
|
|
707
|
+
};
|
|
708
|
+
}, [
|
|
709
|
+
captureMode,
|
|
710
|
+
defaultAnnotationSize,
|
|
711
|
+
defaultSignatureSize,
|
|
712
|
+
placementPreview
|
|
713
|
+
]);
|
|
714
|
+
(0, import_react2.useEffect)(() => {
|
|
715
|
+
const element = layerRef.current;
|
|
716
|
+
if (!element) {
|
|
717
|
+
return;
|
|
718
|
+
}
|
|
719
|
+
const syncSurfaceAspectRatio = () => {
|
|
720
|
+
const rect = element.getBoundingClientRect();
|
|
721
|
+
if (rect.width <= 0 || rect.height <= 0) {
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
724
|
+
const nextAspectRatio = rect.width / rect.height;
|
|
725
|
+
setSurfaceAspectRatio(
|
|
726
|
+
(current) => Math.abs(current - nextAspectRatio) < 1e-3 ? current : nextAspectRatio
|
|
727
|
+
);
|
|
728
|
+
};
|
|
729
|
+
syncSurfaceAspectRatio();
|
|
730
|
+
if (typeof ResizeObserver === "undefined") {
|
|
731
|
+
return;
|
|
732
|
+
}
|
|
733
|
+
const observer = new ResizeObserver(() => {
|
|
734
|
+
syncSurfaceAspectRatio();
|
|
735
|
+
});
|
|
736
|
+
observer.observe(element);
|
|
737
|
+
return () => {
|
|
738
|
+
observer.disconnect();
|
|
739
|
+
};
|
|
740
|
+
}, [surfaceKey, surfaceKind]);
|
|
741
|
+
(0, import_react2.useEffect)(() => {
|
|
742
|
+
if (!pendingSignature?.signatureImageUrl) {
|
|
743
|
+
setPendingSignatureAspectRatio(DEFAULT_SIGNATURE_ASPECT_RATIO);
|
|
744
|
+
return;
|
|
745
|
+
}
|
|
746
|
+
let cancelled = false;
|
|
747
|
+
void getSignatureRenderMetrics(pendingSignature.signatureImageUrl).then((metrics) => {
|
|
748
|
+
if (!cancelled) {
|
|
749
|
+
setPendingSignatureAspectRatio(
|
|
750
|
+
clampAspectRatio(metrics.aspectRatio || DEFAULT_SIGNATURE_ASPECT_RATIO)
|
|
751
|
+
);
|
|
752
|
+
}
|
|
753
|
+
}).catch(() => {
|
|
754
|
+
if (!cancelled) {
|
|
755
|
+
setPendingSignatureAspectRatio(DEFAULT_SIGNATURE_ASPECT_RATIO);
|
|
756
|
+
}
|
|
757
|
+
});
|
|
758
|
+
return () => {
|
|
759
|
+
cancelled = true;
|
|
760
|
+
};
|
|
761
|
+
}, [pendingSignature?.signatureImageUrl]);
|
|
762
|
+
(0, import_react2.useEffect)(() => {
|
|
763
|
+
if (!captureMode) {
|
|
764
|
+
setPlacementPreview(null);
|
|
765
|
+
return;
|
|
766
|
+
}
|
|
767
|
+
const handleKeyDown = (event) => {
|
|
768
|
+
if (event.key !== "Escape") {
|
|
769
|
+
return;
|
|
770
|
+
}
|
|
771
|
+
event.preventDefault();
|
|
772
|
+
onCancelPlacementMode();
|
|
773
|
+
};
|
|
774
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
775
|
+
return () => {
|
|
776
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
777
|
+
};
|
|
778
|
+
}, [captureMode, onCancelPlacementMode]);
|
|
779
|
+
(0, import_react2.useEffect)(() => {
|
|
780
|
+
if (!dragState) {
|
|
781
|
+
setDragPreview(null);
|
|
782
|
+
}
|
|
783
|
+
}, [dragState]);
|
|
784
|
+
(0, import_react2.useEffect)(() => {
|
|
247
785
|
if (captureMode || dragState) {
|
|
248
786
|
return;
|
|
249
787
|
}
|
|
@@ -262,7 +800,7 @@ function SignatureOverlay(props) {
|
|
|
262
800
|
window.removeEventListener("pointerdown", handlePointerDown, true);
|
|
263
801
|
};
|
|
264
802
|
}, [captureMode, dragState, onSelectAnnotation, onSelectPlacement]);
|
|
265
|
-
(0,
|
|
803
|
+
(0, import_react2.useEffect)(() => {
|
|
266
804
|
if (!dragState) {
|
|
267
805
|
return;
|
|
268
806
|
}
|
|
@@ -281,11 +819,12 @@ function SignatureOverlay(props) {
|
|
|
281
819
|
0,
|
|
282
820
|
1 - dragState.originHeight
|
|
283
821
|
);
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
822
|
+
setDragPreview({
|
|
823
|
+
x: nextX,
|
|
824
|
+
y: nextY,
|
|
825
|
+
width: dragState.originWidth,
|
|
826
|
+
height: dragState.originHeight
|
|
827
|
+
});
|
|
289
828
|
return;
|
|
290
829
|
}
|
|
291
830
|
if (dragState.targetType === "signature") {
|
|
@@ -299,7 +838,9 @@ function SignatureOverlay(props) {
|
|
|
299
838
|
0.035,
|
|
300
839
|
1 - dragState.originY
|
|
301
840
|
);
|
|
302
|
-
|
|
841
|
+
setDragPreview({
|
|
842
|
+
x: dragState.originX,
|
|
843
|
+
y: dragState.originY,
|
|
303
844
|
width: nextWidth2,
|
|
304
845
|
height: nextHeight2
|
|
305
846
|
});
|
|
@@ -315,12 +856,22 @@ function SignatureOverlay(props) {
|
|
|
315
856
|
0.08,
|
|
316
857
|
1 - dragState.originY
|
|
317
858
|
);
|
|
318
|
-
|
|
859
|
+
setDragPreview({
|
|
860
|
+
x: dragState.originX,
|
|
861
|
+
y: dragState.originY,
|
|
319
862
|
width: nextWidth,
|
|
320
863
|
height: nextHeight
|
|
321
864
|
});
|
|
322
865
|
};
|
|
323
866
|
const handlePointerUp = () => {
|
|
867
|
+
if (dragPreview) {
|
|
868
|
+
if (dragState.targetType === "signature") {
|
|
869
|
+
onUpdatePlacement(dragState.id, dragPreview);
|
|
870
|
+
} else {
|
|
871
|
+
onUpdateAnnotation(dragState.id, dragPreview);
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
setDragPreview(null);
|
|
324
875
|
setDragState(null);
|
|
325
876
|
};
|
|
326
877
|
window.addEventListener("pointermove", handlePointerMove);
|
|
@@ -329,7 +880,7 @@ function SignatureOverlay(props) {
|
|
|
329
880
|
window.removeEventListener("pointermove", handlePointerMove);
|
|
330
881
|
window.removeEventListener("pointerup", handlePointerUp);
|
|
331
882
|
};
|
|
332
|
-
}, [dragState, onUpdateAnnotation, onUpdatePlacement]);
|
|
883
|
+
}, [dragPreview, dragState, onUpdateAnnotation, onUpdatePlacement]);
|
|
333
884
|
const handlePlace = (event) => {
|
|
334
885
|
if (!layerRef.current || !captureMode) {
|
|
335
886
|
return;
|
|
@@ -338,7 +889,7 @@ function SignatureOverlay(props) {
|
|
|
338
889
|
const clickX = (event.clientX - rect.left) / rect.width;
|
|
339
890
|
const clickY = (event.clientY - rect.top) / rect.height;
|
|
340
891
|
if (captureMode === "signature" && pendingSignature) {
|
|
341
|
-
const { width, height } =
|
|
892
|
+
const { width, height } = defaultSignatureSize;
|
|
342
893
|
onPlaceSignature({
|
|
343
894
|
signature: pendingSignature,
|
|
344
895
|
surfaceKey,
|
|
@@ -354,7 +905,7 @@ function SignatureOverlay(props) {
|
|
|
354
905
|
return;
|
|
355
906
|
}
|
|
356
907
|
if (captureMode === "annotation") {
|
|
357
|
-
const { width, height } =
|
|
908
|
+
const { width, height } = defaultAnnotationSize;
|
|
358
909
|
onPlaceAnnotation({
|
|
359
910
|
surfaceKey,
|
|
360
911
|
surfaceKind,
|
|
@@ -369,6 +920,16 @@ function SignatureOverlay(props) {
|
|
|
369
920
|
});
|
|
370
921
|
}
|
|
371
922
|
};
|
|
923
|
+
const updatePlacementPreview = (clientX, clientY) => {
|
|
924
|
+
if (!layerRef.current) {
|
|
925
|
+
return;
|
|
926
|
+
}
|
|
927
|
+
const rect = layerRef.current.getBoundingClientRect();
|
|
928
|
+
setPlacementPreview({
|
|
929
|
+
x: clamp((clientX - rect.left) / rect.width, 0, 1),
|
|
930
|
+
y: clamp((clientY - rect.top) / rect.height, 0, 1)
|
|
931
|
+
});
|
|
932
|
+
};
|
|
372
933
|
const beginDrag = (event, target, mode) => {
|
|
373
934
|
if (!layerRef.current) {
|
|
374
935
|
return;
|
|
@@ -378,6 +939,7 @@ function SignatureOverlay(props) {
|
|
|
378
939
|
if (target.kind === "signature") {
|
|
379
940
|
onSelectPlacement(target.item.id);
|
|
380
941
|
onSelectAnnotation(null);
|
|
942
|
+
setDragPreview(null);
|
|
381
943
|
setDragState({
|
|
382
944
|
id: target.item.id,
|
|
383
945
|
targetType: "signature",
|
|
@@ -395,6 +957,7 @@ function SignatureOverlay(props) {
|
|
|
395
957
|
}
|
|
396
958
|
onSelectAnnotation(target.item.id);
|
|
397
959
|
onSelectPlacement(null);
|
|
960
|
+
setDragPreview(null);
|
|
398
961
|
setDragState({
|
|
399
962
|
id: target.item.id,
|
|
400
963
|
targetType: "annotation",
|
|
@@ -408,42 +971,134 @@ function SignatureOverlay(props) {
|
|
|
408
971
|
rect: layerRef.current.getBoundingClientRect()
|
|
409
972
|
});
|
|
410
973
|
};
|
|
411
|
-
|
|
412
|
-
|
|
974
|
+
const getSignatureGeometry = (placement) => dragState?.targetType === "signature" && dragState.id === placement.id && dragPreview ? dragPreview : {
|
|
975
|
+
x: placement.x,
|
|
976
|
+
y: placement.y,
|
|
977
|
+
width: placement.width,
|
|
978
|
+
height: placement.height
|
|
979
|
+
};
|
|
980
|
+
const getAnnotationGeometry = (annotation) => dragState?.targetType === "annotation" && dragState.id === annotation.id && dragPreview ? dragPreview : {
|
|
981
|
+
x: annotation.x,
|
|
982
|
+
y: annotation.y,
|
|
983
|
+
width: annotation.width,
|
|
984
|
+
height: annotation.height
|
|
985
|
+
};
|
|
986
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { ref: layerRef, className: "hv-signature-overlay", children: [
|
|
987
|
+
captureMode && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
988
|
+
"div",
|
|
989
|
+
{
|
|
990
|
+
className: "hv-signature-overlay-capture",
|
|
991
|
+
onClick: handlePlace,
|
|
992
|
+
onPointerEnter: (event) => updatePlacementPreview(event.clientX, event.clientY),
|
|
993
|
+
onPointerMove: (event) => updatePlacementPreview(event.clientX, event.clientY),
|
|
994
|
+
onPointerLeave: () => setPlacementPreview(null),
|
|
995
|
+
children: [
|
|
996
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
997
|
+
"div",
|
|
998
|
+
{
|
|
999
|
+
className: "hv-signature-overlay-banner",
|
|
1000
|
+
onPointerDown: (event) => {
|
|
1001
|
+
event.stopPropagation();
|
|
1002
|
+
},
|
|
1003
|
+
onClick: (event) => {
|
|
1004
|
+
event.stopPropagation();
|
|
1005
|
+
},
|
|
1006
|
+
children: [
|
|
1007
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "hv-signature-overlay-banner-copy", children: [
|
|
1008
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("strong", { className: "hv-signature-overlay-title", children: captureMode === "annotation" ? annotationTitle : signatureAltLabel }),
|
|
1009
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "hv-signature-overlay-hint", children: captureMode === "annotation" ? annotationHint : placeHint })
|
|
1010
|
+
] }),
|
|
1011
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1012
|
+
"button",
|
|
1013
|
+
{
|
|
1014
|
+
type: "button",
|
|
1015
|
+
className: "hv-signature-overlay-cancel",
|
|
1016
|
+
onPointerDown: (event) => {
|
|
1017
|
+
event.stopPropagation();
|
|
1018
|
+
},
|
|
1019
|
+
onClick: (event) => {
|
|
1020
|
+
event.stopPropagation();
|
|
1021
|
+
onCancelPlacementMode();
|
|
1022
|
+
},
|
|
1023
|
+
children: cancelPlacementLabel
|
|
1024
|
+
}
|
|
1025
|
+
)
|
|
1026
|
+
]
|
|
1027
|
+
}
|
|
1028
|
+
),
|
|
1029
|
+
captureMode === "signature" && previewGeometry && pendingSignature && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1030
|
+
"div",
|
|
1031
|
+
{
|
|
1032
|
+
className: "hv-signature-stamp hv-signature-ghost",
|
|
1033
|
+
style: {
|
|
1034
|
+
left: `${previewGeometry.x * 100}%`,
|
|
1035
|
+
top: `${previewGeometry.y * 100}%`,
|
|
1036
|
+
width: `${previewGeometry.width * 100}%`,
|
|
1037
|
+
height: `${previewGeometry.height * 100}%`
|
|
1038
|
+
},
|
|
1039
|
+
children: [
|
|
1040
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "hv-signature-image-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1041
|
+
RenderableSignatureImage,
|
|
1042
|
+
{
|
|
1043
|
+
signatureImageUrl: pendingSignature.signatureImageUrl,
|
|
1044
|
+
inkColor: pendingSignatureColor,
|
|
1045
|
+
alt: signatureAltLabel,
|
|
1046
|
+
className: "hv-signature-image"
|
|
1047
|
+
}
|
|
1048
|
+
) }),
|
|
1049
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "hv-signature-meta", children: [
|
|
1050
|
+
pendingSignature.signedBy?.trim() && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "hv-signature-meta-name", children: pendingSignature.signedBy.trim() }),
|
|
1051
|
+
pendingSignature.jobTitle?.trim() && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "hv-signature-meta-jobtitle", children: pendingSignature.jobTitle.trim() }),
|
|
1052
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "hv-signature-meta-date", children: normalizeSignatureDate(pendingSignature.dateSigned) })
|
|
1053
|
+
] })
|
|
1054
|
+
]
|
|
1055
|
+
}
|
|
1056
|
+
),
|
|
1057
|
+
captureMode === "annotation" && previewGeometry && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1058
|
+
"div",
|
|
1059
|
+
{
|
|
1060
|
+
className: "hv-annotation-card hv-annotation-ghost",
|
|
1061
|
+
style: {
|
|
1062
|
+
left: `${previewGeometry.x * 100}%`,
|
|
1063
|
+
top: `${previewGeometry.y * 100}%`,
|
|
1064
|
+
width: `${previewGeometry.width * 100}%`,
|
|
1065
|
+
height: `${previewGeometry.height * 100}%`
|
|
1066
|
+
},
|
|
1067
|
+
children: [
|
|
1068
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "hv-annotation-header", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "hv-annotation-header-copy", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "hv-annotation-title", children: annotationTitle }) }) }),
|
|
1069
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "hv-annotation-body", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "hv-annotation-preview empty", children: annotationPlaceholder }) })
|
|
1070
|
+
]
|
|
1071
|
+
}
|
|
1072
|
+
)
|
|
1073
|
+
]
|
|
1074
|
+
}
|
|
1075
|
+
),
|
|
413
1076
|
visiblePlacements.map((placement) => {
|
|
1077
|
+
const placementGeometry = getSignatureGeometry(placement);
|
|
414
1078
|
const isActive = placement.id === activePlacementId;
|
|
415
1079
|
const hasLinkedAnnotation = linkedAnnotationIds.has(placement.id);
|
|
416
1080
|
const signer = placement.signature.signedBy?.trim();
|
|
417
1081
|
const jobTitle = placement.signature.jobTitle?.trim();
|
|
418
1082
|
const signedDate = normalizeSignatureDate(placement.signature.dateSigned);
|
|
419
1083
|
const signatureColor = normalizeSignatureInkColor(placement.signatureColor);
|
|
420
|
-
|
|
421
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1084
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
422
1085
|
"div",
|
|
423
1086
|
{
|
|
424
1087
|
className: `hv-signature-stamp ${isActive ? "active" : ""}`,
|
|
425
1088
|
style: {
|
|
426
|
-
left: `${
|
|
427
|
-
top: `${
|
|
428
|
-
width: `${
|
|
429
|
-
height: `${
|
|
430
|
-
},
|
|
431
|
-
onPointerDown: (event) => {
|
|
432
|
-
if (!isActive) {
|
|
433
|
-
event.stopPropagation();
|
|
434
|
-
onSelectPlacement(placement.id);
|
|
435
|
-
onSelectAnnotation(null);
|
|
436
|
-
return;
|
|
437
|
-
}
|
|
438
|
-
beginDrag(event, { kind: "signature", item: placement }, "move");
|
|
1089
|
+
left: `${placementGeometry.x * 100}%`,
|
|
1090
|
+
top: `${placementGeometry.y * 100}%`,
|
|
1091
|
+
width: `${placementGeometry.width * 100}%`,
|
|
1092
|
+
height: `${placementGeometry.height * 100}%`
|
|
439
1093
|
},
|
|
1094
|
+
onPointerDown: (event) => beginDrag(event, { kind: "signature", item: placement }, "move"),
|
|
440
1095
|
onClick: (event) => {
|
|
441
1096
|
event.stopPropagation();
|
|
442
1097
|
onSelectPlacement(placement.id);
|
|
443
1098
|
onSelectAnnotation(null);
|
|
444
1099
|
},
|
|
445
1100
|
children: [
|
|
446
|
-
isActive && /* @__PURE__ */ (0,
|
|
1101
|
+
isActive && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
447
1102
|
"button",
|
|
448
1103
|
{
|
|
449
1104
|
type: "button",
|
|
@@ -459,26 +1114,22 @@ function SignatureOverlay(props) {
|
|
|
459
1114
|
children: "x"
|
|
460
1115
|
}
|
|
461
1116
|
),
|
|
462
|
-
/* @__PURE__ */ (0,
|
|
463
|
-
|
|
1117
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "hv-signature-image-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1118
|
+
RenderableSignatureImage,
|
|
464
1119
|
{
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
backgroundColor: SIGNATURE_INK_COLOR_VALUES[signatureColor],
|
|
470
|
-
maskImage,
|
|
471
|
-
WebkitMaskImage: maskImage
|
|
472
|
-
}
|
|
1120
|
+
signatureImageUrl: placement.signature.signatureImageUrl,
|
|
1121
|
+
inkColor: signatureColor,
|
|
1122
|
+
alt: signer ? `${signatureAltByLabel} ${signer}` : signatureAltLabel,
|
|
1123
|
+
className: "hv-signature-image"
|
|
473
1124
|
}
|
|
474
1125
|
) }),
|
|
475
|
-
/* @__PURE__ */ (0,
|
|
476
|
-
signer && /* @__PURE__ */ (0,
|
|
477
|
-
jobTitle && /* @__PURE__ */ (0,
|
|
478
|
-
/* @__PURE__ */ (0,
|
|
1126
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "hv-signature-meta", children: [
|
|
1127
|
+
signer && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "hv-signature-meta-name", children: signer }),
|
|
1128
|
+
jobTitle && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "hv-signature-meta-jobtitle", children: jobTitle }),
|
|
1129
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "hv-signature-meta-date", children: signedDate })
|
|
479
1130
|
] }),
|
|
480
|
-
hasLinkedAnnotation && /* @__PURE__ */ (0,
|
|
481
|
-
isActive && /* @__PURE__ */ (0,
|
|
1131
|
+
hasLinkedAnnotation && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "hv-signature-note-indicator", children: signatureNoteIndicatorLabel }),
|
|
1132
|
+
isActive && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
482
1133
|
"div",
|
|
483
1134
|
{
|
|
484
1135
|
className: "hv-signature-color-toolbar",
|
|
@@ -489,8 +1140,8 @@ function SignatureOverlay(props) {
|
|
|
489
1140
|
event.stopPropagation();
|
|
490
1141
|
},
|
|
491
1142
|
children: [
|
|
492
|
-
/* @__PURE__ */ (0,
|
|
493
|
-
/* @__PURE__ */ (0,
|
|
1143
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "hv-signature-color-toolbar-label", children: signatureColorLabel }),
|
|
1144
|
+
/* @__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
1145
|
"button",
|
|
495
1146
|
{
|
|
496
1147
|
type: "button",
|
|
@@ -505,7 +1156,7 @@ function SignatureOverlay(props) {
|
|
|
505
1156
|
]
|
|
506
1157
|
}
|
|
507
1158
|
),
|
|
508
|
-
isActive && /* @__PURE__ */ (0,
|
|
1159
|
+
isActive && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
509
1160
|
"div",
|
|
510
1161
|
{
|
|
511
1162
|
className: "hv-signature-resize",
|
|
@@ -522,18 +1173,19 @@ function SignatureOverlay(props) {
|
|
|
522
1173
|
);
|
|
523
1174
|
}),
|
|
524
1175
|
visibleAnnotations.map((annotation) => {
|
|
1176
|
+
const annotationGeometry = getAnnotationGeometry(annotation);
|
|
525
1177
|
const isActive = annotation.id === activeAnnotationId;
|
|
526
1178
|
const isLinked = Boolean(annotation.linkedSignaturePlacementId);
|
|
527
1179
|
const hasText = annotation.text.trim().length > 0;
|
|
528
1180
|
if (!isActive) {
|
|
529
|
-
return /* @__PURE__ */ (0,
|
|
1181
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
530
1182
|
"button",
|
|
531
1183
|
{
|
|
532
1184
|
type: "button",
|
|
533
1185
|
className: `hv-annotation-chip ${isLinked ? "linked" : ""} ${hasText ? "" : "empty"}`,
|
|
534
1186
|
style: {
|
|
535
|
-
left: `${
|
|
536
|
-
top: `${
|
|
1187
|
+
left: `${annotationGeometry.x * 100}%`,
|
|
1188
|
+
top: `${annotationGeometry.y * 100}%`
|
|
537
1189
|
},
|
|
538
1190
|
"aria-label": hasText ? annotation.text : openAnnotationLabel,
|
|
539
1191
|
title: hasText ? annotation.text : openAnnotationLabel,
|
|
@@ -542,20 +1194,20 @@ function SignatureOverlay(props) {
|
|
|
542
1194
|
onSelectAnnotation(annotation.id);
|
|
543
1195
|
onSelectPlacement(null);
|
|
544
1196
|
},
|
|
545
|
-
children: /* @__PURE__ */ (0,
|
|
1197
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react.MessageSquare, { size: 14 })
|
|
546
1198
|
},
|
|
547
1199
|
annotation.id
|
|
548
1200
|
);
|
|
549
1201
|
}
|
|
550
|
-
return /* @__PURE__ */ (0,
|
|
1202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
551
1203
|
"div",
|
|
552
1204
|
{
|
|
553
1205
|
className: `hv-annotation-card ${isActive ? "active" : ""} ${isLinked ? "linked" : ""}`,
|
|
554
1206
|
style: {
|
|
555
|
-
left: `${
|
|
556
|
-
top: `${
|
|
557
|
-
width: `${
|
|
558
|
-
height: `${
|
|
1207
|
+
left: `${annotationGeometry.x * 100}%`,
|
|
1208
|
+
top: `${annotationGeometry.y * 100}%`,
|
|
1209
|
+
width: `${annotationGeometry.width * 100}%`,
|
|
1210
|
+
height: `${annotationGeometry.height * 100}%`
|
|
559
1211
|
},
|
|
560
1212
|
onClick: (event) => {
|
|
561
1213
|
event.stopPropagation();
|
|
@@ -563,7 +1215,7 @@ function SignatureOverlay(props) {
|
|
|
563
1215
|
onSelectPlacement(null);
|
|
564
1216
|
},
|
|
565
1217
|
children: [
|
|
566
|
-
/* @__PURE__ */ (0,
|
|
1218
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
567
1219
|
"div",
|
|
568
1220
|
{
|
|
569
1221
|
className: "hv-annotation-header",
|
|
@@ -581,11 +1233,11 @@ function SignatureOverlay(props) {
|
|
|
581
1233
|
);
|
|
582
1234
|
},
|
|
583
1235
|
children: [
|
|
584
|
-
/* @__PURE__ */ (0,
|
|
585
|
-
/* @__PURE__ */ (0,
|
|
586
|
-
isLinked && /* @__PURE__ */ (0,
|
|
1236
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "hv-annotation-header-copy", children: [
|
|
1237
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "hv-annotation-title", children: isLinked ? linkedAnnotationTitle : annotationTitle }),
|
|
1238
|
+
isLinked && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "hv-annotation-badge", children: linkedAnnotationBadge })
|
|
587
1239
|
] }),
|
|
588
|
-
isActive && /* @__PURE__ */ (0,
|
|
1240
|
+
isActive && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
589
1241
|
"button",
|
|
590
1242
|
{
|
|
591
1243
|
type: "button",
|
|
@@ -604,7 +1256,7 @@ function SignatureOverlay(props) {
|
|
|
604
1256
|
]
|
|
605
1257
|
}
|
|
606
1258
|
),
|
|
607
|
-
/* @__PURE__ */ (0,
|
|
1259
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "hv-annotation-body", children: isActive ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
608
1260
|
"textarea",
|
|
609
1261
|
{
|
|
610
1262
|
value: annotation.text,
|
|
@@ -618,14 +1270,14 @@ function SignatureOverlay(props) {
|
|
|
618
1270
|
event.stopPropagation();
|
|
619
1271
|
}
|
|
620
1272
|
}
|
|
621
|
-
) : /* @__PURE__ */ (0,
|
|
1273
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
622
1274
|
"div",
|
|
623
1275
|
{
|
|
624
1276
|
className: `hv-annotation-preview ${hasText ? "" : "empty"}`,
|
|
625
1277
|
children: hasText ? annotation.text : annotationPlaceholder
|
|
626
1278
|
}
|
|
627
1279
|
) }),
|
|
628
|
-
isActive && /* @__PURE__ */ (0,
|
|
1280
|
+
isActive && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
629
1281
|
"div",
|
|
630
1282
|
{
|
|
631
1283
|
className: "hv-annotation-resize",
|
|
@@ -1460,7 +2112,7 @@ function ensureImageSource(source) {
|
|
|
1460
2112
|
}
|
|
1461
2113
|
return `data:image/png;base64,${trimmedSource}`;
|
|
1462
2114
|
}
|
|
1463
|
-
function
|
|
2115
|
+
function createCanvas2(width, height) {
|
|
1464
2116
|
const canvas = document.createElement("canvas");
|
|
1465
2117
|
canvas.width = Math.max(1, Math.round(width));
|
|
1466
2118
|
canvas.height = Math.max(1, Math.round(height));
|
|
@@ -1501,7 +2153,7 @@ async function tryLoadImage(source) {
|
|
|
1501
2153
|
}
|
|
1502
2154
|
}
|
|
1503
2155
|
function getOpaqueImageBounds(image, alphaThreshold = 8) {
|
|
1504
|
-
const canvas =
|
|
2156
|
+
const canvas = createCanvas2(image.width, image.height);
|
|
1505
2157
|
const ctx = canvas.getContext("2d");
|
|
1506
2158
|
if (!ctx) {
|
|
1507
2159
|
return {
|
|
@@ -1852,7 +2504,7 @@ async function renderDecorationCanvasFromModel(model, kind) {
|
|
|
1852
2504
|
}
|
|
1853
2505
|
const canvasWidth = 1600;
|
|
1854
2506
|
const canvasHeight = kind === "header" ? 146 : 88;
|
|
1855
|
-
const canvas =
|
|
2507
|
+
const canvas = createCanvas2(canvasWidth, canvasHeight);
|
|
1856
2508
|
const ctx = canvas.getContext("2d");
|
|
1857
2509
|
if (!ctx) {
|
|
1858
2510
|
return null;
|
|
@@ -2052,7 +2704,7 @@ function applyPageDecorationsToCanvas(baseCanvas, decorations) {
|
|
|
2052
2704
|
if (!decorations?.headerCanvas && !decorations?.footerCanvas) {
|
|
2053
2705
|
return baseCanvas;
|
|
2054
2706
|
}
|
|
2055
|
-
const pageCanvas =
|
|
2707
|
+
const pageCanvas = createCanvas2(baseCanvas.width, baseCanvas.height);
|
|
2056
2708
|
const ctx = pageCanvas.getContext("2d");
|
|
2057
2709
|
if (!ctx) {
|
|
2058
2710
|
return baseCanvas;
|
|
@@ -2099,19 +2751,6 @@ function applyPageDecorationsToCanvas(baseCanvas, decorations) {
|
|
|
2099
2751
|
function formatSignedDate(value) {
|
|
2100
2752
|
return normalizeSignatureDate(value);
|
|
2101
2753
|
}
|
|
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
2754
|
async function drawSignatureStamp(ctx, placement, x, y, width, height, options) {
|
|
2116
2755
|
const isSlideStamp = placement.surfaceKind === "slide";
|
|
2117
2756
|
const borderless = options?.borderless ?? false;
|
|
@@ -2121,12 +2760,12 @@ async function drawSignatureStamp(ctx, placement, x, y, width, height, options)
|
|
|
2121
2760
|
isSlideStamp ? 46 : 40,
|
|
2122
2761
|
height * (isSlideStamp ? 0.36 : 0.32)
|
|
2123
2762
|
);
|
|
2124
|
-
const signatureImage = await loadImage(placement.signature.signatureImageUrl);
|
|
2125
2763
|
const signatureColor = normalizeSignatureInkColor(placement.signatureColor);
|
|
2126
|
-
const
|
|
2127
|
-
|
|
2128
|
-
|
|
2764
|
+
const renderableSignatureImage = await getRenderableSignatureImage(
|
|
2765
|
+
placement.signature.signatureImageUrl,
|
|
2766
|
+
signatureColor
|
|
2129
2767
|
);
|
|
2768
|
+
const signatureImage = await loadImage(renderableSignatureImage);
|
|
2130
2769
|
const imageBounds = getOpaqueImageBounds(signatureImage);
|
|
2131
2770
|
const signer = placement.signature.signedBy?.trim() || "";
|
|
2132
2771
|
const jobTitle = placement.signature.jobTitle?.trim() || "";
|
|
@@ -2157,7 +2796,7 @@ async function drawSignatureStamp(ctx, placement, x, y, width, height, options)
|
|
|
2157
2796
|
const imageBaseY = isSlideStamp ? y : y + padding;
|
|
2158
2797
|
const imageY = imageBaseY + Math.max(imageAreaHeight - imageHeight, 0) * (isSlideStamp ? 0.7 : 0.18);
|
|
2159
2798
|
ctx.drawImage(
|
|
2160
|
-
|
|
2799
|
+
signatureImage,
|
|
2161
2800
|
imageBounds.sx,
|
|
2162
2801
|
imageBounds.sy,
|
|
2163
2802
|
imageBounds.sw,
|
|
@@ -2355,7 +2994,7 @@ async function createSignatureStampDataUrl(placement, width, height) {
|
|
|
2355
2994
|
const aspectRatio = placement.width > 0 && placement.height > 0 ? placement.width / placement.height : 3.1;
|
|
2356
2995
|
const targetHeight = height ?? (placement.surfaceKind === "slide" ? 320 : 260);
|
|
2357
2996
|
const targetWidth = width ?? Math.max(480, Math.round(targetHeight * aspectRatio));
|
|
2358
|
-
const canvas =
|
|
2997
|
+
const canvas = createCanvas2(targetWidth, targetHeight);
|
|
2359
2998
|
const ctx = canvas.getContext("2d");
|
|
2360
2999
|
if (!ctx) {
|
|
2361
3000
|
throw new Error("Unable to render the signature stamp.");
|
|
@@ -2364,7 +3003,7 @@ async function createSignatureStampDataUrl(placement, width, height) {
|
|
|
2364
3003
|
return canvas.toDataURL("image/png");
|
|
2365
3004
|
}
|
|
2366
3005
|
async function createAnnotationCardDataUrl(annotation, width = 720, height = 360, labels = defaultExportLocaleLabels) {
|
|
2367
|
-
const canvas =
|
|
3006
|
+
const canvas = createCanvas2(width, height);
|
|
2368
3007
|
const ctx = canvas.getContext("2d");
|
|
2369
3008
|
if (!ctx) {
|
|
2370
3009
|
throw new Error("Unable to render the annotation.");
|
|
@@ -2689,7 +3328,7 @@ function splitTallCanvas(canvas) {
|
|
|
2689
3328
|
}
|
|
2690
3329
|
for (let offset = 0; offset < canvas.height; offset += maxSliceHeight) {
|
|
2691
3330
|
const sliceHeight = Math.min(maxSliceHeight, canvas.height - offset);
|
|
2692
|
-
const sliceCanvas =
|
|
3331
|
+
const sliceCanvas = createCanvas2(canvas.width, sliceHeight);
|
|
2693
3332
|
const ctx = sliceCanvas.getContext("2d");
|
|
2694
3333
|
if (!ctx) {
|
|
2695
3334
|
continue;
|
|
@@ -2824,7 +3463,7 @@ async function renderSlidesToCanvases(exportState, placements, annotations, labe
|
|
|
2824
3463
|
const scale = targetWidth / slideWidth;
|
|
2825
3464
|
const canvases = [];
|
|
2826
3465
|
for (const [index, slide] of exportState.slides.entries()) {
|
|
2827
|
-
const canvas =
|
|
3466
|
+
const canvas = createCanvas2(slideWidth * scale, slideHeight * scale);
|
|
2828
3467
|
const ctx = canvas.getContext("2d");
|
|
2829
3468
|
if (!ctx) {
|
|
2830
3469
|
continue;
|
|
@@ -2942,7 +3581,7 @@ async function renderSlidesToCanvases(exportState, placements, annotations, labe
|
|
|
2942
3581
|
);
|
|
2943
3582
|
canvases.push(canvas);
|
|
2944
3583
|
}
|
|
2945
|
-
return canvases.length > 0 ? canvases : [
|
|
3584
|
+
return canvases.length > 0 ? canvases : [createCanvas2(1280, 720)];
|
|
2946
3585
|
}
|
|
2947
3586
|
function createSheetMergeLookup(merges) {
|
|
2948
3587
|
const starts = /* @__PURE__ */ new Map();
|
|
@@ -3108,7 +3747,7 @@ async function renderSheetsToCanvases(sheets, placements, annotations, labels =
|
|
|
3108
3747
|
const visibleRowHeights = sheet.rowHeights.slice(0, sheet.renderedRowCount);
|
|
3109
3748
|
const totalWidth = SHEET_ROW_HEADER_WIDTH + visibleColWidths.reduce((sum, value) => sum + value, 0);
|
|
3110
3749
|
const totalHeight = SHEET_COLUMN_HEADER_HEIGHT + visibleRowHeights.reduce((sum, value) => sum + value, 0);
|
|
3111
|
-
const canvas =
|
|
3750
|
+
const canvas = createCanvas2(totalWidth, totalHeight);
|
|
3112
3751
|
const ctx = canvas.getContext("2d");
|
|
3113
3752
|
if (!ctx) {
|
|
3114
3753
|
continue;
|
|
@@ -3233,7 +3872,7 @@ async function exportSignedPdfDocument(args) {
|
|
|
3233
3872
|
for (let pageNumber = 1; pageNumber <= pdf.numPages; pageNumber += 1) {
|
|
3234
3873
|
const page = await pdf.getPage(pageNumber);
|
|
3235
3874
|
const viewport = page.getViewport({ scale: 2 });
|
|
3236
|
-
const canvas =
|
|
3875
|
+
const canvas = createCanvas2(viewport.width, viewport.height);
|
|
3237
3876
|
const ctx = canvas.getContext("2d");
|
|
3238
3877
|
if (!ctx) {
|
|
3239
3878
|
continue;
|
|
@@ -3285,7 +3924,7 @@ async function exportSignedImageFile(args) {
|
|
|
3285
3924
|
const objectUrl = URL.createObjectURL(imageBlob);
|
|
3286
3925
|
try {
|
|
3287
3926
|
const image = await loadImage(objectUrl);
|
|
3288
|
-
const canvas =
|
|
3927
|
+
const canvas = createCanvas2(image.width, image.height);
|
|
3289
3928
|
const ctx = canvas.getContext("2d");
|
|
3290
3929
|
if (!ctx) {
|
|
3291
3930
|
throw new Error("Unable to render the image document.");
|
|
@@ -3329,7 +3968,7 @@ async function exportSignedRichTextFile(args) {
|
|
|
3329
3968
|
const canvases = [];
|
|
3330
3969
|
for (const page of args.pages) {
|
|
3331
3970
|
const image = await loadImage(page.imageUrl);
|
|
3332
|
-
const canvas2 =
|
|
3971
|
+
const canvas2 = createCanvas2(page.width, page.height);
|
|
3333
3972
|
const ctx2 = canvas2.getContext("2d");
|
|
3334
3973
|
if (!ctx2) {
|
|
3335
3974
|
continue;
|
|
@@ -3686,13 +4325,13 @@ function sanitizeHtml(html) {
|
|
|
3686
4325
|
}
|
|
3687
4326
|
|
|
3688
4327
|
// src/editors/RichTextEditor.tsx
|
|
3689
|
-
var
|
|
4328
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
3690
4329
|
var DOC_PAGE_WIDTH = 816;
|
|
3691
4330
|
var DOC_PAGE_HEIGHT = 1056;
|
|
3692
4331
|
var PAGE_RENDER_SCALE = 2;
|
|
3693
4332
|
var PAGE_BREAK_MIN_FILL = 0.55;
|
|
3694
4333
|
var DOCX_PREVIEW_CLASS_NAME = "hv-docx-page";
|
|
3695
|
-
function
|
|
4334
|
+
function createCanvas3(width, height) {
|
|
3696
4335
|
const canvas = document.createElement("canvas");
|
|
3697
4336
|
canvas.width = Math.max(1, Math.round(width));
|
|
3698
4337
|
canvas.height = Math.max(1, Math.round(height));
|
|
@@ -3777,7 +4416,7 @@ function calculatePageBreakOffsets(container, pageHeight) {
|
|
|
3777
4416
|
function createThumbnailDataUrl(canvas) {
|
|
3778
4417
|
const thumbWidth = 160;
|
|
3779
4418
|
const thumbScale = thumbWidth / canvas.width;
|
|
3780
|
-
const thumbCanvas =
|
|
4419
|
+
const thumbCanvas = createCanvas3(thumbWidth, canvas.height * thumbScale);
|
|
3781
4420
|
const thumbCtx = thumbCanvas.getContext("2d");
|
|
3782
4421
|
if (thumbCtx) {
|
|
3783
4422
|
thumbCtx.fillStyle = "#ffffff";
|
|
@@ -3795,7 +4434,7 @@ function buildPageModels(sourceCanvas, breakOffsets) {
|
|
|
3795
4434
|
for (const [index, endOffset] of breakOffsets.entries()) {
|
|
3796
4435
|
const sourceY = previousOffset * scale;
|
|
3797
4436
|
const sourceHeight = Math.max((endOffset - previousOffset) * scale, 1);
|
|
3798
|
-
const pageCanvas =
|
|
4437
|
+
const pageCanvas = createCanvas3(pageCanvasWidth, pageCanvasHeight);
|
|
3799
4438
|
const pageCtx = pageCanvas.getContext("2d");
|
|
3800
4439
|
if (!pageCtx) {
|
|
3801
4440
|
previousOffset = endOffset;
|
|
@@ -3825,7 +4464,7 @@ function buildPageModels(sourceCanvas, breakOffsets) {
|
|
|
3825
4464
|
previousOffset = endOffset;
|
|
3826
4465
|
}
|
|
3827
4466
|
if (pages.length === 0) {
|
|
3828
|
-
const blankCanvas =
|
|
4467
|
+
const blankCanvas = createCanvas3(
|
|
3829
4468
|
DOC_PAGE_WIDTH * PAGE_RENDER_SCALE,
|
|
3830
4469
|
DOC_PAGE_HEIGHT * PAGE_RENDER_SCALE
|
|
3831
4470
|
);
|
|
@@ -4175,36 +4814,38 @@ function RichTextEditor(props) {
|
|
|
4175
4814
|
media: false,
|
|
4176
4815
|
history: false
|
|
4177
4816
|
});
|
|
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,
|
|
4817
|
+
const editorRef = (0, import_react3.useRef)(null);
|
|
4818
|
+
const measureRef = (0, import_react3.useRef)(null);
|
|
4819
|
+
const docxPreviewRef = (0, import_react3.useRef)(null);
|
|
4820
|
+
const imageInputRef = (0, import_react3.useRef)(null);
|
|
4821
|
+
const imagePreviewRef = (0, import_react3.useRef)(null);
|
|
4822
|
+
const savedSelectionRef = (0, import_react3.useRef)(null);
|
|
4823
|
+
const imageDragPointerIdRef = (0, import_react3.useRef)(null);
|
|
4824
|
+
const [contentHtml, setContentHtml] = (0, import_react3.useState)("");
|
|
4825
|
+
const [editableContentHtml, setEditableContentHtml] = (0, import_react3.useState)("");
|
|
4826
|
+
const [selectedTemplateId, setSelectedTemplateId] = (0, import_react3.useState)("blank");
|
|
4827
|
+
const [areTemplatesVisible, setAreTemplatesVisible] = (0, import_react3.useState)(true);
|
|
4828
|
+
const [isCompactToolbar, setIsCompactToolbar] = (0, import_react3.useState)(false);
|
|
4829
|
+
const [expandedToolbarSections, setExpandedToolbarSections] = (0, import_react3.useState)(
|
|
4191
4830
|
createCompactToolbarState
|
|
4192
4831
|
);
|
|
4193
|
-
const [imageEditorState, setImageEditorState] = (0,
|
|
4194
|
-
const [toolbarState, setToolbarState] = (0,
|
|
4832
|
+
const [imageEditorState, setImageEditorState] = (0, import_react3.useState)(null);
|
|
4833
|
+
const [toolbarState, setToolbarState] = (0, import_react3.useState)(
|
|
4195
4834
|
createDefaultToolbarState()
|
|
4196
4835
|
);
|
|
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,
|
|
4836
|
+
const [loading, setLoading] = (0, import_react3.useState)(false);
|
|
4837
|
+
const [isPaginating, setIsPaginating] = (0, import_react3.useState)(false);
|
|
4838
|
+
const [pages, setPages] = (0, import_react3.useState)([]);
|
|
4839
|
+
const [docxPages, setDocxPages] = (0, import_react3.useState)([]);
|
|
4840
|
+
const [isRenderingDocxPreview, setIsRenderingDocxPreview] = (0, import_react3.useState)(false);
|
|
4841
|
+
const [docxPreviewFailed, setDocxPreviewFailed] = (0, import_react3.useState)(false);
|
|
4842
|
+
const mdParser = (0, import_react3.useRef)(new import_markdown_it.default({ html: true, linkify: true }));
|
|
4843
|
+
const authoringTemplates = (0, import_react3.useMemo)(() => createAuthoringTemplates(), []);
|
|
4205
4844
|
const isAuthoringMode = props.mode === "edit" || props.mode === "create";
|
|
4845
|
+
const isPlainTextFile = props.fileName.toLowerCase().endsWith(".txt") || props.fileType === "txt";
|
|
4206
4846
|
const isDocxFile = props.fileName.toLowerCase().endsWith(".docx") || props.fileType === "docx";
|
|
4207
4847
|
const useDocxPreviewView = props.mode === "view" && isDocxFile && Boolean(props.arrayBuffer);
|
|
4848
|
+
const useContinuousPlainTextView = props.mode === "view" && isPlainTextFile;
|
|
4208
4849
|
const syncTemplateSelection = (nextHtml) => {
|
|
4209
4850
|
const matchedTemplate = authoringTemplates.find(
|
|
4210
4851
|
(template) => template.html === nextHtml
|
|
@@ -4248,7 +4889,7 @@ function RichTextEditor(props) {
|
|
|
4248
4889
|
}
|
|
4249
4890
|
setToolbarState(readToolbarState(editorRef.current, savedSelectionRef.current));
|
|
4250
4891
|
};
|
|
4251
|
-
(0,
|
|
4892
|
+
(0, import_react3.useEffect)(() => {
|
|
4252
4893
|
const loadDoc = async () => {
|
|
4253
4894
|
if (!props.arrayBuffer) {
|
|
4254
4895
|
const templateHtml = props.mode === "create" ? authoringTemplates[0]?.html ?? "" : "";
|
|
@@ -4309,7 +4950,7 @@ function RichTextEditor(props) {
|
|
|
4309
4950
|
props.locale,
|
|
4310
4951
|
props.mode
|
|
4311
4952
|
]);
|
|
4312
|
-
(0,
|
|
4953
|
+
(0, import_react3.useEffect)(() => {
|
|
4313
4954
|
if (!isAuthoringMode || !editorRef.current) {
|
|
4314
4955
|
return;
|
|
4315
4956
|
}
|
|
@@ -4318,7 +4959,7 @@ function RichTextEditor(props) {
|
|
|
4318
4959
|
}
|
|
4319
4960
|
refreshToolbarState();
|
|
4320
4961
|
}, [editableContentHtml, isAuthoringMode]);
|
|
4321
|
-
(0,
|
|
4962
|
+
(0, import_react3.useEffect)(() => {
|
|
4322
4963
|
if (!isAuthoringMode || typeof document === "undefined") {
|
|
4323
4964
|
return;
|
|
4324
4965
|
}
|
|
@@ -4338,12 +4979,12 @@ function RichTextEditor(props) {
|
|
|
4338
4979
|
document.removeEventListener("selectionchange", handleSelectionChange);
|
|
4339
4980
|
};
|
|
4340
4981
|
}, [isAuthoringMode]);
|
|
4341
|
-
(0,
|
|
4982
|
+
(0, import_react3.useEffect)(() => {
|
|
4342
4983
|
if (props.mode === "create") {
|
|
4343
4984
|
setAreTemplatesVisible(true);
|
|
4344
4985
|
}
|
|
4345
4986
|
}, [props.mode, props.fileName]);
|
|
4346
|
-
(0,
|
|
4987
|
+
(0, import_react3.useEffect)(() => {
|
|
4347
4988
|
if (typeof window === "undefined") {
|
|
4348
4989
|
return;
|
|
4349
4990
|
}
|
|
@@ -4360,7 +5001,7 @@ function RichTextEditor(props) {
|
|
|
4360
5001
|
mediaQuery.removeEventListener("change", syncCompactState);
|
|
4361
5002
|
};
|
|
4362
5003
|
}, []);
|
|
4363
|
-
(0,
|
|
5004
|
+
(0, import_react3.useEffect)(() => {
|
|
4364
5005
|
if (toolbarState.hasSelectedImage && toolbarState.imageSrc) {
|
|
4365
5006
|
setImageEditorState({
|
|
4366
5007
|
src: toolbarState.imageSrc,
|
|
@@ -4382,7 +5023,7 @@ function RichTextEditor(props) {
|
|
|
4382
5023
|
toolbarState.imageScale,
|
|
4383
5024
|
toolbarState.imageSrc
|
|
4384
5025
|
]);
|
|
4385
|
-
(0,
|
|
5026
|
+
(0, import_react3.useEffect)(() => {
|
|
4386
5027
|
if (!useDocxPreviewView || !docxPreviewRef.current || !props.arrayBuffer) {
|
|
4387
5028
|
setDocxPages([]);
|
|
4388
5029
|
setDocxPreviewFailed(false);
|
|
@@ -4481,13 +5122,23 @@ function RichTextEditor(props) {
|
|
|
4481
5122
|
props.onThumbs,
|
|
4482
5123
|
useDocxPreviewView
|
|
4483
5124
|
]);
|
|
4484
|
-
(0,
|
|
5125
|
+
(0, import_react3.useEffect)(() => {
|
|
4485
5126
|
if (props.mode !== "view") {
|
|
4486
5127
|
setPages([]);
|
|
4487
5128
|
props.onPageCount(1);
|
|
4488
5129
|
props.onThumbs([]);
|
|
4489
5130
|
return;
|
|
4490
5131
|
}
|
|
5132
|
+
if (useContinuousPlainTextView) {
|
|
5133
|
+
setPages([]);
|
|
5134
|
+
setIsPaginating(false);
|
|
5135
|
+
props.onPageCount(1);
|
|
5136
|
+
props.onThumbs([]);
|
|
5137
|
+
if (props.currentPage !== 1) {
|
|
5138
|
+
props.onCurrentPageChange(1);
|
|
5139
|
+
}
|
|
5140
|
+
return;
|
|
5141
|
+
}
|
|
4491
5142
|
if (useDocxPreviewView && !docxPreviewFailed) {
|
|
4492
5143
|
setPages([]);
|
|
4493
5144
|
return;
|
|
@@ -4556,17 +5207,26 @@ function RichTextEditor(props) {
|
|
|
4556
5207
|
}, [
|
|
4557
5208
|
contentHtml,
|
|
4558
5209
|
docxPreviewFailed,
|
|
5210
|
+
props.currentPage,
|
|
4559
5211
|
props.mode,
|
|
4560
5212
|
props.onCurrentPageChange,
|
|
4561
5213
|
props.onPageCount,
|
|
4562
5214
|
props.onThumbs,
|
|
5215
|
+
useContinuousPlainTextView,
|
|
4563
5216
|
useDocxPreviewView
|
|
4564
5217
|
]);
|
|
4565
|
-
const activeViewPages = (0,
|
|
4566
|
-
() => props.mode === "view" ? useDocxPreviewView && !docxPreviewFailed ? docxPages : pages : void 0,
|
|
4567
|
-
[
|
|
5218
|
+
const activeViewPages = (0, import_react3.useMemo)(
|
|
5219
|
+
() => props.mode === "view" ? useDocxPreviewView && !docxPreviewFailed ? docxPages : useContinuousPlainTextView ? void 0 : pages : void 0,
|
|
5220
|
+
[
|
|
5221
|
+
docxPages,
|
|
5222
|
+
docxPreviewFailed,
|
|
5223
|
+
pages,
|
|
5224
|
+
props.mode,
|
|
5225
|
+
useContinuousPlainTextView,
|
|
5226
|
+
useDocxPreviewView
|
|
5227
|
+
]
|
|
4568
5228
|
);
|
|
4569
|
-
(0,
|
|
5229
|
+
(0, import_react3.useEffect)(() => {
|
|
4570
5230
|
const container = props.mode === "view" ? useDocxPreviewView && !docxPreviewFailed ? docxPreviewRef.current : measureRef.current : editorRef.current;
|
|
4571
5231
|
props.onExportStateChange?.({
|
|
4572
5232
|
container,
|
|
@@ -4582,12 +5242,12 @@ function RichTextEditor(props) {
|
|
|
4582
5242
|
props.onExportStateChange,
|
|
4583
5243
|
useDocxPreviewView
|
|
4584
5244
|
]);
|
|
4585
|
-
(0,
|
|
5245
|
+
(0, import_react3.useEffect)(() => {
|
|
4586
5246
|
return () => {
|
|
4587
5247
|
props.onExportStateChange?.(null);
|
|
4588
5248
|
};
|
|
4589
5249
|
}, [props.onExportStateChange]);
|
|
4590
|
-
const pagesToShow = (0,
|
|
5250
|
+
const pagesToShow = (0, import_react3.useMemo)(
|
|
4591
5251
|
() => getPagesToShow(
|
|
4592
5252
|
useDocxPreviewView && !docxPreviewFailed ? docxPages.length : pages.length,
|
|
4593
5253
|
props.currentPage,
|
|
@@ -4888,10 +5548,10 @@ function RichTextEditor(props) {
|
|
|
4888
5548
|
};
|
|
4889
5549
|
const renderToolbarSectionHeader = (section, label) => {
|
|
4890
5550
|
if (!isCompactToolbar) {
|
|
4891
|
-
return /* @__PURE__ */ (0,
|
|
5551
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "hv-richtext-toolbar-label", children: label });
|
|
4892
5552
|
}
|
|
4893
5553
|
const isOpen = isToolbarSectionOpen(section);
|
|
4894
|
-
return /* @__PURE__ */ (0,
|
|
5554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
4895
5555
|
"button",
|
|
4896
5556
|
{
|
|
4897
5557
|
type: "button",
|
|
@@ -4899,8 +5559,8 @@ function RichTextEditor(props) {
|
|
|
4899
5559
|
"aria-expanded": isOpen,
|
|
4900
5560
|
onClick: () => toggleToolbarSection(section),
|
|
4901
5561
|
children: [
|
|
4902
|
-
/* @__PURE__ */ (0,
|
|
4903
|
-
/* @__PURE__ */ (0,
|
|
5562
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "hv-richtext-toolbar-label", children: label }),
|
|
5563
|
+
/* @__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
5564
|
]
|
|
4905
5565
|
}
|
|
4906
5566
|
);
|
|
@@ -4920,8 +5580,8 @@ function RichTextEditor(props) {
|
|
|
4920
5580
|
});
|
|
4921
5581
|
};
|
|
4922
5582
|
if (props.mode === "view" && useDocxPreviewView && !docxPreviewFailed) {
|
|
4923
|
-
return /* @__PURE__ */ (0,
|
|
4924
|
-
/* @__PURE__ */ (0,
|
|
5583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
5584
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "hv-docx-preview-shell", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4925
5585
|
"div",
|
|
4926
5586
|
{
|
|
4927
5587
|
ref: docxPreviewRef,
|
|
@@ -4929,21 +5589,21 @@ function RichTextEditor(props) {
|
|
|
4929
5589
|
"aria-label": "DOCX document pages"
|
|
4930
5590
|
}
|
|
4931
5591
|
) }),
|
|
4932
|
-
/* @__PURE__ */ (0,
|
|
5592
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4933
5593
|
"div",
|
|
4934
5594
|
{
|
|
4935
5595
|
className: props.layout === "side-by-side" ? "hv-view-double" : "hv-view-single",
|
|
4936
|
-
children: loading || isRenderingDocxPreview ? /* @__PURE__ */ (0,
|
|
5596
|
+
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
5597
|
const page = docxPages[pageNumber - 1];
|
|
4938
5598
|
if (!page) {
|
|
4939
5599
|
return null;
|
|
4940
5600
|
}
|
|
4941
|
-
return /* @__PURE__ */ (0,
|
|
5601
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
4942
5602
|
"div",
|
|
4943
5603
|
{
|
|
4944
5604
|
className: "hv-page-container hv-docx-page-surface",
|
|
4945
5605
|
children: [
|
|
4946
|
-
/* @__PURE__ */ (0,
|
|
5606
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4947
5607
|
"img",
|
|
4948
5608
|
{
|
|
4949
5609
|
src: page.imageUrl,
|
|
@@ -4951,7 +5611,7 @@ function RichTextEditor(props) {
|
|
|
4951
5611
|
className: "hv-docx-page-image"
|
|
4952
5612
|
}
|
|
4953
5613
|
),
|
|
4954
|
-
/* @__PURE__ */ (0,
|
|
5614
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4955
5615
|
SignatureOverlay,
|
|
4956
5616
|
{
|
|
4957
5617
|
surfaceKey: page.surfaceKey,
|
|
@@ -4960,11 +5620,13 @@ function RichTextEditor(props) {
|
|
|
4960
5620
|
placements: props.signatureOverlay.placements,
|
|
4961
5621
|
annotations: props.signatureOverlay.annotations,
|
|
4962
5622
|
pendingSignature: props.signatureOverlay.pendingSignature,
|
|
5623
|
+
pendingSignatureColor: props.signatureOverlay.pendingSignatureColor,
|
|
4963
5624
|
pendingAnnotation: props.signatureOverlay.pendingAnnotation,
|
|
4964
5625
|
activePlacementId: props.signatureOverlay.activePlacementId,
|
|
4965
5626
|
activeAnnotationId: props.signatureOverlay.activeAnnotationId,
|
|
4966
5627
|
placeHint: props.signatureOverlay.placeHint,
|
|
4967
5628
|
annotationHint: props.signatureOverlay.annotationHint,
|
|
5629
|
+
cancelPlacementLabel: props.signatureOverlay.cancelPlacementLabel,
|
|
4968
5630
|
annotationPlaceholder: props.signatureOverlay.annotationPlaceholder,
|
|
4969
5631
|
signatureAltLabel: props.signatureOverlay.signatureAltLabel,
|
|
4970
5632
|
signatureAltByLabel: props.signatureOverlay.signatureAltByLabel,
|
|
@@ -4984,7 +5646,8 @@ function RichTextEditor(props) {
|
|
|
4984
5646
|
onRemovePlacement: props.signatureOverlay.onRemovePlacement,
|
|
4985
5647
|
onRemoveAnnotation: props.signatureOverlay.onRemoveAnnotation,
|
|
4986
5648
|
onSelectPlacement: props.signatureOverlay.onSelectPlacement,
|
|
4987
|
-
onSelectAnnotation: props.signatureOverlay.onSelectAnnotation
|
|
5649
|
+
onSelectAnnotation: props.signatureOverlay.onSelectAnnotation,
|
|
5650
|
+
onCancelPlacementMode: props.signatureOverlay.onCancelPlacementMode
|
|
4988
5651
|
}
|
|
4989
5652
|
)
|
|
4990
5653
|
]
|
|
@@ -4996,9 +5659,69 @@ function RichTextEditor(props) {
|
|
|
4996
5659
|
)
|
|
4997
5660
|
] });
|
|
4998
5661
|
}
|
|
5662
|
+
if (props.mode === "view" && useContinuousPlainTextView) {
|
|
5663
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
5664
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "hv-docx-measure-shell", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5665
|
+
"div",
|
|
5666
|
+
{
|
|
5667
|
+
ref: measureRef,
|
|
5668
|
+
className: "hv-docx-content hv-docx-measure-content hv-text-scroll-content",
|
|
5669
|
+
dangerouslySetInnerHTML: { __html: contentHtml }
|
|
5670
|
+
}
|
|
5671
|
+
) }),
|
|
5672
|
+
/* @__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: [
|
|
5673
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5674
|
+
"div",
|
|
5675
|
+
{
|
|
5676
|
+
className: "hv-docx-content hv-text-scroll-content",
|
|
5677
|
+
dangerouslySetInnerHTML: { __html: contentHtml }
|
|
5678
|
+
}
|
|
5679
|
+
),
|
|
5680
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5681
|
+
SignatureOverlay,
|
|
5682
|
+
{
|
|
5683
|
+
surfaceKey: "document:main",
|
|
5684
|
+
surfaceKind: "document",
|
|
5685
|
+
page: 1,
|
|
5686
|
+
placements: props.signatureOverlay.placements,
|
|
5687
|
+
annotations: props.signatureOverlay.annotations,
|
|
5688
|
+
pendingSignature: props.signatureOverlay.pendingSignature,
|
|
5689
|
+
pendingSignatureColor: props.signatureOverlay.pendingSignatureColor,
|
|
5690
|
+
pendingAnnotation: props.signatureOverlay.pendingAnnotation,
|
|
5691
|
+
activePlacementId: props.signatureOverlay.activePlacementId,
|
|
5692
|
+
activeAnnotationId: props.signatureOverlay.activeAnnotationId,
|
|
5693
|
+
placeHint: props.signatureOverlay.placeHint,
|
|
5694
|
+
annotationHint: props.signatureOverlay.annotationHint,
|
|
5695
|
+
cancelPlacementLabel: props.signatureOverlay.cancelPlacementLabel,
|
|
5696
|
+
annotationPlaceholder: props.signatureOverlay.annotationPlaceholder,
|
|
5697
|
+
signatureAltLabel: props.signatureOverlay.signatureAltLabel,
|
|
5698
|
+
signatureAltByLabel: props.signatureOverlay.signatureAltByLabel,
|
|
5699
|
+
signatureNoteIndicatorLabel: props.signatureOverlay.signatureNoteIndicatorLabel,
|
|
5700
|
+
signatureColorLabel: props.signatureOverlay.signatureColorLabel,
|
|
5701
|
+
signatureColorNames: props.signatureOverlay.signatureColorNames,
|
|
5702
|
+
removeSignatureLabel: props.signatureOverlay.removeSignatureLabel,
|
|
5703
|
+
annotationTitle: props.signatureOverlay.annotationTitle,
|
|
5704
|
+
linkedAnnotationTitle: props.signatureOverlay.linkedAnnotationTitle,
|
|
5705
|
+
linkedAnnotationBadge: props.signatureOverlay.linkedAnnotationBadge,
|
|
5706
|
+
openAnnotationLabel: props.signatureOverlay.openAnnotationLabel,
|
|
5707
|
+
removeAnnotationLabel: props.signatureOverlay.removeAnnotationLabel,
|
|
5708
|
+
onPlaceSignature: props.signatureOverlay.onPlaceSignature,
|
|
5709
|
+
onPlaceAnnotation: props.signatureOverlay.onPlaceAnnotation,
|
|
5710
|
+
onUpdatePlacement: props.signatureOverlay.onUpdatePlacement,
|
|
5711
|
+
onUpdateAnnotation: props.signatureOverlay.onUpdateAnnotation,
|
|
5712
|
+
onRemovePlacement: props.signatureOverlay.onRemovePlacement,
|
|
5713
|
+
onRemoveAnnotation: props.signatureOverlay.onRemoveAnnotation,
|
|
5714
|
+
onSelectPlacement: props.signatureOverlay.onSelectPlacement,
|
|
5715
|
+
onSelectAnnotation: props.signatureOverlay.onSelectAnnotation,
|
|
5716
|
+
onCancelPlacementMode: props.signatureOverlay.onCancelPlacementMode
|
|
5717
|
+
}
|
|
5718
|
+
)
|
|
5719
|
+
] }) })
|
|
5720
|
+
] });
|
|
5721
|
+
}
|
|
4999
5722
|
if (props.mode === "view") {
|
|
5000
|
-
return /* @__PURE__ */ (0,
|
|
5001
|
-
/* @__PURE__ */ (0,
|
|
5723
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
5724
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "hv-docx-measure-shell", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5002
5725
|
"div",
|
|
5003
5726
|
{
|
|
5004
5727
|
ref: measureRef,
|
|
@@ -5006,21 +5729,21 @@ function RichTextEditor(props) {
|
|
|
5006
5729
|
dangerouslySetInnerHTML: { __html: contentHtml }
|
|
5007
5730
|
}
|
|
5008
5731
|
) }),
|
|
5009
|
-
/* @__PURE__ */ (0,
|
|
5732
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5010
5733
|
"div",
|
|
5011
5734
|
{
|
|
5012
5735
|
className: props.layout === "side-by-side" ? "hv-view-double" : "hv-view-single",
|
|
5013
|
-
children: loading || isPaginating ? /* @__PURE__ */ (0,
|
|
5736
|
+
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
5737
|
const page = pages[pageNumber - 1];
|
|
5015
5738
|
if (!page) {
|
|
5016
5739
|
return null;
|
|
5017
5740
|
}
|
|
5018
|
-
return /* @__PURE__ */ (0,
|
|
5741
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
5019
5742
|
"div",
|
|
5020
5743
|
{
|
|
5021
5744
|
className: "hv-page-container hv-docx-page-surface",
|
|
5022
5745
|
children: [
|
|
5023
|
-
/* @__PURE__ */ (0,
|
|
5746
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5024
5747
|
"img",
|
|
5025
5748
|
{
|
|
5026
5749
|
src: page.imageUrl,
|
|
@@ -5028,7 +5751,7 @@ function RichTextEditor(props) {
|
|
|
5028
5751
|
className: "hv-docx-page-image"
|
|
5029
5752
|
}
|
|
5030
5753
|
),
|
|
5031
|
-
/* @__PURE__ */ (0,
|
|
5754
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5032
5755
|
SignatureOverlay,
|
|
5033
5756
|
{
|
|
5034
5757
|
surfaceKey: page.surfaceKey,
|
|
@@ -5037,11 +5760,13 @@ function RichTextEditor(props) {
|
|
|
5037
5760
|
placements: props.signatureOverlay.placements,
|
|
5038
5761
|
annotations: props.signatureOverlay.annotations,
|
|
5039
5762
|
pendingSignature: props.signatureOverlay.pendingSignature,
|
|
5763
|
+
pendingSignatureColor: props.signatureOverlay.pendingSignatureColor,
|
|
5040
5764
|
pendingAnnotation: props.signatureOverlay.pendingAnnotation,
|
|
5041
5765
|
activePlacementId: props.signatureOverlay.activePlacementId,
|
|
5042
5766
|
activeAnnotationId: props.signatureOverlay.activeAnnotationId,
|
|
5043
5767
|
placeHint: props.signatureOverlay.placeHint,
|
|
5044
5768
|
annotationHint: props.signatureOverlay.annotationHint,
|
|
5769
|
+
cancelPlacementLabel: props.signatureOverlay.cancelPlacementLabel,
|
|
5045
5770
|
annotationPlaceholder: props.signatureOverlay.annotationPlaceholder,
|
|
5046
5771
|
signatureAltLabel: props.signatureOverlay.signatureAltLabel,
|
|
5047
5772
|
signatureAltByLabel: props.signatureOverlay.signatureAltByLabel,
|
|
@@ -5061,7 +5786,8 @@ function RichTextEditor(props) {
|
|
|
5061
5786
|
onRemovePlacement: props.signatureOverlay.onRemovePlacement,
|
|
5062
5787
|
onRemoveAnnotation: props.signatureOverlay.onRemoveAnnotation,
|
|
5063
5788
|
onSelectPlacement: props.signatureOverlay.onSelectPlacement,
|
|
5064
|
-
onSelectAnnotation: props.signatureOverlay.onSelectAnnotation
|
|
5789
|
+
onSelectAnnotation: props.signatureOverlay.onSelectAnnotation,
|
|
5790
|
+
onCancelPlacementMode: props.signatureOverlay.onCancelPlacementMode
|
|
5065
5791
|
}
|
|
5066
5792
|
)
|
|
5067
5793
|
]
|
|
@@ -5073,8 +5799,8 @@ function RichTextEditor(props) {
|
|
|
5073
5799
|
)
|
|
5074
5800
|
] });
|
|
5075
5801
|
}
|
|
5076
|
-
return /* @__PURE__ */ (0,
|
|
5077
|
-
/* @__PURE__ */ (0,
|
|
5802
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-view-single hv-richtext-authoring-shell", children: [
|
|
5803
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5078
5804
|
"input",
|
|
5079
5805
|
{
|
|
5080
5806
|
ref: imageInputRef,
|
|
@@ -5084,20 +5810,20 @@ function RichTextEditor(props) {
|
|
|
5084
5810
|
onChange: handleInsertImage
|
|
5085
5811
|
}
|
|
5086
5812
|
),
|
|
5087
|
-
isAuthoringMode && /* @__PURE__ */ (0,
|
|
5813
|
+
isAuthoringMode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "hv-richtext-authoring-top", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
5088
5814
|
"div",
|
|
5089
5815
|
{
|
|
5090
5816
|
className: "hv-richtext-toolbar",
|
|
5091
5817
|
role: "toolbar",
|
|
5092
5818
|
"aria-label": props.locale["a11y.ribbon"],
|
|
5093
5819
|
children: [
|
|
5094
|
-
/* @__PURE__ */ (0,
|
|
5095
|
-
/* @__PURE__ */ (0,
|
|
5820
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-toolbar-row", children: [
|
|
5821
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-toolbar-section", children: [
|
|
5096
5822
|
renderToolbarSectionHeader(
|
|
5097
5823
|
"style",
|
|
5098
5824
|
props.locale["documents.richText.toolbar.styleLabel"]
|
|
5099
5825
|
),
|
|
5100
|
-
isToolbarSectionOpen("style") && /* @__PURE__ */ (0,
|
|
5826
|
+
isToolbarSectionOpen("style") && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
5101
5827
|
"select",
|
|
5102
5828
|
{
|
|
5103
5829
|
className: "hv-richtext-select",
|
|
@@ -5107,22 +5833,22 @@ function RichTextEditor(props) {
|
|
|
5107
5833
|
event.target.value === "blockquote" ? "BLOCKQUOTE" : event.target.value.toUpperCase()
|
|
5108
5834
|
),
|
|
5109
5835
|
children: [
|
|
5110
|
-
/* @__PURE__ */ (0,
|
|
5111
|
-
/* @__PURE__ */ (0,
|
|
5112
|
-
/* @__PURE__ */ (0,
|
|
5113
|
-
/* @__PURE__ */ (0,
|
|
5114
|
-
/* @__PURE__ */ (0,
|
|
5836
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "p", children: props.locale["documents.richText.toolbar.paragraph"] }),
|
|
5837
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "h1", children: props.locale["documents.richText.toolbar.heading1"] }),
|
|
5838
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "h2", children: props.locale["documents.richText.toolbar.heading2"] }),
|
|
5839
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "h3", children: props.locale["documents.richText.toolbar.heading3"] }),
|
|
5840
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "blockquote", children: props.locale["documents.richText.toolbar.quote"] })
|
|
5115
5841
|
]
|
|
5116
5842
|
}
|
|
5117
5843
|
)
|
|
5118
5844
|
] }),
|
|
5119
|
-
/* @__PURE__ */ (0,
|
|
5845
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-toolbar-section", children: [
|
|
5120
5846
|
renderToolbarSectionHeader(
|
|
5121
5847
|
"format",
|
|
5122
5848
|
props.locale["documents.richText.toolbar.formatLabel"]
|
|
5123
5849
|
),
|
|
5124
|
-
isToolbarSectionOpen("format") && /* @__PURE__ */ (0,
|
|
5125
|
-
/* @__PURE__ */ (0,
|
|
5850
|
+
isToolbarSectionOpen("format") && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-button-group", children: [
|
|
5851
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5126
5852
|
"button",
|
|
5127
5853
|
{
|
|
5128
5854
|
type: "button",
|
|
@@ -5132,7 +5858,7 @@ function RichTextEditor(props) {
|
|
|
5132
5858
|
children: "B"
|
|
5133
5859
|
}
|
|
5134
5860
|
),
|
|
5135
|
-
/* @__PURE__ */ (0,
|
|
5861
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5136
5862
|
"button",
|
|
5137
5863
|
{
|
|
5138
5864
|
type: "button",
|
|
@@ -5142,7 +5868,7 @@ function RichTextEditor(props) {
|
|
|
5142
5868
|
children: "I"
|
|
5143
5869
|
}
|
|
5144
5870
|
),
|
|
5145
|
-
/* @__PURE__ */ (0,
|
|
5871
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5146
5872
|
"button",
|
|
5147
5873
|
{
|
|
5148
5874
|
type: "button",
|
|
@@ -5152,7 +5878,7 @@ function RichTextEditor(props) {
|
|
|
5152
5878
|
children: "U"
|
|
5153
5879
|
}
|
|
5154
5880
|
),
|
|
5155
|
-
/* @__PURE__ */ (0,
|
|
5881
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5156
5882
|
"button",
|
|
5157
5883
|
{
|
|
5158
5884
|
type: "button",
|
|
@@ -5162,7 +5888,7 @@ function RichTextEditor(props) {
|
|
|
5162
5888
|
children: "UL"
|
|
5163
5889
|
}
|
|
5164
5890
|
),
|
|
5165
|
-
/* @__PURE__ */ (0,
|
|
5891
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5166
5892
|
"button",
|
|
5167
5893
|
{
|
|
5168
5894
|
type: "button",
|
|
@@ -5172,7 +5898,7 @@ function RichTextEditor(props) {
|
|
|
5172
5898
|
children: "1."
|
|
5173
5899
|
}
|
|
5174
5900
|
),
|
|
5175
|
-
/* @__PURE__ */ (0,
|
|
5901
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5176
5902
|
"button",
|
|
5177
5903
|
{
|
|
5178
5904
|
type: "button",
|
|
@@ -5182,7 +5908,7 @@ function RichTextEditor(props) {
|
|
|
5182
5908
|
children: "L"
|
|
5183
5909
|
}
|
|
5184
5910
|
),
|
|
5185
|
-
/* @__PURE__ */ (0,
|
|
5911
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5186
5912
|
"button",
|
|
5187
5913
|
{
|
|
5188
5914
|
type: "button",
|
|
@@ -5192,7 +5918,7 @@ function RichTextEditor(props) {
|
|
|
5192
5918
|
children: "C"
|
|
5193
5919
|
}
|
|
5194
5920
|
),
|
|
5195
|
-
/* @__PURE__ */ (0,
|
|
5921
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5196
5922
|
"button",
|
|
5197
5923
|
{
|
|
5198
5924
|
type: "button",
|
|
@@ -5202,7 +5928,7 @@ function RichTextEditor(props) {
|
|
|
5202
5928
|
children: "R"
|
|
5203
5929
|
}
|
|
5204
5930
|
),
|
|
5205
|
-
/* @__PURE__ */ (0,
|
|
5931
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5206
5932
|
"button",
|
|
5207
5933
|
{
|
|
5208
5934
|
type: "button",
|
|
@@ -5214,13 +5940,13 @@ function RichTextEditor(props) {
|
|
|
5214
5940
|
)
|
|
5215
5941
|
] })
|
|
5216
5942
|
] }),
|
|
5217
|
-
/* @__PURE__ */ (0,
|
|
5943
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-toolbar-section", children: [
|
|
5218
5944
|
renderToolbarSectionHeader(
|
|
5219
5945
|
"insert",
|
|
5220
5946
|
props.locale["documents.richText.toolbar.insertLabel"]
|
|
5221
5947
|
),
|
|
5222
|
-
isToolbarSectionOpen("insert") && /* @__PURE__ */ (0,
|
|
5223
|
-
/* @__PURE__ */ (0,
|
|
5948
|
+
isToolbarSectionOpen("insert") && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-button-group", children: [
|
|
5949
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5224
5950
|
"button",
|
|
5225
5951
|
{
|
|
5226
5952
|
type: "button",
|
|
@@ -5230,7 +5956,7 @@ function RichTextEditor(props) {
|
|
|
5230
5956
|
children: "Link"
|
|
5231
5957
|
}
|
|
5232
5958
|
),
|
|
5233
|
-
/* @__PURE__ */ (0,
|
|
5959
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5234
5960
|
"button",
|
|
5235
5961
|
{
|
|
5236
5962
|
type: "button",
|
|
@@ -5242,13 +5968,13 @@ function RichTextEditor(props) {
|
|
|
5242
5968
|
)
|
|
5243
5969
|
] })
|
|
5244
5970
|
] }),
|
|
5245
|
-
/* @__PURE__ */ (0,
|
|
5971
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-toolbar-section", children: [
|
|
5246
5972
|
renderToolbarSectionHeader(
|
|
5247
5973
|
"media",
|
|
5248
5974
|
props.locale["documents.richText.toolbar.mediaLabel"]
|
|
5249
5975
|
),
|
|
5250
|
-
isToolbarSectionOpen("media") && /* @__PURE__ */ (0,
|
|
5251
|
-
/* @__PURE__ */ (0,
|
|
5976
|
+
isToolbarSectionOpen("media") && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-button-group", children: [
|
|
5977
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5252
5978
|
"button",
|
|
5253
5979
|
{
|
|
5254
5980
|
type: "button",
|
|
@@ -5258,7 +5984,7 @@ function RichTextEditor(props) {
|
|
|
5258
5984
|
children: "Image"
|
|
5259
5985
|
}
|
|
5260
5986
|
),
|
|
5261
|
-
/* @__PURE__ */ (0,
|
|
5987
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5262
5988
|
"button",
|
|
5263
5989
|
{
|
|
5264
5990
|
type: "button",
|
|
@@ -5270,13 +5996,13 @@ function RichTextEditor(props) {
|
|
|
5270
5996
|
)
|
|
5271
5997
|
] })
|
|
5272
5998
|
] }),
|
|
5273
|
-
/* @__PURE__ */ (0,
|
|
5999
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-toolbar-section", children: [
|
|
5274
6000
|
renderToolbarSectionHeader(
|
|
5275
6001
|
"history",
|
|
5276
6002
|
props.locale["documents.richText.toolbar.historyLabel"]
|
|
5277
6003
|
),
|
|
5278
|
-
isToolbarSectionOpen("history") && /* @__PURE__ */ (0,
|
|
5279
|
-
/* @__PURE__ */ (0,
|
|
6004
|
+
isToolbarSectionOpen("history") && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-button-group", children: [
|
|
6005
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5280
6006
|
"button",
|
|
5281
6007
|
{
|
|
5282
6008
|
type: "button",
|
|
@@ -5286,7 +6012,7 @@ function RichTextEditor(props) {
|
|
|
5286
6012
|
children: "Undo"
|
|
5287
6013
|
}
|
|
5288
6014
|
),
|
|
5289
|
-
/* @__PURE__ */ (0,
|
|
6015
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5290
6016
|
"button",
|
|
5291
6017
|
{
|
|
5292
6018
|
type: "button",
|
|
@@ -5299,13 +6025,13 @@ function RichTextEditor(props) {
|
|
|
5299
6025
|
] })
|
|
5300
6026
|
] })
|
|
5301
6027
|
] }),
|
|
5302
|
-
toolbarState.hasSelectedImage && imageEditorState && /* @__PURE__ */ (0,
|
|
5303
|
-
/* @__PURE__ */ (0,
|
|
5304
|
-
/* @__PURE__ */ (0,
|
|
5305
|
-
/* @__PURE__ */ (0,
|
|
6028
|
+
toolbarState.hasSelectedImage && imageEditorState && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-context-panel", children: [
|
|
6029
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "hv-richtext-context-header", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
6030
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: props.locale["documents.richText.imageEditorTitle"] }),
|
|
6031
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { children: props.locale["documents.richText.imageEditorHelp"] })
|
|
5306
6032
|
] }) }),
|
|
5307
|
-
/* @__PURE__ */ (0,
|
|
5308
|
-
/* @__PURE__ */ (0,
|
|
6033
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-image-editor", children: [
|
|
6034
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "hv-richtext-image-preview-card", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
5309
6035
|
"div",
|
|
5310
6036
|
{
|
|
5311
6037
|
ref: imagePreviewRef,
|
|
@@ -5315,7 +6041,7 @@ function RichTextEditor(props) {
|
|
|
5315
6041
|
onPointerUp: handleImagePreviewPointerUp,
|
|
5316
6042
|
onPointerCancel: handleImagePreviewPointerUp,
|
|
5317
6043
|
children: [
|
|
5318
|
-
/* @__PURE__ */ (0,
|
|
6044
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5319
6045
|
"img",
|
|
5320
6046
|
{
|
|
5321
6047
|
src: imageEditorState.src,
|
|
@@ -5326,7 +6052,7 @@ function RichTextEditor(props) {
|
|
|
5326
6052
|
}
|
|
5327
6053
|
}
|
|
5328
6054
|
),
|
|
5329
|
-
/* @__PURE__ */ (0,
|
|
6055
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5330
6056
|
"div",
|
|
5331
6057
|
{
|
|
5332
6058
|
className: "hv-richtext-image-focus-point",
|
|
@@ -5339,11 +6065,11 @@ function RichTextEditor(props) {
|
|
|
5339
6065
|
]
|
|
5340
6066
|
}
|
|
5341
6067
|
) }),
|
|
5342
|
-
/* @__PURE__ */ (0,
|
|
5343
|
-
/* @__PURE__ */ (0,
|
|
5344
|
-
/* @__PURE__ */ (0,
|
|
5345
|
-
/* @__PURE__ */ (0,
|
|
5346
|
-
/* @__PURE__ */ (0,
|
|
6068
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-image-controls", children: [
|
|
6069
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-toolbar-subgroup", children: [
|
|
6070
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "hv-richtext-toolbar-sublabel", children: props.locale["documents.richText.toolbar.imageSizeLabel"] }),
|
|
6071
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-button-group", children: [
|
|
6072
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5347
6073
|
"button",
|
|
5348
6074
|
{
|
|
5349
6075
|
type: "button",
|
|
@@ -5352,7 +6078,7 @@ function RichTextEditor(props) {
|
|
|
5352
6078
|
children: "S"
|
|
5353
6079
|
}
|
|
5354
6080
|
),
|
|
5355
|
-
/* @__PURE__ */ (0,
|
|
6081
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5356
6082
|
"button",
|
|
5357
6083
|
{
|
|
5358
6084
|
type: "button",
|
|
@@ -5361,7 +6087,7 @@ function RichTextEditor(props) {
|
|
|
5361
6087
|
children: "M"
|
|
5362
6088
|
}
|
|
5363
6089
|
),
|
|
5364
|
-
/* @__PURE__ */ (0,
|
|
6090
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5365
6091
|
"button",
|
|
5366
6092
|
{
|
|
5367
6093
|
type: "button",
|
|
@@ -5370,7 +6096,7 @@ function RichTextEditor(props) {
|
|
|
5370
6096
|
children: "L"
|
|
5371
6097
|
}
|
|
5372
6098
|
),
|
|
5373
|
-
/* @__PURE__ */ (0,
|
|
6099
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5374
6100
|
"button",
|
|
5375
6101
|
{
|
|
5376
6102
|
type: "button",
|
|
@@ -5381,10 +6107,10 @@ function RichTextEditor(props) {
|
|
|
5381
6107
|
)
|
|
5382
6108
|
] })
|
|
5383
6109
|
] }),
|
|
5384
|
-
/* @__PURE__ */ (0,
|
|
5385
|
-
/* @__PURE__ */ (0,
|
|
5386
|
-
/* @__PURE__ */ (0,
|
|
5387
|
-
/* @__PURE__ */ (0,
|
|
6110
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-toolbar-subgroup", children: [
|
|
6111
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "hv-richtext-toolbar-sublabel", children: props.locale["documents.richText.toolbar.imageCropLabel"] }),
|
|
6112
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-button-group", children: [
|
|
6113
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5388
6114
|
"button",
|
|
5389
6115
|
{
|
|
5390
6116
|
type: "button",
|
|
@@ -5393,7 +6119,7 @@ function RichTextEditor(props) {
|
|
|
5393
6119
|
children: "Orig"
|
|
5394
6120
|
}
|
|
5395
6121
|
),
|
|
5396
|
-
/* @__PURE__ */ (0,
|
|
6122
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5397
6123
|
"button",
|
|
5398
6124
|
{
|
|
5399
6125
|
type: "button",
|
|
@@ -5402,7 +6128,7 @@ function RichTextEditor(props) {
|
|
|
5402
6128
|
children: "Wide"
|
|
5403
6129
|
}
|
|
5404
6130
|
),
|
|
5405
|
-
/* @__PURE__ */ (0,
|
|
6131
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5406
6132
|
"button",
|
|
5407
6133
|
{
|
|
5408
6134
|
type: "button",
|
|
@@ -5411,7 +6137,7 @@ function RichTextEditor(props) {
|
|
|
5411
6137
|
children: "1:1"
|
|
5412
6138
|
}
|
|
5413
6139
|
),
|
|
5414
|
-
/* @__PURE__ */ (0,
|
|
6140
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5415
6141
|
"button",
|
|
5416
6142
|
{
|
|
5417
6143
|
type: "button",
|
|
@@ -5422,10 +6148,10 @@ function RichTextEditor(props) {
|
|
|
5422
6148
|
)
|
|
5423
6149
|
] })
|
|
5424
6150
|
] }),
|
|
5425
|
-
/* @__PURE__ */ (0,
|
|
5426
|
-
/* @__PURE__ */ (0,
|
|
5427
|
-
/* @__PURE__ */ (0,
|
|
5428
|
-
/* @__PURE__ */ (0,
|
|
6151
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-toolbar-subgroup", children: [
|
|
6152
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "hv-richtext-toolbar-sublabel", children: props.locale["documents.richText.toolbar.imageAlignLabel"] }),
|
|
6153
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-button-group", children: [
|
|
6154
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5429
6155
|
"button",
|
|
5430
6156
|
{
|
|
5431
6157
|
type: "button",
|
|
@@ -5434,7 +6160,7 @@ function RichTextEditor(props) {
|
|
|
5434
6160
|
children: "Left"
|
|
5435
6161
|
}
|
|
5436
6162
|
),
|
|
5437
|
-
/* @__PURE__ */ (0,
|
|
6163
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5438
6164
|
"button",
|
|
5439
6165
|
{
|
|
5440
6166
|
type: "button",
|
|
@@ -5443,7 +6169,7 @@ function RichTextEditor(props) {
|
|
|
5443
6169
|
children: "Center"
|
|
5444
6170
|
}
|
|
5445
6171
|
),
|
|
5446
|
-
/* @__PURE__ */ (0,
|
|
6172
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5447
6173
|
"button",
|
|
5448
6174
|
{
|
|
5449
6175
|
type: "button",
|
|
@@ -5454,9 +6180,9 @@ function RichTextEditor(props) {
|
|
|
5454
6180
|
)
|
|
5455
6181
|
] })
|
|
5456
6182
|
] }),
|
|
5457
|
-
/* @__PURE__ */ (0,
|
|
5458
|
-
/* @__PURE__ */ (0,
|
|
5459
|
-
/* @__PURE__ */ (0,
|
|
6183
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "hv-richtext-range-group", children: [
|
|
6184
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: props.locale["documents.richText.imageZoom"] }),
|
|
6185
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5460
6186
|
"input",
|
|
5461
6187
|
{
|
|
5462
6188
|
type: "range",
|
|
@@ -5479,18 +6205,18 @@ function RichTextEditor(props) {
|
|
|
5479
6205
|
)
|
|
5480
6206
|
}
|
|
5481
6207
|
),
|
|
5482
|
-
/* @__PURE__ */ (0,
|
|
6208
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("strong", { children: [
|
|
5483
6209
|
imageEditorState.scale.toFixed(2),
|
|
5484
6210
|
"x"
|
|
5485
6211
|
] })
|
|
5486
6212
|
] }),
|
|
5487
|
-
/* @__PURE__ */ (0,
|
|
5488
|
-
/* @__PURE__ */ (0,
|
|
6213
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-focus-readout", children: [
|
|
6214
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { children: [
|
|
5489
6215
|
"X ",
|
|
5490
6216
|
Math.round(imageEditorState.focusX),
|
|
5491
6217
|
"%"
|
|
5492
6218
|
] }),
|
|
5493
|
-
/* @__PURE__ */ (0,
|
|
6219
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { children: [
|
|
5494
6220
|
"Y ",
|
|
5495
6221
|
Math.round(imageEditorState.focusY),
|
|
5496
6222
|
"%"
|
|
@@ -5499,10 +6225,10 @@ function RichTextEditor(props) {
|
|
|
5499
6225
|
] })
|
|
5500
6226
|
] })
|
|
5501
6227
|
] }),
|
|
5502
|
-
!toolbarState.hasSelectedImage && toolbarState.insideTable && /* @__PURE__ */ (0,
|
|
5503
|
-
/* @__PURE__ */ (0,
|
|
5504
|
-
/* @__PURE__ */ (0,
|
|
5505
|
-
/* @__PURE__ */ (0,
|
|
6228
|
+
!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: [
|
|
6229
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "hv-richtext-toolbar-sublabel", children: props.locale["documents.richText.toolbar.tableLabel"] }),
|
|
6230
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-button-group", children: [
|
|
6231
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5506
6232
|
"button",
|
|
5507
6233
|
{
|
|
5508
6234
|
type: "button",
|
|
@@ -5512,7 +6238,7 @@ function RichTextEditor(props) {
|
|
|
5512
6238
|
children: "+Row"
|
|
5513
6239
|
}
|
|
5514
6240
|
),
|
|
5515
|
-
/* @__PURE__ */ (0,
|
|
6241
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5516
6242
|
"button",
|
|
5517
6243
|
{
|
|
5518
6244
|
type: "button",
|
|
@@ -5522,7 +6248,7 @@ function RichTextEditor(props) {
|
|
|
5522
6248
|
children: "+Col"
|
|
5523
6249
|
}
|
|
5524
6250
|
),
|
|
5525
|
-
/* @__PURE__ */ (0,
|
|
6251
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5526
6252
|
"button",
|
|
5527
6253
|
{
|
|
5528
6254
|
type: "button",
|
|
@@ -5532,7 +6258,7 @@ function RichTextEditor(props) {
|
|
|
5532
6258
|
children: "-Row"
|
|
5533
6259
|
}
|
|
5534
6260
|
),
|
|
5535
|
-
/* @__PURE__ */ (0,
|
|
6261
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5536
6262
|
"button",
|
|
5537
6263
|
{
|
|
5538
6264
|
type: "button",
|
|
@@ -5544,10 +6270,10 @@ function RichTextEditor(props) {
|
|
|
5544
6270
|
)
|
|
5545
6271
|
] })
|
|
5546
6272
|
] }) }),
|
|
5547
|
-
props.mode === "create" && /* @__PURE__ */ (0,
|
|
5548
|
-
/* @__PURE__ */ (0,
|
|
5549
|
-
/* @__PURE__ */ (0,
|
|
5550
|
-
/* @__PURE__ */ (0,
|
|
6273
|
+
props.mode === "create" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-template-panel", children: [
|
|
6274
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hv-richtext-template-strip", children: [
|
|
6275
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "hv-richtext-template-label", children: props.locale["documents.richText.templates"] }),
|
|
6276
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5551
6277
|
"button",
|
|
5552
6278
|
{
|
|
5553
6279
|
type: "button",
|
|
@@ -5557,15 +6283,15 @@ function RichTextEditor(props) {
|
|
|
5557
6283
|
}
|
|
5558
6284
|
)
|
|
5559
6285
|
] }),
|
|
5560
|
-
areTemplatesVisible && /* @__PURE__ */ (0,
|
|
6286
|
+
areTemplatesVisible && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "hv-richtext-template-grid", children: authoringTemplates.map((template) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
5561
6287
|
"button",
|
|
5562
6288
|
{
|
|
5563
6289
|
type: "button",
|
|
5564
6290
|
className: `hv-richtext-template-card ${selectedTemplateId === template.id ? "active" : ""}`,
|
|
5565
6291
|
onClick: () => applyTemplate(template.id),
|
|
5566
6292
|
children: [
|
|
5567
|
-
/* @__PURE__ */ (0,
|
|
5568
|
-
/* @__PURE__ */ (0,
|
|
6293
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "hv-richtext-template-title", children: props.locale[template.labelKey] }),
|
|
6294
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "hv-richtext-template-description", children: props.locale[template.descriptionKey] })
|
|
5569
6295
|
]
|
|
5570
6296
|
},
|
|
5571
6297
|
template.id
|
|
@@ -5574,8 +6300,8 @@ function RichTextEditor(props) {
|
|
|
5574
6300
|
]
|
|
5575
6301
|
}
|
|
5576
6302
|
) }),
|
|
5577
|
-
/* @__PURE__ */ (0,
|
|
5578
|
-
/* @__PURE__ */ (0,
|
|
6303
|
+
/* @__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: [
|
|
6304
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5579
6305
|
"div",
|
|
5580
6306
|
{
|
|
5581
6307
|
ref: editorRef,
|
|
@@ -5599,7 +6325,7 @@ function RichTextEditor(props) {
|
|
|
5599
6325
|
"aria-label": props.locale["a11y.editor"]
|
|
5600
6326
|
}
|
|
5601
6327
|
),
|
|
5602
|
-
/* @__PURE__ */ (0,
|
|
6328
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5603
6329
|
SignatureOverlay,
|
|
5604
6330
|
{
|
|
5605
6331
|
surfaceKey: "document:main",
|
|
@@ -5607,11 +6333,13 @@ function RichTextEditor(props) {
|
|
|
5607
6333
|
placements: props.signatureOverlay.placements,
|
|
5608
6334
|
annotations: props.signatureOverlay.annotations,
|
|
5609
6335
|
pendingSignature: props.signatureOverlay.pendingSignature,
|
|
6336
|
+
pendingSignatureColor: props.signatureOverlay.pendingSignatureColor,
|
|
5610
6337
|
pendingAnnotation: props.signatureOverlay.pendingAnnotation,
|
|
5611
6338
|
activePlacementId: props.signatureOverlay.activePlacementId,
|
|
5612
6339
|
activeAnnotationId: props.signatureOverlay.activeAnnotationId,
|
|
5613
6340
|
placeHint: props.signatureOverlay.placeHint,
|
|
5614
6341
|
annotationHint: props.signatureOverlay.annotationHint,
|
|
6342
|
+
cancelPlacementLabel: props.signatureOverlay.cancelPlacementLabel,
|
|
5615
6343
|
annotationPlaceholder: props.signatureOverlay.annotationPlaceholder,
|
|
5616
6344
|
signatureAltLabel: props.signatureOverlay.signatureAltLabel,
|
|
5617
6345
|
signatureAltByLabel: props.signatureOverlay.signatureAltByLabel,
|
|
@@ -5631,7 +6359,8 @@ function RichTextEditor(props) {
|
|
|
5631
6359
|
onRemovePlacement: props.signatureOverlay.onRemovePlacement,
|
|
5632
6360
|
onRemoveAnnotation: props.signatureOverlay.onRemoveAnnotation,
|
|
5633
6361
|
onSelectPlacement: props.signatureOverlay.onSelectPlacement,
|
|
5634
|
-
onSelectAnnotation: props.signatureOverlay.onSelectAnnotation
|
|
6362
|
+
onSelectAnnotation: props.signatureOverlay.onSelectAnnotation,
|
|
6363
|
+
onCancelPlacementMode: props.signatureOverlay.onCancelPlacementMode
|
|
5635
6364
|
}
|
|
5636
6365
|
)
|
|
5637
6366
|
] }) })
|
|
@@ -5640,9 +6369,9 @@ function RichTextEditor(props) {
|
|
|
5640
6369
|
|
|
5641
6370
|
// src/editors/SpreadsheetEditor.tsx
|
|
5642
6371
|
var import_exceljs2 = __toESM(require("exceljs"), 1);
|
|
5643
|
-
var
|
|
6372
|
+
var import_react4 = require("react");
|
|
5644
6373
|
var XLSX2 = __toESM(require("xlsx"), 1);
|
|
5645
|
-
var
|
|
6374
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
5646
6375
|
var MAX_RENDER_ROWS = 400;
|
|
5647
6376
|
var MAX_RENDER_COLS = 120;
|
|
5648
6377
|
function toColumnLabel2(index) {
|
|
@@ -6226,11 +6955,11 @@ async function buildSheetModels(arrayBuffer, fileName) {
|
|
|
6226
6955
|
}
|
|
6227
6956
|
function SpreadsheetEditor(props) {
|
|
6228
6957
|
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,
|
|
6958
|
+
const [sheets, setSheets] = (0, import_react4.useState)([]);
|
|
6959
|
+
const [activeCell, setActiveCell] = (0, import_react4.useState)({ row: 0, col: 0 });
|
|
6960
|
+
const [hasEdits, setHasEdits] = (0, import_react4.useState)(false);
|
|
6961
|
+
const [dirtyCellAddressesBySheet, setDirtyCellAddressesBySheet] = (0, import_react4.useState)({});
|
|
6962
|
+
(0, import_react4.useEffect)(() => {
|
|
6234
6963
|
if (!props.arrayBuffer) {
|
|
6235
6964
|
const nextSheets = props.mode === "create" ? [createBlankSheetModel("Sheet1")] : [];
|
|
6236
6965
|
setSheets(nextSheets);
|
|
@@ -6280,7 +7009,7 @@ function SpreadsheetEditor(props) {
|
|
|
6280
7009
|
props.onThumbs,
|
|
6281
7010
|
props.mode
|
|
6282
7011
|
]);
|
|
6283
|
-
(0,
|
|
7012
|
+
(0, import_react4.useEffect)(() => {
|
|
6284
7013
|
props.onExportStateChange?.(
|
|
6285
7014
|
sheets.length > 0 ? {
|
|
6286
7015
|
sheets,
|
|
@@ -6306,7 +7035,7 @@ function SpreadsheetEditor(props) {
|
|
|
6306
7035
|
Math.min(props.currentPage - 1, Math.max(sheets.length - 1, 0))
|
|
6307
7036
|
);
|
|
6308
7037
|
const activeSheet = sheets[activeSheetIndex];
|
|
6309
|
-
const mergeLookup = (0,
|
|
7038
|
+
const mergeLookup = (0, import_react4.useMemo)(
|
|
6310
7039
|
() => createMergeLookup(activeSheet?.merges ?? []),
|
|
6311
7040
|
[activeSheet]
|
|
6312
7041
|
);
|
|
@@ -6383,12 +7112,12 @@ function SpreadsheetEditor(props) {
|
|
|
6383
7112
|
);
|
|
6384
7113
|
};
|
|
6385
7114
|
if (!activeSheet) {
|
|
6386
|
-
return /* @__PURE__ */ (0,
|
|
7115
|
+
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
7116
|
}
|
|
6388
7117
|
const isTruncated = activeSheet.rowCount > activeSheet.renderedRowCount || activeSheet.colCount > activeSheet.renderedColCount;
|
|
6389
|
-
return /* @__PURE__ */ (0,
|
|
6390
|
-
/* @__PURE__ */ (0,
|
|
6391
|
-
/* @__PURE__ */ (0,
|
|
7118
|
+
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: [
|
|
7119
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "hv-sheet-tabs", children: [
|
|
7120
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "hv-sheet-tab-list", children: sheets.map((sheet, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
6392
7121
|
"button",
|
|
6393
7122
|
{
|
|
6394
7123
|
type: "button",
|
|
@@ -6401,8 +7130,8 @@ function SpreadsheetEditor(props) {
|
|
|
6401
7130
|
},
|
|
6402
7131
|
sheet.name
|
|
6403
7132
|
)) }),
|
|
6404
|
-
!readonly && /* @__PURE__ */ (0,
|
|
6405
|
-
/* @__PURE__ */ (0,
|
|
7133
|
+
!readonly && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "hv-sheet-actions", children: [
|
|
7134
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
6406
7135
|
"button",
|
|
6407
7136
|
{
|
|
6408
7137
|
type: "button",
|
|
@@ -6411,7 +7140,7 @@ function SpreadsheetEditor(props) {
|
|
|
6411
7140
|
children: props.locale["documents.sheetAddSheet"]
|
|
6412
7141
|
}
|
|
6413
7142
|
),
|
|
6414
|
-
/* @__PURE__ */ (0,
|
|
7143
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
6415
7144
|
"button",
|
|
6416
7145
|
{
|
|
6417
7146
|
type: "button",
|
|
@@ -6420,7 +7149,7 @@ function SpreadsheetEditor(props) {
|
|
|
6420
7149
|
children: props.locale["documents.sheetAddRow"]
|
|
6421
7150
|
}
|
|
6422
7151
|
),
|
|
6423
|
-
/* @__PURE__ */ (0,
|
|
7152
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
6424
7153
|
"button",
|
|
6425
7154
|
{
|
|
6426
7155
|
type: "button",
|
|
@@ -6431,12 +7160,12 @@ function SpreadsheetEditor(props) {
|
|
|
6431
7160
|
)
|
|
6432
7161
|
] })
|
|
6433
7162
|
] }),
|
|
6434
|
-
/* @__PURE__ */ (0,
|
|
6435
|
-
/* @__PURE__ */ (0,
|
|
7163
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "hv-sheet-formula-bar", children: [
|
|
7164
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "hv-sheet-formula-cell", children: [
|
|
6436
7165
|
toColumnLabel2(activeCell.col),
|
|
6437
7166
|
activeCell.row + 1
|
|
6438
7167
|
] }),
|
|
6439
|
-
/* @__PURE__ */ (0,
|
|
7168
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
6440
7169
|
"input",
|
|
6441
7170
|
{
|
|
6442
7171
|
value: activeCellValue,
|
|
@@ -6446,14 +7175,14 @@ function SpreadsheetEditor(props) {
|
|
|
6446
7175
|
}
|
|
6447
7176
|
)
|
|
6448
7177
|
] }),
|
|
6449
|
-
isTruncated && /* @__PURE__ */ (0,
|
|
6450
|
-
/* @__PURE__ */ (0,
|
|
6451
|
-
/* @__PURE__ */ (0,
|
|
6452
|
-
/* @__PURE__ */ (0,
|
|
6453
|
-
/* @__PURE__ */ (0,
|
|
7178
|
+
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)) }),
|
|
7179
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "hv-sheet-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "hv-sheet-surface", children: [
|
|
7180
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("table", { className: "hv-sheet-table", children: [
|
|
7181
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("tr", { children: [
|
|
7182
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("th", { className: "hv-sheet-corner" }),
|
|
6454
7183
|
Array.from(
|
|
6455
7184
|
{ length: activeSheet.renderedColCount },
|
|
6456
|
-
(_, colIndex) => /* @__PURE__ */ (0,
|
|
7185
|
+
(_, colIndex) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
6457
7186
|
"th",
|
|
6458
7187
|
{
|
|
6459
7188
|
className: "hv-sheet-column-header",
|
|
@@ -6467,12 +7196,12 @@ function SpreadsheetEditor(props) {
|
|
|
6467
7196
|
)
|
|
6468
7197
|
)
|
|
6469
7198
|
] }) }),
|
|
6470
|
-
/* @__PURE__ */ (0,
|
|
7199
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("tbody", { children: activeSheet.data.map((row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
6471
7200
|
"tr",
|
|
6472
7201
|
{
|
|
6473
7202
|
style: { height: activeSheet.rowHeights[rowIndex] ?? 32 },
|
|
6474
7203
|
children: [
|
|
6475
|
-
/* @__PURE__ */ (0,
|
|
7204
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("td", { className: "hv-sheet-row-header", children: rowIndex + 1 }),
|
|
6476
7205
|
row.map((cellValue, colIndex) => {
|
|
6477
7206
|
const cellKey = makeCellKey(rowIndex, colIndex);
|
|
6478
7207
|
if (mergeLookup.covered.has(cellKey)) {
|
|
@@ -6481,7 +7210,7 @@ function SpreadsheetEditor(props) {
|
|
|
6481
7210
|
const merge = mergeLookup.starts.get(cellKey);
|
|
6482
7211
|
const cellModel = activeSheet.cells[cellKey];
|
|
6483
7212
|
const width = activeSheet.colWidths[colIndex] ?? 96;
|
|
6484
|
-
return /* @__PURE__ */ (0,
|
|
7213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
6485
7214
|
"td",
|
|
6486
7215
|
{
|
|
6487
7216
|
rowSpan: merge ? merge.endRow - merge.startRow + 1 : 1,
|
|
@@ -6508,7 +7237,7 @@ function SpreadsheetEditor(props) {
|
|
|
6508
7237
|
rowIndex
|
|
6509
7238
|
)) })
|
|
6510
7239
|
] }),
|
|
6511
|
-
/* @__PURE__ */ (0,
|
|
7240
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
6512
7241
|
SignatureOverlay,
|
|
6513
7242
|
{
|
|
6514
7243
|
surfaceKey: `sheet:${activeSheet.name}`,
|
|
@@ -6517,11 +7246,13 @@ function SpreadsheetEditor(props) {
|
|
|
6517
7246
|
placements: props.signatureOverlay.placements,
|
|
6518
7247
|
annotations: props.signatureOverlay.annotations,
|
|
6519
7248
|
pendingSignature: props.signatureOverlay.pendingSignature,
|
|
7249
|
+
pendingSignatureColor: props.signatureOverlay.pendingSignatureColor,
|
|
6520
7250
|
pendingAnnotation: props.signatureOverlay.pendingAnnotation,
|
|
6521
7251
|
activePlacementId: props.signatureOverlay.activePlacementId,
|
|
6522
7252
|
activeAnnotationId: props.signatureOverlay.activeAnnotationId,
|
|
6523
7253
|
placeHint: props.signatureOverlay.placeHint,
|
|
6524
7254
|
annotationHint: props.signatureOverlay.annotationHint,
|
|
7255
|
+
cancelPlacementLabel: props.signatureOverlay.cancelPlacementLabel,
|
|
6525
7256
|
annotationPlaceholder: props.signatureOverlay.annotationPlaceholder,
|
|
6526
7257
|
signatureAltLabel: props.signatureOverlay.signatureAltLabel,
|
|
6527
7258
|
signatureAltByLabel: props.signatureOverlay.signatureAltByLabel,
|
|
@@ -6541,7 +7272,8 @@ function SpreadsheetEditor(props) {
|
|
|
6541
7272
|
onRemovePlacement: props.signatureOverlay.onRemovePlacement,
|
|
6542
7273
|
onRemoveAnnotation: props.signatureOverlay.onRemoveAnnotation,
|
|
6543
7274
|
onSelectPlacement: props.signatureOverlay.onSelectPlacement,
|
|
6544
|
-
onSelectAnnotation: props.signatureOverlay.onSelectAnnotation
|
|
7275
|
+
onSelectAnnotation: props.signatureOverlay.onSelectAnnotation,
|
|
7276
|
+
onCancelPlacementMode: props.signatureOverlay.onCancelPlacementMode
|
|
6545
7277
|
}
|
|
6546
7278
|
)
|
|
6547
7279
|
] }) })
|
|
@@ -6549,17 +7281,17 @@ function SpreadsheetEditor(props) {
|
|
|
6549
7281
|
}
|
|
6550
7282
|
|
|
6551
7283
|
// src/renderers/ImageRenderer.tsx
|
|
6552
|
-
var
|
|
6553
|
-
var
|
|
7284
|
+
var import_react5 = require("react");
|
|
7285
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
6554
7286
|
function ImageRenderer(props) {
|
|
6555
|
-
const url = (0,
|
|
7287
|
+
const url = (0, import_react5.useMemo)(() => {
|
|
6556
7288
|
if (!props.arrayBuffer) {
|
|
6557
7289
|
return void 0;
|
|
6558
7290
|
}
|
|
6559
7291
|
const mime = props.fileType === "svg" ? "image/svg+xml" : props.fileType === "png" ? "image/png" : "image/jpeg";
|
|
6560
7292
|
return URL.createObjectURL(new Blob([props.arrayBuffer], { type: mime }));
|
|
6561
7293
|
}, [props.arrayBuffer, props.fileType]);
|
|
6562
|
-
(0,
|
|
7294
|
+
(0, import_react5.useEffect)(() => {
|
|
6563
7295
|
return () => {
|
|
6564
7296
|
if (url) {
|
|
6565
7297
|
URL.revokeObjectURL(url);
|
|
@@ -6567,11 +7299,11 @@ function ImageRenderer(props) {
|
|
|
6567
7299
|
};
|
|
6568
7300
|
}, [url]);
|
|
6569
7301
|
if (!props.arrayBuffer || !url) {
|
|
6570
|
-
return /* @__PURE__ */ (0,
|
|
7302
|
+
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
7303
|
}
|
|
6572
|
-
return /* @__PURE__ */ (0,
|
|
6573
|
-
/* @__PURE__ */ (0,
|
|
6574
|
-
/* @__PURE__ */ (0,
|
|
7304
|
+
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: [
|
|
7305
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("img", { src: url, alt: props.fileName, className: "hv-image-renderer" }),
|
|
7306
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
6575
7307
|
SignatureOverlay,
|
|
6576
7308
|
{
|
|
6577
7309
|
surfaceKey: "image:main",
|
|
@@ -6579,11 +7311,13 @@ function ImageRenderer(props) {
|
|
|
6579
7311
|
placements: props.signatureOverlay.placements,
|
|
6580
7312
|
annotations: props.signatureOverlay.annotations,
|
|
6581
7313
|
pendingSignature: props.signatureOverlay.pendingSignature,
|
|
7314
|
+
pendingSignatureColor: props.signatureOverlay.pendingSignatureColor,
|
|
6582
7315
|
pendingAnnotation: props.signatureOverlay.pendingAnnotation,
|
|
6583
7316
|
activePlacementId: props.signatureOverlay.activePlacementId,
|
|
6584
7317
|
activeAnnotationId: props.signatureOverlay.activeAnnotationId,
|
|
6585
7318
|
placeHint: props.signatureOverlay.placeHint,
|
|
6586
7319
|
annotationHint: props.signatureOverlay.annotationHint,
|
|
7320
|
+
cancelPlacementLabel: props.signatureOverlay.cancelPlacementLabel,
|
|
6587
7321
|
annotationPlaceholder: props.signatureOverlay.annotationPlaceholder,
|
|
6588
7322
|
signatureAltLabel: props.signatureOverlay.signatureAltLabel,
|
|
6589
7323
|
signatureAltByLabel: props.signatureOverlay.signatureAltByLabel,
|
|
@@ -6603,7 +7337,8 @@ function ImageRenderer(props) {
|
|
|
6603
7337
|
onRemovePlacement: props.signatureOverlay.onRemovePlacement,
|
|
6604
7338
|
onRemoveAnnotation: props.signatureOverlay.onRemoveAnnotation,
|
|
6605
7339
|
onSelectPlacement: props.signatureOverlay.onSelectPlacement,
|
|
6606
|
-
onSelectAnnotation: props.signatureOverlay.onSelectAnnotation
|
|
7340
|
+
onSelectAnnotation: props.signatureOverlay.onSelectAnnotation,
|
|
7341
|
+
onCancelPlacementMode: props.signatureOverlay.onCancelPlacementMode
|
|
6607
7342
|
}
|
|
6608
7343
|
)
|
|
6609
7344
|
] }) });
|
|
@@ -6611,8 +7346,8 @@ function ImageRenderer(props) {
|
|
|
6611
7346
|
|
|
6612
7347
|
// src/renderers/PdfRenderer.tsx
|
|
6613
7348
|
var import_pdfjs_dist2 = require("pdfjs-dist");
|
|
6614
|
-
var
|
|
6615
|
-
var
|
|
7349
|
+
var import_react6 = require("react");
|
|
7350
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
6616
7351
|
var pdfWorkerBlobUrlPromise2 = null;
|
|
6617
7352
|
function yieldToBrowser() {
|
|
6618
7353
|
return new Promise((resolve) => {
|
|
@@ -6637,10 +7372,10 @@ async function resolvePdfWorkerSrc(customWorkerSrc) {
|
|
|
6637
7372
|
}
|
|
6638
7373
|
function PdfRenderer(props) {
|
|
6639
7374
|
const { url, arrayBuffer, layout, currentPage, workerSrc } = props;
|
|
6640
|
-
const [doc, setDoc] = (0,
|
|
6641
|
-
const [error, setError] = (0,
|
|
6642
|
-
const thumbnailJobRef = (0,
|
|
6643
|
-
(0,
|
|
7375
|
+
const [doc, setDoc] = (0, import_react6.useState)(null);
|
|
7376
|
+
const [error, setError] = (0, import_react6.useState)(null);
|
|
7377
|
+
const thumbnailJobRef = (0, import_react6.useRef)(0);
|
|
7378
|
+
(0, import_react6.useEffect)(() => {
|
|
6644
7379
|
let active = true;
|
|
6645
7380
|
const thumbnailJobId = thumbnailJobRef.current + 1;
|
|
6646
7381
|
thumbnailJobRef.current = thumbnailJobId;
|
|
@@ -6704,7 +7439,7 @@ function PdfRenderer(props) {
|
|
|
6704
7439
|
} catch (e) {
|
|
6705
7440
|
}
|
|
6706
7441
|
};
|
|
6707
|
-
const pagesToRender = (0,
|
|
7442
|
+
const pagesToRender = (0, import_react6.useMemo)(() => {
|
|
6708
7443
|
if (!doc) return [];
|
|
6709
7444
|
const p = Math.max(1, Math.min(currentPage, doc.numPages));
|
|
6710
7445
|
if (layout === "side-by-side" && doc.numPages > 1) {
|
|
@@ -6715,16 +7450,16 @@ function PdfRenderer(props) {
|
|
|
6715
7450
|
return [p];
|
|
6716
7451
|
}, [doc, currentPage, layout]);
|
|
6717
7452
|
if (error) {
|
|
6718
|
-
return /* @__PURE__ */ (0,
|
|
6719
|
-
/* @__PURE__ */ (0,
|
|
6720
|
-
/* @__PURE__ */ (0,
|
|
7453
|
+
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: [
|
|
7454
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("strong", { children: props.locale["documents.pdfLoadErrorTitle"] }),
|
|
7455
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: error })
|
|
6721
7456
|
] }) });
|
|
6722
7457
|
}
|
|
6723
|
-
return /* @__PURE__ */ (0,
|
|
7458
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
6724
7459
|
"div",
|
|
6725
7460
|
{
|
|
6726
7461
|
className: `hv-doc-scroll ${layout === "side-by-side" ? "hv-view-double" : "hv-view-single"}`,
|
|
6727
|
-
children: pagesToRender.map((page) => /* @__PURE__ */ (0,
|
|
7462
|
+
children: pagesToRender.map((page) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
6728
7463
|
PdfPage,
|
|
6729
7464
|
{
|
|
6730
7465
|
doc,
|
|
@@ -6741,8 +7476,8 @@ function PdfPage({
|
|
|
6741
7476
|
pageNum,
|
|
6742
7477
|
signatureOverlay
|
|
6743
7478
|
}) {
|
|
6744
|
-
const canvasRef = (0,
|
|
6745
|
-
(0,
|
|
7479
|
+
const canvasRef = (0, import_react6.useRef)(null);
|
|
7480
|
+
(0, import_react6.useEffect)(() => {
|
|
6746
7481
|
if (!doc || !canvasRef.current) return;
|
|
6747
7482
|
let active = true;
|
|
6748
7483
|
const render = async () => {
|
|
@@ -6768,7 +7503,7 @@ function PdfPage({
|
|
|
6768
7503
|
active = false;
|
|
6769
7504
|
};
|
|
6770
7505
|
}, [doc, pageNum]);
|
|
6771
|
-
return /* @__PURE__ */ (0,
|
|
7506
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
6772
7507
|
"div",
|
|
6773
7508
|
{
|
|
6774
7509
|
className: "hv-page-container",
|
|
@@ -6779,8 +7514,8 @@ function PdfPage({
|
|
|
6779
7514
|
justifyContent: "center"
|
|
6780
7515
|
},
|
|
6781
7516
|
children: [
|
|
6782
|
-
/* @__PURE__ */ (0,
|
|
6783
|
-
/* @__PURE__ */ (0,
|
|
7517
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("canvas", { ref: canvasRef, className: "hv-pdf-canvas" }),
|
|
7518
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
6784
7519
|
SignatureOverlay,
|
|
6785
7520
|
{
|
|
6786
7521
|
surfaceKey: `page:${pageNum}`,
|
|
@@ -6789,11 +7524,13 @@ function PdfPage({
|
|
|
6789
7524
|
placements: signatureOverlay.placements,
|
|
6790
7525
|
annotations: signatureOverlay.annotations,
|
|
6791
7526
|
pendingSignature: signatureOverlay.pendingSignature,
|
|
7527
|
+
pendingSignatureColor: signatureOverlay.pendingSignatureColor,
|
|
6792
7528
|
pendingAnnotation: signatureOverlay.pendingAnnotation,
|
|
6793
7529
|
activePlacementId: signatureOverlay.activePlacementId,
|
|
6794
7530
|
activeAnnotationId: signatureOverlay.activeAnnotationId,
|
|
6795
7531
|
placeHint: signatureOverlay.placeHint,
|
|
6796
7532
|
annotationHint: signatureOverlay.annotationHint,
|
|
7533
|
+
cancelPlacementLabel: signatureOverlay.cancelPlacementLabel,
|
|
6797
7534
|
annotationPlaceholder: signatureOverlay.annotationPlaceholder,
|
|
6798
7535
|
signatureAltLabel: signatureOverlay.signatureAltLabel,
|
|
6799
7536
|
signatureAltByLabel: signatureOverlay.signatureAltByLabel,
|
|
@@ -6813,7 +7550,8 @@ function PdfPage({
|
|
|
6813
7550
|
onRemovePlacement: signatureOverlay.onRemovePlacement,
|
|
6814
7551
|
onRemoveAnnotation: signatureOverlay.onRemoveAnnotation,
|
|
6815
7552
|
onSelectPlacement: signatureOverlay.onSelectPlacement,
|
|
6816
|
-
onSelectAnnotation: signatureOverlay.onSelectAnnotation
|
|
7553
|
+
onSelectAnnotation: signatureOverlay.onSelectAnnotation,
|
|
7554
|
+
onCancelPlacementMode: signatureOverlay.onCancelPlacementMode
|
|
6817
7555
|
}
|
|
6818
7556
|
)
|
|
6819
7557
|
]
|
|
@@ -6822,9 +7560,9 @@ function PdfPage({
|
|
|
6822
7560
|
}
|
|
6823
7561
|
|
|
6824
7562
|
// src/renderers/PptxRenderer.tsx
|
|
6825
|
-
var
|
|
7563
|
+
var import_react7 = require("react");
|
|
6826
7564
|
var import_jszip2 = __toESM(require("jszip"), 1);
|
|
6827
|
-
var
|
|
7565
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
6828
7566
|
var NS_P = "http://schemas.openxmlformats.org/presentationml/2006/main";
|
|
6829
7567
|
var NS_A = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
6830
7568
|
var NS_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
@@ -6845,11 +7583,11 @@ function isBrowserRenderableSlideImage(source) {
|
|
|
6845
7583
|
return !/^data:image\/(?:emf|wmf|tiff)/i.test(source);
|
|
6846
7584
|
}
|
|
6847
7585
|
function PresentationImage(props) {
|
|
6848
|
-
const [failed, setFailed] = (0,
|
|
7586
|
+
const [failed, setFailed] = (0, import_react7.useState)(!isBrowserRenderableSlideImage(props.src));
|
|
6849
7587
|
if (failed) {
|
|
6850
|
-
return /* @__PURE__ */ (0,
|
|
7588
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hv-slide-image-fallback", children: props.alt });
|
|
6851
7589
|
}
|
|
6852
|
-
return /* @__PURE__ */ (0,
|
|
7590
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
6853
7591
|
"img",
|
|
6854
7592
|
{
|
|
6855
7593
|
src: props.src,
|
|
@@ -7112,12 +7850,12 @@ function makeSlideThumbnail(slide, index) {
|
|
|
7112
7850
|
return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
|
|
7113
7851
|
}
|
|
7114
7852
|
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,
|
|
7853
|
+
const [slides, setSlides] = (0, import_react7.useState)([]);
|
|
7854
|
+
const [slideSize, setSlideSize] = (0, import_react7.useState)({ width: 9144e3, height: 5143500 });
|
|
7855
|
+
const [error, setError] = (0, import_react7.useState)(null);
|
|
7856
|
+
const viewRef = (0, import_react7.useRef)(null);
|
|
7857
|
+
const [viewWidth, setViewWidth] = (0, import_react7.useState)(SLIDE_RENDER_MAX_VIEW_WIDTH);
|
|
7858
|
+
(0, import_react7.useEffect)(() => {
|
|
7121
7859
|
if (!props.arrayBuffer) {
|
|
7122
7860
|
setSlides([]);
|
|
7123
7861
|
props.onPageCount(1);
|
|
@@ -7169,7 +7907,7 @@ function PptxRenderer(props) {
|
|
|
7169
7907
|
};
|
|
7170
7908
|
loadPptx();
|
|
7171
7909
|
}, [props.arrayBuffer, props.onExportStateChange]);
|
|
7172
|
-
(0,
|
|
7910
|
+
(0, import_react7.useEffect)(() => {
|
|
7173
7911
|
const host = viewRef.current;
|
|
7174
7912
|
if (!host || typeof ResizeObserver === "undefined") {
|
|
7175
7913
|
return;
|
|
@@ -7183,7 +7921,7 @@ function PptxRenderer(props) {
|
|
|
7183
7921
|
observer.observe(host);
|
|
7184
7922
|
return () => observer.disconnect();
|
|
7185
7923
|
}, []);
|
|
7186
|
-
const pagesToShow = (0,
|
|
7924
|
+
const pagesToShow = (0, import_react7.useMemo)(() => {
|
|
7187
7925
|
if (slides.length === 0) {
|
|
7188
7926
|
return [];
|
|
7189
7927
|
}
|
|
@@ -7197,7 +7935,7 @@ function PptxRenderer(props) {
|
|
|
7197
7935
|
}
|
|
7198
7936
|
return [validPage];
|
|
7199
7937
|
}, [slides.length, props.currentPage, props.layout]);
|
|
7200
|
-
const slideViewportWidth = (0,
|
|
7938
|
+
const slideViewportWidth = (0, import_react7.useMemo)(() => {
|
|
7201
7939
|
const boundedWidth = Math.max(
|
|
7202
7940
|
SLIDE_RENDER_MIN_VIEW_WIDTH,
|
|
7203
7941
|
Math.min(viewWidth, SLIDE_RENDER_MAX_VIEW_WIDTH * 2 + SLIDE_RENDER_GAP)
|
|
@@ -7217,9 +7955,9 @@ function PptxRenderer(props) {
|
|
|
7217
7955
|
const sceneHeight = Math.max(1, Math.round(slideSize.height * sceneCoordScale));
|
|
7218
7956
|
const sceneScale = slideViewportWidth / SLIDE_RENDER_BASE_WIDTH;
|
|
7219
7957
|
if (error) {
|
|
7220
|
-
return /* @__PURE__ */ (0,
|
|
7958
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hv-error-banner", children: error });
|
|
7221
7959
|
}
|
|
7222
|
-
return /* @__PURE__ */ (0,
|
|
7960
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
7223
7961
|
"div",
|
|
7224
7962
|
{
|
|
7225
7963
|
ref: viewRef,
|
|
@@ -7229,7 +7967,7 @@ function PptxRenderer(props) {
|
|
|
7229
7967
|
if (!slide) {
|
|
7230
7968
|
return null;
|
|
7231
7969
|
}
|
|
7232
|
-
return /* @__PURE__ */ (0,
|
|
7970
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
7233
7971
|
"div",
|
|
7234
7972
|
{
|
|
7235
7973
|
className: "hv-page-container hv-slide-surface",
|
|
@@ -7237,12 +7975,12 @@ function PptxRenderer(props) {
|
|
|
7237
7975
|
aspectRatio: `${slideSize.width}/${slideSize.height}`,
|
|
7238
7976
|
width: props.layout === "side-by-side" && pagesToShow.length > 1 ? `${slideViewportWidth}px` : void 0
|
|
7239
7977
|
},
|
|
7240
|
-
children: /* @__PURE__ */ (0,
|
|
7978
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
7241
7979
|
"div",
|
|
7242
7980
|
{
|
|
7243
7981
|
className: "hv-slide-stage",
|
|
7244
7982
|
style: { background: slide.background || "#ffffff" },
|
|
7245
|
-
children: /* @__PURE__ */ (0,
|
|
7983
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
7246
7984
|
"div",
|
|
7247
7985
|
{
|
|
7248
7986
|
className: "hv-slide-scene",
|
|
@@ -7252,7 +7990,7 @@ function PptxRenderer(props) {
|
|
|
7252
7990
|
transform: `scale(${sceneScale})`
|
|
7253
7991
|
},
|
|
7254
7992
|
children: [
|
|
7255
|
-
slide.elements.map((element) => /* @__PURE__ */ (0,
|
|
7993
|
+
slide.elements.map((element) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
7256
7994
|
"div",
|
|
7257
7995
|
{
|
|
7258
7996
|
className: `hv-slide-element ${element.kind}`,
|
|
@@ -7265,20 +8003,20 @@ function PptxRenderer(props) {
|
|
|
7265
8003
|
background: element.kind === "shape" ? element.fill || "transparent" : void 0,
|
|
7266
8004
|
borderColor: element.stroke
|
|
7267
8005
|
},
|
|
7268
|
-
children: element.kind === "image" && element.imageSrc ? /* @__PURE__ */ (0,
|
|
8006
|
+
children: element.kind === "image" && element.imageSrc ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
7269
8007
|
PresentationImage,
|
|
7270
8008
|
{
|
|
7271
8009
|
src: element.imageSrc,
|
|
7272
8010
|
alt: element.alt || "Slide image"
|
|
7273
8011
|
}
|
|
7274
|
-
) : /* @__PURE__ */ (0,
|
|
8012
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hv-slide-textbox", children: element.paragraphs?.map((paragraph, paragraphIndex) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
7275
8013
|
"p",
|
|
7276
8014
|
{
|
|
7277
8015
|
className: `hv-slide-paragraph ${alignToClassName(paragraph.align)}`,
|
|
7278
8016
|
style: { paddingInlineStart: `${paragraph.level * 18}px` },
|
|
7279
8017
|
children: [
|
|
7280
|
-
paragraph.bullet && /* @__PURE__ */ (0,
|
|
7281
|
-
/* @__PURE__ */ (0,
|
|
8018
|
+
paragraph.bullet && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hv-slide-bullet", children: "\u2022" }),
|
|
8019
|
+
/* @__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
8020
|
"span",
|
|
7283
8021
|
{
|
|
7284
8022
|
style: {
|
|
@@ -7303,7 +8041,7 @@ function PptxRenderer(props) {
|
|
|
7303
8041
|
},
|
|
7304
8042
|
element.id
|
|
7305
8043
|
)),
|
|
7306
|
-
/* @__PURE__ */ (0,
|
|
8044
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
7307
8045
|
SignatureOverlay,
|
|
7308
8046
|
{
|
|
7309
8047
|
surfaceKey: `slide:${pageNumber}`,
|
|
@@ -7312,11 +8050,13 @@ function PptxRenderer(props) {
|
|
|
7312
8050
|
placements: props.signatureOverlay.placements,
|
|
7313
8051
|
annotations: props.signatureOverlay.annotations,
|
|
7314
8052
|
pendingSignature: props.signatureOverlay.pendingSignature,
|
|
8053
|
+
pendingSignatureColor: props.signatureOverlay.pendingSignatureColor,
|
|
7315
8054
|
pendingAnnotation: props.signatureOverlay.pendingAnnotation,
|
|
7316
8055
|
activePlacementId: props.signatureOverlay.activePlacementId,
|
|
7317
8056
|
activeAnnotationId: props.signatureOverlay.activeAnnotationId,
|
|
7318
8057
|
placeHint: props.signatureOverlay.placeHint,
|
|
7319
8058
|
annotationHint: props.signatureOverlay.annotationHint,
|
|
8059
|
+
cancelPlacementLabel: props.signatureOverlay.cancelPlacementLabel,
|
|
7320
8060
|
annotationPlaceholder: props.signatureOverlay.annotationPlaceholder,
|
|
7321
8061
|
signatureAltLabel: props.signatureOverlay.signatureAltLabel,
|
|
7322
8062
|
signatureAltByLabel: props.signatureOverlay.signatureAltByLabel,
|
|
@@ -7336,7 +8076,8 @@ function PptxRenderer(props) {
|
|
|
7336
8076
|
onRemovePlacement: props.signatureOverlay.onRemovePlacement,
|
|
7337
8077
|
onRemoveAnnotation: props.signatureOverlay.onRemoveAnnotation,
|
|
7338
8078
|
onSelectPlacement: props.signatureOverlay.onSelectPlacement,
|
|
7339
|
-
onSelectAnnotation: props.signatureOverlay.onSelectAnnotation
|
|
8079
|
+
onSelectAnnotation: props.signatureOverlay.onSelectAnnotation,
|
|
8080
|
+
onCancelPlacementMode: props.signatureOverlay.onCancelPlacementMode
|
|
7340
8081
|
}
|
|
7341
8082
|
)
|
|
7342
8083
|
]
|
|
@@ -7374,13 +8115,13 @@ var defaultLocale = {
|
|
|
7374
8115
|
"signatures.title": "Signatures",
|
|
7375
8116
|
"signatures.empty": "No signatures",
|
|
7376
8117
|
"signatures.new": "New Signature",
|
|
7377
|
-
"signatures.ready": "
|
|
8118
|
+
"signatures.ready": "Placement mode active",
|
|
7378
8119
|
"signatures.cancelPlacement": "Cancel placement",
|
|
7379
8120
|
"signatures.drawTitle": "Draw Signature",
|
|
7380
8121
|
"signatures.drawHelp": "Sign above using your mouse or finger",
|
|
7381
8122
|
"signatures.clear": "Clear",
|
|
7382
8123
|
"signatures.createAndUse": "Create & Use",
|
|
7383
|
-
"signatures.placeHint": "
|
|
8124
|
+
"signatures.placeHint": "Move your pointer to preview the signature, click to place it, then drag to reposition. Press Esc to cancel.",
|
|
7384
8125
|
"signatures.alt": "Signature",
|
|
7385
8126
|
"signatures.altBy": "Signature by",
|
|
7386
8127
|
"signatures.noteIndicator": "Note",
|
|
@@ -7390,7 +8131,7 @@ var defaultLocale = {
|
|
|
7390
8131
|
"signatures.color.blue": "Blue",
|
|
7391
8132
|
"signatures.color.red": "Red",
|
|
7392
8133
|
"signatures.color.green": "Green",
|
|
7393
|
-
"annotations.placeHint": "
|
|
8134
|
+
"annotations.placeHint": "Move your pointer to preview the note, click to place it, then drag to reposition. Press Esc to cancel.",
|
|
7394
8135
|
"annotations.placeholder": "Add instruction or review note...",
|
|
7395
8136
|
"annotations.title": "Annotation",
|
|
7396
8137
|
"annotations.linkedTitle": "Signature Note",
|
|
@@ -7479,8 +8220,8 @@ var defaultLocale = {
|
|
|
7479
8220
|
|
|
7480
8221
|
// src/components/SignaturePanel.tsx
|
|
7481
8222
|
var import_lucide_react2 = require("lucide-react");
|
|
7482
|
-
var
|
|
7483
|
-
var
|
|
8223
|
+
var import_react8 = require("react");
|
|
8224
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
7484
8225
|
function sameSignature(left, right) {
|
|
7485
8226
|
if (left.id && right.id) {
|
|
7486
8227
|
return left.id === right.id;
|
|
@@ -7550,12 +8291,12 @@ function SignaturePanel(props) {
|
|
|
7550
8291
|
onSignRequest,
|
|
7551
8292
|
locale
|
|
7552
8293
|
} = 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,
|
|
8294
|
+
const canvasRef = (0, import_react8.useRef)(null);
|
|
8295
|
+
const [localSignatures, setLocalSignatures] = (0, import_react8.useState)([]);
|
|
8296
|
+
const [showModal, setShowModal] = (0, import_react8.useState)(false);
|
|
8297
|
+
const [isDrawing, setIsDrawing] = (0, import_react8.useState)(false);
|
|
8298
|
+
const [hasInk, setHasInk] = (0, import_react8.useState)(false);
|
|
8299
|
+
const signatures = (0, import_react8.useMemo)(() => {
|
|
7559
8300
|
const merged = [];
|
|
7560
8301
|
for (const signature of [...externalSignatures, ...localSignatures]) {
|
|
7561
8302
|
if (!merged.some((item) => sameSignature(item, signature))) {
|
|
@@ -7651,34 +8392,34 @@ function SignaturePanel(props) {
|
|
|
7651
8392
|
ctx.lineTo(x, y);
|
|
7652
8393
|
ctx.stroke();
|
|
7653
8394
|
};
|
|
7654
|
-
return /* @__PURE__ */ (0,
|
|
7655
|
-
/* @__PURE__ */ (0,
|
|
8395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
8396
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
7656
8397
|
"div",
|
|
7657
8398
|
{
|
|
7658
8399
|
className: `hv-sidebar hv-sidebar-right ${!isOpen ? "collapsed" : ""}`,
|
|
7659
8400
|
style: { width: isOpen ? "300px" : "0" },
|
|
7660
8401
|
children: [
|
|
7661
|
-
/* @__PURE__ */ (0,
|
|
8402
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
7662
8403
|
"div",
|
|
7663
8404
|
{
|
|
7664
8405
|
className: "hv-sidebar-header",
|
|
7665
8406
|
style: { justifyContent: "space-between", padding: "12px 16px" },
|
|
7666
8407
|
children: [
|
|
7667
|
-
/* @__PURE__ */ (0,
|
|
7668
|
-
/* @__PURE__ */ (0,
|
|
8408
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("h3", { style: { margin: 0, fontSize: "15px", fontWeight: 600 }, children: locale["signatures.title"] }),
|
|
8409
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
7669
8410
|
"button",
|
|
7670
8411
|
{
|
|
7671
8412
|
onClick: onClose,
|
|
7672
8413
|
className: "hv-btn",
|
|
7673
8414
|
style: { padding: "4px", border: "none" },
|
|
7674
|
-
children: /* @__PURE__ */ (0,
|
|
8415
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.X, { size: 18 })
|
|
7675
8416
|
}
|
|
7676
8417
|
)
|
|
7677
8418
|
]
|
|
7678
8419
|
}
|
|
7679
8420
|
),
|
|
7680
|
-
/* @__PURE__ */ (0,
|
|
7681
|
-
/* @__PURE__ */ (0,
|
|
8421
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "hv-thumb-list", children: [
|
|
8422
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
7682
8423
|
"button",
|
|
7683
8424
|
{
|
|
7684
8425
|
onClick: handleCreateClick,
|
|
@@ -7691,25 +8432,26 @@ function SignaturePanel(props) {
|
|
|
7691
8432
|
color: "var(--hv-primary)"
|
|
7692
8433
|
},
|
|
7693
8434
|
children: [
|
|
7694
|
-
/* @__PURE__ */ (0,
|
|
8435
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Plus, { size: 18, style: { marginRight: "8px" } }),
|
|
7695
8436
|
locale["signatures.new"]
|
|
7696
8437
|
]
|
|
7697
8438
|
}
|
|
7698
8439
|
),
|
|
7699
|
-
selectedSignature && /* @__PURE__ */ (0,
|
|
7700
|
-
/* @__PURE__ */ (0,
|
|
7701
|
-
/* @__PURE__ */ (0,
|
|
7702
|
-
|
|
8440
|
+
selectedSignature && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "hv-signature-selection-card", children: [
|
|
8441
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "hv-signature-selection-title", children: locale["signatures.ready"] }),
|
|
8442
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
8443
|
+
RenderableSignatureImage,
|
|
7703
8444
|
{
|
|
7704
|
-
|
|
8445
|
+
signatureImageUrl: selectedSignature.signatureImageUrl,
|
|
8446
|
+
inkColor: selectedColor,
|
|
7705
8447
|
alt: selectedSignature.signedBy ? `Selected signature by ${selectedSignature.signedBy}` : "Selected signature",
|
|
7706
8448
|
className: "hv-signature-selection-image"
|
|
7707
8449
|
}
|
|
7708
8450
|
),
|
|
7709
|
-
/* @__PURE__ */ (0,
|
|
7710
|
-
/* @__PURE__ */ (0,
|
|
7711
|
-
/* @__PURE__ */ (0,
|
|
7712
|
-
/* @__PURE__ */ (0,
|
|
8451
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "hv-signature-selection-copy", children: locale["signatures.placeHint"] }),
|
|
8452
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "hv-signature-color-picker", children: [
|
|
8453
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "hv-signature-color-picker-label", children: locale["signatures.color"] }),
|
|
8454
|
+
/* @__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
8455
|
"button",
|
|
7714
8456
|
{
|
|
7715
8457
|
type: "button",
|
|
@@ -7722,7 +8464,7 @@ function SignaturePanel(props) {
|
|
|
7722
8464
|
color
|
|
7723
8465
|
)) })
|
|
7724
8466
|
] }),
|
|
7725
|
-
/* @__PURE__ */ (0,
|
|
8467
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
7726
8468
|
"button",
|
|
7727
8469
|
{
|
|
7728
8470
|
type: "button",
|
|
@@ -7733,45 +8475,46 @@ function SignaturePanel(props) {
|
|
|
7733
8475
|
}
|
|
7734
8476
|
)
|
|
7735
8477
|
] }),
|
|
7736
|
-
signatures.length === 0 && /* @__PURE__ */ (0,
|
|
8478
|
+
signatures.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "hv-signature-empty", children: locale["signatures.empty"] }),
|
|
7737
8479
|
signatures.map((signature, index) => {
|
|
7738
8480
|
const isLocal = localSignatures.some(
|
|
7739
8481
|
(item) => sameSignature(item, signature)
|
|
7740
8482
|
);
|
|
7741
8483
|
const isSelected = selectedSignature ? sameSignature(selectedSignature, signature) : false;
|
|
7742
|
-
return /* @__PURE__ */ (0,
|
|
8484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
7743
8485
|
"div",
|
|
7744
8486
|
{
|
|
7745
8487
|
className: `hv-thumb-item hv-signature-item ${isSelected ? "active" : ""}`,
|
|
7746
8488
|
children: [
|
|
7747
|
-
/* @__PURE__ */ (0,
|
|
8489
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
7748
8490
|
"button",
|
|
7749
8491
|
{
|
|
7750
8492
|
type: "button",
|
|
7751
8493
|
className: "hv-signature-item-main",
|
|
7752
8494
|
onClick: () => onSelectSignature(signature),
|
|
7753
8495
|
children: [
|
|
7754
|
-
/* @__PURE__ */ (0,
|
|
7755
|
-
/* @__PURE__ */ (0,
|
|
7756
|
-
|
|
8496
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "hv-signature-item-stack", children: [
|
|
8497
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
8498
|
+
RenderableSignatureImage,
|
|
7757
8499
|
{
|
|
7758
|
-
|
|
8500
|
+
signatureImageUrl: signature.signatureImageUrl,
|
|
8501
|
+
inkColor: "black",
|
|
7759
8502
|
alt: signature.signedBy ? `Signature by ${signature.signedBy}` : "Signature",
|
|
7760
8503
|
className: "hv-signature-item-image"
|
|
7761
8504
|
}
|
|
7762
8505
|
),
|
|
7763
|
-
/* @__PURE__ */ (0,
|
|
7764
|
-
signature.signedBy && /* @__PURE__ */ (0,
|
|
7765
|
-
signature.jobTitle && /* @__PURE__ */ (0,
|
|
7766
|
-
/* @__PURE__ */ (0,
|
|
7767
|
-
signature.comment && /* @__PURE__ */ (0,
|
|
8506
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "hv-signature-item-copy", children: [
|
|
8507
|
+
signature.signedBy && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("strong", { children: signature.signedBy }),
|
|
8508
|
+
signature.jobTitle && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: signature.jobTitle }),
|
|
8509
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: normalizeSignatureDate(signature.dateSigned) }),
|
|
8510
|
+
signature.comment && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("em", { children: signature.comment })
|
|
7768
8511
|
] })
|
|
7769
8512
|
] }),
|
|
7770
|
-
isSelected && /* @__PURE__ */ (0,
|
|
8513
|
+
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
8514
|
]
|
|
7772
8515
|
}
|
|
7773
8516
|
),
|
|
7774
|
-
isLocal && /* @__PURE__ */ (0,
|
|
8517
|
+
isLocal && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
7775
8518
|
"button",
|
|
7776
8519
|
{
|
|
7777
8520
|
type: "button",
|
|
@@ -7794,7 +8537,7 @@ function SignaturePanel(props) {
|
|
|
7794
8537
|
onClearSelection();
|
|
7795
8538
|
}
|
|
7796
8539
|
},
|
|
7797
|
-
children: /* @__PURE__ */ (0,
|
|
8540
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Trash2, { size: 12 })
|
|
7798
8541
|
}
|
|
7799
8542
|
)
|
|
7800
8543
|
]
|
|
@@ -7806,8 +8549,8 @@ function SignaturePanel(props) {
|
|
|
7806
8549
|
]
|
|
7807
8550
|
}
|
|
7808
8551
|
),
|
|
7809
|
-
showModal && /* @__PURE__ */ (0,
|
|
7810
|
-
/* @__PURE__ */ (0,
|
|
8552
|
+
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: [
|
|
8553
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
7811
8554
|
"div",
|
|
7812
8555
|
{
|
|
7813
8556
|
style: {
|
|
@@ -7818,20 +8561,20 @@ function SignaturePanel(props) {
|
|
|
7818
8561
|
alignItems: "center"
|
|
7819
8562
|
},
|
|
7820
8563
|
children: [
|
|
7821
|
-
/* @__PURE__ */ (0,
|
|
7822
|
-
/* @__PURE__ */ (0,
|
|
8564
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("h3", { style: { margin: 0, fontSize: "18px", fontWeight: 600 }, children: locale["signatures.drawTitle"] }),
|
|
8565
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
7823
8566
|
"button",
|
|
7824
8567
|
{
|
|
7825
8568
|
onClick: () => setShowModal(false),
|
|
7826
8569
|
className: "hv-btn",
|
|
7827
8570
|
style: { border: "none" },
|
|
7828
|
-
children: /* @__PURE__ */ (0,
|
|
8571
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.X, { size: 20 })
|
|
7829
8572
|
}
|
|
7830
8573
|
)
|
|
7831
8574
|
]
|
|
7832
8575
|
}
|
|
7833
8576
|
),
|
|
7834
|
-
/* @__PURE__ */ (0,
|
|
8577
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
7835
8578
|
"div",
|
|
7836
8579
|
{
|
|
7837
8580
|
style: {
|
|
@@ -7842,7 +8585,7 @@ function SignaturePanel(props) {
|
|
|
7842
8585
|
alignItems: "center"
|
|
7843
8586
|
},
|
|
7844
8587
|
children: [
|
|
7845
|
-
/* @__PURE__ */ (0,
|
|
8588
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
7846
8589
|
"div",
|
|
7847
8590
|
{
|
|
7848
8591
|
style: {
|
|
@@ -7852,7 +8595,7 @@ function SignaturePanel(props) {
|
|
|
7852
8595
|
overflow: "hidden",
|
|
7853
8596
|
boxShadow: "inset 0 2px 4px 0 rgba(0,0,0,0.05)"
|
|
7854
8597
|
},
|
|
7855
|
-
children: /* @__PURE__ */ (0,
|
|
8598
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
7856
8599
|
"canvas",
|
|
7857
8600
|
{
|
|
7858
8601
|
ref: canvasRef,
|
|
@@ -7874,7 +8617,7 @@ function SignaturePanel(props) {
|
|
|
7874
8617
|
)
|
|
7875
8618
|
}
|
|
7876
8619
|
),
|
|
7877
|
-
/* @__PURE__ */ (0,
|
|
8620
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
7878
8621
|
"p",
|
|
7879
8622
|
{
|
|
7880
8623
|
style: {
|
|
@@ -7888,7 +8631,7 @@ function SignaturePanel(props) {
|
|
|
7888
8631
|
]
|
|
7889
8632
|
}
|
|
7890
8633
|
),
|
|
7891
|
-
/* @__PURE__ */ (0,
|
|
8634
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
7892
8635
|
"div",
|
|
7893
8636
|
{
|
|
7894
8637
|
style: {
|
|
@@ -7899,8 +8642,8 @@ function SignaturePanel(props) {
|
|
|
7899
8642
|
gap: "12px"
|
|
7900
8643
|
},
|
|
7901
8644
|
children: [
|
|
7902
|
-
/* @__PURE__ */ (0,
|
|
7903
|
-
/* @__PURE__ */ (0,
|
|
8645
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { onClick: clearCanvas, className: "hv-btn", children: locale["signatures.clear"] }),
|
|
8646
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
7904
8647
|
"button",
|
|
7905
8648
|
{
|
|
7906
8649
|
onClick: saveSignature,
|
|
@@ -7917,16 +8660,16 @@ function SignaturePanel(props) {
|
|
|
7917
8660
|
}
|
|
7918
8661
|
|
|
7919
8662
|
// src/components/ThumbnailsSidebar.tsx
|
|
7920
|
-
var
|
|
7921
|
-
var
|
|
8663
|
+
var import_react9 = require("react");
|
|
8664
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
7922
8665
|
var THUMB_ITEM_HEIGHT = 184;
|
|
7923
8666
|
var THUMB_OVERSCAN = 4;
|
|
7924
8667
|
function ThumbnailsSidebar(props) {
|
|
7925
8668
|
const { isOpen, thumbnails, currentPage, onSelectPage, locale } = props;
|
|
7926
|
-
const listRef = (0,
|
|
7927
|
-
const [scrollTop, setScrollTop] = (0,
|
|
7928
|
-
const [viewportHeight, setViewportHeight] = (0,
|
|
7929
|
-
(0,
|
|
8669
|
+
const listRef = (0, import_react9.useRef)(null);
|
|
8670
|
+
const [scrollTop, setScrollTop] = (0, import_react9.useState)(0);
|
|
8671
|
+
const [viewportHeight, setViewportHeight] = (0, import_react9.useState)(0);
|
|
8672
|
+
(0, import_react9.useEffect)(() => {
|
|
7930
8673
|
const element = listRef.current;
|
|
7931
8674
|
if (!element || !isOpen) {
|
|
7932
8675
|
return;
|
|
@@ -7947,7 +8690,7 @@ function ThumbnailsSidebar(props) {
|
|
|
7947
8690
|
behavior: "smooth"
|
|
7948
8691
|
});
|
|
7949
8692
|
}, [currentPage, isOpen]);
|
|
7950
|
-
(0,
|
|
8693
|
+
(0, import_react9.useEffect)(() => {
|
|
7951
8694
|
const element = listRef.current;
|
|
7952
8695
|
if (!element) {
|
|
7953
8696
|
return;
|
|
@@ -7976,7 +8719,7 @@ function ThumbnailsSidebar(props) {
|
|
|
7976
8719
|
window.removeEventListener("resize", updateViewport);
|
|
7977
8720
|
};
|
|
7978
8721
|
}, []);
|
|
7979
|
-
const virtualWindow = (0,
|
|
8722
|
+
const virtualWindow = (0, import_react9.useMemo)(() => {
|
|
7980
8723
|
if (thumbnails.length === 0) {
|
|
7981
8724
|
return {
|
|
7982
8725
|
startIndex: 0,
|
|
@@ -8002,15 +8745,15 @@ function ThumbnailsSidebar(props) {
|
|
|
8002
8745
|
totalHeight: thumbnails.length * THUMB_ITEM_HEIGHT
|
|
8003
8746
|
};
|
|
8004
8747
|
}, [scrollTop, thumbnails.length, viewportHeight]);
|
|
8005
|
-
const visibleItems = (0,
|
|
8748
|
+
const visibleItems = (0, import_react9.useMemo)(
|
|
8006
8749
|
() => thumbnails.slice(
|
|
8007
8750
|
virtualWindow.startIndex,
|
|
8008
8751
|
virtualWindow.endIndex >= virtualWindow.startIndex ? virtualWindow.endIndex + 1 : virtualWindow.startIndex
|
|
8009
8752
|
),
|
|
8010
8753
|
[thumbnails, virtualWindow.endIndex, virtualWindow.startIndex]
|
|
8011
8754
|
);
|
|
8012
|
-
return /* @__PURE__ */ (0,
|
|
8013
|
-
thumbnails.length > 0 && /* @__PURE__ */ (0,
|
|
8755
|
+
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: [
|
|
8756
|
+
thumbnails.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
8014
8757
|
"div",
|
|
8015
8758
|
{
|
|
8016
8759
|
className: "hv-thumb-viewport",
|
|
@@ -8019,22 +8762,22 @@ function ThumbnailsSidebar(props) {
|
|
|
8019
8762
|
const absoluteIndex = virtualWindow.startIndex + index;
|
|
8020
8763
|
const pageNum = absoluteIndex + 1;
|
|
8021
8764
|
const isActive = pageNum === currentPage;
|
|
8022
|
-
return /* @__PURE__ */ (0,
|
|
8765
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
8023
8766
|
"div",
|
|
8024
8767
|
{
|
|
8025
8768
|
className: `hv-thumb-item ${isActive ? "active" : ""}`,
|
|
8026
8769
|
style: { top: `${absoluteIndex * THUMB_ITEM_HEIGHT}px` },
|
|
8027
8770
|
onClick: () => onSelectPage(pageNum),
|
|
8028
8771
|
children: [
|
|
8029
|
-
/* @__PURE__ */ (0,
|
|
8772
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "hv-thumb-preview", children: src ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
8030
8773
|
"img",
|
|
8031
8774
|
{
|
|
8032
8775
|
src,
|
|
8033
8776
|
alt: `Page ${pageNum}`,
|
|
8034
8777
|
className: "hv-thumb-img"
|
|
8035
8778
|
}
|
|
8036
|
-
) : /* @__PURE__ */ (0,
|
|
8037
|
-
/* @__PURE__ */ (0,
|
|
8779
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "hv-thumb-skeleton", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: "..." }) }) }),
|
|
8780
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "hv-thumb-label", children: [
|
|
8038
8781
|
locale["thumbnails.page"],
|
|
8039
8782
|
" ",
|
|
8040
8783
|
pageNum
|
|
@@ -8046,13 +8789,13 @@ function ThumbnailsSidebar(props) {
|
|
|
8046
8789
|
})
|
|
8047
8790
|
}
|
|
8048
8791
|
),
|
|
8049
|
-
thumbnails.length === 0 && /* @__PURE__ */ (0,
|
|
8792
|
+
thumbnails.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "hv-thumb-empty", children: locale["thumbnails.empty"] })
|
|
8050
8793
|
] }) });
|
|
8051
8794
|
}
|
|
8052
8795
|
|
|
8053
8796
|
// src/components/Toolbar.tsx
|
|
8054
8797
|
var import_lucide_react3 = require("lucide-react");
|
|
8055
|
-
var
|
|
8798
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
8056
8799
|
function Toolbar(props) {
|
|
8057
8800
|
const {
|
|
8058
8801
|
fileName,
|
|
@@ -8088,18 +8831,18 @@ function Toolbar(props) {
|
|
|
8088
8831
|
onPageChange(val);
|
|
8089
8832
|
}
|
|
8090
8833
|
};
|
|
8091
|
-
return /* @__PURE__ */ (0,
|
|
8092
|
-
/* @__PURE__ */ (0,
|
|
8093
|
-
/* @__PURE__ */ (0,
|
|
8834
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "hv-toolbar", children: [
|
|
8835
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "hv-toolbar-group", children: [
|
|
8836
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
8094
8837
|
"button",
|
|
8095
8838
|
{
|
|
8096
8839
|
className: `hv-btn ${props.showThumbnails ? "hv-btn-active" : ""}`,
|
|
8097
8840
|
onClick: props.onToggleThumbnails,
|
|
8098
8841
|
title: locale["toolbar.thumbs"],
|
|
8099
|
-
children: props.showThumbnails ? /* @__PURE__ */ (0,
|
|
8842
|
+
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
8843
|
}
|
|
8101
8844
|
),
|
|
8102
|
-
/* @__PURE__ */ (0,
|
|
8845
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
8103
8846
|
"div",
|
|
8104
8847
|
{
|
|
8105
8848
|
className: "hv-sep",
|
|
@@ -8111,7 +8854,7 @@ function Toolbar(props) {
|
|
|
8111
8854
|
}
|
|
8112
8855
|
}
|
|
8113
8856
|
),
|
|
8114
|
-
/* @__PURE__ */ (0,
|
|
8857
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
8115
8858
|
"span",
|
|
8116
8859
|
{
|
|
8117
8860
|
style: {
|
|
@@ -8126,18 +8869,18 @@ function Toolbar(props) {
|
|
|
8126
8869
|
}
|
|
8127
8870
|
)
|
|
8128
8871
|
] }),
|
|
8129
|
-
/* @__PURE__ */ (0,
|
|
8130
|
-
/* @__PURE__ */ (0,
|
|
8872
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "hv-toolbar-group", children: [
|
|
8873
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
8131
8874
|
"button",
|
|
8132
8875
|
{
|
|
8133
8876
|
className: "hv-btn",
|
|
8134
8877
|
disabled: currentPage <= 1,
|
|
8135
8878
|
onClick: handlePrev,
|
|
8136
|
-
children: /* @__PURE__ */ (0,
|
|
8879
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.ChevronLeft, { size: 20 })
|
|
8137
8880
|
}
|
|
8138
8881
|
),
|
|
8139
|
-
/* @__PURE__ */ (0,
|
|
8140
|
-
/* @__PURE__ */ (0,
|
|
8882
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "hv-toolbar-page-group", children: [
|
|
8883
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
8141
8884
|
"input",
|
|
8142
8885
|
{
|
|
8143
8886
|
type: "number",
|
|
@@ -8148,53 +8891,53 @@ function Toolbar(props) {
|
|
|
8148
8891
|
max: pageCount
|
|
8149
8892
|
}
|
|
8150
8893
|
),
|
|
8151
|
-
/* @__PURE__ */ (0,
|
|
8152
|
-
/* @__PURE__ */ (0,
|
|
8894
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "hv-toolbar-page-sep", children: "/" }),
|
|
8895
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: pageCount })
|
|
8153
8896
|
] }),
|
|
8154
|
-
/* @__PURE__ */ (0,
|
|
8897
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
8155
8898
|
"button",
|
|
8156
8899
|
{
|
|
8157
8900
|
className: "hv-btn",
|
|
8158
8901
|
disabled: currentPage >= pageCount,
|
|
8159
8902
|
onClick: handleNext,
|
|
8160
|
-
children: /* @__PURE__ */ (0,
|
|
8903
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.ChevronRight, { size: 20 })
|
|
8161
8904
|
}
|
|
8162
8905
|
)
|
|
8163
8906
|
] }),
|
|
8164
|
-
/* @__PURE__ */ (0,
|
|
8165
|
-
/* @__PURE__ */ (0,
|
|
8907
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "hv-toolbar-group", children: [
|
|
8908
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
8166
8909
|
"button",
|
|
8167
8910
|
{
|
|
8168
8911
|
className: "hv-btn",
|
|
8169
8912
|
onClick: onZoomOut,
|
|
8170
8913
|
title: locale["toolbar.zoomOut"],
|
|
8171
8914
|
disabled: zoom <= 0.5,
|
|
8172
|
-
children: /* @__PURE__ */ (0,
|
|
8915
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.ZoomOut, { size: 18 })
|
|
8173
8916
|
}
|
|
8174
8917
|
),
|
|
8175
|
-
/* @__PURE__ */ (0,
|
|
8918
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
8176
8919
|
"button",
|
|
8177
8920
|
{
|
|
8178
8921
|
className: "hv-btn",
|
|
8179
8922
|
onClick: onZoomReset,
|
|
8180
8923
|
title: locale["toolbar.zoomReset"],
|
|
8181
|
-
children: /* @__PURE__ */ (0,
|
|
8924
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { style: { fontSize: "12px", fontWeight: 600 }, children: [
|
|
8182
8925
|
Math.round(zoom * 100),
|
|
8183
8926
|
"%"
|
|
8184
8927
|
] })
|
|
8185
8928
|
}
|
|
8186
8929
|
),
|
|
8187
|
-
/* @__PURE__ */ (0,
|
|
8930
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
8188
8931
|
"button",
|
|
8189
8932
|
{
|
|
8190
8933
|
className: "hv-btn",
|
|
8191
8934
|
onClick: onZoomIn,
|
|
8192
8935
|
title: locale["toolbar.zoomIn"],
|
|
8193
8936
|
disabled: zoom >= 2,
|
|
8194
|
-
children: /* @__PURE__ */ (0,
|
|
8937
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.ZoomIn, { size: 18 })
|
|
8195
8938
|
}
|
|
8196
8939
|
),
|
|
8197
|
-
/* @__PURE__ */ (0,
|
|
8940
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
8198
8941
|
"div",
|
|
8199
8942
|
{
|
|
8200
8943
|
className: "hv-sep",
|
|
@@ -8206,37 +8949,37 @@ function Toolbar(props) {
|
|
|
8206
8949
|
}
|
|
8207
8950
|
}
|
|
8208
8951
|
),
|
|
8209
|
-
/* @__PURE__ */ (0,
|
|
8952
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
8210
8953
|
"button",
|
|
8211
8954
|
{
|
|
8212
8955
|
className: `hv-btn ${layout === "single" ? "hv-btn-active" : ""}`,
|
|
8213
8956
|
onClick: () => onLayoutChange("single"),
|
|
8214
8957
|
title: locale["toolbar.layout.single"],
|
|
8215
|
-
children: /* @__PURE__ */ (0,
|
|
8958
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.LayoutTemplate, { size: 18 })
|
|
8216
8959
|
}
|
|
8217
8960
|
),
|
|
8218
|
-
/* @__PURE__ */ (0,
|
|
8961
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
8219
8962
|
"button",
|
|
8220
8963
|
{
|
|
8221
8964
|
className: `hv-btn ${layout === "side-by-side" ? "hv-btn-active" : ""}`,
|
|
8222
8965
|
onClick: () => onLayoutChange("side-by-side"),
|
|
8223
8966
|
title: locale["toolbar.layout.two"],
|
|
8224
|
-
children: /* @__PURE__ */ (0,
|
|
8967
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.Grid2X2, { size: 18 })
|
|
8225
8968
|
}
|
|
8226
8969
|
),
|
|
8227
|
-
showHeaderFooterToggle && /* @__PURE__ */ (0,
|
|
8970
|
+
showHeaderFooterToggle && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
8228
8971
|
"button",
|
|
8229
8972
|
{
|
|
8230
8973
|
className: `hv-btn ${headerFooterVisible ? "hv-btn-active" : ""}`,
|
|
8231
8974
|
onClick: onToggleHeaderFooter,
|
|
8232
8975
|
title: locale["toolbar.headerFooter"],
|
|
8233
8976
|
children: [
|
|
8234
|
-
/* @__PURE__ */ (0,
|
|
8235
|
-
/* @__PURE__ */ (0,
|
|
8977
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: "12px", fontWeight: 700, marginRight: "8px" }, children: "HF" }),
|
|
8978
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "hv-btn-label", children: locale["toolbar.headerFooter"] })
|
|
8236
8979
|
]
|
|
8237
8980
|
}
|
|
8238
8981
|
),
|
|
8239
|
-
/* @__PURE__ */ (0,
|
|
8982
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
8240
8983
|
"div",
|
|
8241
8984
|
{
|
|
8242
8985
|
className: "hv-sep",
|
|
@@ -8248,18 +8991,18 @@ function Toolbar(props) {
|
|
|
8248
8991
|
}
|
|
8249
8992
|
}
|
|
8250
8993
|
),
|
|
8251
|
-
saveEnabled && /* @__PURE__ */ (0,
|
|
8252
|
-
showExportPdfAction && /* @__PURE__ */ (0,
|
|
8994
|
+
saveEnabled && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
8995
|
+
showExportPdfAction && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
8253
8996
|
"button",
|
|
8254
8997
|
{
|
|
8255
8998
|
className: "hv-btn",
|
|
8256
8999
|
onClick: onExportPdf,
|
|
8257
9000
|
title: locale["toolbar.exportPdf"],
|
|
8258
9001
|
disabled: isSaving,
|
|
8259
|
-
children: /* @__PURE__ */ (0,
|
|
9002
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.FileDown, { size: 18 })
|
|
8260
9003
|
}
|
|
8261
9004
|
),
|
|
8262
|
-
/* @__PURE__ */ (0,
|
|
9005
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
8263
9006
|
"button",
|
|
8264
9007
|
{
|
|
8265
9008
|
className: "hv-btn hv-btn-primary",
|
|
@@ -8267,12 +9010,12 @@ function Toolbar(props) {
|
|
|
8267
9010
|
title: saveLabel ?? locale["toolbar.save"],
|
|
8268
9011
|
disabled: isSaving,
|
|
8269
9012
|
children: [
|
|
8270
|
-
/* @__PURE__ */ (0,
|
|
8271
|
-
/* @__PURE__ */ (0,
|
|
9013
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.Save, { size: 18, style: { marginRight: "8px" } }),
|
|
9014
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "hv-btn-label", children: isSaving ? locale.loading : saveLabel ?? locale["toolbar.save"] })
|
|
8272
9015
|
]
|
|
8273
9016
|
}
|
|
8274
9017
|
),
|
|
8275
|
-
/* @__PURE__ */ (0,
|
|
9018
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
8276
9019
|
"div",
|
|
8277
9020
|
{
|
|
8278
9021
|
className: "hv-sep",
|
|
@@ -8285,27 +9028,27 @@ function Toolbar(props) {
|
|
|
8285
9028
|
}
|
|
8286
9029
|
)
|
|
8287
9030
|
] }),
|
|
8288
|
-
props.annotationEnabled && /* @__PURE__ */ (0,
|
|
9031
|
+
props.annotationEnabled && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
8289
9032
|
"button",
|
|
8290
9033
|
{
|
|
8291
9034
|
className: `hv-btn ${props.annotationMode ? "hv-btn-active" : ""}`,
|
|
8292
9035
|
onClick: props.onToggleAnnotationMode,
|
|
8293
9036
|
title: locale["toolbar.annotate"],
|
|
8294
9037
|
children: [
|
|
8295
|
-
/* @__PURE__ */ (0,
|
|
8296
|
-
/* @__PURE__ */ (0,
|
|
9038
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.MessageSquarePlus, { size: 18, style: { marginRight: "8px" } }),
|
|
9039
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "hv-btn-label", children: locale["toolbar.annotate"] })
|
|
8297
9040
|
]
|
|
8298
9041
|
}
|
|
8299
9042
|
),
|
|
8300
|
-
props.signingEnabled && /* @__PURE__ */ (0,
|
|
9043
|
+
props.signingEnabled && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
8301
9044
|
"button",
|
|
8302
9045
|
{
|
|
8303
9046
|
className: `hv-btn hv-btn-primary ${props.showSignatures ? "hv-btn-active" : ""}`,
|
|
8304
9047
|
onClick: props.onToggleSignatures,
|
|
8305
9048
|
title: locale["toolbar.sign"],
|
|
8306
9049
|
children: [
|
|
8307
|
-
/* @__PURE__ */ (0,
|
|
8308
|
-
/* @__PURE__ */ (0,
|
|
9050
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.PenLine, { size: 18, style: { marginRight: "8px" } }),
|
|
9051
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "hv-btn-label", children: locale["toolbar.sign"] })
|
|
8309
9052
|
]
|
|
8310
9053
|
}
|
|
8311
9054
|
)
|
|
@@ -8314,7 +9057,7 @@ function Toolbar(props) {
|
|
|
8314
9057
|
}
|
|
8315
9058
|
|
|
8316
9059
|
// src/components/DocumentViewer.tsx
|
|
8317
|
-
var
|
|
9060
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
8318
9061
|
function createPlacementId() {
|
|
8319
9062
|
return `sig-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
8320
9063
|
}
|
|
@@ -8398,56 +9141,56 @@ function getFileNameHint(fileUrl, fileName) {
|
|
|
8398
9141
|
function DocumentViewer(props) {
|
|
8399
9142
|
const mode = props.mode ?? "view";
|
|
8400
9143
|
const theme = props.theme ?? "light";
|
|
8401
|
-
const locale = (0,
|
|
9144
|
+
const locale = (0, import_react10.useMemo)(
|
|
8402
9145
|
() => ({ ...defaultLocale, ...props.locale }),
|
|
8403
9146
|
[props.locale]
|
|
8404
9147
|
);
|
|
8405
|
-
const [layout, setLayout] = (0,
|
|
9148
|
+
const [layout, setLayout] = (0, import_react10.useState)(
|
|
8406
9149
|
props.defaultLayout ?? "single"
|
|
8407
9150
|
);
|
|
8408
|
-
const [showThumbnails, setShowThumbnails] = (0,
|
|
9151
|
+
const [showThumbnails, setShowThumbnails] = (0, import_react10.useState)(
|
|
8409
9152
|
props.defaultShowThumbnails ?? true
|
|
8410
9153
|
);
|
|
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,
|
|
9154
|
+
const [showHeaderFooterSlots, setShowHeaderFooterSlots] = (0, import_react10.useState)(true);
|
|
9155
|
+
const [showSignatures, setShowSignatures] = (0, import_react10.useState)(false);
|
|
9156
|
+
const [zoom, setZoom] = (0, import_react10.useState)(1);
|
|
9157
|
+
const mainRef = (0, import_react10.useRef)(null);
|
|
9158
|
+
const zoomStageRef = (0, import_react10.useRef)(null);
|
|
9159
|
+
const exportHeaderRef = (0, import_react10.useRef)(null);
|
|
9160
|
+
const exportFooterRef = (0, import_react10.useRef)(null);
|
|
9161
|
+
const [selectedSignature, setSelectedSignature] = (0, import_react10.useState)(
|
|
8419
9162
|
null
|
|
8420
9163
|
);
|
|
8421
|
-
const [selectedSignatureColor, setSelectedSignatureColor] = (0,
|
|
8422
|
-
const [isPlacingAnnotation, setIsPlacingAnnotation] = (0,
|
|
8423
|
-
const [activePlacementId, setActivePlacementId] = (0,
|
|
9164
|
+
const [selectedSignatureColor, setSelectedSignatureColor] = (0, import_react10.useState)("black");
|
|
9165
|
+
const [isPlacingAnnotation, setIsPlacingAnnotation] = (0, import_react10.useState)(false);
|
|
9166
|
+
const [activePlacementId, setActivePlacementId] = (0, import_react10.useState)(
|
|
8424
9167
|
null
|
|
8425
9168
|
);
|
|
8426
|
-
const [activeAnnotationId, setActiveAnnotationId] = (0,
|
|
9169
|
+
const [activeAnnotationId, setActiveAnnotationId] = (0, import_react10.useState)(
|
|
8427
9170
|
null
|
|
8428
9171
|
);
|
|
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,
|
|
9172
|
+
const [resolved, setResolved] = (0, import_react10.useState)(null);
|
|
9173
|
+
const [loading, setLoading] = (0, import_react10.useState)(true);
|
|
9174
|
+
const [error, setError] = (0, import_react10.useState)("");
|
|
9175
|
+
const [isSaving, setIsSaving] = (0, import_react10.useState)(false);
|
|
9176
|
+
const [pageCount, setPageCount] = (0, import_react10.useState)(1);
|
|
9177
|
+
const [currentPage, setCurrentPage] = (0, import_react10.useState)(1);
|
|
9178
|
+
const [thumbnails, setThumbnails] = (0, import_react10.useState)([]);
|
|
9179
|
+
const [richTextExportState, setRichTextExportState] = (0, import_react10.useState)(null);
|
|
9180
|
+
const [spreadsheetExportState, setSpreadsheetExportState] = (0, import_react10.useState)(null);
|
|
9181
|
+
const [pptxExportState, setPptxExportState] = (0, import_react10.useState)(null);
|
|
9182
|
+
const [internalPlacements, setInternalPlacements] = (0, import_react10.useState)(props.signaturePlacements ?? []);
|
|
9183
|
+
const [internalAnnotations, setInternalAnnotations] = (0, import_react10.useState)(props.annotations ?? []);
|
|
9184
|
+
const [zoomStageSize, setZoomStageSize] = (0, import_react10.useState)({ width: 0, height: 0 });
|
|
9185
|
+
const [mainContentWidth, setMainContentWidth] = (0, import_react10.useState)(0);
|
|
9186
|
+
const placements = (0, import_react10.useMemo)(
|
|
8444
9187
|
() => (props.signaturePlacements ?? internalPlacements).map(
|
|
8445
9188
|
(placement) => normalizeSignaturePlacement(placement)
|
|
8446
9189
|
),
|
|
8447
9190
|
[internalPlacements, props.signaturePlacements]
|
|
8448
9191
|
);
|
|
8449
9192
|
const annotations = props.annotations ?? internalAnnotations;
|
|
8450
|
-
const availableSignatures = (0,
|
|
9193
|
+
const availableSignatures = (0, import_react10.useMemo)(
|
|
8451
9194
|
() => (props.signatures ?? []).map((signature) => normalizeSignature(signature)),
|
|
8452
9195
|
[props.signatures]
|
|
8453
9196
|
);
|
|
@@ -8482,7 +9225,7 @@ function DocumentViewer(props) {
|
|
|
8482
9225
|
const isRichTextAuthoringMode = Boolean(
|
|
8483
9226
|
resolved && ["docx", "doc", "rtf", "txt", "md"].includes(resolved.fileType) && effectiveMode !== "view"
|
|
8484
9227
|
);
|
|
8485
|
-
const finalizedSignatures = (0,
|
|
9228
|
+
const finalizedSignatures = (0, import_react10.useMemo)(() => {
|
|
8486
9229
|
const seen = /* @__PURE__ */ new Set();
|
|
8487
9230
|
return placements.flatMap((placement) => {
|
|
8488
9231
|
const signature = placement.signature;
|
|
@@ -8494,7 +9237,7 @@ function DocumentViewer(props) {
|
|
|
8494
9237
|
return [signature];
|
|
8495
9238
|
});
|
|
8496
9239
|
}, [placements]);
|
|
8497
|
-
const signatureList = (0,
|
|
9240
|
+
const signatureList = (0, import_react10.useMemo)(
|
|
8498
9241
|
() => placements.map((placement) => ({
|
|
8499
9242
|
placementId: placement.id,
|
|
8500
9243
|
signatureId: placement.signatureId,
|
|
@@ -8509,41 +9252,41 @@ function DocumentViewer(props) {
|
|
|
8509
9252
|
})),
|
|
8510
9253
|
[placements]
|
|
8511
9254
|
);
|
|
8512
|
-
(0,
|
|
9255
|
+
(0, import_react10.useEffect)(() => {
|
|
8513
9256
|
if (props.signaturePlacements) {
|
|
8514
9257
|
setInternalPlacements(props.signaturePlacements);
|
|
8515
9258
|
}
|
|
8516
9259
|
}, [props.signaturePlacements]);
|
|
8517
|
-
(0,
|
|
9260
|
+
(0, import_react10.useEffect)(() => {
|
|
8518
9261
|
if (props.annotations) {
|
|
8519
9262
|
setInternalAnnotations(props.annotations);
|
|
8520
9263
|
}
|
|
8521
9264
|
}, [props.annotations]);
|
|
8522
|
-
(0,
|
|
9265
|
+
(0, import_react10.useEffect)(() => {
|
|
8523
9266
|
setShowThumbnails(props.defaultShowThumbnails ?? true);
|
|
8524
9267
|
}, [props.defaultShowThumbnails]);
|
|
8525
|
-
(0,
|
|
9268
|
+
(0, import_react10.useEffect)(() => {
|
|
8526
9269
|
setLayout(props.defaultLayout ?? "single");
|
|
8527
9270
|
}, [props.defaultLayout]);
|
|
8528
|
-
(0,
|
|
9271
|
+
(0, import_react10.useEffect)(() => {
|
|
8529
9272
|
if (!signingEnabled) {
|
|
8530
9273
|
setShowSignatures(false);
|
|
8531
9274
|
setSelectedSignature(null);
|
|
8532
9275
|
setActivePlacementId(null);
|
|
8533
9276
|
}
|
|
8534
9277
|
}, [signingEnabled]);
|
|
8535
|
-
(0,
|
|
9278
|
+
(0, import_react10.useEffect)(() => {
|
|
8536
9279
|
if (!annotationEnabled) {
|
|
8537
9280
|
setIsPlacingAnnotation(false);
|
|
8538
9281
|
setActiveAnnotationId(null);
|
|
8539
9282
|
}
|
|
8540
9283
|
}, [annotationEnabled]);
|
|
8541
|
-
(0,
|
|
9284
|
+
(0, import_react10.useEffect)(() => {
|
|
8542
9285
|
if (!headerFooterToggleEnabled) {
|
|
8543
9286
|
setShowHeaderFooterSlots(true);
|
|
8544
9287
|
}
|
|
8545
9288
|
}, [headerFooterToggleEnabled]);
|
|
8546
|
-
(0,
|
|
9289
|
+
(0, import_react10.useEffect)(() => {
|
|
8547
9290
|
let active = true;
|
|
8548
9291
|
let cleanupSource;
|
|
8549
9292
|
const loadFile = async () => {
|
|
@@ -8602,7 +9345,7 @@ function DocumentViewer(props) {
|
|
|
8602
9345
|
props.fileUrl,
|
|
8603
9346
|
requestedFileType
|
|
8604
9347
|
]);
|
|
8605
|
-
(0,
|
|
9348
|
+
(0, import_react10.useEffect)(() => {
|
|
8606
9349
|
setZoom(1);
|
|
8607
9350
|
setCurrentPage(1);
|
|
8608
9351
|
setSelectedSignature(null);
|
|
@@ -8620,7 +9363,7 @@ function DocumentViewer(props) {
|
|
|
8620
9363
|
setInternalAnnotations([]);
|
|
8621
9364
|
}
|
|
8622
9365
|
}, [mode, props.fileUrl, props.fileName, props.fileType, props.blob, props.base64]);
|
|
8623
|
-
(0,
|
|
9366
|
+
(0, import_react10.useEffect)(() => {
|
|
8624
9367
|
const element = zoomStageRef.current;
|
|
8625
9368
|
if (!element) {
|
|
8626
9369
|
return;
|
|
@@ -8678,7 +9421,7 @@ function DocumentViewer(props) {
|
|
|
8678
9421
|
showSignatures,
|
|
8679
9422
|
showThumbnails
|
|
8680
9423
|
]);
|
|
8681
|
-
(0,
|
|
9424
|
+
(0, import_react10.useEffect)(() => {
|
|
8682
9425
|
const element = mainRef.current;
|
|
8683
9426
|
if (!element) {
|
|
8684
9427
|
return;
|
|
@@ -8712,7 +9455,7 @@ function DocumentViewer(props) {
|
|
|
8712
9455
|
window.removeEventListener("resize", scheduleMeasure);
|
|
8713
9456
|
};
|
|
8714
9457
|
}, []);
|
|
8715
|
-
const zoomShellStyle = (0,
|
|
9458
|
+
const zoomShellStyle = (0, import_react10.useMemo)(
|
|
8716
9459
|
() => {
|
|
8717
9460
|
const baseWidth = isRichTextAuthoringMode && mainContentWidth > 0 ? mainContentWidth : zoomStageSize.width;
|
|
8718
9461
|
return {
|
|
@@ -8723,7 +9466,7 @@ function DocumentViewer(props) {
|
|
|
8723
9466
|
},
|
|
8724
9467
|
[isRichTextAuthoringMode, mainContentWidth, zoom, zoomStageSize.height, zoomStageSize.width]
|
|
8725
9468
|
);
|
|
8726
|
-
const zoomStageStyle = (0,
|
|
9469
|
+
const zoomStageStyle = (0, import_react10.useMemo)(
|
|
8727
9470
|
() => {
|
|
8728
9471
|
const baseWidth = isRichTextAuthoringMode && mainContentWidth > 0 ? mainContentWidth : zoomStageSize.width;
|
|
8729
9472
|
return {
|
|
@@ -8753,12 +9496,17 @@ function DocumentViewer(props) {
|
|
|
8753
9496
|
};
|
|
8754
9497
|
const handleSignatureSelect = (signature) => {
|
|
8755
9498
|
setSelectedSignature(normalizeSignature(signature));
|
|
8756
|
-
setSelectedSignatureColor("black");
|
|
8757
9499
|
setIsPlacingAnnotation(false);
|
|
8758
9500
|
setActivePlacementId(null);
|
|
8759
9501
|
setActiveAnnotationId(null);
|
|
8760
9502
|
props.onSign?.(normalizeSignature(signature));
|
|
8761
9503
|
};
|
|
9504
|
+
const handleCancelPlacementMode = () => {
|
|
9505
|
+
setSelectedSignature(null);
|
|
9506
|
+
setIsPlacingAnnotation(false);
|
|
9507
|
+
setActivePlacementId(null);
|
|
9508
|
+
setActiveAnnotationId(null);
|
|
9509
|
+
};
|
|
8762
9510
|
const handlePlaceSignature = (placement) => {
|
|
8763
9511
|
const nextPlacement = normalizeSignaturePlacement({
|
|
8764
9512
|
id: createPlacementId(),
|
|
@@ -8777,8 +9525,7 @@ function DocumentViewer(props) {
|
|
|
8777
9525
|
});
|
|
8778
9526
|
updatePlacements((prev) => [...prev, nextPlacement]);
|
|
8779
9527
|
setSelectedSignature(null);
|
|
8780
|
-
|
|
8781
|
-
setActivePlacementId(null);
|
|
9528
|
+
setActivePlacementId(nextPlacement.id);
|
|
8782
9529
|
setActiveAnnotationId(null);
|
|
8783
9530
|
};
|
|
8784
9531
|
const handlePlaceAnnotation = (annotation) => {
|
|
@@ -8828,11 +9575,13 @@ function DocumentViewer(props) {
|
|
|
8828
9575
|
placements,
|
|
8829
9576
|
annotations,
|
|
8830
9577
|
pendingSignature: selectedSignature,
|
|
9578
|
+
pendingSignatureColor: selectedSignature ? selectedSignatureColor : void 0,
|
|
8831
9579
|
pendingAnnotation: isPlacingAnnotation,
|
|
8832
9580
|
activePlacementId,
|
|
8833
9581
|
activeAnnotationId,
|
|
8834
9582
|
placeHint: locale["signatures.placeHint"],
|
|
8835
9583
|
annotationHint: locale["annotations.placeHint"],
|
|
9584
|
+
cancelPlacementLabel: locale["signatures.cancelPlacement"],
|
|
8836
9585
|
annotationPlaceholder: locale["annotations.placeholder"],
|
|
8837
9586
|
signatureAltLabel: locale["signatures.alt"],
|
|
8838
9587
|
signatureAltByLabel: locale["signatures.altBy"],
|
|
@@ -8859,17 +9608,22 @@ function DocumentViewer(props) {
|
|
|
8859
9608
|
onSelectPlacement: (id) => {
|
|
8860
9609
|
setActivePlacementId(id);
|
|
8861
9610
|
if (id) {
|
|
9611
|
+
setSelectedSignature(null);
|
|
9612
|
+
setIsPlacingAnnotation(false);
|
|
8862
9613
|
setActiveAnnotationId(null);
|
|
8863
9614
|
}
|
|
8864
9615
|
},
|
|
8865
9616
|
onSelectAnnotation: (id) => {
|
|
8866
9617
|
setActiveAnnotationId(id);
|
|
8867
9618
|
if (id) {
|
|
9619
|
+
setSelectedSignature(null);
|
|
9620
|
+
setIsPlacingAnnotation(false);
|
|
8868
9621
|
setActivePlacementId(null);
|
|
8869
9622
|
}
|
|
8870
|
-
}
|
|
9623
|
+
},
|
|
9624
|
+
onCancelPlacementMode: handleCancelPlacementMode
|
|
8871
9625
|
};
|
|
8872
|
-
const saveReady = (0,
|
|
9626
|
+
const saveReady = (0, import_react10.useMemo)(() => {
|
|
8873
9627
|
if (!resolved) {
|
|
8874
9628
|
return false;
|
|
8875
9629
|
}
|
|
@@ -8904,7 +9658,7 @@ function DocumentViewer(props) {
|
|
|
8904
9658
|
spreadsheetExportState
|
|
8905
9659
|
]);
|
|
8906
9660
|
const saveEnabled = Boolean(props.onSave) && Boolean(resolved) && !loading && saveReady;
|
|
8907
|
-
const exportLabels = (0,
|
|
9661
|
+
const exportLabels = (0, import_react10.useMemo)(
|
|
8908
9662
|
() => ({
|
|
8909
9663
|
annotationTitle: locale["annotations.title"],
|
|
8910
9664
|
linkedAnnotationTitle: locale["annotations.linkedTitle"],
|
|
@@ -9058,20 +9812,20 @@ function DocumentViewer(props) {
|
|
|
9058
9812
|
};
|
|
9059
9813
|
const renderContent = () => {
|
|
9060
9814
|
if (error) {
|
|
9061
|
-
return /* @__PURE__ */ (0,
|
|
9062
|
-
/* @__PURE__ */ (0,
|
|
9063
|
-
/* @__PURE__ */ (0,
|
|
9815
|
+
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: [
|
|
9816
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("strong", { children: locale["error.title"] }),
|
|
9817
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { children: error })
|
|
9064
9818
|
] }) });
|
|
9065
9819
|
}
|
|
9066
9820
|
if (loading || !resolved) {
|
|
9067
|
-
return /* @__PURE__ */ (0,
|
|
9068
|
-
/* @__PURE__ */ (0,
|
|
9069
|
-
/* @__PURE__ */ (0,
|
|
9821
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "hv-status-shell", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "hv-loader", children: [
|
|
9822
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "hv-spinner" }),
|
|
9823
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: locale.loading })
|
|
9070
9824
|
] }) });
|
|
9071
9825
|
}
|
|
9072
|
-
const renderCapabilityNotice = (title, description, variant = "info") => /* @__PURE__ */ (0,
|
|
9073
|
-
/* @__PURE__ */ (0,
|
|
9074
|
-
/* @__PURE__ */ (0,
|
|
9826
|
+
const renderCapabilityNotice = (title, description, variant = "info") => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: `hv-info-banner${variant === "warning" ? " warning" : ""}`, children: [
|
|
9827
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("strong", { children: title }),
|
|
9828
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { children: description })
|
|
9075
9829
|
] });
|
|
9076
9830
|
const shouldShowModeAdjustedNotice = showModeFallbackNotice || showCreateUnsupportedNotice && hasRenderableSource;
|
|
9077
9831
|
const modeAdjustedNotice = shouldShowModeAdjustedNotice ? renderCapabilityNotice(
|
|
@@ -9082,7 +9836,7 @@ function DocumentViewer(props) {
|
|
|
9082
9836
|
).replace("{fileType}", getReadableFileTypeLabel(resolved.fileType))
|
|
9083
9837
|
) : null;
|
|
9084
9838
|
if (showCreateUnsupportedNotice && !hasRenderableSource) {
|
|
9085
|
-
return /* @__PURE__ */ (0,
|
|
9839
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "hv-page-container", style: { padding: "32px" }, children: renderCapabilityNotice(
|
|
9086
9840
|
locale["documents.createUnsupportedTitle"],
|
|
9087
9841
|
locale["documents.createUnsupportedDescription"].replace(
|
|
9088
9842
|
"{formats}",
|
|
@@ -9105,9 +9859,9 @@ function DocumentViewer(props) {
|
|
|
9105
9859
|
};
|
|
9106
9860
|
switch (resolved.fileType) {
|
|
9107
9861
|
case "pdf":
|
|
9108
|
-
return /* @__PURE__ */ (0,
|
|
9862
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
9109
9863
|
modeAdjustedNotice,
|
|
9110
|
-
/* @__PURE__ */ (0,
|
|
9864
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
9111
9865
|
PdfRenderer,
|
|
9112
9866
|
{
|
|
9113
9867
|
url: resolved.url,
|
|
@@ -9121,9 +9875,9 @@ function DocumentViewer(props) {
|
|
|
9121
9875
|
case "rtf":
|
|
9122
9876
|
case "txt":
|
|
9123
9877
|
case "md":
|
|
9124
|
-
return /* @__PURE__ */ (0,
|
|
9878
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
9125
9879
|
modeAdjustedNotice,
|
|
9126
|
-
/* @__PURE__ */ (0,
|
|
9880
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
9127
9881
|
RichTextEditor,
|
|
9128
9882
|
{
|
|
9129
9883
|
mode: effectiveMode,
|
|
@@ -9135,9 +9889,9 @@ function DocumentViewer(props) {
|
|
|
9135
9889
|
case "xlsx":
|
|
9136
9890
|
case "csv":
|
|
9137
9891
|
case "xls":
|
|
9138
|
-
return /* @__PURE__ */ (0,
|
|
9892
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
9139
9893
|
modeAdjustedNotice,
|
|
9140
|
-
/* @__PURE__ */ (0,
|
|
9894
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
9141
9895
|
SpreadsheetEditor,
|
|
9142
9896
|
{
|
|
9143
9897
|
mode: effectiveMode,
|
|
@@ -9148,9 +9902,9 @@ function DocumentViewer(props) {
|
|
|
9148
9902
|
] });
|
|
9149
9903
|
case "pptx":
|
|
9150
9904
|
case "ppt":
|
|
9151
|
-
return /* @__PURE__ */ (0,
|
|
9905
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
9152
9906
|
modeAdjustedNotice,
|
|
9153
|
-
/* @__PURE__ */ (0,
|
|
9907
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
9154
9908
|
PptxRenderer,
|
|
9155
9909
|
{
|
|
9156
9910
|
onExportStateChange: setPptxExportState,
|
|
@@ -9164,20 +9918,20 @@ function DocumentViewer(props) {
|
|
|
9164
9918
|
case "gif":
|
|
9165
9919
|
case "bmp":
|
|
9166
9920
|
case "svg":
|
|
9167
|
-
return /* @__PURE__ */ (0,
|
|
9921
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
9168
9922
|
modeAdjustedNotice,
|
|
9169
|
-
/* @__PURE__ */ (0,
|
|
9923
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ImageRenderer, { ...commonProps, fileType: resolved.fileType })
|
|
9170
9924
|
] });
|
|
9171
9925
|
default:
|
|
9172
|
-
return /* @__PURE__ */ (0,
|
|
9926
|
+
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
9927
|
locale["documents.unsupportedFileType"],
|
|
9174
9928
|
": ",
|
|
9175
9929
|
resolved.fileType
|
|
9176
9930
|
] }) });
|
|
9177
9931
|
}
|
|
9178
9932
|
};
|
|
9179
|
-
return /* @__PURE__ */ (0,
|
|
9180
|
-
/* @__PURE__ */ (0,
|
|
9933
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "hv-root", "data-hv-theme": theme, children: [
|
|
9934
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
9181
9935
|
Toolbar,
|
|
9182
9936
|
{
|
|
9183
9937
|
fileName: resolved?.fileName,
|
|
@@ -9224,8 +9978,8 @@ function DocumentViewer(props) {
|
|
|
9224
9978
|
locale
|
|
9225
9979
|
}
|
|
9226
9980
|
),
|
|
9227
|
-
(props.headerComponent || props.footerComponent) && /* @__PURE__ */ (0,
|
|
9228
|
-
props.headerComponent && /* @__PURE__ */ (0,
|
|
9981
|
+
(props.headerComponent || props.footerComponent) && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "hv-export-slot-host", "aria-hidden": "true", children: [
|
|
9982
|
+
props.headerComponent && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
9229
9983
|
"div",
|
|
9230
9984
|
{
|
|
9231
9985
|
ref: exportHeaderRef,
|
|
@@ -9233,7 +9987,7 @@ function DocumentViewer(props) {
|
|
|
9233
9987
|
children: props.headerComponent
|
|
9234
9988
|
}
|
|
9235
9989
|
),
|
|
9236
|
-
props.footerComponent && /* @__PURE__ */ (0,
|
|
9990
|
+
props.footerComponent && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
9237
9991
|
"div",
|
|
9238
9992
|
{
|
|
9239
9993
|
ref: exportFooterRef,
|
|
@@ -9242,8 +9996,8 @@ function DocumentViewer(props) {
|
|
|
9242
9996
|
}
|
|
9243
9997
|
)
|
|
9244
9998
|
] }),
|
|
9245
|
-
/* @__PURE__ */ (0,
|
|
9246
|
-
/* @__PURE__ */ (0,
|
|
9999
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "hv-shell", children: [
|
|
10000
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
9247
10001
|
ThumbnailsSidebar,
|
|
9248
10002
|
{
|
|
9249
10003
|
isOpen: showThumbnails,
|
|
@@ -9253,15 +10007,15 @@ function DocumentViewer(props) {
|
|
|
9253
10007
|
locale
|
|
9254
10008
|
}
|
|
9255
10009
|
),
|
|
9256
|
-
/* @__PURE__ */ (0,
|
|
10010
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
9257
10011
|
"main",
|
|
9258
10012
|
{
|
|
9259
10013
|
ref: mainRef,
|
|
9260
10014
|
className: `hv-main${isRichTextAuthoringMode ? " hv-main-richtext-authoring" : ""}`,
|
|
9261
|
-
children: /* @__PURE__ */ (0,
|
|
10015
|
+
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
10016
|
}
|
|
9263
10017
|
),
|
|
9264
|
-
signingEnabled && /* @__PURE__ */ (0,
|
|
10018
|
+
signingEnabled && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
9265
10019
|
SignaturePanel,
|
|
9266
10020
|
{
|
|
9267
10021
|
isOpen: showSignatures,
|