Skip to content

Commit 3636434

Browse files
committed
more format
1 parent d5890f2 commit 3636434

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/components/editors/ScriptEditor/index.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
import React, { useEffect } from 'react'
2+
import MonacoEditor from 'monaco-editor'
13
import Editor, { Monaco } from '@monaco-editor/react'
24
import {
35
leftBarTrackScaleWidth,
46
TimelineStore,
57
useTimeline,
68
} from '@aitube/timeline'
7-
import MonacoEditor from 'monaco-editor'
8-
import { useEffect } from 'react'
99

1010
import { useScriptEditor } from '@/services/editors/script-editor/useScriptEditor'
1111
import { useUI } from '@/services/ui'
@@ -37,7 +37,11 @@ export function ScriptEditor() {
3737
if (!standaloneCodeEditor) {
3838
return
3939
}
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+
4145
// timeline-to-editor scroll sync when the user is
4246
// hovering the editor
4347
if (useScriptEditor.getState().mouseIsInside) {
@@ -49,7 +53,7 @@ export function ScriptEditor() {
4953
scrollTop: horizontalTimelineRatio,
5054
})
5155
}
52-
// let's do something basic for now: we disable the
56+
// let's do something basic for now: we disable the
5357
// Scroll to a specific line:
5458
// editor.revealLine(15);
5559

@@ -87,6 +91,7 @@ export function ScriptEditor() {
8791
onDidScrollChange({ scrollTop, scrollLeft, scrollWidth, scrollHeight })
8892
}
8993
)
94+
9095
// as an optimization we can use this later, for surgical edits,
9196
// to perform real time updates of the timeline
9297

@@ -122,6 +127,7 @@ export function ScriptEditor() {
122127
base: 'vs-dark', // Base theme (you can change to vs for a lighter theme if preferred)
123128
inherit: true, // Inherit the default rules
124129
rules: [
130+
// You can define token-specific styles here if needed
125131
{ token: 'scene.int', foreground: '#4EC9B0' },
126132
{ token: 'scene.ext', foreground: '#9CDCFE' },
127133
{ token: 'character', foreground: '#DCDCAA' },
@@ -144,10 +150,12 @@ export function ScriptEditor() {
144150
'editorIndentGuide.background': '#78716c', // Indent guides color
145151
'editorIndentGuide.activeBackground': '#a8a29e', // Active indent guides color
146152
'editorWhitespace.foreground': '#a8a29e', // Whitespace symbols color
153+
// Add more color overrides if needed here
147154
},
148155
})
149156
}
150157

158+
// Apply the custom theme immediately after defining it
151159
monaco.editor.setTheme(themes.backstage.id)
152160

153161
const textModel: MonacoEditor.editor.ITextModel = monaco.editor.createModel(

0 commit comments

Comments
 (0)