This commit is contained in:
Timothy J. Baek 2024-10-05 16:16:51 -07:00
parent 2e067b0541
commit bbbd94f69c
2 changed files with 10 additions and 4 deletions

View File

@ -1,5 +1,5 @@
<script>
import { getContext, createEventDispatcher, onMount } from 'svelte';
import { getContext, createEventDispatcher, onMount, tick } from 'svelte';
import { goto } from '$app/navigation';
const dispatch = createEventDispatcher();
@ -263,10 +263,14 @@ class Pipe:
const submitHandler = async () => {
if (codeEditor) {
content = _content;
await tick();
const res = await codeEditor.formatPythonCodeHandler();
if (res) {
console.log('Code formatted successfully');
saveHandler();
}
}
@ -352,8 +356,7 @@ class Pipe:
on:change={(e) => {
_content = e.detail.value;
}}
on:save={() => {
content = _content;
on:save={async () => {
if (formElement) {
formElement.requestSubmit();
}

View File

@ -151,10 +151,14 @@ class Tools:
const submitHandler = async () => {
if (codeEditor) {
content = _content;
await tick();
const res = await codeEditor.formatPythonCodeHandler();
if (res) {
console.log('Code formatted successfully');
saveHandler();
}
}
@ -241,7 +245,6 @@ class Tools:
_content = e.detail.value;
}}
on:save={() => {
content = _content;
if (formElement) {
formElement.requestSubmit();
}