File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
packages/core/src/data-editor Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 1
1
/* eslint-disable sonarjs/no-duplicate-string */
2
2
import { assertNever } from "../common/support.js" ;
3
3
import {
4
- GridCellKind ,
5
- type GridCell ,
6
4
BooleanEmpty ,
7
5
BooleanIndeterminate ,
6
+ GridCellKind ,
7
+ type GridCell ,
8
8
} from "../internal/data-grid/data-grid-types.js" ;
9
9
10
10
type StringArrayCellBuffer = {
11
11
formatted : string [ ] ;
12
12
rawValue : string [ ] ;
13
13
format : "string-array" ;
14
+ doNotEscape ?: boolean ;
14
15
} ;
15
16
16
17
type BasicCellBuffer = {
17
18
formatted : string ;
18
19
rawValue : string | number | boolean | BooleanEmpty | BooleanIndeterminate | undefined ;
19
20
format : "string" | "number" | "boolean" | "url" ;
21
+ doNotEscape ?: boolean ;
20
22
} ;
21
23
export type CellBuffer = StringArrayCellBuffer | BasicCellBuffer ;
22
24
export type CopyBuffer = CellBuffer [ ] [ ] ;
@@ -27,6 +29,8 @@ function convertCellToBuffer(cell: GridCell): CellBuffer {
27
29
formatted : cell . copyData ,
28
30
rawValue : cell . copyData ,
29
31
format : "string" ,
32
+ // Do not escape the copy value if it was explicitly specified via copyData:
33
+ doNotEscape : true ,
30
34
} ;
31
35
}
32
36
switch ( cell . kind ) {
@@ -140,7 +144,7 @@ function createTextBuffer(copyBuffer: CopyBuffer): string {
140
144
} else if ( cell . format === "string-array" ) {
141
145
line . push ( cell . formatted . map ( x => escapeIfNeeded ( x , true ) ) . join ( "," ) ) ;
142
146
} else {
143
- line . push ( escapeIfNeeded ( cell . formatted , false ) ) ;
147
+ line . push ( cell . doNotEscape === true ? cell . formatted : escapeIfNeeded ( cell . formatted , false ) ) ;
144
148
}
145
149
}
146
150
lines . push ( line . join ( "\t" ) ) ;
You can’t perform that action at this time.
0 commit comments