mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
First pass at decoding changes & comments in ranges
This commit is contained in:
parent
e2547e0051
commit
24f44889a7
1 changed files with 24 additions and 2 deletions
|
@ -256,14 +256,36 @@ define [
|
|||
return callback(error) if error?
|
||||
@joined = true
|
||||
@doc.catchUp( updates )
|
||||
@_catchUpRanges( ranges?.changes, ranges?.comments )
|
||||
|
||||
if ranges?.changes
|
||||
changes = for change in ranges.changes
|
||||
change.op.i = decodeURIComponent(escape(change.op.i)) if change.op.i
|
||||
change.op.d = decodeURIComponent(escape(change.op.d)) if change.op.d
|
||||
change
|
||||
if ranges?.comments
|
||||
comments = for comment in ranges.comments
|
||||
comment.op.c = decodeURIComponent(escape(comment.op.c))
|
||||
comment
|
||||
|
||||
@_catchUpRanges( changes, comments )
|
||||
callback()
|
||||
else
|
||||
@ide.socket.emit 'joinDoc', @doc_id, (error, docLines, version, updates, ranges) =>
|
||||
return callback(error) if error?
|
||||
@joined = true
|
||||
@doc = new ShareJsDoc @doc_id, docLines, version, @ide.socket
|
||||
@ranges = new RangesTracker(ranges?.changes, ranges?.comments)
|
||||
|
||||
if ranges?.changes
|
||||
changes = for change in ranges.changes
|
||||
change.op.i = decodeURIComponent(escape(change.op.i)) if change.op.i
|
||||
change.op.d = decodeURIComponent(escape(change.op.d)) if change.op.d
|
||||
change
|
||||
if ranges?.comments
|
||||
comments = for comment in ranges.comments
|
||||
comment.op.c = decodeURIComponent(escape(comment.op.c))
|
||||
comment
|
||||
|
||||
@ranges = new RangesTracker(changes, comments)
|
||||
@_bindToShareJsDocEvents()
|
||||
callback()
|
||||
|
||||
|
|
Loading…
Reference in a new issue