File tree Expand file tree Collapse file tree
packages/grid/src/key-handlers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,11 +45,15 @@ export function parseValueFromNodes(nodes: NodeListOf<ChildNode>): string[][] {
4545 return result ;
4646}
4747
48- export function parseValueFromText ( text : string ) : string [ ] [ ] {
49- return text
48+ export function parseValueFromText ( text : string ) : string | string [ ] [ ] {
49+ const rows = text
5050 . trim ( )
5151 . split ( '\n' )
5252 . map ( row => row . split ( '\t' ) ) ;
53+ if ( rows . length === 1 && rows [ 0 ] . length === 1 ) {
54+ return rows [ 0 ] [ 0 ] ;
55+ }
56+ return rows ;
5357}
5458
5559export function parseValueFromElement (
@@ -131,8 +135,8 @@ class PasteKeyHandler extends KeyHandler {
131135 const inputListener = ( ) : void => {
132136 cleanup ( ) ;
133137 const value =
134- parseValueFromElement ( dummyInput ) ??
135- ( plainText . length > 0 ? parseValueFromText ( plainText ) : null ) ;
138+ ( plainText . length > 0 ? parseValueFromText ( plainText ) : null ) ??
139+ parseValueFromElement ( dummyInput ) ;
136140 if ( value != null ) {
137141 grid . pasteValue ( value ) ;
138142 }
You can’t perform that action at this time.
0 commit comments