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