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