sjdemartini / mui-tiptap

A Material UI (MUI) styled WYSIWYG rich text editor, using Tiptap
MIT License
298 stars 39 forks source link

Lazy load default icon set #263

Open chggib opened 3 weeks ago

chggib commented 3 weeks ago

Is your feature request related to a problem? Please describe.

I really like mui-tiptap. It is easy to use and worked well to sync tiptap with mui. We are undergoing a redesign and using a custom icon set with MUI. Now we don't use material icons. Including the @mui/icons-material bloats the package for me. Material icons are not consistent with the rest of our design. We still use mui for components, theming, and styling.

Describe the solution you'd like

It seems that we can customize extensions by passing custom icons to them. However, looking at the implementation, material icons are being loaded, regardless of whether custom icons have been set.

Instead of directly calling the material icons, you can lazy load them as defaults for non-mapped icons to reduce the bundle size. Thanks!

sjdemartini commented 3 weeks ago

Interesting point and idea. I'd have to see what downsides this presents (if any) for the more common default use-case of using icons-material, but the general idea makes sense to me! Open to a PR if you'd like to make one!