@@ -12,7 +12,6 @@ import {
12
12
useAreas ,
13
13
useEnums ,
14
14
useNotes ,
15
- useSettings ,
16
15
useDiagram ,
17
16
useTransform ,
18
17
useTypes ,
@@ -34,21 +33,12 @@ import ImportSource from "./ImportSource";
34
33
import SetTableWidth from "./SetTableWidth" ;
35
34
import Language from "./Language" ;
36
35
import Share from "./Share" ;
37
- import CodeMirror from "@uiw/react-codemirror" ;
38
- import { sql } from "@codemirror/lang-sql" ;
39
- import { vscodeDark } from "@uiw/codemirror-theme-vscode" ;
40
- import { json } from "@codemirror/lang-json" ;
41
- import { githubLight } from "@uiw/codemirror-theme-github" ;
36
+ import Code from "./Code" ;
42
37
import { useTranslation } from "react-i18next" ;
43
38
import { importSQL } from "../../../utils/importSQL" ;
44
39
import { databases } from "../../../data/databases" ;
45
40
import { isRtl } from "../../../i18n/utils/rtl" ;
46
41
47
- const languageExtension = {
48
- sql : [ sql ( ) ] ,
49
- json : [ json ( ) ] ,
50
- } ;
51
-
52
42
export default function Modal ( {
53
43
modal,
54
44
setModal,
@@ -64,7 +54,6 @@ export default function Modal({
64
54
const { setNotes } = useNotes ( ) ;
65
55
const { setAreas } = useAreas ( ) ;
66
56
const { setTypes } = useTypes ( ) ;
67
- const { settings } = useSettings ( ) ;
68
57
const { setEnums } = useEnums ( ) ;
69
58
const { setTasks } = useTasks ( ) ;
70
59
const { setTransform } = useTransform ( ) ;
@@ -303,14 +292,7 @@ export default function Modal({
303
292
{ modal === MODAL . IMG ? (
304
293
< Image src = { exportData . data } alt = "Diagram" height = { 280 } />
305
294
) : (
306
- < CodeMirror
307
- value = { exportData . data }
308
- height = "360px"
309
- extensions = { languageExtension [ exportData . extension ] }
310
- onChange = { ( ) => { } }
311
- editable = { false }
312
- theme = { settings . mode === "dark" ? vscodeDark : githubLight }
313
- />
295
+ < Code value = { exportData . data } language = { exportData . extension } />
314
296
) }
315
297
< div className = "text-sm font-semibold mt-2" > { t ( "filename" ) } :</ div >
316
298
< Input
@@ -387,7 +369,8 @@ export default function Modal({
387
369
width = { getModalWidth ( modal ) }
388
370
bodyStyle = { {
389
371
maxHeight : window . innerHeight - 280 ,
390
- overflow : "auto" ,
372
+ overflow :
373
+ modal === MODAL . CODE || modal === MODAL . IMG ? "hidden" : "auto" ,
391
374
direction : "ltr" ,
392
375
} }
393
376
>
0 commit comments