reactjsmonaco-editorreact-monaco-editor

where is the monaco-editor trigger function documentation?


in Monaco-editor in react, I want to manually trigger some keyboard commands and I can't find any suitable documentation for it. for example when you want to enter backspace like this:

editor.trigger('keyboard', 'deleteLeft', null)

or if you want to type something:

editor.trigger('keyboard', 'type', {text: 'hi'})

where are the other commands like 'deleteLeft' or 'type'?

I found some commands in stackoverflow or GitHub issues but it's insufficient. 1- 2 - 3


Solution

  • You can get a list of all supported actions using this code:

            editor.getSupportedActions().forEach((value: Monaco.IEditorAction) => {
                console.log(value);
            });
    

    This helped me to find actions/commands for specific tasks.