Skip to content

Separate UI and tools into different entrypoints to create a fully headless editor with minimal bundle size #702

@Stopa

Description

@Stopa

First of all, love the package and I think it fills a gap in the ecosystem.

I'm creating this issue to discuss and get alignment on a possible future refactor that would allow this package to be even more useful.

After #697 the package already allows to replace all UI elements and use your own, which is great for uses when the look and feel is meant to come from an external component/design system. The only problem is that right now the bundle still includes some UI components, so they are added to the application's final bundle size even if they're not needed.

What do you think about separating the package like this:

  1. @uiwjs/react-md-editor/core: exports all headless tools and utilities, allowing the user the build a fully custom UI with them

Exports:

  • commands
  • utils
  • types
  • components/TextArea/shortcuts
  • components/TextArea/handleKeyDown
  • Context
  1. @uiwjs/react-md-editor/ui: ready-made React components, allowing the user to quickly integrate an existing editor into their application

Exports:

  • Editor

Bundles LESS styles
Uses the core package internally


Alternatively, they could be separate packages, published separately.

I may be forgetting an import here or there, but I hope this describes the idea.

Do you have any questions, concerns, thoughts on this? Maybe we could agree on a final scope and take this into consideration for the next major version?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions