File tree Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ import { currentGraph } from "../../store";
26
26
import { PropData , PropsData } from "../../utils/props" ;
27
27
import { multiOutSocketToOutput } from "../../utils/toOutpus" ;
28
28
import { SpecialBlock } from "./base" ;
29
+ import { setExtraLib } from "../../utils" ;
29
30
30
31
export abstract class FuncBlockBase extends RectBlock implements SpecialBlock {
31
32
cloneTo ( target : this) : this {
@@ -100,6 +101,7 @@ export abstract class FuncBlockBase extends RectBlock implements SpecialBlock {
100
101
} )
101
102
) {
102
103
this . inputValue . value = _ . $ev ;
104
+ setExtraLib ( this . slots . map ( slot => `/** param */ declare const $${ slot } : any;` ) . join ( "\n" ) ) ;
103
105
}
104
106
} ,
105
107
) ;
Original file line number Diff line number Diff line change 1
1
export * from "./align" ;
2
2
export * from "./duplicateBlocks" ;
3
3
export * from "./file" ;
4
- export * from "./initMonaco " ;
4
+ export * from "./monaco " ;
5
5
export * from "./removeBlocks" ;
Original file line number Diff line number Diff line change @@ -34,3 +34,10 @@ export function initMonaco() {
34
34
formatProvider ,
35
35
) ;
36
36
}
37
+
38
+ let currentExtraLib = "" ;
39
+ export function setExtraLib ( code : string ) {
40
+ if ( currentExtraLib === code ) return ;
41
+ monaco . languages . typescript . javascriptDefaults . addExtraLib ( code , "context.d.ts" ) ;
42
+ currentExtraLib = code ;
43
+ }
You can’t perform that action at this time.
0 commit comments