Skip to content

Commit

Permalink
chore(pdf): import definitions alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
Novout committed Jul 11, 2022
1 parent 3c286c1 commit fd5358d
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@
<script setup lang="ts">
import { useDOCXStore } from '@/store/docx'
import { useFile } from '@/use/file'
import { useI18n } from 'vue-i18n'
import { useToast } from 'vue-toastification'
const DOCX = useDOCXStore()
const file = useFile()
const toast = useToast()
const { t } = useI18n()
const importFile = async () => {
file
Expand All @@ -19,6 +23,7 @@
})
.then((data: any) => {
if (data.base) DOCX.$state = data
else toast.error(t('toast.generics.configurationFail'))
})
.catch(() => {})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
@close="ABSOLUTE.pdf.configuration = false"
/>
</div>
<PDFConfigurationConfig />
<PDFConfigurationPreview
v-if="os !== 'Android' && os !== 'iOS' && os !== 'Mac OS'"
/>
<div class="flex items-start flex-col my-5">
<PDFConfigurationConfig class="h-10" />
<PDFConfigurationPreview
v-if="os !== 'Android' && os !== 'iOS' && os !== 'Mac OS'"
/>
</div>
<GeneratorToggle :value="false" :title="t('editor.pdf.project.title')">
<PDFConfigurationEncryption />
</GeneratorToggle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@
<script setup lang="ts">
import { usePDFStore } from '@/store/pdf'
import { useFile } from '@/use/file'
import { useI18n } from 'vue-i18n'
import { useToast } from 'vue-toastification'
const PDF = usePDFStore()
const file = useFile()
const toast = useToast()
const { t } = useI18n()
const importFile = async () => {
file
Expand All @@ -19,6 +23,7 @@
})
.then((data: any) => {
if (data.base) PDF.styles = data
else toast.error(t('toast.generics.configurationFail'))
})
.catch(() => {})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
<script setup lang="ts">
import { useProjectStore } from '@/store/project'
import { useFile } from '@/use/file'
import { useI18n } from 'vue-i18n'
import { useToast } from 'vue-toastification'
const PROJECT = useProjectStore()
const file = useFile()
const toast = useToast()
const { t } = useI18n()
const importFile = async () => {
file
Expand All @@ -26,6 +30,7 @@
Array.isArray(data.bold)
)
PROJECT.templates.substitutions = data
else toast.error(t('toast.generics.configurationFail'))
})
.catch(() => {})
}
Expand Down
2 changes: 2 additions & 0 deletions packages/better-write-localisation/src/en-US/toast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export default {
error: 'An unexpected error occurred :(',
supported: 'Your browser does not support this feature :(',
cancel: 'The action has been cancelled!',
configurationFail: 'The imported configuration is not valid!',
},
pdf: {
error:
Expand All @@ -12,6 +13,7 @@ export default {
save: 'Configurações salvas com sucesso!',
},
create: 'Successfully Downloaded PDF!',
preview: 'PDF Preview successfully completed!',
generate: {
empty: 'Please select at least one chapter!',
},
Expand Down
2 changes: 2 additions & 0 deletions packages/better-write-localisation/src/pt-BR/toast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export default {
error: 'Um erro inesperado ocorreu :(',
supported: 'O seu navegador não suporta este recurso :(',
cancel: 'A ação foi cancelada!',
configurationFail: 'A configuração importada nao é válida!',
},
pdf: {
error:
Expand All @@ -12,6 +13,7 @@ export default {
save: 'Configurações salvas com sucesso!',
},
create: 'PDF Baixado com Sucesso!',
preview: 'Preview do PDF executado com sucesso!',
generate: {
empty: 'Selecione pelo menos um capítulo!',
},
Expand Down
2 changes: 1 addition & 1 deletion packages/better-write-plugin-pdf/src/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1350,7 +1350,7 @@ export const PluginPDFSet = (

input?.appendChild(iframe)

toast.success(hooks.i18n.t('toast.pdf.create'))
toast.success(hooks.i18n.t('toast.pdf.preview'))
},
(err: any) => {
if (hooks.env.isDev()) console.log(err)
Expand Down

0 comments on commit fd5358d

Please sign in to comment.