How to reset Codemirror editor?

☆樱花仙子☆ 提交于 2019-12-04 03:33:30
cm.setValue("");
cm.clearHistory();
// cm.clearGutter("gutterId"); if you have gutters

If you don't want to kill the CodeMirror instance, just change the entire document holding the text, data on markers etc.

This can be done by calling cm.swapDoc(doc: CodeMirror.Doc).

Also, doing cm.setValue(newValue) just sets content of the editor without deleting the CM instance. Doc

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!