包详细信息

@scalar/use-codemirror

scalar218.1kMIT0.12.19

CodeMirror for Vue

codemirror, composable, vue, vue3

自述文件

CodeMirror Hook for Vue

Version Downloads License Discord

Installation

npm install @scalar/use-codemirror

Usage

<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.