Files
orca/src/shared/markdown-default-view-mode.ts
T
NeilandClaude c5f9ce8e6f feat(editor): default Markdown view setting + right-click on the view switcher (#38106)
* feat(editor): add a default Markdown view setting with a switcher right-click menu

Markdown files can now open in Source instead of Rich Editor. The choice
lives in Settings > General > Editor and in a right-click menu on the
editor's view switcher. Changing it keeps already-open tabs on their
current view; the right-clicked tab follows the new default.

Closes #38102

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(editor): switch the right-clicked tab through the normal view toggle

Picking a default from the switcher menu now goes through the same
handler as clicking a segment, so a tab showing Changes or a plugin
editor leaves it for the chosen Markdown view.

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-04 02:33:24 -08:00

10 lines
500 B
TypeScript

/** The view a newly opened Markdown file starts in; per-tab toggles still override it. */
export type MarkdownDefaultViewMode = 'source' | 'rich'
export const DEFAULT_MARKDOWN_DEFAULT_VIEW_MODE: MarkdownDefaultViewMode = 'rich'
/** Profiles saved before the setting existed (or with a malformed value) keep opening in Rich. */
export function normalizeMarkdownDefaultViewMode(value: unknown): MarkdownDefaultViewMode {
return value === 'source' ? 'source' : DEFAULT_MARKDOWN_DEFAULT_VIEW_MODE
}