This commit is contained in:
Timothy J. Baek 2024-06-10 17:24:42 -07:00
parent 12a04b118f
commit f43b545bdd
2 changed files with 7 additions and 1 deletions

View File

@ -37,6 +37,8 @@
codeEditor.dispatch({ codeEditor.dispatch({
changes: [{ from: 0, to: codeEditor.state.doc.length, insert: formattedCode }] changes: [{ from: 0, to: codeEditor.state.doc.length, insert: formattedCode }]
}); });
toast.success('Code formatted successfully');
return true; return true;
} }
@ -59,13 +61,15 @@
]; ];
onMount(() => { onMount(() => {
value = boilerplate;
// Check if html class has dark mode // Check if html class has dark mode
isDarkMode = document.documentElement.classList.contains('dark'); isDarkMode = document.documentElement.classList.contains('dark');
// python code editor, highlight python code // python code editor, highlight python code
codeEditor = new EditorView({ codeEditor = new EditorView({
state: EditorState.create({ state: EditorState.create({
doc: boilerplate, doc: value,
extensions: extensions extensions: extensions
}), }),
parent: document.getElementById('code-textarea') parent: document.getElementById('code-textarea')

View File

@ -12,6 +12,7 @@
from datetime import datetime from datetime import datetime
import requests import requests
class Tools: class Tools:
def __init__(self): def __init__(self):
pass pass
@ -40,6 +41,7 @@ class Tools:
except Exception as e: except Exception as e:
print(e) print(e)
return "Invalid equation" return "Invalid equation"
`; `;
</script> </script>