diff --git a/src/components/sprite-selector/sprite-list.jsx b/src/components/sprite-selector/sprite-list.jsx index c10362a44797f876322f4c133290c16b0c712154..17ba2dc215345c14ddc3f4291ca7cc2700927e20 100644 --- a/src/components/sprite-selector/sprite-list.jsx +++ b/src/components/sprite-selector/sprite-list.jsx @@ -57,7 +57,8 @@ const SpriteList = function (props) { DragConstants.COSTUME, DragConstants.SOUND, DragConstants.BACKPACK_COSTUME, - DragConstants.BACKPACK_SOUND].includes(draggingType); + DragConstants.BACKPACK_SOUND, + DragConstants.BACKPACK_CODE].includes(draggingType); return ( <SortableAsset diff --git a/src/containers/stage-selector.jsx b/src/containers/stage-selector.jsx index e8f0fc9df0b2fefbb31f1c18ba52bc56f48bdc2f..1edff778076e52a240cfd776d161f620e00e9c5a 100644 --- a/src/containers/stage-selector.jsx +++ b/src/containers/stage-selector.jsx @@ -22,7 +22,8 @@ const dragTypes = [ DragConstants.COSTUME, DragConstants.SOUND, DragConstants.BACKPACK_COSTUME, - DragConstants.BACKPACK_SOUND + DragConstants.BACKPACK_SOUND, + DragConstants.BACKPACK_CODE ]; const DroppableStage = DropAreaHOC(dragTypes)(StageSelectorComponent); @@ -99,6 +100,13 @@ class StageSelector extends React.Component { md5: dragInfo.payload.body, name: dragInfo.payload.name }, this.props.id); + } else if (dragInfo.dragType === DragConstants.BACKPACK_CODE) { + fetch(dragInfo.payload.bodyUrl) + .then(response => response.json()) + .then(blocks => { + this.props.vm.shareBlocksToTarget(blocks, this.props.id); + this.props.vm.refreshWorkspace(); + }); } } setFileInput (input) { diff --git a/src/containers/target-pane.jsx b/src/containers/target-pane.jsx index cde8d4af41f8feb9d02b9ac101b53674b01e92c1..b210ad35f496f123c4b2f438b6d13f19a885ccc5 100644 --- a/src/containers/target-pane.jsx +++ b/src/containers/target-pane.jsx @@ -192,6 +192,13 @@ class TargetPane extends React.Component { md5: dragInfo.payload.body, name: dragInfo.payload.name }, targetId); + } else if (dragInfo.dragType === DragConstants.BACKPACK_CODE) { + fetch(dragInfo.payload.bodyUrl) + .then(response => response.json()) + .then(blocks => { + this.props.vm.shareBlocksToTarget(blocks, targetId); + this.props.vm.refreshWorkspace(); + }); } } }