Che*_*tan 4 javascript codemirror
我正在使用工具栏附带的CodeMirror设计应用程序.由于性能原因,我没有通过异步或异步模式执行lint.
我在工具栏中提供了一个图标,点击这个我正在进行解析并构建错误.但我仍然坚持如何在编辑器中更新lint错误?
任何指针都非常有用.
lint插件为所有调用的Editor实例添加一个"扩展"方法performLint,与编辑器选项结合使用lint: { lintOnChange: false },然后你可以通过调用来调用linter mirror.performLint().
如果你定义自己的lint方法ala
CodeMirror.registerHelper('lint', 'mode', (text) => { /* your cool stuff here */ })
Run Code Online (Sandbox Code Playgroud)
那将被调用performLint().
您是否尝试过使用以下代码动态设置 lint 值?
//enable
editor.setOption("lint",true);
//disable
editor.setOption("lint",false);
Run Code Online (Sandbox Code Playgroud)
您可以在此处查看演示JSFiddle 链接
| 归档时间: |
|
| 查看次数: |
4455 次 |
| 最近记录: |