suren-atoyan / monaco-react

Monaco Editor for React - use the monaco-editor in any React application without needing to use webpack (or rollup/parcel/etc) configuration files / plugins

Home Page:https://monaco-react.surenatoyan.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The editor does not shirnk its hight if the window / parant size shrinks.

Wissperwind opened this issue · comments

Hi,

I use the editor with 100% height and 100% width. So it fills the parent object. If I enlarge and shrink the browser window by mouse dragging horizontally, the editor perfectly adjusts its size. It grows and it shrinks. But that is not the case if I adjust the height. It grows, if I enlarge the browser window. But it does not get smaller in hight if I make the browser window smaller in height. Instead a scrollbar at the parent object appears.

just bumped into the same issue.

I see the height is being calculated in pixels when it grows but not when it shrinks. I guess I'm also curious to understand why the editor is using a static unit instead of height: 100% in these cases

Do you think it's related to the React wrapper or the original monaco-editor library? Maybe you can check your case in the monaco playground

Hi @suren-atoyan, I've just tested my usecase in the monaco playground and the height seems to be correctly adapting when shrinking the window. For context, I'm looking at the height inlined property of the <div class="monaco-editor"/> container

If the issue is in the wrapper we should be able to fix it by changing the styles of this element. This is the only extra element react-monaco is adding to the monaco.