forked from bazingaedward/monaco-editor-vue3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
bazingaedward
committed
Jul 1, 2021
1 parent
dcbcde1
commit e7a9e3f
Showing
2 changed files
with
103 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) bazingaedward <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,82 @@ | ||
# Monaco Editor Vue3 | ||
# Monaco Editor Vue3 | ||
[Monaco Editor](https://github.com/Microsoft/monaco-editor) is the code editor that powers VS Code, now it's available as a Vue3 component `<MonacoEditor>` thanks to this project. | ||
|
||
## Install | ||
|
||
```bash | ||
npm install monaco-editor-vue3 | ||
``` | ||
|
||
Or | ||
|
||
```bash | ||
yarn add monaco-editor-vue3 | ||
``` | ||
|
||
## Usage | ||
|
||
### Use ESM version with webpack | ||
|
||
Use [monaco-editor-webpack-plugin](https://github.com/Microsoft/monaco-editor-webpack-plugin): | ||
|
||
```js | ||
// webpack.config.js | ||
const MonacoEditorPlugin = require('monaco-editor-webpack-plugin') | ||
|
||
module.exports = { | ||
plugins: [ | ||
new MonacoEditorPlugin({ | ||
// https://github.com/Microsoft/monaco-editor-webpack-plugin#options | ||
// Include a subset of languages support | ||
// Some language extensions like typescript are so huge that may impact build performance | ||
// e.g. Build full languages support with webpack 4.0 takes over 80 seconds | ||
// Languages are loaded on demand at runtime | ||
languages: ['javascript', 'css', 'html', 'typescript'] | ||
}) | ||
] | ||
} | ||
``` | ||
|
||
Then use the component: | ||
|
||
```vue | ||
<template> | ||
<MonacoEditor class="editor" v-model="code" language="javascript" /> | ||
</template> | ||
<script> | ||
import MonacoEditor from 'vue-monaco' | ||
export default { | ||
components: { | ||
MonacoEditor | ||
}, | ||
data() { | ||
return { | ||
code: 'const noop = () => {}' | ||
} | ||
} | ||
} | ||
</script> | ||
<style> | ||
.editor { | ||
width: 600px; | ||
height: 800px; | ||
} | ||
</style> | ||
``` | ||
|
||
## Contributing | ||
|
||
1. Fork it! | ||
2. Create your feature branch: `git checkout -b my-new-feature` | ||
3. Commit your changes: `git commit -am 'Add some feature'` | ||
4. Push to the branch: `git push origin my-new-feature` | ||
5. Submit a pull request :D | ||
|
||
## Author | ||
|
||
**Monaco Editor Vue3** © [bazingaedward](https://github.com/bazingaedward), Released under the [MIT](./LICENSE) License.<br> | ||
Authored and maintained by egoist with help from contributors ([list](https://github.com/bazingaedward/monaco-editor-vue3/contributors)). |