add resetCode
This commit is contained in:
parent
d682accdbf
commit
0943742b78
@ -26,6 +26,8 @@ const CodeEditor = (props) => {
|
|||||||
sessionStorage.getItem("ArduinoCode")
|
sessionStorage.getItem("ArduinoCode")
|
||||||
? sessionStorage.getItem("ArduinoCode")
|
? sessionStorage.getItem("ArduinoCode")
|
||||||
: `
|
: `
|
||||||
|
#include <senseBoxIO.h> //needs to be always included
|
||||||
|
|
||||||
void setup () {
|
void setup () {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -34,6 +36,7 @@ void loop() {
|
|||||||
|
|
||||||
}`
|
}`
|
||||||
);
|
);
|
||||||
|
|
||||||
const compile = () => {
|
const compile = () => {
|
||||||
setProgress(true);
|
setProgress(true);
|
||||||
const data = {
|
const data = {
|
||||||
@ -97,12 +100,8 @@ void loop() {
|
|||||||
setOpen(false);
|
setOpen(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadCode = () => {
|
const resetCode = () => {
|
||||||
editorRef.current.setValue("test");
|
editorRef.current.setValue(defaultValue);
|
||||||
};
|
|
||||||
|
|
||||||
const handleChange = () => {
|
|
||||||
setAutoSave(!autoSave);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const resetTimeout = (id, newID) => {
|
const resetTimeout = (id, newID) => {
|
||||||
@ -211,7 +210,7 @@ void loop() {
|
|||||||
style={{ padding: "1rem", margin: "1rem" }}
|
style={{ padding: "1rem", margin: "1rem" }}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
color="primary"
|
color="primary"
|
||||||
onClick={() => loadCode()}
|
onClick={() => resetCode()}
|
||||||
>
|
>
|
||||||
Reset Editor
|
Reset Editor
|
||||||
</Button>
|
</Button>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user