Billiballa / bilibala-echarts-panel

Echarts panel for grafana
Apache License 2.0
148 stars 52 forks source link

Auto refresh CodeMirror #15

Open bugybq opened 4 years ago

bugybq commented 4 years ago

replace setTimeout(() => this.cm.refresh(), 0); with

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
    });
Billiballa commented 4 years ago

Thanks! but it doesn't solve the display problem.

bugybq commented 4 years ago

display problem 是指啥?用setTimeout也没发现有什么异常

Billiballa commented 4 years ago

image edit panel 界面直接F5刷新后会变成这个样子,初始化时的宽度似乎有问题,导致lineNumber的宽度异常,所以手动调用了refresh()方法。