Skip to content

Extras

MarkdownEditor

Bit.BlazorUI.ExtrasMdEditor

BitMarkdownEditor is a dependency-free markdown editor built on a plain textarea: a data-driven toolbar, keyboard shortcuts, smart list continuation, undo/redo, find & replace, table tools, image paste/drop/pick upload, autosaved drafts and EditForm validation, with a live GitHub-flavored preview rendered by the BitMarkdownViewer. Every command is a pure C# text transformation, and the toolbar, menus, panels and dialog follow the keyboard and ARIA patterns of their roles.

Forms & accessibility

Localized strings, EditForm validation and focus, and how the textarea, the toolbar and its panels are named, described and driven from the keyboard.

Localization

Strings holds every string the editor renders - tooltips, accessible names, status bar templates, panels and announcements. Override only what you need; the counts are {0} templates so the translation owns the word order.

Un éditeur localisé

Chaque libellé de l'éditeur vient du paramètre Strings : survolez la barre d'outils, ouvrez la recherche ou lisez la barre d'état.

Partagé 25 mots 159 caractères1 min de lecture

Forms & accessibility

Inside an EditForm, @bind-Value ties the editor to its field: edits are validated as typed, and a failing field gets aria-invalid and the error border. Label (or LabelTemplate) names the textarea, Description (or DescriptionTemplate) describes it, Required marks it, Name posts it with a plain form, and OnSubmit makes Ctrl/Cmd+Enter submit. OnFocus, OnBlur, Focus, Blur and AutoFocus handle the focus.

Nothing to preview yet.
Markdown is supported. Press Ctrl+Enter to publish.
Split 0 words 0 chars


Accessibility

The text is typed into a plain textarea. A Label names it through its for attribute; with no label the EditorAriaLabel of Strings ("Markdown editor") names it, and an AriaLabel overrides both. Description and, while MaxLength is set, the status bar's character counter describe it through aria-describedby. Required adds aria-required, and Disabled adds disabled and aria-disabled.

The toolbar is a role="toolbar" named by ToolbarAriaLabel, and one tab stop: the arrow keys move between its enabled buttons (mirrored in RTL), and Home / End jump to the first and the last. Every button has an aria-label, plus aria-keyshortcuts when its item has a Shortcut. The format buttons (bold, italic, strikethrough, inline code, quote, the lists) report the format at the caret through aria-pressed, and the find, full-screen and help buttons report their panel the same way. A menu button (aria-haspopup="menu", aria-expanded) opens on Enter, Space or Arrow Down with the focus on its first item; Arrow Up / Down, Home and End move through it, and Escape closes it back onto its button. The heading levels are menuitemradio items with aria-checked. A command run from the toolbar returns the focus to the textarea it changed. ReadOnly disables, with aria-disabled, the buttons that change the text and keeps the rest; Disabled disables them all.

In the textarea Tab and Shift+Tab indent and outdent, or walk the cells of a table. Escape followed by Tab or Shift+Tab always moves the focus out, and with TabIndents off or ReadOnly on Tab moves it out directly. In full-screen the focus cycles inside the editor, and Escape leaves full-screen. Ctrl/Cmd+/ (or the ? button) opens a modal role="dialog" that lists every shortcut; it keeps Tab inside, and Escape or Ctrl/Cmd+/ closes it and returns the focus to the editor.

A plain Escape closes, one per press, the shortcuts dialog, then the find panel, then full-screen. The editor claims only the Escape it acts on: a dialog the editor sits in stays open on that press, and closes on one the editor leaves alone. The find panel is a named role="region" that opens with the focus in its find box: its match count is a polite live region, Aa reports aria-pressed, and Escape returns the focus to the editor.

The preview pane is a focusable role="group" named by PreviewAriaLabel, so the arrow keys can scroll it, and F9, F11, Ctrl/Cmd+/ and Escape work from it too. It is not a live region, so its updates while typing are not announced. Cycling the mode with F9 or the eye button is announced ("Preview mode") through a polite live region; a Mode set from code is not. When a mode change hides the pane that has the focus, the focus moves to the visible one.

Try it with the keyboard:

Keyboard tour

  • Tab indents this item, Shift+Tab outdents it
  • Escape, then Tab, moves the focus out
Tabwalks
thecells

F9 cycles the panes, F11 goes full-screen and Ctrl+/ lists every shortcut.

Split 46 words 228 chars

Feedback

Found a mistake, a gap, or something that could be clearer? Every page and every component is one click from its source.