Open bugybq opened 4 years ago
replace setTimeout(() => this.cm.refresh(), 0); with
setTimeout(() => this.cm.refresh(), 0);
import 'codemirror/addon/display/autorefresh'; ... componentDidMount() { this.cm = CodeMirror.fromTextArea(this.editorRef.current, { theme: 'ayu-mirage', mode: 'javascript', tabSize: 2, autoRefresh: true, // https://codemirror.net/doc/manual.html#addon_autorefresh });
Thanks! but it doesn't solve the display problem.
display problem 是指啥?用setTimeout也没发现有什么异常
edit panel 界面直接F5刷新后会变成这个样子,初始化时的宽度似乎有问题,导致lineNumber的宽度异常,所以手动调用了refresh()方法。
refresh()
replace
setTimeout(() => this.cm.refresh(), 0);
with