removing workspace from Redux

This commit is contained in:
Delucse
2020-07-23 15:55:54 +02:00
parent c2405de04a
commit 168c5fb575
7 changed files with 25 additions and 68 deletions
-1
View File
@@ -1,6 +1,5 @@
export const NEW_CODE = 'NEW_CODE';
export const CHANGE_WORKSPACE = 'CHANGE_WORKSPACE';
export const NEW_WORKSPACE = 'NEW_WORKSPACE';
export const CREATE_BLOCK = 'CREATE_BLOCK';
export const MOVE_BLOCK = 'MOVE_BLOCK';
export const CHANGE_BLOCK = 'CHANGE_BLOCK';
+2 -20
View File
@@ -1,4 +1,4 @@
import { NEW_CODE, CHANGE_WORKSPACE, NEW_WORKSPACE, CREATE_BLOCK, MOVE_BLOCK, CHANGE_BLOCK, DELETE_BLOCK, CLEAR_STATS } from './types';
import { NEW_CODE, CHANGE_WORKSPACE, CREATE_BLOCK, MOVE_BLOCK, CHANGE_BLOCK, DELETE_BLOCK, CLEAR_STATS } from './types';
import * as Blockly from 'blockly/core';
@@ -8,22 +8,12 @@ export const workspaceChange = () => (dispatch) => {
})
}
export const initWorkspace = (workspace) => (dispatch) => {
dispatch({
type: NEW_WORKSPACE,
payload: workspace
});
}
export const onChangeWorkspace = (event) => (dispatch, getState) => {
const workspace = Blockly.getMainWorkspace();
dispatch({
type: NEW_WORKSPACE,
payload: workspace
});
dispatch({
type: CHANGE_WORKSPACE,
})
const workspace = Blockly.getMainWorkspace();
var code = getState().workspace.code;
code.arduino = Blockly.Arduino.workspaceToCode(workspace);
var xmlDom = Blockly.Xml.workspaceToDom(workspace);
@@ -78,11 +68,3 @@ export const clearStats = () => (dispatch) => {
payload: stats
});
};
export const setWorkspace = (workspace) => (dispatch, getState) => {
dispatch({
type: NEW_WORKSPACE,
payload: {new: workspace, old: getState().workspace.new}
});
};