@@ -37,7 +37,7 @@ let newHash = '';
37
37
//let newContent = '';
38
38
//let lastHash = '';
39
39
const INTERVALTIMEOUT = 1000 ;
40
- const HEADER = "changes Index: a\n===================================================================" ;
40
+ const HEADER = "changes Index: a\n===================================================================\n " ;
41
41
42
42
const fetchOne = ( methodname , args ) => call ( [ {
43
43
methodname,
@@ -105,7 +105,7 @@ export const register = (editor) => {
105
105
} ) ;
106
106
}
107
107
} ) ;
108
-
108
+ let newContent2 = editor . getContent ( ) ;
109
109
fetchOne ( 'tiny_collaborate_get_changes' , {
110
110
contextid : Options . getContextId ( editor ) ,
111
111
pagehash : Options . getPageHash ( editor ) ,
@@ -116,14 +116,14 @@ export const register = (editor) => {
116
116
if ( result ) {
117
117
for ( let i in result ) {
118
118
let change = result [ i ] ;
119
- c . log ( 'changes' , change ) ;
120
119
let patch = HEADER + change ;
121
- currentContent = jsDiff . applyPatch ( currentContent , patch ) ;
122
- editor . setContent ( currentContent ) ;
123
- sha1 ( currentContent ) . then ( hash => {
124
- currentHash = hash ;
125
- } ) ;
120
+ c . log ( 'changes' , patch ) ;
121
+ newContent2 = jsDiff . applyPatch ( newContent2 , patch ) ;
126
122
}
123
+ editor . setContent ( newContent2 ) ;
124
+ sha1 ( newContent2 ) . then ( hash => {
125
+ currentHash = hash ;
126
+ } ) ;
127
127
}
128
128
} ) ;
129
129
0 commit comments