File tree Expand file tree Collapse file tree
packages/open-collaboration-monaco/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -496,7 +496,7 @@ export class CollaborationInstance implements Disposable {
496496 value = debounce ( ( ) => {
497497 this . yjsMutex ( ( ) => {
498498 const yjsText = this . yjs . getText ( path ) ;
499- const newContent = yjsText . toString ( ) ;
499+ const newContent = this . adjustEol ( yjsText . toString ( ) , document . getEndOfLineSequence ( ) ) ;
500500 if ( newContent !== document . getValue ( ) ) {
501501 this . updateDocumentContent ( document , newContent ) ;
502502 }
@@ -657,4 +657,9 @@ export class CollaborationInstance implements Disposable {
657657 return decoder . decode ( file . content ) ;
658658 }
659659 }
660+
661+ private adjustEol ( text : string , eol : monaco . editor . EndOfLineSequence ) : string {
662+ const newEol = eol === monaco . editor . EndOfLineSequence . LF ? '\n' : '\r\n' ;
663+ return text . replace ( / \r ? \n / g, newEol ) ;
664+ }
660665}
You can’t perform that action at this time.
0 commit comments