Save all CodeMirrors on page

谁都会走 提交于 2019-12-13 04:19:52

问题


How I can save() all CodeMirror textareas on one page?


回答1:


You'd have to cache all CodeMirror instances in to an array, and then loop through that array save()'ing each instance.

var CMInstances = [instance1, instance2, ..., instanceN];
for (instance in CMInstances) {
  instance.save();
}

I'd assume at some point in your script you're setting up your CodeMirror instances, so that point would be ideal to cache them.



来源:https://stackoverflow.com/questions/7463644/save-all-codemirrors-on-page

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