markdown_view_mode.ts

The layouts of the markdown file view (DiskfileMarkdownView).

view source

Declarations
#

6 declarations

MARKDOWN_VIEW_MODE_LABELS
#

MARKDOWN_VIEW_MODE_SHORTCUTS
#

MARKDOWN_VIEW_MODES
#

MarkdownViewMode
#

markdown_view_mode.ts view source

MarkdownViewMode

type "split" | "preview" | "source"

import type {MarkdownViewMode} from '@fuzdev/zzz/markdown_view_mode.js';

split shows the source beside its preview, preview the rendered markdown alone, and source the source alone.

to_default_markdown_view_mode
#

markdown_view_mode.ts view source

(content_loaded: boolean): MarkdownViewMode import {to_default_markdown_view_mode} from '@fuzdev/zzz/markdown_view_mode.js';

The mode a file opens in until one is chosen: preview where its content is read-only (not loaded), else split.

content_loaded

whether the file's content was loaded, so it can be edited

type boolean

returns

MarkdownViewMode

to_markdown_view_mode_for_shortcut
#

markdown_view_mode.ts view source

(event: Pick<KeyboardEvent, "code" | "ctrlKey" | "shiftKey" | "altKey" | "metaKey">): MarkdownViewMode | null import {to_markdown_view_mode_for_shortcut} from '@fuzdev/zzz/markdown_view_mode.js';

The mode a keydown switches the markdown view to, or null when it isn't one of MARKDOWN_VIEW_MODE_SHORTCUTS. Matches the physical digit key (event.code), since Shift turns the digit into a layout's symbol, and takes Ctrl on every platform — Cmd+Shift+3 is a macOS screenshot. Ctrl+Shift types no character, so taking it from a textarea loses no input.

event

the keydown event

type Pick<KeyboardEvent, "ctrlKey" | "shiftKey" | "altKey" | "metaKey" | "code">

returns

MarkdownViewMode | null

Imported by
#