fix pdf generation

This commit is contained in:
Alex Turchyn
2023-06-18 16:30:35 +03:00
parent 662d052904
commit 02fee9f885
9 changed files with 99 additions and 68 deletions
+3 -2
View File
@@ -4,7 +4,7 @@ import { targets, targetable } from '@github/catalyst/lib/targetable'
export default actionable(targetable(class extends HTMLElement {
static [targets.static] = ['items']
addItem = (e) => {
addItem (e) {
e.preventDefault()
const originalItem = this.items[0]
@@ -26,8 +26,9 @@ export default actionable(targetable(class extends HTMLElement {
originalItem.parentNode.append(duplicateItem)
}
removeItem = (e) => {
removeItem (e) {
e.preventDefault()
this.items.find((item) => item.contains(e.target))?.remove()
}
}))
+5 -7
View File
@@ -46,7 +46,7 @@
>
<div
v-else-if="field.type === 'file'"
class="px-0.5 flex items-center"
class="px-0.5 flex flex-col justify-center"
>
<a
v-for="(attachment, index) in attachments"
@@ -73,9 +73,8 @@
:checked="!!modelValue"
@click="$emit('update:model-value', !modelValue)"
>
<component
:is="modelValue ? 'IconCheckbox' : 'IconSquare'"
v-else
<IconCheck
v-else-if="modelValue"
class="aspect-square"
:class="{ '!w-auto !h-full': area.w > area.h, '!w-full !h-auto': area.w <= area.h }"
/>
@@ -98,14 +97,13 @@
</template>
<script>
import { IconTextSize, IconWriting, IconCalendarEvent, IconPhoto, IconCheckbox, IconPaperclip, IconSelect, IconCircleDot, IconChecks, IconSquare } from '@tabler/icons-vue'
import { IconTextSize, IconWriting, IconCalendarEvent, IconPhoto, IconCheckbox, IconPaperclip, IconSelect, IconCircleDot, IconChecks, IconCheck } from '@tabler/icons-vue'
export default {
name: 'FieldArea',
components: {
IconPaperclip,
IconCheckbox,
IconSquare
IconCheck
},
props: {
field: {
+4 -5
View File
@@ -91,13 +91,12 @@ export default {
fetch(`/submitters/${this.submitterSlug}/download`).then((response) => response.json()).then((urls) => {
urls.forEach((url) => {
fetch(url).then(async (response) => {
const blob = new Blob([await response.text()], { type: `${response.headers.get('content-type')};charset=utf-8;` })
const url = URL.createObjectURL(blob)
fetch(url).then(async (resp) => {
const blobUrl = URL.createObjectURL(await resp.blob())
const link = document.createElement('a')
link.href = url
link.setAttribute('download', response.headers.get('content-disposition').split('"')[1])
link.href = blobUrl
link.setAttribute('download', resp.headers.get('content-disposition').split('"')[1])
link.click()