Skip to content

CodeMirror loses height when removed and re-added to the DOM #519

@kimfucious

Description

@kimfucious

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:

  1. Load sandbox
  2. Note how the height is 500px (this is CodeMirror)
  3. Edit text (press the 'o' key and type some stuff)
  4. Click Show Diffs button (this opens CodeMirrorMerge)
  5. Abandon, Save, or cancel (back to CodeMirror)
  6. Note how the height is no longer set to 500px.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions