1
+ import React , { useEffect } from 'react'
2
+ import MonacoEditor from 'monaco-editor'
1
3
import Editor , { Monaco } from '@monaco-editor/react'
2
4
import {
3
5
leftBarTrackScaleWidth ,
4
6
TimelineStore ,
5
7
useTimeline ,
6
8
} from '@aitube/timeline'
7
- import MonacoEditor from 'monaco-editor'
8
- import { useEffect } from 'react'
9
9
10
10
import { useScriptEditor } from '@/services/editors/script-editor/useScriptEditor'
11
11
import { useUI } from '@/services/ui'
@@ -37,7 +37,11 @@ export function ScriptEditor() {
37
37
if ( ! standaloneCodeEditor ) {
38
38
return
39
39
}
40
- // let's do something basic for now: we disable the
40
+
41
+ // various things we can do here!
42
+ // move the scroll:
43
+ // editor.setScrollPosition({ scrollTop: horizontalTimelineRatio })
44
+
41
45
// timeline-to-editor scroll sync when the user is
42
46
// hovering the editor
43
47
if ( useScriptEditor . getState ( ) . mouseIsInside ) {
@@ -49,7 +53,7 @@ export function ScriptEditor() {
49
53
scrollTop : horizontalTimelineRatio ,
50
54
} )
51
55
}
52
- // let's do something basic for now: we disable the
56
+ // let's do something basic for now: we disable the
53
57
// Scroll to a specific line:
54
58
// editor.revealLine(15);
55
59
@@ -87,6 +91,7 @@ export function ScriptEditor() {
87
91
onDidScrollChange ( { scrollTop, scrollLeft, scrollWidth, scrollHeight } )
88
92
}
89
93
)
94
+
90
95
// as an optimization we can use this later, for surgical edits,
91
96
// to perform real time updates of the timeline
92
97
@@ -122,6 +127,7 @@ export function ScriptEditor() {
122
127
base : 'vs-dark' , // Base theme (you can change to vs for a lighter theme if preferred)
123
128
inherit : true , // Inherit the default rules
124
129
rules : [
130
+ // You can define token-specific styles here if needed
125
131
{ token : 'scene.int' , foreground : '#4EC9B0' } ,
126
132
{ token : 'scene.ext' , foreground : '#9CDCFE' } ,
127
133
{ token : 'character' , foreground : '#DCDCAA' } ,
@@ -144,10 +150,12 @@ export function ScriptEditor() {
144
150
'editorIndentGuide.background' : '#78716c' , // Indent guides color
145
151
'editorIndentGuide.activeBackground' : '#a8a29e' , // Active indent guides color
146
152
'editorWhitespace.foreground' : '#a8a29e' , // Whitespace symbols color
153
+ // Add more color overrides if needed here
147
154
} ,
148
155
} )
149
156
}
150
157
158
+ // Apply the custom theme immediately after defining it
151
159
monaco . editor . setTheme ( themes . backstage . id )
152
160
153
161
const textModel : MonacoEditor . editor . ITextModel = monaco . editor . createModel (
0 commit comments