I am trying to figure out how to write a GreaseMonkey script that would detect whether there is a monaco editor on a webpage, and if there is one, then it would try to retrieve its contents. It seems to be easy to do as long as I have an instance of Monaco editor, but I am struggling to figure out how to find it from within GreaseMonkey script.
Basically, here is an example page with Monaco: https://app.coderpad.io/sandbox
From what I understand, a line like this is executed somewhere to initialize Monaco:
let editor = monaco.editor.create.create(...);
And then the reference to this editor could either be dropped, or not saved in any standard place. At least I wasn't able to find it in document.* or window.*. I only found global variable window.MonacoEnvironment, but it doesn't appear to contain any useful references to editor object itself.
So how can I find reference to editor object(s) from within GreaseMonkey script, that would work reliably on any webpage using reasonably recent version of Monaco? Or is this even possible?
Thanks in advance for any help!