How to get the instance of editor in DOM?

How do I get the instance of the editor in DOM when I have access to the DOM. On the version 5, I can do something like javascript - Get CodeMirror instance - Stack Overflow

//Get a reference to the CodeMirror editor
var editor = document.querySelector('.CodeMirror').CodeMirror;

I’ve implemented a helper function for this in the patch below.

1 Like