-
-
Notifications
You must be signed in to change notification settings - Fork 132
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 loses height when removed and re-added to the DOM #519
Comments
I can't view your example |
<CodeMirrorMerge
orientation={orientation}
revertControls={revertControls}
collapseUnchanged={collapseUnchanged}
highlightChanges={highlightChanges}
gutter={gutter}
+ style={{ height: 300, overflow: 'auto' }}
theme={theme}
>
<Original value={originalCode} extensions={[langs.javascript()]} />
<Modified
value={modifiedCode}
extensions={[langs.javascript(), EditorView.editable.of(false), EditorState.readOnly.of(true)]}
/>
</CodeMirrorMerge> |
Sorry, try this link. |
@kimfucious |
Thanks for that, @jaywcjlove. I did try it, and unfortunately the Vim panel placement gets lost.
|
Hi @jaywcjlove, I'm not sure that you're interested, but the highlighted line in the HTML code below is what controls the position of the Vim status bar. No amount of fiddling seems to reset this except for a full browser refresh. If I do edit the HTML with dev tools like the below, if does move the status bar down: <div class="cm-panels cm-panels-bottom" style="top: 500px;"> This means that I can also update the I can't see a way to control this here: <CodeMirror
autoFocus
basicSetup={{
foldGutter: false,
highlightActiveLine: false,
}}
value={state.draftActiveSceneText}
theme={isDark ? "dark" : solarizedLight}
height={height}
width={`calc(36em + 74px)`}
extensions={[
vim({ status: true }), // <= can't do anything here
markdown(),
EditorView.lineWrapping,
EditorView.contentAttributes.of({ spellcheck: "true" }),
]}
onChange={onChange}
style={{ fontSize: editorFontSize }}
/> That said, these are workarounds. I think the real issue is that |
I don't understand exactly what you want to do in your description. |
Hi @jaywcjlove, Sorry for the confusion. While the height of the CodeMirror editor is preserved when using height with Follow these steps to see:
|
@kimfucious Upgrade |
@jaywcjlove thank you very much; you are a 🌟! |
If I create a
CodeMirror
instance and set it with a height, it will initially show with the correct height.If the component with the
CodeMirror
is removed from and returned to the DOM via conditional rendering, the height is lost.I've created a sandbox here to demonstrate.
Steps to reproduce:
I've read that there is a refresh and/or an autorefresh cm command that might address this issue, but you probably know better than I do.
The text was updated successfully, but these errors were encountered: