Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(chat): the inline preview keeps a width of its own (B29, Mac run)

purple0bff1a6b27f3
diff --git a/src/components/chat/CodeBlock.tsx b/src/components/chat/CodeBlock.tsx
index 774a466c..213a90e6 100644
--- a/src/components/chat/CodeBlock.tsx
+++ b/src/components/chat/CodeBlock.tsx
@@ -217,7 +217,10 @@ export function CodeBlock({ code, language }: Props) {
{preview !== 'off' && (
<Suspense fallback={null}>
{preview === 'inline' && (
- <div className="h-[360px]">
+ // The panel has no width of its own (the frame is 100%), and an
+ // answer bubble sizes to its content: without a wish the block
+ // shrank to the toolbar (Mac run). 48rem, never wider than the column.
+ <div className="h-[360px] w-[48rem] max-w-full" data-testid="code-preview-inline">
<HtmlPreviewPanel
code={code}
language={language}
diff --git a/src/components/chat/__tests__/html-preview-b29.test.tsx b/src/components/chat/__tests__/html-preview-b29.test.tsx
index 0d4b9ed2..4085c285 100644
--- a/src/components/chat/__tests__/html-preview-b29.test.tsx
+++ b/src/components/chat/__tests__/html-preview-b29.test.tsx
@@ -62,6 +62,8 @@ describe('B29: preview only on the user\'s click', () => {
const frame = container.querySelector('iframe')!
expect(frame.getAttribute('sandbox')).toBe('allow-scripts')
expect(frame.getAttribute('referrerpolicy')).toBe('no-referrer')
+ // Mac run: without a width wish the answer bubble shrank around the toolbar.
+ expect(screen.getByTestId('code-preview-inline').className).toMatch(/\bw-\[48rem\] max-w-full\b/)
// Back to code takes the frame away again.
fireEvent.click(screen.getByTestId('code-preview-button'))
expect(container.querySelector('iframe')).toBeNull()