Skip to content

Using custom language #41

Answered by imguolao
ianteohsc asked this question in Q&A
Nov 30, 2023 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

Hi, im strugling on enabling comments in json model, how can i get monaco instance?

If you are in vue, you can get a monaco instance via component hooks.

<template>
  <vue-monaco-editor @beforeMount ="handleBeforeMount" @mount="handleMount" />
</template>

<script lang="ts" setup>
import { shallowRef } from 'vue'

const monaco= shallowRef()
const editor = shallowRef()

// Both hooks can get the monaco instances
const handleBeforeMount = monacoInstance => (monaco.value = monacoInstance)

const handleMount = (editorInstance, monacoInstance) => {
  editor.value = editorInstance
  monaco.value = monacoInstance
}
</script>

Or this way:

<template>
  <div ref="containerRef"></div>
</template>

<

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@DeedsBaron
Comment options

@imguolao
Comment options

Answer selected by imguolao
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants