sjdemartini / mui-tiptap

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

Don't unmount `RichTextContent` when `variant` changes #82

Closed sjdemartini closed 1 year ago

sjdemartini commented 1 year ago

This consolidates the "outlined" vs "standard" DOM nodes/classes/styles into a single FieldContainer component, rather than conditionally rendering <OutlinedField /> or some other DOM node. With conditional-rendering approach, the {content} was being unmounted whenever the variant changed, which could cause a visual glitch as all Tiptap React node-views would have to re-render (so for instance, images and heading nodes would be temporarily empty during the transition).

Breaking change: the internal component OutlinedField has been renamed to FieldContainer. The associated utility classes like MuiTiptap-OutlinedField-root, MuiTiptap-OutlinedField-notchedOutline, etc are now named as MuiTiptap-FieldContainer-root, MuiTiptap-FieldContainer-notchedOutline, etc.