Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
47
rated 0 times [  54] [ 7]  / answers: 1 / hits: 17067  / 12 Years ago, mon, april 30, 2012, 12:00:00

I'm using codemirror with textareas in a tabbed interface, when i'm not in the tab that contains codemirror and then go to it, I get empty white space without line numbers or the cursor, when I refresh the page it works, I know it's because the tabs content is hidden using display: none; so how can I fix this issue ?



here's my code, (I'm also using jquery):



var editor = CodeMirror.fromTextArea(document.getElementById($this.attr('id')), {
lineNumbers: true,
mode: text/html,
enterMode: keep,
tabMode: shift
});

$(editor.getScrollerElement()).width(300);
width = $(editor.getScrollerElement()).parent().width();
$(editor.getScrollerElement()).width(width);
editor.refresh();


thanks in advance.


More From » codemirror

 Answers
37

Make sure you also call refresh when switching to the tab that contains the editor.


[#85888] Saturday, April 28, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
josuea

Total Points: 609
Total Questions: 121
Total Answers: 104

Location: South Georgia
Member since Fri, Nov 13, 2020
4 Years ago
josuea questions
;