Giter Club home page Giter Club logo

Comments (10)

Nicolewxyy avatar Nicolewxyy commented on July 17, 2024 8

Use refresh or autorefresh , I require autorefresh.js and set option autoRefresh to true solved it. For more details

from react-codemirror.

aichaoxy avatar aichaoxy commented on July 17, 2024 5

Did you guys really solve this problem ?

I used autoRefresh: true and import 'codemirror/addon/display/autorefresh'; , wrong rendering still remains.

image

from react-codemirror.

davalopar avatar davalopar commented on July 17, 2024 3

I tried refresh() instead and it worked.

Something like this:
componentDidMount() { this.refs.editor.getCodeMirror().refresh(); };

from react-codemirror.

Pau1fitz avatar Pau1fitz commented on July 17, 2024 1

Figured this out and it worked for me

The component that you are using CodeMirror in should look something like this:

class RefreshExample() {

  componentDidMount() {
    this.refs.editor.getCodeMirror().refresh(); 
  }

  render() {
    var options = {
      lineNumbers: true,
    };

    return (
        <CodeMirror ref="editor" options={options} />
    );
  }

}

You need to use ref="editor" to then call this.refs.editor.getCodeMirror().refresh();

from react-codemirror.

rootlinux2 avatar rootlinux2 commented on July 17, 2024 1

Thanks @Pau1fitz it worked for me too

from react-codemirror.

travisperson avatar travisperson commented on July 17, 2024

Has anyone been able to figure this out completely? I am too running into this issue.

from react-codemirror.

ArnaudValensi avatar ArnaudValensi commented on July 17, 2024

I have the same issue too.

from react-codemirror.

devaKumaraswamy avatar devaKumaraswamy commented on July 17, 2024

See http://dorianpula.ca/2015/10/07/adding-a-code-editor-to-rookeries/ for a possible answer. Dorian's suggestion worked for me. But highlighting is still MIA.

from react-codemirror.

devaKumaraswamy avatar devaKumaraswamy commented on July 17, 2024

Should have read the example more carefully. The css in he example (https://github.com/JedWatson/react-codemirror/blob/master/example/src/example.less) includes the necessary css. Still looking for an answer to the highlighting issue - probably not specifying some option.

from react-codemirror.

Nicolewxyy avatar Nicolewxyy commented on July 17, 2024

I have the same issue even if I loaded the codemirror.css

from react-codemirror.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.