I've tried in several ways to delete the \r IE adds at the end of each line
I've tried to do it before and after the asynchronous call both in server and client side:

$new_content = str_replace("\r\n", "\n", $new_content);
currentContent = currentContent.replace(/\r\n/g, "\n" );

But IE still add the "invisible" character at the end of the line. As a result, if we delete the end of the line (i.e. merging two lines in one) there will be a wrong replacement length value (i.e. 4 instead of 3) and the content in both users will be different
Sometimes it does an automatic replacement when the user even hasn't typed anything and then enters in a loop of use cases 4->1->2->4->1.... Since the user is sending blank changes to other users

Comments

karens’s picture

Very interesting module!!

Not sure if this is related, but even without a carriage return I can't get IE working right.

I tried opening one window in FF and one in IE and logging in as 2 different users. In IE, the debug window is empty and I get no information in the collaborative edit box (it just says Doc not saved yet), and nothing is saved unless I save the document manually. Meanwhile, the FF window indicates that test2 is logged in, but does not pick up changes. Everything works nicely when using 2 different FF windows as test1 and test2.

ernestd’s picture

Status: Active » Fixed

adding the following line before sending the content to the server:
currentContent = currentContent.replace(/\r/g, "").replace(/\n/g, "\r\n");
we force all browsers to have the same carriage return characters so that we can then calculate the right delta diff as the text will have the same length for the different browsers.

ernestd’s picture

The problem that KarenS reported was probably caused by a wrong line at the drupal.collaborative_editor_ui.js file, where:
el.style.fontStyle = ...
Should be:
el.style.fontFamily = ...

That caused javascript errors in IE and it didn't let the rest of javascript functions of the application work properly.

Anonymous’s picture

Status: Fixed » Closed (fixed)