From c90a8787f7b48855cb895291b619afb71580a111 Mon Sep 17 00:00:00 2001 From: a2nr Date: Sat, 22 Aug 2026 21:30:06 +0700 Subject: [PATCH] feat(teacher-nav): tambah Edit Content & Progress di navbar, pindah route /progress -> /teacher/progress, perbaiki toolbar editor - Navbar: item 'Edit Content' (/teacher/content) & 'Progress' (/teacher/progress) muncul hanya saat akun guru login, ditaruh di atas divider login/logout - Pindahkan route /progress -> /teacher/progress (git mv) agar konsisten dg /teacher/content - Hapus link Progress di Footer (sudah ada di navbar) - Editor content: tombol Fitur (toggle sidebar) dipindah ke header samping Simpan/Publish, Simpan/Publish diubah jadi icon, hapus tombol panah floating di tepi & di header sidebar, tombol dock/undock & minimize dipindah ke pojok kanan (mode desktop) - Bump APP_VERSION 28 -> 29 --- frontend/src/lib/components/CodeEditor.svelte | 11 + frontend/src/lib/components/Footer.svelte | 4 - frontend/src/lib/components/Navbar.svelte | 12 +- frontend/src/lib/version.ts | 2 +- .../src/routes/teacher/content/+page.svelte | 419 +++++++++++++++++- .../{ => teacher}/progress/+page.svelte | 0 6 files changed, 430 insertions(+), 18 deletions(-) rename frontend/src/routes/{ => teacher}/progress/+page.svelte (100%) 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 @@