React-ace: Editor line-height 'pops' after loading.

Created on 20 Jun 2017  路  4Comments  路  Source: securingsincity/react-ace

Problem

When the editor first loads, the lines of text are vertically squished as if the line-height property were set to about half the normal value. After about 1/2 a second, the editor repaints and the lines look normal.

I've attempted to work around this in a bunch of ways (explicitly setting line-height in the css for example) and none of my efforts have had any effect.

This is mainly a cosmetic issue, it doesn't affect editor functionality but it does look unsightly.

Here are two screen shots showing what it looks like before and after the pop:

editor_before

editor_after

Sample code to reproduce your issue

My editor configuration is fairly minimal, the only thing unusual is that I'm using percentages for width and height:

<AceEditor
  mode={mode}
  theme="twilight"
  width="100%"
  height="100%"
  focus
  tabSize={2}
  ref={el => { this.editor = el; }}
  editorProps={{ $blockScrolling: true }} />
bug issue with ace

Most helpful comment

This is due to the fact that the line height is being calculated at run time.
Till the time the actual fix is rolled out, you can use the below hack.

Override the .ace_line css class with the minimum height that your code block is expected to render.

You can see what is the actual height that your editor is rendering using developer tools.
Use this as minHeight inside the overriden .ace_line class.

screen shot 2018-04-10 at 4 30 05 pm

All 4 comments

@securingsincity Is it still open? Can I work on this one?

I'm running into this as well and it's a bit unsightly as the contents of the editor can change frequently/easily and the line height "pops" every time. Will this be fixed soon?

This is due to the fact that the line height is being calculated at run time.
Till the time the actual fix is rolled out, you can use the below hack.

Override the .ace_line css class with the minimum height that your code block is expected to render.

You can see what is the actual height that your editor is rendering using developer tools.
Use this as minHeight inside the overriden .ace_line class.

screen shot 2018-04-10 at 4 30 05 pm

Any word on if this will actually be fixed? Still seeing it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nenadlukic picture nenadlukic  路  6Comments

levi0913 picture levi0913  路  7Comments

tsmirnov picture tsmirnov  路  4Comments

kolbinski picture kolbinski  路  5Comments

Lyeed picture Lyeed  路  3Comments