e-chan1007 / nuxt-monaco-editor

Integrate monaco-editor with Nuxt
https://e-chan1007.github.io/nuxt-monaco-editor
MIT License
119 stars 16 forks source link
monaco-editor nuxt nuxt-module nuxt3

Nuxt Monaco Editor

npm version License: MIT Codacy Badge Test result

Integrate monaco-editor with Nuxt

Install

npx nuxi@latest module add nuxt-monaco-editor

Don't forget to install monaco-editor.

Setup

  1. Add this module to the Nuxt config
export default defineNuxtConfig({
  modules: [
    'nuxt-monaco-editor'
  ]
})
  1. (Optional) Configure the module
export default defineNuxtConfig({
  monacoEditor: {
    // These are default values:
    locale: 'en',
    componentName: {
      codeEditor: 'MonacoEditor',
      diffEditor: 'MonacoDiffEditor'
    }
  }
})
  1. Use the component in your pages or components
<template>
  <MonacoEditor v-model="value" lang="typescript" />
</template>

<script lang="ts" setup>
const value = ref('')
</script>

Development