Getting console error: doc.iter is not a function

Hi team,

I am using CodeMirror plugin in Umbraco-8 cms. It was supporting with umbraco-7 version. I am getting error in console: doc.iter is not a function
From below line of code in codemirro.js file -
function estimateLineHeights(cm) {
var doc = cm.doc, est = estimateHeight(cm);
doc.iter(function (line) {
var estHeight = est(line);
if (estHeight != line.height) { updateLineHeight(line, estHeight); }

Kindly resolve my issue.