File tree 3 files changed +27
-13
lines changed
frontend/src/lib/components
3 files changed +27
-13
lines changed Original file line number Diff line number Diff line change 515
515
on:change ={() => {
516
516
dispatch (' change' , { argName , arg })
517
517
}}
518
+ loadAsync
518
519
/>
519
520
{/if }
520
521
</div >
583
584
focused = false
584
585
}}
585
586
autoHeight
587
+ loadAsync
586
588
/>
587
589
</div >
588
590
{#if ! hideHelpButton }
Original file line number Diff line number Diff line change 100
100
autofocus = false ,
101
101
allowVim = false ,
102
102
tailwindClasses = [],
103
- class : className = ' '
103
+ class : className = ' ' ,
104
+ loadAsync = false
104
105
} = $props <{
105
106
lang: string
106
107
code? : string
122
123
allowVim? : boolean
123
124
tailwindClasses? : string []
124
125
class? : string
126
+ loadAsync? : boolean
125
127
}>()
126
128
127
129
const dispatch = createEventDispatcher ()
510
512
}
511
513
}
512
514
513
- onMount (() => {
514
- setTimeout (async () => {
515
- if (BROWSER ) {
516
- mounted = true
515
+ onMount (async () => {
516
+ if (BROWSER ) {
517
+ if (loadAsync ) {
518
+ setTimeout (async () => {
519
+ await loadMonaco ()
520
+ mounted = true
521
+ if (autofocus ) setTimeout (() => focus (), 0 )
522
+ }, 0 )
523
+ } else {
517
524
await loadMonaco ()
518
- if (autofocus ) {
519
- setTimeout (() => focus (), 0 )
520
- }
525
+ mounted = true
526
+ if (autofocus ) setTimeout (() => focus (), 0 )
521
527
}
522
- }, 0 )
528
+ }
523
529
})
524
530
525
531
$effect (() => {
Original file line number Diff line number Diff line change 375
375
export let autoHeight = true
376
376
export let fixedOverflowWidgets = true
377
377
export let fontSize = 16
378
+ export let loadAsync = false
378
379
379
380
if (typeof code != ' string' ) {
380
381
code = ' '
593
594
}
594
595
595
596
let mounted = false
596
- onMount (() => {
597
- setTimeout (async () => {
598
- if (BROWSER ) {
597
+ onMount (async () => {
598
+ if (BROWSER ) {
599
+ if (loadAsync ) {
600
+ setTimeout (async () => {
601
+ await loadMonaco ()
602
+ mounted = true
603
+ }, 0 )
604
+ } else {
599
605
await loadMonaco ()
600
606
mounted = true
601
607
}
602
- }, 0 )
608
+ }
603
609
})
604
610
605
611
$ : mounted && extraLib && initialized && loadExtraLib ()
You can’t perform that action at this time.
0 commit comments