html2canvas-pro 1.5.10 → 1.5.11

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * html2canvas-pro 1.5.10 <https://yorickshan.github.io/html2canvas-pro/>
2
+ * html2canvas-pro 1.5.11 <https://yorickshan.github.io/html2canvas-pro/>
3
3
  * Copyright (c) 2024-present yorickshan and html2canvas-pro contributors
4
4
  * Released under MIT License
5
5
  */
@@ -6586,12 +6586,21 @@ var Cache = /** @class */ (function () {
6586
6586
  };
6587
6587
  Cache.prototype.loadImage = function (key) {
6588
6588
  return __awaiter(this, void 0, void 0, function () {
6589
- var isSameOrigin, useCORS, useProxy, src;
6589
+ var isSameOrigin, _a, useCORS, useProxy, src;
6590
6590
  var _this = this;
6591
- return __generator(this, function (_a) {
6592
- switch (_a.label) {
6591
+ return __generator(this, function (_b) {
6592
+ switch (_b.label) {
6593
6593
  case 0:
6594
- isSameOrigin = CacheStorage.isSameOrigin(key);
6594
+ if (!(typeof this._options.customIsSameOrigin === 'function')) return [3 /*break*/, 2];
6595
+ return [4 /*yield*/, this._options.customIsSameOrigin(key, CacheStorage.isSameOrigin)];
6596
+ case 1:
6597
+ _a = _b.sent();
6598
+ return [3 /*break*/, 3];
6599
+ case 2:
6600
+ _a = CacheStorage.isSameOrigin(key);
6601
+ _b.label = 3;
6602
+ case 3:
6603
+ isSameOrigin = _a;
6595
6604
  useCORS = !isInlineImage(key) && this._options.useCORS === true && FEATURES.SUPPORT_CORS_IMAGES && !isSameOrigin;
6596
6605
  useProxy = !isInlineImage(key) &&
6597
6606
  !isSameOrigin &&
@@ -6608,12 +6617,12 @@ var Cache = /** @class */ (function () {
6608
6617
  return [2 /*return*/];
6609
6618
  }
6610
6619
  src = key;
6611
- if (!useProxy) return [3 /*break*/, 2];
6620
+ if (!useProxy) return [3 /*break*/, 5];
6612
6621
  return [4 /*yield*/, this.proxy(src)];
6613
- case 1:
6614
- src = _a.sent();
6615
- _a.label = 2;
6616
- case 2:
6622
+ case 4:
6623
+ src = _b.sent();
6624
+ _b.label = 5;
6625
+ case 5:
6617
6626
  this.context.logger.debug("Added image ".concat(key.substring(0, 256)));
6618
6627
  return [4 /*yield*/, new Promise(function (resolve, reject) {
6619
6628
  var img = new Image();
@@ -6632,7 +6641,7 @@ var Cache = /** @class */ (function () {
6632
6641
  setTimeout(function () { return reject("Timed out (".concat(_this._options.imageTimeout, "ms) loading image")); }, _this._options.imageTimeout);
6633
6642
  }
6634
6643
  })];
6635
- case 3: return [2 /*return*/, _a.sent()];
6644
+ case 6: return [2 /*return*/, _b.sent()];
6636
6645
  }
6637
6646
  });
6638
6647
  });
@@ -8675,7 +8684,8 @@ var renderElement = function (element, opts) { return __awaiter(void 0, void 0,
8675
8684
  allowTaint: (_b = opts.allowTaint) !== null && _b !== void 0 ? _b : false,
8676
8685
  imageTimeout: (_c = opts.imageTimeout) !== null && _c !== void 0 ? _c : 15000,
8677
8686
  proxy: opts.proxy,
8678
- useCORS: (_d = opts.useCORS) !== null && _d !== void 0 ? _d : false
8687
+ useCORS: (_d = opts.useCORS) !== null && _d !== void 0 ? _d : false,
8688
+ customIsSameOrigin: opts.customIsSameOrigin
8679
8689
  };
8680
8690
  contextOptions = __assign({ logging: (_e = opts.logging) !== null && _e !== void 0 ? _e : true, cache: opts.cache }, resourceOptions);
8681
8691
  windowOptions = {