@@ -398,16 +398,7 @@ storiesOf('ListView/Drag and Drop', module)
398
398
< DragExample listViewProps = { { onAction : action ( 'onAction' ) , ...args } } dragHookOptions = { { onDragStart : action ( 'dragStart' ) , onDragEnd : action ( 'dragEnd' ) } } />
399
399
</ Flex >
400
400
) , { description : { data : 'Folders are non-draggable.' } }
401
- )
402
- . add (
403
- 'draggable rows, selectionStyle: highlight, onAction' ,
404
- args => (
405
- < Flex direction = "row" wrap alignItems = "center" >
406
- < input />
407
- < Droppable />
408
- < DragExample listViewProps = { { selectionStyle : 'highlight' , onAction : action ( 'onAction' ) , ...args } } dragHookOptions = { { onDragStart : action ( 'dragStart' ) , onDragEnd : action ( 'dragEnd' ) } } />
409
- </ Flex >
410
- ) , { description : { data : 'Folders are non-draggable.' } } ) ;
401
+ ) ;
411
402
412
403
function renderActionsExample ( renderActions , props ?) {
413
404
return (
@@ -678,12 +669,12 @@ export function ReorderExample(props) {
678
669
let key ;
679
670
if ( item . types . has ( dragType ) ) {
680
671
key = JSON . parse ( await item . getText ( dragType ) ) ;
672
+ keys . push ( key ) ;
681
673
} else if ( item . types . has ( 'text/plain' ) ) {
682
674
// Fallback for Chrome Android case: https://bugs.chromium.org/p/chromium/issues/detail?id=1293803
683
- key = JSON . parse ( await item . getText ( 'text/plain' ) ) ;
684
- }
685
- if ( key ) {
686
- keys . push ( key ) ;
675
+ // Multiple drag items are contained in a single string so we need to split them out
676
+ key = await item . getText ( 'text/plain' ) ;
677
+ keys = key . split ( '\n' ) . map ( val => val . replaceAll ( '"' , '' ) ) ;
687
678
}
688
679
}
689
680
}
@@ -768,12 +759,12 @@ export function DragIntoItemExample(props) {
768
759
let key ;
769
760
if ( item . types . has ( dragType ) ) {
770
761
key = JSON . parse ( await item . getText ( dragType ) ) ;
762
+ keys . push ( key ) ;
771
763
} else if ( item . types . has ( 'text/plain' ) ) {
772
764
// Fallback for Chrome Android case: https://bugs.chromium.org/p/chromium/issues/detail?id=1293803
773
- key = JSON . parse ( await item . getText ( 'text/plain' ) ) ;
774
- }
775
- if ( key ) {
776
- keys . push ( key ) ;
765
+ // Multiple drag items are contained in a single string so we need to split them out
766
+ key = await item . getText ( 'text/plain' ) ;
767
+ keys = key . split ( '\n' ) . map ( val => val . replaceAll ( '"' , '' ) ) ;
777
768
}
778
769
}
779
770
}
@@ -876,12 +867,12 @@ export function DragBetweenListsExample(props) {
876
867
let key ;
877
868
if ( item . types . has ( dragType ) ) {
878
869
key = JSON . parse ( await item . getText ( dragType ) ) ;
870
+ keys . push ( key ) ;
879
871
} else if ( item . types . has ( 'text/plain' ) ) {
880
872
// Fallback for Chrome Android case: https://bugs.chromium.org/p/chromium/issues/detail?id=1293803
881
- key = JSON . parse ( await item . getText ( 'text/plain' ) ) ;
882
- }
883
- if ( key ) {
884
- keys . push ( key ) ;
873
+ // Multiple drag items are contained in a single string so we need to split them out
874
+ key = await item . getText ( 'text/plain' ) ;
875
+ keys = key . split ( '\n' ) . map ( val => val . replaceAll ( '"' , '' ) ) ;
885
876
}
886
877
}
887
878
}
@@ -996,12 +987,12 @@ export function DragBetweenListsRootOnlyExample(props) {
996
987
let key ;
997
988
if ( item . types . has ( 'list2' ) ) {
998
989
key = JSON . parse ( await item . getText ( 'list2' ) ) ;
990
+ keys . push ( key ) ;
999
991
} else if ( item . types . has ( 'text/plain' ) ) {
1000
992
// Fallback for Chrome Android case: https://bugs.chromium.org/p/chromium/issues/detail?id=1293803
1001
- key = JSON . parse ( await item . getText ( 'text/plain' ) ) ;
1002
- }
1003
- if ( key ) {
1004
- keys . push ( key ) ;
993
+ // Multiple drag items are contained in a single string so we need to split them out
994
+ key = await item . getText ( 'text/plain' ) ;
995
+ keys = key . split ( '\n' ) . map ( val => val . replaceAll ( '"' , '' ) ) ;
1005
996
}
1006
997
}
1007
998
}
@@ -1010,7 +1001,7 @@ export function DragBetweenListsRootOnlyExample(props) {
1010
1001
}
1011
1002
} ,
1012
1003
getDropOperation ( target , types ) {
1013
- if ( target . type === 'root' && types . has ( 'list2' ) ) {
1004
+ if ( target . type === 'root' && ( types . has ( 'list2' ) || types . has ( 'text/plain' ) ) ) {
1014
1005
return 'move' ;
1015
1006
}
1016
1007
@@ -1028,12 +1019,12 @@ export function DragBetweenListsRootOnlyExample(props) {
1028
1019
let key ;
1029
1020
if ( item . types . has ( 'list1' ) ) {
1030
1021
key = JSON . parse ( await item . getText ( 'list1' ) ) ;
1022
+ keys . push ( key ) ;
1031
1023
} else if ( item . types . has ( 'text/plain' ) ) {
1032
1024
// Fallback for Chrome Android case: https://bugs.chromium.org/p/chromium/issues/detail?id=1293803
1033
- key = JSON . parse ( await item . getText ( 'text/plain' ) ) ;
1034
- }
1035
- if ( key ) {
1036
- keys . push ( key ) ;
1025
+ // Multiple drag items are contained in a single string so we need to split them out
1026
+ key = await item . getText ( 'text/plain' ) ;
1027
+ keys = key . split ( '\n' ) . map ( val => val . replaceAll ( '"' , '' ) ) ;
1037
1028
}
1038
1029
}
1039
1030
}
@@ -1042,7 +1033,7 @@ export function DragBetweenListsRootOnlyExample(props) {
1042
1033
}
1043
1034
} ,
1044
1035
getDropOperation ( target , types ) {
1045
- if ( target . type === 'root' && types . has ( 'list1' ) ) {
1036
+ if ( target . type === 'root' && ( types . has ( 'list1' ) || types . has ( 'text/plain' ) ) ) {
1046
1037
return 'move' ;
1047
1038
}
1048
1039
0 commit comments