Skip to content

Commit 9dfd366

Browse files
committed
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-位置错误)
1 parent 4c0d0ab commit 9dfd366

File tree

1 file changed

+9
-17
lines changed
  • packages/frontend/core/src/blocksuite/presets/ai/messages

1 file changed

+9
-17
lines changed

packages/frontend/core/src/blocksuite/presets/ai/messages/error.ts

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -152,26 +152,18 @@ export function AIChatErrorRenderer(host: EditorHost, error: AIError) {
152152
} else {
153153
const tip = error.message;
154154
return GeneralErrorRenderer({
155-
error: html`<style>
155+
error: html` <style>
156156
.tip {
157-
position: relative;
158-
cursor: pointer;
159-
}
160-
161-
.tip:hover::after {
162-
content: attr(data-tip);
163-
position: absolute;
164-
left: 0;
165-
top: 20px;
166-
background-color: black;
167-
color: white;
168-
padding: 5px 10px;
169-
border-radius: 5px;
170-
z-index: 1000;
171-
white-space: pre;
157+
text-decoration: underline;
172158
}
173159
</style>
174-
<a class="tip" href="#" data-tip="${tip}">An error occurred</a>`,
160+
<span class="tip"
161+
>An error occurred<affine-tooltip
162+
tip-position="bottom-start"
163+
.arrow=${false}
164+
>${tip}</affine-tooltip
165+
></span
166+
>`,
175167
});
176168
}
177169
}

0 commit comments

Comments
 (0)