mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-06-10 23:30:51 +02:00
More robust edge detection (#2710)
* more robust edge detection * nit * k
This commit is contained in:
parent
8f61505437
commit
f83e6806b6
@ -16,9 +16,13 @@ export function ChatBanner() {
|
|||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
const checkOverflow = () => {
|
const checkOverflow = () => {
|
||||||
if (contentRef.current && fullContentRef.current) {
|
if (contentRef.current && fullContentRef.current) {
|
||||||
setIsOverflowing(
|
const contentRect = contentRef.current.getBoundingClientRect();
|
||||||
fullContentRef.current.scrollHeight > contentRef.current.clientHeight
|
const fullContentRect = fullContentRef.current.getBoundingClientRect();
|
||||||
);
|
|
||||||
|
const isWidthOverflowing = fullContentRect.width > contentRect.width;
|
||||||
|
const isHeightOverflowing = fullContentRect.height > contentRect.height;
|
||||||
|
|
||||||
|
setIsOverflowing(isWidthOverflowing || isHeightOverflowing);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -53,24 +57,28 @@ export function ChatBanner() {
|
|||||||
>
|
>
|
||||||
<div className="text-emphasis text-sm w-full">
|
<div className="text-emphasis text-sm w-full">
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
|
<div className={`flex justify-center w-full overflow-hidden pr-8`}>
|
||||||
<div
|
<div
|
||||||
ref={contentRef}
|
ref={contentRef}
|
||||||
className={`${settings.enterpriseSettings.two_lines_for_chat_header ? "line-clamp-2" : "line-clamp-1"} text-center w-full overflow-hidden pr-8`}
|
className={`overflow-hidden ${settings.enterpriseSettings.two_lines_for_chat_header ? "line-clamp-2" : "line-clamp-1"} text-center max-w-full`}
|
||||||
>
|
>
|
||||||
<MinimalMarkdown
|
<MinimalMarkdown
|
||||||
className="prose text-sm max-w-full"
|
className="prose text-sm max-w-full"
|
||||||
content={settings.enterpriseSettings.custom_header_content}
|
content={settings.enterpriseSettings.custom_header_content}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="absolute top-0 left-0 invisible flex justify-center max-w-full">
|
||||||
<div
|
<div
|
||||||
ref={fullContentRef}
|
ref={fullContentRef}
|
||||||
className="absolute top-0 left-0 invisible w-full"
|
className={`overflow-hidden invisible ${settings.enterpriseSettings.two_lines_for_chat_header ? "line-clamp-2" : "line-clamp-1"} text-center max-w-full`}
|
||||||
>
|
>
|
||||||
<MinimalMarkdown
|
<MinimalMarkdown
|
||||||
className="prose text-sm max-w-full"
|
className="prose text-sm max-w-full"
|
||||||
content={settings.enterpriseSettings.custom_header_content}
|
content={settings.enterpriseSettings.custom_header_content}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div className="absolute bottom-0 right-0">
|
<div className="absolute bottom-0 right-0">
|
||||||
{isOverflowing && (
|
{isOverflowing && (
|
||||||
<Popover
|
<Popover
|
||||||
|
Loading…
x
Reference in New Issue
Block a user