sjdemartini / mui-tiptap

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

Set editor height to prevent dynamic height changes #198

Closed woigl closed 7 months ago

woigl commented 8 months ago

I want to set the editor height by lines or by pixels.

That means the initial editor without content already has a certain height, which should also stay the same with a lot of content. If required, scrollbars should appear.

Can that be achieved already, or does that require a code improvement?

Shao-fract commented 8 months ago

Hi, try something like wrapping your RichTextField in a box and apply this :

<Box
          sx={{
           "&& .ProseMirror": {
          height: "yourDesiredHeight",
          overflowY: "auto",
        },
      }}
    >
<YourRichTextField/>
</Box>
sjdemartini commented 7 months ago

CSS is indeed the approach I'd recommend, like in the snippet above. Closing out.

It may be worth making CSS overrides (in general) a bit easier for mui-tiptap at some point later, but for now the above is likely the simplest way to handle this use-case.