I'm using codemirror latest (v5.49.0). for my electron text editor app, sometimes line numbers are rendered overlapped with the text. cannot reproduce the bug because it doesn't happen always. easily it can reproduce by refreshing the app several times. Anyone have an idea? or may be this is a known issue for you?
I was having this issue as well but what worked for me was this answer from Github.
const Editor = CodeMirror.fromTextArea(element, { lineNumbers: true });
Editor.refresh();
This answer worked for me.
import CodeMirror from 'codemirror';
import htmlembedded from 'codemirror/mode/htmlembedded/htmlembedded';
import js from 'codemirror/mode/javascript/javascript';
import 'codemirror/lib/codemirror.css';
import 'codemirror/addon/display/autorefresh';
// ...
const codeEditor = CodeMirror.fromTextArea(this.$('#isCalculatedValueTextField')[0], {
lineNumbers: true,
autoRefresh:true,
// ...
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With