Repository navigation
feat: open HTML files in bb's rendered preview by default - #5426
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
when i try to open an HTML link, it shows the HTML code, which is annoying sometimes...the PR fixes this to show the rendered preview by default, following the same pattern as for markdown files.
html-preview-bb.mp4
What was wrong
With File Editor enabled, HTML links opened in Monaco because it claimed
.htmland.htm. BB already has a sandboxed HTML viewer with Preview/Raw controls. The viewer also did not recognize.htm, and project file previews on the New thread screen did not supply an HTML content URL.What changed
Leave
.htmland.htmto BB's built-in preview, following the existing Markdown exclusion. Recognize.htmcase-insensitively and pass the existing project file content URL to the shared preview surface. Reuse the existing HTML iframe and Preview/Raw controls without introducing UI components or styling. Update the File Editor documentation.As with Markdown, Monaco is no longer offered for
.htmland.htmin Settings → File openers or the Open with menus. Existing HTML-to-Monaco preferences fall back to BB's preview. HTML remains editable from Monaco's own file tree; the built-in Raw view is read-only.This follows #5054 — Leave Markdown files to BB’s preview in the Monaco plugin: extend the same default-opener behavior to HTML while reusing the existing viewer.
Existing SDK and CLI file-opening paths continue through the shared opener routing; no new API, CLI flag, or daemon wire changes.
How you verified
Regression cases failed before the corresponding fixes and pass after:
.HTMdocument renders and switches through the existing Preview/Raw controls.Checks:
pnpm exec turbo run lint typecheck test --filter=bb-plugin-monaco-editor— 47 tests passed.pnpm exec turbo run test --filter=@bb/app -- src/components/secondary-panel/FilePreview.test.tsx src/components/secondary-panel/ThreadSecondaryPanelTabContent.markdown-images.test.tsx— 40 tests passed.pnpm exec turbo run lint typecheck --filter=@bb/app --filter=@bb/client-core— passed, app lint has existing warnings and no errors.pnpm exec turbo run test --filter=@bb/client-core -- test/file-preview.test.ts— 13 tests passed.git diff --check— passed.Live Chromium verification in an isolated source app with File Editor enabled: opened HTML and HTM through the project file picker, clicked the page's JavaScript button, switched Raw → Preview and confirmed its counter state survived, checked Markdown still renders and TypeScript still opens Monaco, and reloaded the HTML preview. HTML responses retained
Content-Security-Policy: sandbox allow-scripts. No native iOS run.The TypeScript control emitted a Monaco disposal TypeError when switching away; no editor runtime code changed and that separate path was not investigated here.
Independent read-only reviews by GPT-6-Astra (xhigh) and Opus 5.5 (high) found no blocking defects. They inspected the source and existing verification evidence; they did not rerun the test suites or browser checks.