Reputation: 323
I'm working on a real-time collaborative editor within Ace editor, and I couldn't find any docs on inserting text at a certain position within the editor (Aka, the position the other user types at.) Any ideas?
Upvotes: 19
Views: 10105
Reputation: 10575
To insert at current position you can use ( assuming that might be what you are looking for )
editor.session.insert(editor.getCursorPosition(), text)
Upvotes: 37
Reputation: 24169
use editor.session.insert(position, text)
where position is an object of the form {row:number, column:number}
However this alone won't help to make collaborative editor. take a look at share.js which supports Ace.
Upvotes: 20