Skip to content

Commit ecde894

Browse files
committed
working
1 parent e8cb2ef commit ecde894

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lib/editor/tiny/plugins/collaborative/amd/build/collaborater.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/editor/tiny/plugins/collaborative/amd/src/collaborater.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ let newHash = '';
3737
//let newContent = '';
3838
//let lastHash = '';
3939
const INTERVALTIMEOUT = 1000;
40-
const HEADER = "changes Index: a\n===================================================================";
40+
const HEADER = "changes Index: a\n===================================================================\n";
4141

4242
const fetchOne = (methodname, args) => call([{
4343
methodname,
@@ -105,7 +105,7 @@ export const register = (editor) => {
105105
});
106106
}
107107
});
108-
108+
let newContent2 = editor.getContent();
109109
fetchOne('tiny_collaborate_get_changes', {
110110
contextid: Options.getContextId(editor),
111111
pagehash: Options.getPageHash(editor),
@@ -116,14 +116,14 @@ export const register = (editor) => {
116116
if (result) {
117117
for (let i in result) {
118118
let change = result[i];
119-
c.log('changes', change);
120119
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);
126122
}
123+
editor.setContent(newContent2);
124+
sha1(newContent2).then(hash => {
125+
currentHash = hash;
126+
});
127127
}
128128
});
129129

0 commit comments

Comments
 (0)