diff --git a/frontend/src/lib/components/CodeEditor.svelte b/frontend/src/lib/components/CodeEditor.svelte
index 674d324..cf68b41 100644
--- a/frontend/src/lib/components/CodeEditor.svelte
+++ b/frontend/src/lib/components/CodeEditor.svelte
@@ -302,6 +302,17 @@
});
}
+ /** Insert text at the current cursor / selection. Triggers onchange. */
+ export function insertAtCursor(text: string) {
+ if (!view) return;
+ const { from, to } = view.state.selection.main;
+ view.dispatch({
+ changes: { from, to, insert: text },
+ selection: { anchor: from + text.length },
+ });
+ view.focus();
+ }
+
/** Return current editor content. */
export function getCode(): string {
return view?.state.doc.toString() ?? code;
diff --git a/frontend/src/lib/components/Footer.svelte b/frontend/src/lib/components/Footer.svelte
index e20f88f..331af3c 100644
--- a/frontend/src/lib/components/Footer.svelte
+++ b/frontend/src/lib/components/Footer.svelte
@@ -1,5 +1,4 @@
@@ -7,9 +6,6 @@
diff --git a/frontend/src/lib/components/Navbar.svelte b/frontend/src/lib/components/Navbar.svelte
index 27040e8..a579f16 100644
--- a/frontend/src/lib/components/Navbar.svelte
+++ b/frontend/src/lib/components/Navbar.svelte
@@ -1,5 +1,5 @@