fix(webui): align mention overlay spacing with the native caret
This commit is contained in:
1 parent
61666c495a
commit
1a4cee5815
2 files changed
+17
-1
No files matched your search
@@ -2466,7 +2466,8 @@ export function ThreadComposer({
|
||||
<ComposerUsagePopover context={contextUsage} rounds={recentRoundUsage} showLabel={compactControls} bottomSheet={compactControls} />
|
||||
) : null;
|
||||
const inputTextClasses = cn(
|
||||
"w-full resize-none bg-transparent",
|
||||
// Keep the overlay's CJK/Latin spacing aligned with the native textarea caret.
|
||||
"w-full resize-none bg-transparent [text-autospace:no-autospace]",
|
||||
compactControls
|
||||
? "min-h-[52px] px-4 pb-2 pt-3 text-[16px] leading-6"
|
||||
: isHero
|
||||
|
||||
@@ -2484,6 +2484,21 @@ describe("ThreadComposer", () => {
|
||||
expect(input).toHaveValue("use @Blender tonight");
|
||||
});
|
||||
|
||||
it("keeps literal mixed-script spacing in both composer input layers", () => {
|
||||
render(<ThreadComposer onSend={vi.fn()} cliApps={CLI_APPS} />);
|
||||
const input = screen.getByLabelText("Message input");
|
||||
const value = "定位原因, 提 @gimp issue, i并提";
|
||||
fireEvent.change(input, { target: { value, selectionStart: value.length } });
|
||||
|
||||
const display = "定位原因, 提 @\u00a0GIMP issue, i并提";
|
||||
const overlay = input.previousElementSibling;
|
||||
expect(input).toHaveValue(display);
|
||||
expect(overlay).toHaveAttribute("aria-hidden", "true");
|
||||
expect(overlay?.textContent).toBe(display);
|
||||
expect(input).toHaveClass("[text-autospace:no-autospace]");
|
||||
expect(overlay).toHaveClass("[text-autospace:no-autospace]");
|
||||
});
|
||||
|
||||
it("renders a CLI app mention logo inline without moving the text cursor slot", () => {
|
||||
render(
|
||||
<ThreadComposer
|
||||
|
||||
Reference in new issue
Block a user