문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판이전 판다음 판 | 이전 판 | ||
| study:monaco_editor [2021/10/01 14:20] – 바깥 편집 127.0.0.1 | study:monaco_editor [2025/04/15 10:05] (현재) – 바깥 편집 127.0.0.1 | ||
|---|---|---|---|
| 줄 1: | 줄 1: | ||
| + | ====== About Monaco Editor ====== | ||
| + | [[monaco_editor|Microsoft Monaco Editor]] | ||
| + | ===== install ===== | ||
| + | <code bash> | ||
| + | > npm install css-loader monaco-editor style-loader --save-dev | ||
| + | </ | ||
| + | === package.json === | ||
| + | |||
| + | <file javascript package.json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | === webpack.config.js === | ||
| + | <code javascript webpack.config.js> | ||
| + | const path = require(' | ||
| + | |||
| + | module.exports = { | ||
| + | mode: ' | ||
| + | entry: { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | output: { | ||
| + | globalObject: | ||
| + | filename: ' | ||
| + | path: path.resolve(__dirname, | ||
| + | }, | ||
| + | module: { | ||
| + | rules: [{ | ||
| + | test: /\.css$/, | ||
| + | use: [ ' | ||
| + | }] | ||
| + | }, | ||
| + | }; | ||
| + | |||
| + | </ | ||
| + | |||
| + | === index.js === | ||
| + | <file javascript index.js> | ||
| + | import * as monaco from ' | ||
| + | |||
| + | self.MonacoEnvironment = { | ||
| + | getWorkerUrl: | ||
| + | if (label === ' | ||
| + | return ' | ||
| + | } | ||
| + | if (label === ' | ||
| + | return ' | ||
| + | } | ||
| + | if (label === ' | ||
| + | return ' | ||
| + | } | ||
| + | if (label === ' | ||
| + | return ' | ||
| + | } | ||
| + | return ' | ||
| + | } | ||
| + | } | ||
| + | |||
| + | monaco.editor.create(document.getElementById(' | ||
| + | value: [ | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ].join(' | ||
| + | language: ' | ||
| + | }); | ||
| + | </ | ||
| + | === index.html === | ||
| + | <file html index.html> | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | <meta http-equiv=" | ||
| + | <meta http-equiv=" | ||
| + | </ | ||
| + | < | ||
| + | |||
| + | <div id=" | ||
| + | |||
| + | <script src=" | ||
| + | |||
| + | </ | ||
| + | </ | ||
| + | </ | ||