I am currently developing a real-time collaborative editor using the Ace editor library, but I am facing challenges with inserting text at a specific position within the editor.
Specifically, I am looking to insert text at the cursor position when the user clicks a button.
Below is the code snippet I am working with:
<div ui-ace="aceOptions" ng-model="content"></div>
In my Angular controller, I have the following code:
$scope.aceOptions = {
mode : 'Javascript',
theme : 'dreamweaver'
};
//content of ace editor
$scope.content = "test";
//handling button click to add text
$scope.addTextOnClick = function(){
//I need to retrieve the current cursor position and insert text here
//This text should be added to the existing content
}
I would greatly appreciate any assistance in resolving this issue.