<template>
  <div>
    <editor :content="content" @on-change="onChange" />
  </div>
</template>

<script>
import editor from './index'

export default {
  components: {
    editor,
  },
  props: ['data', 'value', 'option', 'error'],
  data () {
    return {
      content: this.value[this.data.keyword],
    }
  },
  methods: {
    onChange (content) {
      this.$hub.$emit(this.data.hub, {
        type: 'value',
        payload: Object.assign(this.value, {
          [this.data.keyword]: content,
        }),
      })
    },
  },
}
</script>
