Skip to content

feat(ui): RichTextEditor + RichText (TipTap), moved from AbstimmBAR — ui 0.4.0 - #5

Merged
rrolf merged 4 commits into
mainfrom
feat/ui-rich-text-editor
Sep 27, 2026
Merged

rrolf merged 4 commits into
mainfrom
feat/ui-rich-text-editor

Conversation

@rrolf

@rrolf rrolf commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

@basicbar/ui 0.4.0 — shared rich-text editor

Moves AbstimmBAR's TipTap rich-text editor into @basicbar/ui so every -bar tool can share it. The first consumer is Ausleihbar (virtUOS/ausleihbar#5); AbstimmBAR can switch over in a later PR.

What's included

  • RichTextEditor (TipTap 3) with bold, italic, H2/H3, bulleted and numbered lists, links and images.
    • Props: value, onChange, optional onUploadImage(file) → Promise<relative URL>, ariaLabel, labelledBy, id.
    • Images are optional. Without onUploadImage there is no image button, and pasted or dropped image files are ignored.
    • Pasted HTML is filtered: any <img> whose src doesn't start with /media/ is dropped. When images are disabled, every pasted <img> is dropped.
    • The editor only offers formatting the shared sanitizer (basicbar_integrations.html_sanitize.clean_html) keeps: underline and strike are disabled, and links carry no target.
    • Keeps AbstimmBAR's "PlainBold", so pasted Word/PDF text doesn't turn bold on its own.
    • Syncing an external value doesn't add an undo step.
  • RichText renders server-sanitized HTML with sensible prose defaults. A caller className replaces the defaults.
  • TranslatableField: the label gets an id, exposed as RenderInputArgs.labelId, so a custom input such as the editor can use aria-labelledby. This is backward compatible.
  • react-dom is now a peer dependency, because @tiptap/react imports it at runtime. TipTap packages are dependencies at ^3.27.2, matching AbstimmBAR.
  • The README gains a "Rich text" section: usage with and without images, renderInput integration, the sanitizer contract, and the translation keys the app must provide. The CHANGELOG has an entry for ui 0.4.0.

Release

After merging, tag ui/v0.4.0. The publish workflow builds the tgz and creates a draft release, which needs to be published manually. Ausleihbar's PR switches to the release URL once it's published.

Testing

  • npm run build succeeds, and dist/index.d.ts exports RichTextEditor, RichTextEditorProps, RichText, RichTextProps and RenderInputArgs (with labelId).
  • Used from a locally packed tgz in Ausleihbar and verified in the browser there:
    • formatting, links and image upload;
    • label wiring and dark mode;
    • pasted external images being dropped.

🤖 Generated with Claude Code

rrolf and others added 4 commits September 27, 2026 11:55
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ency

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…history-safe sync

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant