Skip to content

Commit

Permalink
chore(pdf): blank project in generate instant
Browse files Browse the repository at this point in the history
  • Loading branch information
Novout committed Jul 11, 2022
1 parent fd5358d commit 84282fc
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</EditorHeaderItem>
<EditorHeaderItem
:text="t('editor.bar.pdf.generate')"
@action="ABSOLUTE.pdf.generate = true"
@action="onPDFGenerate"
>
<template #icon>
<IconPDF class="w-6 h-6" />
Expand Down Expand Up @@ -81,11 +81,29 @@
import { useEnv } from '@/use/env'
import { useI18n } from 'vue-i18n'
import { usePlugin } from 'better-write-plugin-core'
import { useStorage } from '@/use/storage/storage'
import { useProject } from '@/use/project'
const ABSOLUTE = useAbsoluteStore()
const PROJECT = useProjectStore()
const env = useEnv()
const plugin = usePlugin()
const { t } = useI18n()
const storage = useStorage()
const project = useProject()
const onPDFGenerate = async () => {
if (PROJECT.type === 'creative') {
ABSOLUTE.pdf.generate = true
return
}
await storage.normalize()
plugin.emit('plugin-pdf-generate', {
chapters: project.utils().getChaptersSelection(),
})
}
</script>

0 comments on commit 84282fc

Please sign in to comment.