logue / vue-codemirror6

⌨️ @codemirror 6 component for @vuejs. Vue2 & Vue3 both supported.
https://logue.dev/vue-codemirror6/
MIT License
123 stars 16 forks source link

Bug: @update:model-value return _TextLeaf object instead of string #30

Closed LavaYasha closed 5 months ago

LavaYasha commented 5 months ago

version 1.2.3

<template>
  <div>
    <CodeMirror
      ref="cm"
      :model-value="code"
      @update:model-value="updateCode"
      basic
      dark
      :lang="lang"
    ></CodeMirror>
  </div>
</template>

<script setup lang="ts">
import {onMounted, Ref, ref} from "vue";
import CodeMirror from "vue-codemirror6";
import { LanguageSupport } from '@codemirror/language'
import { sql, PostgreSQL } from "@codemirror/lang-sql";

const props = defineProps<{
  source?: string,
  tables?: { columns: string[] }[],
}>()

const cm = ref()

const code: Ref<string>= ref('')
const updateCode = (val: string) => {
  console.log('value from @update:model-value: ', val)
  code.value = val
}

const lang: LanguageSupport = sql({
  dialect: PostgreSQL,
  schema: {
    tableTest: ['col1', 'col2']
  }
})
</script>

<style scoped lang="scss"></style>

image

logue commented 5 months ago

Fixed in 1.2.5.

LavaYasha commented 5 months ago

Thanks, this resolved the issue.