mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-15 05:37:32 +00:00
fix: ai error message tip would be cut off (#8183)
Use `<affine-tooltip>` component that updates the float position when it might be clipped。 Fix: [BS-1386](https://linear.app/affine-design/issue/BS-1386/[bug]-tooltip-位置错误)
This commit is contained in:
@@ -152,26 +152,18 @@ export function AIChatErrorRenderer(host: EditorHost, error: AIError) {
|
|||||||
} else {
|
} else {
|
||||||
const tip = error.message;
|
const tip = error.message;
|
||||||
return GeneralErrorRenderer({
|
return GeneralErrorRenderer({
|
||||||
error: html`<style>
|
error: html` <style>
|
||||||
.tip {
|
.tip {
|
||||||
position: relative;
|
text-decoration: underline;
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tip:hover::after {
|
|
||||||
content: attr(data-tip);
|
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
top: 20px;
|
|
||||||
background-color: black;
|
|
||||||
color: white;
|
|
||||||
padding: 5px 10px;
|
|
||||||
border-radius: 5px;
|
|
||||||
z-index: 1000;
|
|
||||||
white-space: pre;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<a class="tip" href="#" data-tip="${tip}">An error occurred</a>`,
|
<span class="tip"
|
||||||
|
>An error occurred<affine-tooltip
|
||||||
|
tip-position="bottom-start"
|
||||||
|
.arrow=${false}
|
||||||
|
>${tip}</affine-tooltip
|
||||||
|
></span
|
||||||
|
>`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user