File tree Expand file tree Collapse file tree 5 files changed +9
-13
lines changed
app/components/code-capture Expand file tree Collapse file tree 5 files changed +9
-13
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ export default function ControlOptions() {
52
52
< Select
53
53
onValueChange = { ( value ) => {
54
54
changeEditorTheme ( value ) ;
55
- updateEditorWindowTheme ( ) ;
55
+ updateEditorWindowTheme ( value ) ;
56
56
} }
57
57
>
58
58
< SelectTrigger >
Original file line number Diff line number Diff line change @@ -5,8 +5,6 @@ import useStore from "@/lib/store/store";
5
5
export default function WindowHeader ( ) {
6
6
const editorThemeColors = useStore ( ( state ) => state . editorThemeColors ) ;
7
7
8
- console . log ( "edit" , editorThemeColors ) ;
9
-
10
8
return (
11
9
< div
12
10
className = "window-header rounded-t-md flex justify-between w-full py-3 px-4 items-center"
Original file line number Diff line number Diff line change @@ -2,17 +2,14 @@ import { applyTheme } from "@/lib/editor/themes/apply-theme";
2
2
import useStore from "@/lib/store/store" ;
3
3
4
4
export default function useEditorTheme ( ) {
5
-
6
- const editorTheme = useStore ( ( state ) => state . editorTheme ) ;
7
- const editorThemeColors = useStore ( ( state ) => state . editorThemeColors ) ;
5
+
8
6
const changeEditorThemeColors = useStore (
9
7
( state ) => state . changeEditorThemeColors
10
8
) ;
11
9
12
- const updateEditorWindowTheme = async ( ) => {
13
- const colors = await applyTheme ( editorTheme ) ;
10
+ const updateEditorWindowTheme = async ( themeName : string ) => {
11
+ const colors = await applyTheme ( themeName ) ;
14
12
changeEditorThemeColors ( colors ) ;
15
- 13 ;
16
13
} ;
17
14
18
15
return { updateEditorWindowTheme } ;
Original file line number Diff line number Diff line change 1
1
import { loader } from "@monaco-editor/react" ;
2
2
3
3
const applyTheme = async ( themeName : string ) => {
4
- console . log ( themeName ) ;
4
+ console . log ( "themeName" , themeName ) ;
5
+
5
6
let themeData = await import ( `monaco-themes/themes/${ themeName } .json` ) ;
6
7
7
8
themeName &&
Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ export default function MonacoEditor() {
13
13
const windowWidth = useStore ( ( state ) => state . windowWidth ) ;
14
14
const changeWindowWidth = useStore ( ( state ) => state . changeWindowWidth ) ;
15
15
16
+ const editorTheme = useStore ( ( state ) => state . editorTheme ) ;
17
+
16
18
const editorLanguage = useStore ( ( state ) => state . editorLanguage ) ;
17
19
18
20
// to adjust editor width based on its content
@@ -27,8 +29,6 @@ export default function MonacoEditor() {
27
29
}
28
30
} ;
29
31
30
- console . log ( "changed language" , editorLanguage ) ;
31
-
32
32
return (
33
33
< Editor
34
34
language = { editorLanguage }
@@ -41,7 +41,7 @@ export default function MonacoEditor() {
41
41
theme = "vs-dark"
42
42
onMount = { ( editor ) => {
43
43
editorRef . current = editor ;
44
- updateEditorWindowTheme ( ) ;
44
+ updateEditorWindowTheme ( editorTheme ) ;
45
45
} }
46
46
onChange = { ( ) => {
47
47
controlEditorWidth ( ) ;
You can’t perform that action at this time.
0 commit comments