Comments (2)
You can take a look here: Props & Events & slots
example:
<template>
<vue-monaco-editor
v-model:value="code"
theme="vs-dark"
:options="MONACO_EDITOR_OPTONS"
@mount=“handleMount”
/>
</template>
<script lang="ts" setup>
import { ref, shallowRef } from 'vue'
import * as monaco from 'monaco-editor'
const MONACO_EDITOR_OPTONS = {
automaticLayout: true,
formatOnType: true,
formatOnPaste: true,
}
const code = ref('// some code...')
const editorRef = shallowRef<monaco.editor.IStandaloneCodeEditor>()
const handleMount = editor => (editorRef.value = editor)
// your action
funtion formatCode() {
editorRef.value?.getAction('editor.action.formatDocument').run()
}
</script>
from monaco-vue.
Thanks! Hope the example can be added into README.md
.
from monaco-vue.
Related Issues (20)
- [feat] support diff editor HOT 3
- Error Using Latest Monaco Package HOT 2
- Not working with 'warn' messages and some configurations HOT 3
- 0.41.0 The input prompt is not displayed. HOT 5
- `build.rollupOptions.output` in `vite.config.ts` is not working HOT 2
- bug: the monaco editor is loaded during SSR
- Modify monaco before loader.config({ monaco }) HOT 1
- It is not possible to load a custom monaco instance with `await import` HOT 9
- 如何给编辑器添加一个自定义的全局变量及类型呢? HOT 1
- Monaco initialization error: no such file or directory, open 'https:/cdn.jsdelivr.net/npm/[email protected]/min/vs/editor/editor.main.js' HOT 4
- index.js:314 Uncaught (in promise) TypeError: monacoRef.value.editor.onDidChangeMarkers is not a function HOT 2
- UMD HOT 2
- 请教下有没有办法配合 monaco-editor-nginx 一起使用 HOT 4
- I use [email protected] but i don't install by npm. HOT 1
- why not lien prop does not work HOT 1
- How to get Range from Editor or Highlight Lines? HOT 2
- [FAQ] 自定义语言和主题 - Custom languages and themes
- Change Background Color or Theme HOT 6
- Add error handling when CDN fails HOT 4
- Update monaco-editor HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from monaco-vue.