diff --git a/src/lib/components/common/CodeEditor.svelte b/src/lib/components/common/CodeEditor.svelte index 5cf10e1e4..aeaa4095c 100644 --- a/src/lib/components/common/CodeEditor.svelte +++ b/src/lib/components/common/CodeEditor.svelte @@ -37,6 +37,8 @@ codeEditor.dispatch({ changes: [{ from: 0, to: codeEditor.state.doc.length, insert: formattedCode }] }); + + toast.success('Code formatted successfully'); return true; } @@ -59,13 +61,15 @@ ]; onMount(() => { + value = boilerplate; + // Check if html class has dark mode isDarkMode = document.documentElement.classList.contains('dark'); // python code editor, highlight python code codeEditor = new EditorView({ state: EditorState.create({ - doc: boilerplate, + doc: value, extensions: extensions }), parent: document.getElementById('code-textarea') diff --git a/src/lib/components/workspace/Tools/CodeEditor.svelte b/src/lib/components/workspace/Tools/CodeEditor.svelte index ec7656096..2950e30e0 100644 --- a/src/lib/components/workspace/Tools/CodeEditor.svelte +++ b/src/lib/components/workspace/Tools/CodeEditor.svelte @@ -12,6 +12,7 @@ from datetime import datetime import requests + class Tools: def __init__(self): pass @@ -40,6 +41,7 @@ class Tools: except Exception as e: print(e) return "Invalid equation" + `;