11/* eslint-disable no-alert */
22import {
33 FaSave , FaUndo , FaRedo , FaTrash , FaFileImport , FaPlus , FaDownload , FaEdit , FaRegTimesCircle , FaHistory ,
4- FaHammer , FaBug , FaBomb , FaToggleOn , FaThermometerEmpty ,
4+ FaHammer , FaBug , FaBomb , FaToggleOn , FaThermometerEmpty , FaUndoAlt ,
55} from 'react-icons/fa' ;
66
77import {
@@ -11,7 +11,7 @@ import {
1111
1212import {
1313 createNode , editElement , deleteElem , downloadImg , saveAction , saveGraphMLFile ,
14- createFile , readFile , clearAll , undo , redo , viewHistory ,
14+ createFile , readFile , clearAll , undo , redo , viewHistory , resetAfterClear ,
1515 toggleServer ,
1616 // openSettingModal,
1717} from './toolbarFunctions' ;
@@ -65,17 +65,26 @@ const toolbarList = (state, dispatcher) => [
6565 text : 'Empty' ,
6666 icon : FaThermometerEmpty ,
6767 action : clearAll ,
68- active : state . curGraphInstance ,
68+ active : state . curGraphInstance && ! state . resetEnabled ,
6969 visibility : true ,
7070 hotkey : 'Ctrl+Backspace' ,
7171 } ,
72+ {
73+ type : 'action' ,
74+ text : 'Reset' ,
75+ icon : FaUndoAlt ,
76+ action : resetAfterClear ,
77+ active : state . curGraphInstance && state . resetEnabled ,
78+ visibility : true ,
79+ hotkey : 'Ctrl+I' ,
80+ } ,
7281 { type : 'vsep' } ,
7382 {
7483 type : 'action' ,
7584 text : 'Undo' ,
7685 icon : FaUndo ,
7786 action : undo ,
78- active : state . undoEnabled && state . curGraphInstance ,
87+ active : state . undoEnabled && state . curGraphInstance && ! state . resetEnabled ,
7988 visibility : true ,
8089 hotkey : 'Ctrl+Z' ,
8190 } ,
@@ -84,7 +93,7 @@ const toolbarList = (state, dispatcher) => [
8493 text : 'Redo' ,
8594 icon : FaRedo ,
8695 action : redo ,
87- active : state . redoEnabled && state . curGraphInstance ,
96+ active : state . redoEnabled && state . curGraphInstance && ! state . resetEnabled ,
8897 visibility : true ,
8998 hotkey : 'Ctrl+Shift+Z,Ctrl+Y' ,
9099 } ,
0 commit comments