Code Mirror Detect Change

let editor=CodeMirror.fromTextArea(textArea);                                                                     

//listen for CodeMirror changes
editor.on('change', function(editor){                                   
      let text = editor.doc.getValue()                                        
      console.log(text);                                                      
}); 
Friendly Hawk