-4

Im trying to get the text from a monaco page but it keeps returning the "full" string: image

But this is the code in monaco: image

Here is the code I used:

MessageBox.Show(await Monaco.CoreWebView2.ExecuteScriptAsync("editor.getValue()"), "Monaco text:");

this is in a async function connected to one of my buttons.

Whoman
  • 36
  • 7

1 Answers1

-1

When you have Monaco in C#, you can get the text from webBrowser1 this way:

webBrowser1.Document.InvokeScript("GetText");
Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
Ondřej
  • 11
  • 1
  • thanks for the answer, but all I had to do was `Regex.Unescape` and remove the first and last answer because my issue was that the text was formated in a unusual way, not getting the text – Whoman Aug 29 '22 at 08:59