Răsfoiți Sursa

Pass option to encode range

To ensure backwards compat with clients not refreshing, pass a flag to enable
encoding.  This way, old client won't receive encoded ranges, but also won't
have decoding logic. The flag can then be removed once all clients are up to
date
Alasdair Smith 9 ani în urmă
părinte
comite
e2bb6dcecb
1 a modificat fișierele cu 2 adăugiri și 2 ștergeri
  1. 2 2
      services/web/public/coffee/ide/editor/Document.coffee

+ 2 - 2
services/web/public/coffee/ide/editor/Document.coffee

@@ -252,7 +252,7 @@ define [
 
 		_joinDoc: (callback = (error) ->) ->
 			if @doc?
-				@ide.socket.emit 'joinDoc', @doc_id, @doc.getVersion(), (error, docLines, version, updates, ranges) =>
+				@ide.socket.emit 'joinDoc', @doc_id, { encodeRanges: true }, @doc.getVersion(), (error, docLines, version, updates, ranges) =>
 					return callback(error) if error?
 					@joined = true
 					@doc.catchUp( updates )
@@ -260,7 +260,7 @@ define [
 					@_catchUpRanges( changes, comments )
 					callback()
 			else
-				@ide.socket.emit 'joinDoc', @doc_id, (error, docLines, version, updates, ranges) =>
+				@ide.socket.emit 'joinDoc', @doc_id, { encodeRanges: true }, (error, docLines, version, updates, ranges) =>
 					return callback(error) if error?
 					@joined = true
 					@doc = new ShareJsDoc @doc_id, docLines, version, @ide.socket