npm install @scalar/use-codemirror
<script setup>
import { useCodeMirror } from '@scalar/use-codemirror'
import { ref } from 'vue'
const editor = ref(null)
const { codeMirror, setCodeMirrorContent } = useCodeMirror({
codeMirrorRef: editor,
content: '{ "foo": "bar" }',
language: 'json',
lineNumbers: true,
onChange: (value) => {
console.log('Content changed:', value)
},
})
</script>
<template>
<div ref="editor" />
</template>
We are API nerds. You too? Let’s chat on Discord: https://discord.gg/scalar
The source code in this repository is licensed under MIT.