Skip to content

Add MarkdownEditor with formatting, preview and configurable completion - #393

Merged
einari merged 5 commits into
mainfrom
feature/markdown-editor
Oct 1, 2026
Merged

einari merged 5 commits into
mainfrom
feature/markdown-editor

Conversation

@einari

@einari einari commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Added

  • MarkdownEditor (@cratis/components/MarkdownEditor): a markdown editor with a formatting toolbar, keyboard shortcuts, a write/preview toggle and file uploads, styled through --cratis-* tokens and pt parts (part of Cratis/Direct#1275)
  • Configurable completion for MarkdownEditor: give it trigger characters or patterns (for example #) and a callback that returns suggestions. The editor shows the list and inserts the chosen item (part of Cratis/Direct#1275)

A controlled markdown editor published as the ./MarkdownEditor subpath:
one bordered box with a formatting toolbar and a round corner toggle
that swaps it to a host-rendered preview.

- Completion is generic: a MarkdownCompletion names a string or RegExp
  trigger and a suggest callback. The editor recognizes the trigger at
  the caret, debounces, aborts and drops stale answers, renders the list
  at the caret above any dialog, and inserts the picked suggestion.
- Pasted and dropped files upload through an uploadFile callback behind
  a placeholder that is resolved by value, or removed on failure.
- No markdown renderer ships: renderPreview hands rendering and
  sanitization to the host, so the subpath adds no dependencies.
- Stable parts, labels with English defaults, and a toolbar with one
  Tab stop and Control/Command shortcuts.
Give styles.MarkdownEditor.css its measured per-area ceiling, and move
the aggregate ceilings by what the editor's rules measured: raw to
210 KiB and gzip to 33 KiB. The aggregate had 54 gzip bytes of
headroom before the editor, whose rules were already cut to what they
need.
@einari einari added the minor label Oct 1, 2026
@einari
einari merged commit e9f644a into main Oct 1, 2026
2 checks passed
@einari
einari deleted the feature/markdown-editor branch October 1, 2026 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant