mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-21 16:10:19 +01:00
80ee0a3563
## Summary Markdown files can now open in preview by default, but there's no discoverable way back to the raw source. `markdown::CloseAndReturnToEditor` exists (`cmd-shift-v` / `ctrl-shift-v`), but nothing in the UI points to it. This adds a "Show Source" entry to the preview tab's context menu that triggers that action. Tab menu entries that dispatch actions only work on the active tab. Inactive tabs aren't rendered, so they aren't in the dispatch tree and never receive the action. Because of that: - "Show Source" only appears when the preview is the active tab. - The editor's "Open Markdown Preview" and "Open SVG Preview" entries had the same problem, so they're now hidden on inactive tabs too. ## Testing - `cargo test -p markdown_preview` - `./script/clippy -p markdown_preview -p editor` - Manually verified on macOS: - Right-click the active Markdown preview tab → "Show Source" closes the preview and focuses the source editor. - Right-click an inactive preview tab or inactive Markdown editor tab → no preview entries are shown. To try it: open any `.md` file in preview, right-click the preview tab, choose "Show Source". ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - Added a "Show Source" option to the Markdown preview tab context menu. - Fixed "Open Markdown Preview" and "Open SVG Preview" appearing in the tab context menu of inactive tabs, where they had no effect.