Skip to content

Commit 854fa5d

Browse files
authored
Merge pull request #139 from parteekcoder/disabling-fix
disabling button
2 parents c480aab + 94c8f71 commit 854fa5d

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/toolbarActions/toolbarFunctions.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +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';
73+
dispatcher({ type: T.ELE_UNSELECTED, payload: null });
7574
};
7675

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

src/toolbarActions/toolbarList.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const toolbarList = (state, dispatcher) => [
6565
text: 'Empty',
6666
icon: FaThermometerEmpty,
6767
action: clearAll,
68-
active: true,
68+
active: state.curGraphInstance,
6969
visibility: true,
7070
hotkey: 'Ctrl+Backspace',
7171
},
@@ -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)