mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-05-21 05:00:16 +09:00
hotfix: auto set height
This commit is contained in:
parent
763fc89b29
commit
7c1bc1f1a1
@ -37,17 +37,17 @@ export function HTMLPreview(props: {
|
|||||||
const { id, height, title } = e.data;
|
const { id, height, title } = e.data;
|
||||||
setTitle(title);
|
setTitle(title);
|
||||||
if (id == frameId.current) {
|
if (id == frameId.current) {
|
||||||
if (height != iframeHeight + 40) {
|
|
||||||
setIframeHeight(height);
|
setIframeHeight(height);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}, [iframeHeight]);
|
}, [iframeHeight]);
|
||||||
|
|
||||||
const height = useMemo(() => {
|
const height = useMemo(() => {
|
||||||
const parentHeight = props.height || 600;
|
const parentHeight = props.height || 600;
|
||||||
if (props.autoHeight !== false) {
|
if (props.autoHeight !== false) {
|
||||||
return iframeHeight > parentHeight ? parentHeight : iframeHeight + 40;
|
return iframeHeight + 40 > parentHeight
|
||||||
|
? parentHeight
|
||||||
|
: iframeHeight + 40;
|
||||||
} else {
|
} else {
|
||||||
return parentHeight;
|
return parentHeight;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user