问题
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