stored xml in tutorial redux store

This commit is contained in:
Delucse
2020-09-08 14:43:30 +02:00
parent 7e0fbf1f75
commit eea893a071
7 changed files with 38 additions and 23 deletions
+5 -1
View File
@@ -2,6 +2,8 @@ import { NEW_CODE, CHANGE_WORKSPACE, CREATE_BLOCK, MOVE_BLOCK, CHANGE_BLOCK, DEL
import * as Blockly from 'blockly/core';
import { storeTutorialXml } from './tutorialActions';
export const workspaceChange = () => (dispatch) => {
dispatch({
type: CHANGE_WORKSPACE
@@ -18,11 +20,13 @@ export const onChangeCode = () => (dispatch, getState) => {
type: NEW_CODE,
payload: code
});
return code;
};
export const onChangeWorkspace = (event) => (dispatch, getState) => {
dispatch(workspaceChange());
dispatch(onChangeCode());
var code = dispatch(onChangeCode());
dispatch(storeTutorialXml(code.xml));
var stats = getState().workspace.stats;
if (event.type === Blockly.Events.BLOCK_CREATE) {
stats.create += event.ids.length;