Skip to content
Snippets Groups Projects
dm5-topicmap-panel.vue 1.88 KiB
Newer Older
Jörg Richter's avatar
Jörg Richter committed
<template>
  <div class="dm5-topicmap-panel" v-loading="loading">
    <dm5-toolbar :comp-defs="toolbarCompDefs"></dm5-toolbar>
    <div ref="mountElement"></div><!-- topicmap renderer mount element -->
Jörg Richter's avatar
Jörg Richter committed
  </div>
</template>

<script>
import { mapState } from 'vuex'

Jörg Richter's avatar
Jörg Richter committed
export default {
    // console.log('dm5-topicmap-panel created', this.topicmapTypes)
    this.$store.registerModule('topicmapPanel', require('../topicmap-panel').default)
  mounted () {
    // console.log('dm5-topicmap-panel mounted')
    this.$store.dispatch('_initTopicmapPanel', {
      mountElement: this.$refs.mountElement,
  mixins: [
    require('./mixins/object').default,
    require('./mixins/writable').default,
    require('./mixins/object-renderers').default
  ],

  props: {
    toolbarCompDefs: Object,
    contextCommands: Object,
    quillConfig: Object
Jörg Richter's avatar
Jörg Richter committed
  data () {
    return {
      // mirror props ### FIXME: add remaining props?
      object_:   this.object,
      writable_: this.writable
    }
  },

  computed: mapState({
    topicmapRenderer: state => state.topicmapPanel.topicmapRenderer,
    loading:          state => state.topicmapPanel.loading
  }),
Jörg Richter's avatar
Jörg Richter committed
    object_ () {
      // console.log('object_ watcher', this.object_)
      this.checkTopicmapRenderer()
Jörg Richter's avatar
Jörg Richter committed
      this.topicmapRenderer.object = this.object_
Jörg Richter's avatar
Jörg Richter committed
    writable_ () {
      // console.log('writable_ watcher', this.writable_)
      this.checkTopicmapRenderer()
Jörg Richter's avatar
Jörg Richter committed
      this.topicmapRenderer.writable = this.writable_
    }
  },

  methods: {
    checkTopicmapRenderer () {
      if (!this.topicmapRenderer) {
        throw Error('Topicmap renderer not yet instantiated')
      }
  components: {
    'dm5-toolbar': require('./dm5-toolbar').default
Jörg Richter's avatar
Jörg Richter committed
  }
}
</script>

<style>
</style>