<template>
    <div>
        <div class="status"></div>
        <div class="item" @click="manualLoadView()">
            <span>{{ t('toolbar.save-as-pdf') }}</span>
            <span></span>
        </div>
    </div>
</template>

<script setup>
import { saveAsPdf } from '@/api';
import { ElLoading } from 'element-plus';
import { defineComponent } from 'vue';
import { useI18n } from 'vue-i18n';

const { t } = useI18n();

defineComponent({ name: 'save-as-pdf' });

async function manualLoadView() {
    const loading = new ElLoading.service({
        lock: true,
        text: t('saving'),
        background: 'rgba(0, 0, 0, 0.7)'
    });

    const res = await saveAsPdf();
    loading.close();
}

// document.addEventListener('keydown', async event => {
//     if (event.ctrlKey && event.key === 'k') {
//         event.preventDefault();
//         manualLoadView();
//     }
// });

</script>