File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed 
component/src/utils/paste/CSV Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ export class ParseCSVClipboardText {
66  public  static  readonly  NEW_LINE_SYMBOL  =  '\\n' ; 
77  private  static  readonly  EXPLICIT_TAB_SYMBOL  =  '\\\\t' ; 
88  private  static  readonly  EXPLICIT_NEW_LINE_SYMBOL  =  '\\\\n' ; 
9+   private  static  readonly  WINDOWS_NEW_LINE_SYMBOL  =  '\\r\\n' ; 
10+   private  static  readonly  EXPLICIT_WINDOWS_NEW_LINE_SYMBOL  =  '\\\\r\\\\n' ; 
911
1012  private  static  preprocessText ( multiLineString : string ) : string  { 
1113    let  newString  =  multiLineString ; 
@@ -20,6 +22,17 @@ export class ParseCSVClipboardText {
2022
2123  private  static  getSeparatorSymbols ( multiLineString : string ) : { newLine : string ;  tab : string }  { 
2224    // occurs when pasting string that contains actual \n or \t symbols 
25+ 
26+     // Handle Windows-style line endings (`\r\n`) 
27+     if  ( multiLineString . indexOf ( ParseCSVClipboardText . EXPLICIT_WINDOWS_NEW_LINE_SYMBOL )  >  - 1 )  { 
28+       return  { 
29+         newLine : ParseCSVClipboardText . EXPLICIT_WINDOWS_NEW_LINE_SYMBOL ,  tab : ParseCSVClipboardText . EXPLICIT_TAB_SYMBOL 
30+       } ; 
31+     } 
32+     if  ( multiLineString . indexOf ( ParseCSVClipboardText . WINDOWS_NEW_LINE_SYMBOL )  >  - 1 )  { 
33+       return  {  newLine : ParseCSVClipboardText . WINDOWS_NEW_LINE_SYMBOL ,  tab : ParseCSVClipboardText . TAB_SYMBOL  } ; 
34+     } 
35+     // Handle Unix-style line endings (`\n`) 
2336    if  ( 
2437      multiLineString . indexOf ( ParseCSVClipboardText . EXPLICIT_NEW_LINE_SYMBOL )  >  - 1  || 
2538      multiLineString . indexOf ( ParseCSVClipboardText . EXPLICIT_TAB_SYMBOL )  >  - 1 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments