@guolao/vue-monaco-editor
Advanced tools
Comparing version 1.1.3 to 1.1.4
{ | ||
"name": "@guolao/vue-monaco-editor", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "Monaco Editor for Vue 2&3 - use the monaco-editor in any Vue application without needing to use webpack (or rollup/vite) configuration files / plugins", | ||
@@ -48,3 +48,3 @@ "author": { | ||
"dependencies": { | ||
"@monaco-editor/loader": "^1.3.2", | ||
"@monaco-editor/loader": "^1.3.3", | ||
"vue-demi": "latest" | ||
@@ -56,3 +56,3 @@ }, | ||
"esbuild": "^0.17.11", | ||
"monaco-editor": "^0.35.0", | ||
"monaco-editor": "^0.40.0", | ||
"rimraf": "^4.1.2", | ||
@@ -77,3 +77,3 @@ "rollup": "^3.17.2", | ||
}, | ||
"gitHead": "a386ef1bc11b6731ce7327874cbe5eadc5528eab" | ||
"gitHead": "74ea9de91a8a3db25a8779c2e297c66e1d7bfe1b" | ||
} |
@@ -9,3 +9,3 @@ # monaco-vue | ||
English | [中文](https://github.com/imguolao/monaco-vue/blob/main/README.zh-CN.md) | ||
English | [简体中文](https://github.com/imguolao/monaco-vue/blob/main/README.zh-CN.md) | ||
@@ -33,10 +33,2 @@ View [Demo](https://imguolao.github.io/monaco-vue/). | ||
```ts | ||
import { createApp } from 'vue' | ||
import { install as VueMonacoEditorPlugin } from '@guolao/vue-monaco-editor' | ||
const app = createApp(App) | ||
app.use(VueMonacoEditorPlugin) | ||
``` | ||
```vue | ||
<template> | ||
@@ -46,3 +38,4 @@ <vue-monaco-editor | ||
theme="vs-dark" | ||
@change="handleChange" | ||
:options="MONACO_EDITOR_OPTIONS" | ||
@mount=“handleMount” | ||
/> | ||
@@ -52,6 +45,18 @@ </template> | ||
<script lang="ts" setup> | ||
import { ref } from 'vue' | ||
import { ref, shallowRef } from 'vue' | ||
const MONACO_EDITOR_OPTIONS = { | ||
automaticLayout: true, | ||
formatOnType: true, | ||
formatOnPaste: true, | ||
} | ||
const code = ref('// some code...') | ||
const handleChange = console.log | ||
const editorRef = shallowRef() | ||
const handleMount = editor => (editorRef.value = editor) | ||
// your action | ||
function formatCode() { | ||
editorRef.value?.getAction('editor.action.formatDocument').run() | ||
} | ||
</script> | ||
@@ -94,4 +99,4 @@ ``` | ||
<script lang="ts" setup> | ||
import { onUnmounted } from 'vue' | ||
import { useMonaco, watchEffect, nextTick } from '@guolao/vue-monaco-editor' | ||
import { ref, onUnmounted, watchEffect, nextTick } from 'vue' | ||
import { useMonaco } from '@guolao/vue-monaco-editor' | ||
@@ -98,0 +103,0 @@ const containerRef = ref() |
55301
221
Updated@monaco-editor/loader@^1.3.3