Monaco-editor: Documentation - How to find documentation to find how to hook into events such as selection of text

Created on 26 Sep 2016  路  4Comments  路  Source: microsoft/monaco-editor

monaco-editor npm version: 0.6.1
Browser: Latest Chrome
OS: OSX El Captain

Hi,

Firstly I'd like to apologise for such a basic query.
Background to query: I've successfully integrated the Monaco editor into a fairly large react application. Within this application, the editor is used to author JSON objects. My aim is to do some data processing when a user selects a part of the JSON structure, thus hoping to have a listener for selection events.

I've had a good look through a number of documentation pages and can't locate information in regards to hooking into (what is assumed) events such as users selecting text.

  • I can successful retrieve text selection, merely wish to hook into an event of some kind.

Thanks,
Aaron

All 4 comments

Apologies for the lacking documentation. I haven't yet found a good tool that can generate good HTML documentation from a .d.ts file.

The API is expressed in monaco.d.ts that comes with the npm module. Usually, editors are able to consume such files and drive a decent intellisense experience ... Have you tried VS Code ;)...

The API is also updated from time to time (when we update the website) here -- https://github.com/Microsoft/monaco-editor/blob/master/website/playground/monaco.d.ts.txt

TL;DR editor.onDidChangeCursorSelection(function(e) { console.log(e); })

Tip: If you go in the playground, IntelliSense is set up properly there

https://microsoft.github.io/monaco-editor/playground.html

intellisense

Ah thank you, this is ideal.

Will take a look at intellisense for this kind of work, I do have VS 2015 on my Windows machine. Currently using Intellij, it should hopefully provide some support for this.

I recommend Visual Studio Code -- built with this editor :) -- https://code.visualstudio.com/

Just installed and setup, looks excellent!

Thanks for the recommendation.

Was this page helpful?
0 / 5 - 0 ratings