react-ace icon indicating copy to clipboard operation
react-ace copied to clipboard

highlightActiveLine not working properly

Open mpj opened this issue 10 years ago • 2 comments

The current line is not initially highlighted with this setting on true/default. It starts working after a little while after you've clicked on a bunch of lines.

A functioning workaround is to set highlightActiveLine to false on the JSX component, and use ref to grab a reference to the editor, and instead do .setHighlightActiveLine inside componentDidMount. This indicates there is some DOM race condition going on that that react-ace is trying to do something earlier than is possible.

mpj avatar Oct 11 '16 13:10 mpj

Hi @mpj , so how to do?

zetsin avatar Nov 18 '16 08:11 zetsin

Hi @mpj . I found a hack:

onLoad={e => {
  e.setHighlightActiveLine(false)
  e.setHighlightActiveLine(true)
}}

It works to me.

zetsin avatar Nov 18 '16 09:11 zetsin