@@ -125,7 +125,7 @@ export default class ScriptTab extends Vue {
125125 this .handleInitialSctipt (payload );
126126 }
127127 });
128- eventBus .$on <ISave >(" save " , (payload ) => {
128+ eventBus .$on <ISave >(EventType . Save , (payload ) => {
129129 if (payload .scriptId === this .scriptId ) {
130130 this .handleSave (payload );
131131 }
@@ -163,7 +163,7 @@ export default class ScriptTab extends Vue {
163163 this .script = script ;
164164 this .metaBuffer = this .prepareMetaBuffer (this .script .metadata );
165165
166- eventBus .$emit <IChangeTitle >(" change-title " , {
166+ eventBus .$emit <IChangeTitle >(EventType . ChangeTitle , {
167167 title: script .name ,
168168 scriptId: this .scriptId ?? this .localScriptId ,
169169 });
@@ -187,7 +187,7 @@ export default class ScriptTab extends Vue {
187187 this .onMetaChange = false ;
188188 }
189189
190- async handleSave({ currentCode }: ISave ) {
190+ async handleSave({ currentCode , debug }: ISave ) {
191191 // todo 保存时候错误处理
192192 let [newScript, oldScript] = await this .scriptMgr .prepareScriptByCode (
193193 currentCode ,
@@ -225,21 +225,14 @@ export default class ScriptTab extends Vue {
225225 await this .handleInitialSctipt ({} as any );
226226
227227 // 还原unsavdChange状态的title
228- eventBus .$emit <IChangeTitle >(" change-title " , {
228+ eventBus .$emit <IChangeTitle >(EventType . ChangeTitle , {
229229 title: ` ${this .script .name } ` ,
230230 scriptId: this .scriptId ?? this .localScriptId ,
231231 });
232232
233- if (oldScript ) {
234- // 后台脚本才可以调用
235- if (this .script .metadata [" debug" ] != undefined ) {
236- this .scriptMgr .execScript (this .script , true );
237- }
238- } else {
239- // eventBus.$emit<INewScript>("new-script", {
240- // scriptId: this.scriptId ?? this.localScriptId,
241- // });
242- // this.$router.push({ path: "/" });
233+ // 后台脚本才可以调用
234+ if (debug ) {
235+ this .scriptMgr .execScript (this .script , true );
243236 }
244237
245238 this .$refs .editor .hasUnsavedChange = false ;
0 commit comments