@yoamigo.com/core 0.3.9 → 0.3.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.
- package/dist/index.js +51 -14
- package/dist/lib.js +51 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -693,19 +693,41 @@ var BuilderSelectionManager = class {
|
|
|
693
693
|
el.style.display = "none";
|
|
694
694
|
});
|
|
695
695
|
const canvas = await html2canvas(document.body, {
|
|
696
|
-
scale:
|
|
697
|
-
//
|
|
696
|
+
scale: 1,
|
|
697
|
+
// Full resolution
|
|
698
698
|
logging: false,
|
|
699
699
|
useCORS: true,
|
|
700
700
|
allowTaint: true,
|
|
701
|
-
backgroundColor:
|
|
702
|
-
//
|
|
701
|
+
backgroundColor: null,
|
|
702
|
+
// No background - preserve page's actual background
|
|
703
|
+
windowHeight: document.body.scrollHeight,
|
|
704
|
+
// Full page height
|
|
705
|
+
height: document.body.scrollHeight,
|
|
706
|
+
// Full page height
|
|
707
|
+
scrollX: 0,
|
|
708
|
+
// Render from left (no visible scroll)
|
|
709
|
+
scrollY: 0,
|
|
710
|
+
// Render from top (no visible scroll)
|
|
711
|
+
onclone: async (clonedDoc) => {
|
|
712
|
+
clonedDoc.querySelectorAll('img[loading="lazy"]').forEach((img) => {
|
|
713
|
+
img.removeAttribute("loading");
|
|
714
|
+
});
|
|
715
|
+
await Promise.all(
|
|
716
|
+
Array.from(clonedDoc.querySelectorAll("img")).map(
|
|
717
|
+
(img) => img.complete && img.naturalHeight !== 0 ? Promise.resolve() : new Promise((r) => {
|
|
718
|
+
img.onload = r;
|
|
719
|
+
img.onerror = r;
|
|
720
|
+
})
|
|
721
|
+
)
|
|
722
|
+
);
|
|
723
|
+
await clonedDoc.fonts?.ready;
|
|
724
|
+
}
|
|
703
725
|
});
|
|
704
726
|
overlays.forEach((el) => {
|
|
705
727
|
;
|
|
706
728
|
el.style.display = "";
|
|
707
729
|
});
|
|
708
|
-
const dataUrl = canvas.toDataURL("image/jpeg", 0.
|
|
730
|
+
const dataUrl = canvas.toDataURL("image/jpeg", 0.8);
|
|
709
731
|
this.sendToParent({
|
|
710
732
|
type: "SCREENSHOT_READY",
|
|
711
733
|
dataUrl
|
|
@@ -939,27 +961,42 @@ var BuilderSelectionManager = class {
|
|
|
939
961
|
;
|
|
940
962
|
el.style.display = "none";
|
|
941
963
|
});
|
|
942
|
-
const originalScrollY = window.scrollY;
|
|
943
|
-
window.scrollTo(0, 0);
|
|
944
|
-
await new Promise((resolve) => requestAnimationFrame(resolve));
|
|
945
964
|
const canvas = await html2canvas(document.body, {
|
|
946
|
-
scale:
|
|
947
|
-
//
|
|
965
|
+
scale: 1,
|
|
966
|
+
// Full resolution
|
|
948
967
|
logging: false,
|
|
949
968
|
useCORS: true,
|
|
950
969
|
allowTaint: true,
|
|
951
|
-
backgroundColor:
|
|
970
|
+
backgroundColor: null,
|
|
971
|
+
// No background - preserve page's actual background
|
|
952
972
|
windowHeight: document.body.scrollHeight,
|
|
953
973
|
// Full page height
|
|
954
|
-
height: document.body.scrollHeight
|
|
974
|
+
height: document.body.scrollHeight,
|
|
975
|
+
scrollX: 0,
|
|
976
|
+
// Render from left (no visible scroll)
|
|
977
|
+
scrollY: 0,
|
|
978
|
+
// Render from top (no visible scroll)
|
|
979
|
+
onclone: async (clonedDoc) => {
|
|
980
|
+
clonedDoc.querySelectorAll('img[loading="lazy"]').forEach((img) => {
|
|
981
|
+
img.removeAttribute("loading");
|
|
982
|
+
});
|
|
983
|
+
await Promise.all(
|
|
984
|
+
Array.from(clonedDoc.querySelectorAll("img")).map(
|
|
985
|
+
(img) => img.complete && img.naturalHeight !== 0 ? Promise.resolve() : new Promise((r) => {
|
|
986
|
+
img.onload = r;
|
|
987
|
+
img.onerror = r;
|
|
988
|
+
})
|
|
989
|
+
)
|
|
990
|
+
);
|
|
991
|
+
await clonedDoc.fonts?.ready;
|
|
992
|
+
}
|
|
955
993
|
});
|
|
956
|
-
window.scrollTo(0, originalScrollY);
|
|
957
994
|
overlays.forEach((el) => {
|
|
958
995
|
;
|
|
959
996
|
el.style.display = "";
|
|
960
997
|
});
|
|
961
998
|
const blob = await new Promise((resolve) => {
|
|
962
|
-
canvas.toBlob((b) => resolve(b), "image/jpeg", 0.
|
|
999
|
+
canvas.toBlob((b) => resolve(b), "image/jpeg", 0.8);
|
|
963
1000
|
});
|
|
964
1001
|
if (!blob) {
|
|
965
1002
|
console.error("[BuilderSelection] Failed to create blob from canvas");
|
package/dist/lib.js
CHANGED
|
@@ -652,19 +652,41 @@ var BuilderSelectionManager = class {
|
|
|
652
652
|
el.style.display = "none";
|
|
653
653
|
});
|
|
654
654
|
const canvas = await html2canvas(document.body, {
|
|
655
|
-
scale:
|
|
656
|
-
//
|
|
655
|
+
scale: 1,
|
|
656
|
+
// Full resolution
|
|
657
657
|
logging: false,
|
|
658
658
|
useCORS: true,
|
|
659
659
|
allowTaint: true,
|
|
660
|
-
backgroundColor:
|
|
661
|
-
//
|
|
660
|
+
backgroundColor: null,
|
|
661
|
+
// No background - preserve page's actual background
|
|
662
|
+
windowHeight: document.body.scrollHeight,
|
|
663
|
+
// Full page height
|
|
664
|
+
height: document.body.scrollHeight,
|
|
665
|
+
// Full page height
|
|
666
|
+
scrollX: 0,
|
|
667
|
+
// Render from left (no visible scroll)
|
|
668
|
+
scrollY: 0,
|
|
669
|
+
// Render from top (no visible scroll)
|
|
670
|
+
onclone: async (clonedDoc) => {
|
|
671
|
+
clonedDoc.querySelectorAll('img[loading="lazy"]').forEach((img) => {
|
|
672
|
+
img.removeAttribute("loading");
|
|
673
|
+
});
|
|
674
|
+
await Promise.all(
|
|
675
|
+
Array.from(clonedDoc.querySelectorAll("img")).map(
|
|
676
|
+
(img) => img.complete && img.naturalHeight !== 0 ? Promise.resolve() : new Promise((r) => {
|
|
677
|
+
img.onload = r;
|
|
678
|
+
img.onerror = r;
|
|
679
|
+
})
|
|
680
|
+
)
|
|
681
|
+
);
|
|
682
|
+
await clonedDoc.fonts?.ready;
|
|
683
|
+
}
|
|
662
684
|
});
|
|
663
685
|
overlays.forEach((el) => {
|
|
664
686
|
;
|
|
665
687
|
el.style.display = "";
|
|
666
688
|
});
|
|
667
|
-
const dataUrl = canvas.toDataURL("image/jpeg", 0.
|
|
689
|
+
const dataUrl = canvas.toDataURL("image/jpeg", 0.8);
|
|
668
690
|
this.sendToParent({
|
|
669
691
|
type: "SCREENSHOT_READY",
|
|
670
692
|
dataUrl
|
|
@@ -898,27 +920,42 @@ var BuilderSelectionManager = class {
|
|
|
898
920
|
;
|
|
899
921
|
el.style.display = "none";
|
|
900
922
|
});
|
|
901
|
-
const originalScrollY = window.scrollY;
|
|
902
|
-
window.scrollTo(0, 0);
|
|
903
|
-
await new Promise((resolve) => requestAnimationFrame(resolve));
|
|
904
923
|
const canvas = await html2canvas(document.body, {
|
|
905
|
-
scale:
|
|
906
|
-
//
|
|
924
|
+
scale: 1,
|
|
925
|
+
// Full resolution
|
|
907
926
|
logging: false,
|
|
908
927
|
useCORS: true,
|
|
909
928
|
allowTaint: true,
|
|
910
|
-
backgroundColor:
|
|
929
|
+
backgroundColor: null,
|
|
930
|
+
// No background - preserve page's actual background
|
|
911
931
|
windowHeight: document.body.scrollHeight,
|
|
912
932
|
// Full page height
|
|
913
|
-
height: document.body.scrollHeight
|
|
933
|
+
height: document.body.scrollHeight,
|
|
934
|
+
scrollX: 0,
|
|
935
|
+
// Render from left (no visible scroll)
|
|
936
|
+
scrollY: 0,
|
|
937
|
+
// Render from top (no visible scroll)
|
|
938
|
+
onclone: async (clonedDoc) => {
|
|
939
|
+
clonedDoc.querySelectorAll('img[loading="lazy"]').forEach((img) => {
|
|
940
|
+
img.removeAttribute("loading");
|
|
941
|
+
});
|
|
942
|
+
await Promise.all(
|
|
943
|
+
Array.from(clonedDoc.querySelectorAll("img")).map(
|
|
944
|
+
(img) => img.complete && img.naturalHeight !== 0 ? Promise.resolve() : new Promise((r) => {
|
|
945
|
+
img.onload = r;
|
|
946
|
+
img.onerror = r;
|
|
947
|
+
})
|
|
948
|
+
)
|
|
949
|
+
);
|
|
950
|
+
await clonedDoc.fonts?.ready;
|
|
951
|
+
}
|
|
914
952
|
});
|
|
915
|
-
window.scrollTo(0, originalScrollY);
|
|
916
953
|
overlays.forEach((el) => {
|
|
917
954
|
;
|
|
918
955
|
el.style.display = "";
|
|
919
956
|
});
|
|
920
957
|
const blob = await new Promise((resolve) => {
|
|
921
|
-
canvas.toBlob((b) => resolve(b), "image/jpeg", 0.
|
|
958
|
+
canvas.toBlob((b) => resolve(b), "image/jpeg", 0.8);
|
|
922
959
|
});
|
|
923
960
|
if (!blob) {
|
|
924
961
|
console.error("[BuilderSelection] Failed to create blob from canvas");
|