Skip to content

Commit adfb174

Browse files
Merge pull request #391 from adobe-commerce-tier-4/PR-02-11-2025
[Support Tier-4 chittima] 02-11-2025 Regular delivery of bugfixes and improvements
2 parents 9bae1de + 0e0b7b9 commit adfb174

File tree

3 files changed

+235
-106
lines changed

3 files changed

+235
-106
lines changed

app/code/Magento/PageBuilder/view/adminhtml/web/js/template-manager.js

+18-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/template-manager.ts

+15-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
2-
* Copyright © Magento, Inc. All rights reserved.
3-
* See COPYING.txt for license details.
2+
* Copyright 2019 Adobe
3+
* All Rights Reserved.
44
*/
55

66
import html2canvas from "html2canvas";
@@ -138,6 +138,7 @@ function createCapture(stage: Stage) {
138138
renderingLock.then(() => {
139139
// Resolve issues with Parallax
140140
const parallaxRestore = disableParallax(stageElement);
141+
const canvasElement = document.querySelector("#" + stage.id + " .pagebuilder-canvas") as HTMLElement;
141142

142143
stageElement.style.height = $(stageElement).outerHeight(false) + "px";
143144
stageElement.classList.add("capture");
@@ -151,11 +152,12 @@ function createCapture(stage: Stage) {
151152

152153
_.defer(() => {
153154
html2canvas(
154-
document.querySelector("#" + stage.id + " .pagebuilder-canvas"),
155+
canvasElement,
155156
{
156157
scale: 1,
157158
useCORS: true,
158159
scrollY: (window.pageYOffset * -1),
160+
height: correctCanvasHeight(canvasElement),
159161
},
160162
).then((canvas: HTMLCanvasElement) => {
161163
const imageSrc = canvas.toDataURL("image/jpeg", 0.85);
@@ -216,6 +218,16 @@ function restoreParallax(rows: ResetRowInterface[]) {
216218
});
217219
}
218220

221+
/**
222+
* Adjust canvas element size to prevent area overflow.
223+
*
224+
* @param canvasElement
225+
*/
226+
function correctCanvasHeight(canvasElement: HTMLElement) {
227+
// @ts-ignore
228+
return canvasElement.getHeight() < 4096 ? canvasElement.getHeight() : 4096;
229+
}
230+
219231
interface ResetRowInterface {
220232
element: HTMLElement;
221233
styles: string;

0 commit comments

Comments
 (0)