Reputation: 1280
I just started with Ace online code editor and it looks very powerful and easily customizable. I am using the editor as a syntax highlighter on my website. I wanted to implement line bookmarking functionality like Github Gists on my editor. And since github uses Ace editor, I think it will be possible. But there are lots of api and events in Ace editor and I am confused which one to use.
If somebody has already implemented the above mentioned feature then please help me out with the api and events needed to implement it.
Thanks in advance.
Upvotes: 2
Views: 566
Reputation: 91
I'm use Vue.js
editor.on("mousedown", function(e) {
console.log(e.getDocumentPosition().row);
});
Upvotes: 0
Reputation: 1832
I used this:
editor.on("guttermousedown", function(e){
console.log(e.getDocumentPosition().row);
})
The first line detects every mousedown event that occurs on the "line number" section of the text editor.
e.getDocumentPosition.row detects the row of the mousedown, that matches the number of the line that you've clicked.
That way, you can use other ace actions to what you want with the line you selected.
Upvotes: 4
Reputation: 1280
Okay, I think I figured it out. There is a event 'guttermousedown' which captures the event when the user clicks on the line numbers. Check this github issue
Upvotes: 1