Unable to get text from a Monaco editor using Shortcuts action extension

I’m trying to get the text from Monaco, an editor that runs on a webpage.

I have something that works from the browser development tools on a regular computer also with Safari on the phone, but I cannot get the same thing to work from the Shortcuts action extension.

As a example I tried this page:
https://microsoft.github.io/monaco-editor/playground.html

Checking with developer tools there should be a global variable “monaco” but this is missing when evaluating from the action extension.

What could be happening and how can I access this editor?

In a very quick scan of the source I can see some references in the JavaScript to iFrames and in the DOM. Perhaps the variable is only available for reference within the scope of the frame?

1 Like

Somehow things assigned to window global variables is inaccessible in the action extension. I looks like you are mainly supposed to access through document.

I tried with the most basic example:
https://workingcopyapp.com/temp/window.html

<script>
   window.hello = "Hello World!";
   document.write(window.hello);
</script>

and window.hello isn’t available from the “Run JavaScript on Web Page”.

Right. iFrames have always been a pain to navigate into. At least from in-page javascript.