Skip to content

Commit

Permalink
feat(editor): pdf progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
Novout committed Nov 17, 2021
1 parent bf59b8c commit 3a8d250
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/use/pdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { useProjectStore } from '@/store/project'
import { usePDFStore } from '@/store/pdf'
import { useAbsoluteStore } from '@/store/absolute'
import { useStorage } from './storage/storage'
import { useNProgress } from '@vueuse/integrations'

export const usePDF = () => {
const ABSOLUTE = useAbsoluteStore()
Expand All @@ -26,6 +27,7 @@ export const usePDF = () => {
const env = useEnv()
const project = useProject()
const storage = useStorage()
const { isLoading } = useNProgress()
const { t } = useI18n()

const init: Callback<any> = async () => {
Expand Down Expand Up @@ -764,8 +766,10 @@ export const usePDF = () => {

pdf.download(`${PROJECT.nameRaw}.pdf`, () => {
toast.success(t('toast.pdf.create'))

ABSOLUTE.load = false

isLoading.value = false
})
}

Expand Down Expand Up @@ -795,6 +799,8 @@ export const usePDF = () => {
input.appendChild(iframe)

ABSOLUTE.load = false

isLoading.value = false
})
}

Expand All @@ -805,6 +811,7 @@ export const usePDF = () => {
toast.info(t('toast.generics.load'))

ABSOLUTE.load = true
isLoading.value = true

storage.normalize().then(() => {
create()
Expand All @@ -815,6 +822,7 @@ export const usePDF = () => {
if (useEnv().isEmptyProject(PROJECT.name)) return

ABSOLUTE.load = true
isLoading.value = true

storage.normalize().then(() => {
preview(input)
Expand Down

0 comments on commit 3a8d250

Please sign in to comment.