html2canvas-pro 2.4.0 → 2.4.1
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/html2canvas-pro.cjs +35 -2
- package/dist/html2canvas-pro.cjs.map +1 -1
- package/dist/html2canvas-pro.esm.js +35 -2
- package/dist/html2canvas-pro.esm.js.map +1 -1
- package/dist/html2canvas-pro.js +35 -2
- package/dist/html2canvas-pro.js.map +1 -1
- package/dist/html2canvas-pro.min.js +4 -4
- package/dist/lib/dom/replaced-elements/svg-element-container.js +40 -2
- package/dist/types/dom/replaced-elements/svg-element-container.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* html2canvas-pro 2.4.
|
|
2
|
+
* html2canvas-pro 2.4.1 <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
|
*/
|
|
@@ -8082,6 +8082,39 @@ var CanvasElementContainer = class extends ElementContainer {
|
|
|
8082
8082
|
};
|
|
8083
8083
|
//#endregion
|
|
8084
8084
|
//#region src/dom/replaced-elements/svg-element-container.ts
|
|
8085
|
+
const BOX_OFFSET_PROPERTIES = [
|
|
8086
|
+
"position",
|
|
8087
|
+
"inset",
|
|
8088
|
+
"top",
|
|
8089
|
+
"right",
|
|
8090
|
+
"bottom",
|
|
8091
|
+
"left",
|
|
8092
|
+
"inset-inline",
|
|
8093
|
+
"inset-inline-start",
|
|
8094
|
+
"inset-inline-end",
|
|
8095
|
+
"inset-block",
|
|
8096
|
+
"inset-block-start",
|
|
8097
|
+
"inset-block-end",
|
|
8098
|
+
"margin",
|
|
8099
|
+
"margin-top",
|
|
8100
|
+
"margin-right",
|
|
8101
|
+
"margin-bottom",
|
|
8102
|
+
"margin-left",
|
|
8103
|
+
"margin-inline",
|
|
8104
|
+
"margin-inline-start",
|
|
8105
|
+
"margin-inline-end",
|
|
8106
|
+
"margin-block",
|
|
8107
|
+
"margin-block-start",
|
|
8108
|
+
"margin-block-end"
|
|
8109
|
+
];
|
|
8110
|
+
const serializeWithoutBoxOffsets = (serializer, img) => {
|
|
8111
|
+
const style = img.getAttribute("style");
|
|
8112
|
+
BOX_OFFSET_PROPERTIES.forEach((property) => img.style.removeProperty(property));
|
|
8113
|
+
const serialized = serializer.serializeToString(img);
|
|
8114
|
+
if (style === null) img.removeAttribute("style");
|
|
8115
|
+
else img.setAttribute("style", style);
|
|
8116
|
+
return serialized;
|
|
8117
|
+
};
|
|
8085
8118
|
var SVGElementContainer = class extends ElementContainer {
|
|
8086
8119
|
constructor(context, img) {
|
|
8087
8120
|
super(context, img);
|
|
@@ -8089,7 +8122,7 @@ var SVGElementContainer = class extends ElementContainer {
|
|
|
8089
8122
|
const bounds = parseBounds(context, img);
|
|
8090
8123
|
img.setAttribute("width", `${bounds.width}px`);
|
|
8091
8124
|
img.setAttribute("height", `${bounds.height}px`);
|
|
8092
|
-
this.svg = `data:image/svg+xml,${encodeURIComponent(s
|
|
8125
|
+
this.svg = `data:image/svg+xml,${encodeURIComponent(serializeWithoutBoxOffsets(s, img))}`;
|
|
8093
8126
|
this.intrinsicWidth = img.width.baseVal.value;
|
|
8094
8127
|
this.intrinsicHeight = img.height.baseVal.value;
|
|
8095
8128
|
this.context.cache.addImage(this.svg);
|