-
-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
codemirror is empty when inside element with display:none #61
Comments
Did you try calling .refresh() after un-hiding the editor? |
i tried it but after everything was loaded. i used it in a slide effect, so i would slide in and then call refresh. another solution is not there or? just giving it 100% or so? or copy the height of the textarea? (hm is alos not possible if its in a div with display none or?) |
another question. is there a fix in sight for the cursor position when on a line ending? |
When display is none, no elements report any kind of valid width, height, or offset numbers, so CodeMirror can't lay itself out. Thus, after the display: none is removed (visibility: hidden, or being scrolled/clipped out of view is okay), you should call refresh to make it re-layout. As for cursor position on a line ending, I don't know of any problem there. Please open a new issue with a more specific description of the problem (including the browser you're using). |
Force display update after doing a page scroll
select the class of '.CodeMirror' and instance the object for refresh when change size For example in my case I want to click a button to add and remove an 'active' class to make the content of CodeMirror appear and disappear.
CodeMirror Object
Event of btn
Solution
|
when i have a textarea which is inside a div with display:none; the codemirror area is empty.
when i set the height of any div inside the codemirror div larger than the height of the codemirror div a scrollbar appears, (but the div is still empty) when i then scroll the conten appears.
i think it have to do with calculated size of the CodeMirror-gutter, which can not be done when its inside a display:none block.
The text was updated successfully, but these errors were encountered: