feedback-vos 1.0.50 → 1.0.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -388,6 +388,20 @@ function ScreenshotEditor({
388
388
  ] })
389
389
  ] }) });
390
390
  }
391
+ if (typeof window !== "undefined" && typeof CanvasRenderingContext2D !== "undefined") {
392
+ const originalCreatePattern = CanvasRenderingContext2D.prototype.createPattern;
393
+ CanvasRenderingContext2D.prototype.createPattern = function(image, repetition) {
394
+ if (image instanceof HTMLCanvasElement) {
395
+ if (image.width === 0 || image.height === 0) {
396
+ const temp = document.createElement("canvas");
397
+ temp.width = 1;
398
+ temp.height = 1;
399
+ return originalCreatePattern.call(this, temp, repetition);
400
+ }
401
+ }
402
+ return originalCreatePattern.apply(this, arguments);
403
+ };
404
+ }
391
405
  function ScreenshotButton({
392
406
  screenshot,
393
407
  onScreenshotTook,
@@ -425,31 +439,28 @@ function ScreenshotButton({
425
439
  if (tagName === "IMG" || tagName === "CANVAS" || tagName === "VIDEO" || tagName === "SVG") {
426
440
  try {
427
441
  const rect = element.getBoundingClientRect();
428
- if (rect.width < 1 || rect.height < 1) {
442
+ if (rect.width === 0 || rect.height === 0) {
429
443
  return true;
430
444
  }
431
445
  if (tagName === "CANVAS") {
432
446
  const canvas2 = element;
433
447
  if (canvas2.width === 0 || canvas2.height === 0) {
434
- console.warn("FeedbackWidget: Ignored 0-intrinsic canvas:", element);
435
448
  return true;
436
449
  }
437
450
  }
438
451
  if (tagName === "IMG") {
439
452
  const img = element;
440
- if (img.getAttribute("src") && img.naturalWidth === 0) {
453
+ if (img.src && img.complete && (img.naturalWidth === 0 || img.naturalHeight === 0)) {
441
454
  return true;
442
455
  }
443
456
  }
444
457
  if (tagName === "VIDEO") {
445
458
  const video = element;
446
459
  if (video.readyState >= 1 && (video.videoWidth === 0 || video.videoHeight === 0)) {
447
- console.warn("FeedbackWidget: Ignored 0-intrinsic video:", element);
448
460
  return true;
449
461
  }
450
462
  }
451
463
  } catch (e) {
452
- console.warn("FeedbackWidget: Error checking element dimensions, ignoring safety check for:", element, e);
453
464
  }
454
465
  }
455
466
  return false;