Skip to content

Editor inside a flexbox #681

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
frafall opened this issue Feb 8, 2025 · 0 comments
Open

Editor inside a flexbox #681

frafall opened this issue Feb 8, 2025 · 0 comments

Comments

@frafall
Copy link

frafall commented Feb 8, 2025

I am trying to have the MDEditor inside a flex box to fill the available height with no luck,
anyone done this?

To verify my setup I've tested a TextField instead of the MDEditor which worked as it should.

Any suggestions on how to have the edit textarea flexGrow?

Best regards
Morten

Ex

<TextField
   id="content"
   autoFocus
   fullWidth
   type="text"
   name="content"
   label="Content"
   margin="dense"
   onBlur={handleBlur}
   onChange={handleChange}
   value={value}
   helperText={touched.content && errors.content}
   error={Boolean(errors.content && touched.content)}

   multiline
   sx={{
       display: 'flex', 
       flexGrow: 1,
   }}

   InputProps={{
       sx: {
           display: 'flex', 
           flexGrow: 1,
           height: '100%',
           alignItems: 'start'
       }
   }}
/>

and

<MDEditor
   value={value}
   preview="edit"
   hideToolbar={false}
   visibleDragbar={false}
 
   onBlur={handleBlur}
   onChange={(content) => setFieldValue("content", content)}
 
   //height={"100%"}
   height={470}
   
   textareaProps={{ 
       name: 'content',
   }}
/>
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

No branches or pull requests

1 participant