CodeMirror 2 - wrong editor height after hidden textarea unhides

so I have a text box surrounded by a DIV container:

<div>
  <textarea id="code"> some text here </textarea>
</div>

and this text box is converted to a code editor using CodeMirror:

CodeMirror.fromTextArea('code', {
  lineNumbers: true,
  matchBrackets: true,
  mode: 'text/html'
});

the problem is that when the text area container is hidden (sometimes it depends on what the user chooses to display), then after switching to display it, the CodeMirror editor does not look as it should. It shows only one line, and you should actually click inside it to redraw and show correctly.

Does anyone know how to fix this?

+3
source share
1 answer

Refresh()
- ( ) , , , , , , CodeMirror - , .

CodeMirror ( , 2)

+7

All Articles