Skip to content

Commit 5711c5f

Browse files
committed
Add editor file to handle monaco editor creation
I think this is more clear as the editor creation is in another file. I still have to move the main.js content in order to use this file This is a refactor for the Twitch crowd
1 parent 72fa052 commit 5711c5f

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

editor.js

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import * as monaco from 'monaco-editor'
2+
3+
const COMMON_EDITOR_OPTIONS = {
4+
automaticLayout: true,
5+
fontSize: 18,
6+
scrollBeyondLastLine: false,
7+
roundedSelection: false,
8+
padding: {
9+
top: 16
10+
},
11+
lineNumbers: false,
12+
minimap: {
13+
enabled: false
14+
},
15+
theme: 'vs-dark'
16+
}
17+
18+
export const createEditor = ({ domElement, language, value }) => {
19+
monaco.editor.create(domElement, {
20+
value,
21+
language,
22+
...COMMON_EDITOR_OPTIONS
23+
})
24+
}

0 commit comments

Comments
 (0)