File tree 2 files changed +24
-1
lines changed
2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 1
1
import { Component , ViewChild } from '@angular/core' ;
2
+ import { ActivatedRoute } from '@angular/router' ;
2
3
import { EditorView } from 'codemirror' ;
3
4
import {
4
5
bracketMatching ,
@@ -63,7 +64,7 @@ export class EditorComponent {
63
64
@ViewChild ( 'editor' )
64
65
private editor ! : CodeEditor ;
65
66
66
- constructor ( private executor : ExecutorService ) {
67
+ constructor ( private executor : ExecutorService , private route : ActivatedRoute ) {
67
68
const noDotted = EditorView . theme ( {
68
69
'&.cm-editor.cm-focused' : {
69
70
outline : 'none' ,
@@ -82,6 +83,23 @@ export class EditorComponent {
82
83
flexGrow : 1 ,
83
84
} ,
84
85
} ) ;
86
+
87
+ // Check for URL parameter and decode if present
88
+ this . route . queryParams . subscribe ( params => {
89
+ const encodedContent = params [ 'code' ] ;
90
+ if ( encodedContent ) {
91
+ const decodedContent = atob ( encodedContent ) ;
92
+ this . content = `/world/New()
93
+ main()
94
+ ..()
95
+ eval("")
96
+ shutdown()
97
+
98
+ /proc/main()
99
+ ${ decodedContent } `
100
+ }
101
+ } ) ;
102
+
85
103
const darkMode = EditorView . theme ( { } , { dark : true } ) ;
86
104
87
105
const runCodeEffect = StateEffect . define < void > ( ) ;
@@ -156,5 +174,6 @@ export class EditorComponent {
156
174
[ controlPanel ] ,
157
175
[ runCodeField ] ,
158
176
] ;
177
+
159
178
}
160
179
}
Original file line number Diff line number Diff line change @@ -131,6 +131,10 @@ export class ByondService {
131
131
void this . lock . run ( async ( ) => {
132
132
for await ( const version of ( await this . getByondFolder ( ) ) . keys ( ) ) {
133
133
this . _versions . set ( version , VersionStatus . Fetched ) ;
134
+ // If this is the first version in the list, load it
135
+ if ( this . _activeVersion == null ) {
136
+ await this . load ( version , true ) ;
137
+ }
134
138
}
135
139
} ) ;
136
140
void this . lock . run ( ( ) =>
You can’t perform that action at this time.
0 commit comments