Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在一页上保存()所有 CodeMirror 文本区域?
您必须将所有 CodeMirror 实例缓存到一个数组中,然后在该数组中循环遍历save()每个实例。
save()
var CMInstances = [instance1, instance2, ..., instanceN]; for (instance in CMInstances) { instance.save(); }
我假设在您的脚本中的某个时刻您正在设置您的 CodeMirror 实例,因此该点将是缓存它们的理想选择。