Skip to content

Commit c1b0c4b

Browse files
committed
feat: improve iframe dynamic resizing and adjust body padding in standalone uploader
1 parent 7b3842c commit c1b0c4b

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

src/standalone-uploader/embeddedDvWebloader.html

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,35 @@
1414
};
1515
</script>
1616
<style>
17-
body {
17+
html, body {
1818
margin: 0;
19-
padding: 10px;
19+
padding: 0;
2020
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
2121
background-color: transparent;
2222
}
23+
#root {
24+
padding: 10px;
25+
}
2326
</style>
2427
<script type="module" src="dvwebloader-v2.js"></script>
28+
<script>
29+
// Send height to parent for dynamic iframe sizing
30+
function sendHeightToParent() {
31+
const height = document.documentElement.scrollHeight;
32+
window.parent.postMessage({ type: 'dvwebloader-resize', height: height }, '*');
33+
}
34+
35+
// Observe DOM changes to detect when content size changes
36+
const resizeObserver = new ResizeObserver(sendHeightToParent);
37+
38+
document.addEventListener('DOMContentLoaded', function() {
39+
resizeObserver.observe(document.body);
40+
sendHeightToParent();
41+
});
42+
43+
// Also send on window resize
44+
window.addEventListener('resize', sendHeightToParent);
45+
</script>
2546
</head>
2647
<body>
2748
<div id="root"></div>

0 commit comments

Comments
 (0)