Package Exports
- @scalar/use-codemirror
- @scalar/use-codemirror/src/index.ts
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@scalar/use-codemirror) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
CodeMirror Hook for Vue
Installation
npm install @scalar/use-codemirrorUsage
<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>Community
We are API nerds. You too? Let's chat on Discord: https://discord.gg/scalar
License
The source code in this repository is licensed under MIT.