1
- import React , { useContext , useState , useRef , useEffect } from 'react' ;
2
- import AceEditor from 'react-ace' ;
1
+ import 'ace-builds/src-noconflict/ace' ;
3
2
import 'ace-builds/src-min-noconflict/ext-searchbox' ;
4
3
import 'ace-builds/src-noconflict/mode-javascript' ;
5
- import 'ace-builds/src-noconflict/theme-monokai' ;
6
- import 'ace-builds/src-noconflict/theme-github' ;
7
- import 'ace-builds/src-noconflict/theme-solarized_dark' ;
8
- import 'ace-builds/src-noconflict/theme-solarized_light' ;
9
- import 'ace-builds/src-noconflict/theme-monokai' ;
4
+ import 'ace-builds/src-noconflict/theme-dracula' ;
10
5
import 'ace-builds/src-noconflict/theme-terminal' ;
11
- import { Component } from '../../interfaces/Interfaces' ;
12
- import useResizeObserver from '../../tree/useResizeObserver' ;
13
- import { unpkgPathPlugin } from '../../plugins/unpkg-path-plugin' ;
14
- import { fetchPlugin } from '../../plugins/fetch-plugin' ;
6
+
15
7
import * as esbuild from 'esbuild-wasm' ;
16
- import { codePreviewSave , codePreviewInput } from "../../redux/reducers/slice/codePreviewSlice" ;
8
+
9
+ import React , { useContext , useEffect , useRef , useState } from 'react' ;
10
+ import {
11
+ codePreviewInput ,
12
+ codePreviewSave
13
+ } from '../../redux/reducers/slice/codePreviewSlice' ;
17
14
import { useDispatch , useSelector } from 'react-redux' ;
15
+
16
+ import AceEditor from 'react-ace' ;
17
+ import { Component } from '../../interfaces/Interfaces' ;
18
18
import { RootState } from '../../redux/store' ;
19
+ import { fetchPlugin } from '../../plugins/fetch-plugin' ;
20
+ import { unpkgPathPlugin } from '../../plugins/unpkg-path-plugin' ;
21
+ import useResizeObserver from '../../tree/useResizeObserver' ;
19
22
20
23
const CodePreview : React . FC < {
21
24
theme : string | null ;
@@ -37,7 +40,7 @@ const CodePreview: React.FC<{
37
40
const wrapper = useRef ( ) ;
38
41
const dimensions = useResizeObserver ( wrapper ) ;
39
42
const { height } = dimensions || 0 ;
40
- const state = useSelector ( ( store :RootState ) => store . appState )
43
+ const state = useSelector ( ( store : RootState ) => store . appState ) ;
41
44
const [ , setDivHeight ] = useState ( 0 ) ;
42
45
let currentComponent = state . components . find (
43
46
( elem : Component ) => elem . id === state . canvasFocus . componentId
@@ -80,7 +83,7 @@ const CodePreview: React.FC<{
80
83
global : 'window'
81
84
}
82
85
} ) ;
83
- dispatch ( codePreviewSave ( result . outputFiles [ 0 ] . text ) )
86
+ dispatch ( codePreviewSave ( result . outputFiles [ 0 ] . text ) ) ;
84
87
} ;
85
88
86
89
return (
@@ -95,15 +98,16 @@ const CodePreview: React.FC<{
95
98
>
96
99
< AceEditor
97
100
mode = "javascript"
98
- theme = "monokai "
101
+ theme = "dracula "
99
102
width = "100%"
100
103
height = "100%"
101
104
onChange = { handleChange }
102
105
value = { input }
103
106
name = "Code_div"
104
107
readOnly = { false }
105
- fontSize = { 18 }
108
+ fontSize = { 14 }
106
109
tabSize = { 2 }
110
+ wrapEnabled = { true }
107
111
setOptions = { {
108
112
useWorker : false
109
113
} }
0 commit comments