Skip to content

Commit a21758b

Browse files
committed
fix
1 parent 49f4b4c commit a21758b

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

src/toolbarActions/toolbarFunctions.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,10 @@ const editElement = (state, setState) => {
6767
}
6868
};
6969

70-
const deleteElem = (state) => {
70+
const deleteElem = (state, dispatcher) => {
7171
const tid = new Date().getTime();
7272
state.eleSelectedPayload.ids.forEach((id) => getGraphFun(state).deleteElem(id, tid));
73-
// eslint-disable-next-line
74-
state.eleSelectedPayload.type = 'MIX';
75-
// eslint-disable-next-line
76-
state.eleSelected = false;
73+
dispatcher({ type: T.ELE_UNSELECTED, payload: null });
7774
};
7875

7976
const downloadImg = (state, setState, format) => {

src/toolbarActions/toolbarList.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ const toolbarList = (state, dispatcher) => [
9494
text: 'Edit',
9595
icon: FaEdit,
9696
action: editElement,
97-
active: (state.eleSelected && state.eleSelectedPayload.type !== 'MIX'),
97+
active: state.curGraphInstance && state.eleSelected,
9898
visibility: true,
9999
hotkey: 'Ctrl+E',
100100
},
101101
{
102102
type: 'action',
103103
text: 'Delete',
104104
icon: FaTrash,
105-
action: deleteElem,
105+
action: () => deleteElem(state, dispatcher),
106106
active: state.eleSelected,
107107
visibility: true,
108108
hotkey: 'Delete,Backspace,Del,Clear',

0 commit comments

Comments
 (0)