Real-time editor for 2 users.

53 views
Skip to first unread message

jandzban1

unread,
Mar 6, 2016, 12:26:15 PM3/6/16
to Ace Internals Dev
So I have a site with 2 instances of editor in it. <div id="first">  and <div id="second"> . I want the <div id="first"> to be editor for each user to edit on his side and <div id="second"> to show what the other user is typing.


This is how want it to work. So far I've been using jquery 
$('#second').empty;
$
('#first').children().clone().appendTo($('#second'));

but it works on client side only. I'm using SignalR for realtime "updating" but this doenst work. I believe the problem lays in the type of data im sending through SignalR. Im sending
$('#first').children().clone()
as object, but maybe there is any Ace built-in function to for example get current text from one editor and so I could use it to append that text to another editor?

Harutyun Amirjanyan

unread,
Mar 10, 2016, 7:40:01 PM3/10/16
to ace-in...@googlegroups.com
editor.getValue and editor.setValue can be used for getting text

if each user can modify only his own document

editor1.on("change", function(d) {
    editor2.session.doc.applyDelta(d)
})

can work

but if both users can edit same document you need to use something like

Reply all
Reply to author
Forward
0 new messages