File tree Expand file tree Collapse file tree
src/lib/components/chat/FileNav Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<script lang =" ts" >
2- import { getContext , onDestroy } from ' svelte' ;
2+ import { getContext , onDestroy , tick } from ' svelte' ;
33 import panzoom , { type PanZoom } from ' panzoom' ;
44 import { marked } from ' marked' ;
55 import DOMPurify from ' dompurify' ;
1919 export let editing = false ;
2020 let editContent = ' ' ;
2121 export let saving = false ;
22+ let editTextarea: HTMLTextAreaElement ;
2223
2324 // Reset edit state when switching files
2425 $ : selectedFile , resetEdit ();
2930 saving = false ;
3031 };
3132
32- export const startEdit = () => {
33+ export const startEdit = async () => {
3334 editContent = fileContent ?? ' ' ;
3435 editing = true ;
3536 showRaw = true ;
37+ await tick ();
38+ editTextarea ?.focus ();
3639 };
3740
3841 export const saveEdit = async () => {
191194 {:else }
192195 {#if editing }
193196 <textarea
197+ bind:this ={editTextarea }
194198 bind:value ={editContent }
195199 class =" w-full h-full text-xs font-mono text-gray-800 dark:text-gray-200 whitespace-pre break-all leading-relaxed p-3 bg-transparent border-none outline-none resize-none"
196200 spellcheck =" false"
You can’t perform that action at this time.
0 commit comments