【问题标题】:codemirror - line numbers overlapped with codecodemirror - 行号与代码重叠
【发布时间】:2019-11-20 10:11:37
【问题描述】:

我正在使用最新的 codemirror (v5.49.0)。对于我的电子文本编辑器应用程序,有时行号会与文本重叠。无法重现该错误,因为它并不总是发生。通过多次刷新应用程序可以轻松重现。有人有想法吗?还是这对您来说是一个已知问题?

【问题讨论】:

标签: electron codemirror


【解决方案1】:

我也遇到了这个问题,但对我有用的是来自 Github 的 this answer

const Editor = CodeMirror.fromTextArea(element, { lineNumbers: true });
Editor.refresh();

【讨论】:

  • 自动刷新解决方案对我不起作用 - 确实如此。谢谢@海洋世界
【解决方案2】:

This answer 为我工作。

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,
    // ...

  });



【讨论】:

  • 我正在使用@ctrl/ngx-codemirror,不幸的是这对我不起作用。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-07-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-04-16
  • 2020-08-29
  • 1970-01-01
相关资源
最近更新 更多