<script lang="jsx">
export default {
  name: 'DgEditor',
  functional: true,
  inheritAttrs: false,
  props: {
    editor: {
      type: String,
      required: true,
    },
  },
  render(h, ctx) {
    const { class: className, ...data } = ctx.data

    return h(ctx.props.editor, { class: [className, 'dg-editor'], ...data }, [
      ...(ctx.children || []),
      ...Object.entries(ctx.scopedSlots).map(([slot, render]) => h({ render }, { slot })),
    ])
  },
}
</script>
