1

I can't find a getter method in the API docs for monaco editor, is there an example for how to get code that a user has entered in the editor?

Dion Coder
  • 13
  • 2

1 Answers1

2

You can retrieve the code that an user has entered by calling the following method:

// Store your editor in a variable
var codeEditor = monaco.editor.create(...);

// Then, whenever you want to retrieve the code, use this.
var codeFromUser = codeEditor.getValue();

You can find similar answers here: Get the value of Monaco Editor