保存所有CodeMirror在页面上 [英] Save all CodeMirrors on page

查看:141
本文介绍了保存所有CodeMirror在页面上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在一页上 save()所有CodeMirror文本区域?

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

推荐答案

您必须将所有CodeMirror实例缓存到一个数组中,然后遍历该数组 save()<

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();
}

我假设脚本中的某个时刻正在设置CodeMirror实例,因此最好将其缓存。

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.

这篇关于保存所有CodeMirror在页面上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆