File tree Expand file tree Collapse file tree 4 files changed +112
-48
lines changed
src/routes/(authed)/playground/[id] Expand file tree Collapse file tree 4 files changed +112
-48
lines changed Original file line number Diff line number Diff line change 7070 "prettier-plugin-svelte" : " ^3.2.4" ,
7171 "satori" : " ^0.10.13" ,
7272 "satori-html" : " ^0.3.2" ,
73- "svelte" : " 5.0.0-next.269 " ,
73+ "svelte" : " 5.0.0" ,
7474 "svelte-check" : " ^4.0.0" ,
7575 "svelte-preprocess" : " ^5.1.4" ,
7676 "tiny-glob" : " ^0.2.9" ,
Original file line number Diff line number Diff line change 1212
1313 let { data } = $props ();
1414
15- let repl = $state () as Repl ;
15+ let repl = $state () as ReturnType < typeof Repl > ;
1616 let name = $state (data .gist .name );
1717 let modified = $state (false );
1818 let version = data .version ;
Original file line number Diff line number Diff line change @@ -300,13 +300,11 @@ export class Workspace {
300300 this . #view = null ;
301301 }
302302
303- update_file ( file : File ) {
304- if ( file . name === this . #current. name ) {
305- // TODO this line causes the editor to keep losign
306- // focus and I have no idea why. It seems important,
307- // but it also doesn't appear to break anything
308- // if we comment it out?
309- // this.#current = file;
303+ update_file ( file : File , from_codemirror = false ) {
304+ if ( file . name === this . #current. name && ! from_codemirror ) {
305+ // we don't want to update the file if the update comes from
306+ // codemirror or it will loose focus
307+ this . #current = file ;
310308 }
311309
312310 this . #files = this . #files. map ( ( old ) => {
@@ -364,10 +362,13 @@ export class Workspace {
364362 if ( update . docChanged ) {
365363 const state = this . #view! . state ! ;
366364
367- this . update_file ( {
368- ...this . #current,
369- contents : state . doc . toString ( )
370- } ) ;
365+ this . update_file (
366+ {
367+ ...this . #current,
368+ contents : state . doc . toString ( )
369+ } ,
370+ true
371+ ) ;
371372
372373 // preserve undo/redo across files
373374 this . states . set ( this . #current. name , state ) ;
You can’t perform that action at this time.
0 commit comments