Skip to content

Commit 00483ea

Browse files
authored
fix: caption width match file container #1169 (#1182)
* fix: caption width match file container #1169 * remove debug code * revert some unnecessary format change
1 parent 08b5510 commit 00483ea

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/core/src/blocks/FileBlockContent/fileBlockHelpers.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,13 @@ export const createFileAndCaptionWrapper = (
108108
caption.className = "bn-file-caption";
109109
caption.textContent = block.props.caption;
110110

111+
if (typeof block.props.previewWidth === "number" &&
112+
block.props.previewWidth > 0 &&
113+
block.props.caption !== undefined
114+
) {
115+
caption.style.width = `${block.props.previewWidth}px`
116+
}
117+
111118
fileAndCaptionWrapper.appendChild(file);
112119
fileAndCaptionWrapper.appendChild(caption);
113120

0 commit comments

Comments
 (0)