feat: open .html files in built-in browser pane#1427
feat: open .html files in built-in browser pane#1427shreyaspapi wants to merge 4 commits intogeneralaction:mainfrom
Conversation
|
@shreyaspapi is attempting to deploy a commit to the General Action Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryThis PR adds "Open in Browser Pane" to the file explorer context menu for Key changes:
Confidence Score: 4/5
|
| Filename | Overview |
|---|---|
| src/renderer/lib/browserPaneUtils.ts | New utility module with three helpers. isHtmlFile and normalizeAddressBarUrl are correct and well-tested. buildFileUrl has a Windows path bug: omits the required third slash when rootPath doesn't start with / (e.g. C:/... on Windows), producing file://C:/... instead of file:///C:/.... |
| src/renderer/components/BrowserPane.tsx | Two clean changes: (1) pointer-events-auto moved from the full-screen wrapper to the inner pane div, correctly fixing the mouse-event blocking bug; (2) inline address-bar URL normalisation replaced with the new normalizeAddressBarUrl utility, which also adds file:// support. Both changes are correct. |
| src/renderer/components/FileExplorer/FileTree.tsx | Adds "Open in Browser Pane" context menu item, correctly guarded by node.type === 'file' and isHtmlFile(node.name). The handleOpenInBrowser callback is properly memoised with useCallback. The callback delegates path building to buildFileUrl(rootPath, node.path), consistent with how other handlers join these two values. |
| src/test/renderer/browserPaneUtils.test.ts | Good coverage for isHtmlFile and normalizeAddressBarUrl. buildFileUrl tests only exercise Unix-style paths; no Windows-style drive-letter paths (e.g. C:/...) are tested, leaving the Windows bug undetected. |
Sequence Diagram
sequenceDiagram
participant User
participant FileTree
participant browserPaneUtils
participant BrowserProvider
participant BrowserPane
participant ElectronAPI
User->>FileTree: Right-click .html file
FileTree->>FileTree: isHtmlFile(node.name) → show menu item
User->>FileTree: Click "Open in Browser Pane"
FileTree->>browserPaneUtils: buildFileUrl(rootPath, node.path)
browserPaneUtils-->>FileTree: file:///root/path/to/file.html
FileTree->>BrowserProvider: browser.open(fileUrl)
BrowserProvider->>BrowserProvider: navigate(fileUrl) → setUrl(fileUrl)
BrowserProvider->>ElectronAPI: browserLoadURL(fileUrl)
BrowserProvider->>BrowserProvider: setOpen(true)
BrowserPane->>BrowserPane: paneVisible=true, shouldShow=true
BrowserPane->>ElectronAPI: browserShow(bounds, fileUrl)
ElectronAPI-->>User: HTML file rendered in browser pane
Last reviewed commit: 5043944
Ensure the joined path always starts with / before prepending file:// so Windows paths like C:/Users/... produce file:///C:/Users/... (three slashes) instead of the malformed file://C:/... Also normalise backslashes to forward slashes. Adds Windows path test coverage.
|
Thanks! @shreyaspapi |
Screen.Recording.2026-03-13.at.12.24.28.PM.mov |
Summary
Adds the ability to open local
.html/.htmfiles in Emdash's built-in browser pane directly from the file explorer context menu. Also fixes a pre-existing bug where the browser pane's full-screen overlay blocked mouse events on the editor and sidebar.Changes:
.html/.htmfiles. UsesuseBrowser().open()to load afile://URL in the built-in browser pane.pointer-events-autofrom the full-screen outer wrapper to the inner pane div, so the editor and sidebar remain interactive when the browser pane is open. Also updated the address bar regex to acceptfile://URLs without prependinghttp://.Fixes
Fixes #1421
Snapshot
To be added
Type of change
Mandatory Tasks
Checklist
pnpm run format)pnpm run lint)