<template>
  <Button :class="{ active: isOpen }" @click="changePageViewStatus" :title="$t('header.viewSetting')">
    <Pageset />
  </Button>
</template>

<script setup>
import { computed } from 'vue'
import { useViewerStore } from '@/stores/modules/viewer'

const useViewer = useViewerStore()
const isOpen = computed(() => useViewer.isElementOpen('pageModePanel'))

const changePageViewStatus = () => {
  if (isOpen.value) {
    useViewer.closeElement('pageModePanel')
  } else {
    useViewer.openElement('pageModePanel')
    
    useViewer.closeElement('contentEditorPanel')
  }
}
</script>
