Skip to content

Commit 201bd27

Browse files
committed
ot server patch
1 parent 57cd874 commit 201bd27

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/realtime/realtime.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,10 @@ function buildAuthorProfilesFromNote(noteAuthors) {
479479

480480
function makeNewServerNote(note) {
481481
const authors = buildAuthorProfilesFromNote(note.authors)
482+
const otServer = new ot.EditorSocketIOServer(note.content, [], note.id, ifMayEdit, operationCallback)
483+
otServer.debug = config.debug
484+
otServer.setLogger(logger)
485+
otServer.setDocumentMaxLength(config.documentmaxlength)
482486

483487
return {
484488
id: note.id,
@@ -494,7 +498,7 @@ function makeNewServerNote(note) {
494498
tempUsers: {},
495499
createtime: moment(note.createdAt).valueOf(),
496500
updatetime: moment(note.lastchangeAt).valueOf(),
497-
server: new ot.EditorSocketIOServer(note.content, [], note.id, ifMayEdit, operationCallback),
501+
server: otServer,
498502
authors: authors,
499503
authorship: note.authorship
500504
}
@@ -652,6 +656,7 @@ function operationCallback(socket, operation) {
652656
return logger.error('operation callback failed: ' + err)
653657
})
654658
}
659+
note.server.isDirty = true
655660
note.tempUsers[userId] = Date.now()
656661
}
657662
// save authorship - use timer here because it's an O(n) complexity algorithm

0 commit comments

Comments
 (0)