Yanzhen Yu
2026-04-01 12:00:00 +08:00
parent e65160697b
commit c7966070ef
2 changed files with 6 additions and 3 deletions

View File

@@ -309,8 +309,11 @@ function serializeNode(
}
if (needBlock) {
const { width, height } = (n as HTMLElement).getBoundingClientRect();
attributes.rr_width = `${width}px`;
attributes.rr_height = `${height}px`;
attributes = {
class: attributes.class,
rr_width: `${width}px`,
rr_height: `${height}px`,
};
}
return {
type: NodeType.Element,

View File

@@ -70,7 +70,7 @@ exports[`[html file]: block-element.html 1`] = `
<div class=\\"rr-block big\\" style=\\"width: 50px; height: 50px;\\"></div>
<div>record 2</div>
<div class=\\"rr-block small\\" style=\\"width: 50px; height: 100px;\\"></div>
<div class=\\"rr-block\\" style=\\"height: 200px; width: 100px\\"></div>
<div class=\\"rr-block\\" style=\\"width: 100px; height: 200px;\\"></div>
</body></html>"
`;