Comments (10)
Use refresh or autorefresh , I require autorefresh.js and set option autoRefresh to true solved it. For more details
from react-codemirror.
Did you guys really solve this problem ?
I used autoRefresh: true
and import 'codemirror/addon/display/autorefresh';
, wrong rendering still remains.
from react-codemirror.
I tried refresh() instead and it worked.
Something like this:
componentDidMount() { this.refs.editor.getCodeMirror().refresh(); };
from react-codemirror.
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.
Thanks @Pau1fitz it worked for me too
from react-codemirror.
Has anyone been able to figure this out completely? I am too running into this issue.
from react-codemirror.
I have the same issue too.
from react-codemirror.
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.
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.
I have the same issue even if I loaded the codemirror.css
from react-codemirror.
Related Issues (20)
- Theme syntax highlighting not working HOT 3
- how can I beautify(formatting) code after load HOT 2
- Foldcode not working for me. And not even getting foldgutter. Any help? HOT 3
- Update peerDependencies for react > 16 HOT 1
- Is this library deprecated? HOT 2
- How to integrate codemirror-formatting plugin with react
- Focus lost after typing character HOT 2
- How do I use methods like setSize of an instance?
- How to Set Default Background Color and Default Content Width in Editor?????
- Line numbers sometimes don't load properly using fromTextArea
- Can't use defineMode ?
- beforeChange is not fired?
- autofocus is broken on UnControlled
- how can I use MergeView
- lineNumbers show in preview codemirror
- .
- New project with react-codemirror on typescript HOT 1
- Codemirror syntax highlighting works in preview but not when published
- Support React 17 HOT 1
- When pasting in multi-line values, it pastes twice HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-codemirror.