Skip to content

Commit

Permalink
Quick fixes for printing very long words and URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
carlobeltrame committed Jun 28, 2024
1 parent f043588 commit eb8c246
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
10 changes: 10 additions & 0 deletions pdf/src/CampPrint.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ import Picasso from '@/campPrint/picasso/Picasso.vue'
import Story from '@/campPrint/story/Story.vue'
import Program from '@/campPrint/program/Program.vue'
import Activity from '@/campPrint/activity/Activity.vue'
import { wordHyphenation } from '@react-pdf/textkit'
const originalHyphenationCallback = wordHyphenation()
export default {
name: 'CampPrint',
Expand All @@ -47,6 +50,13 @@ export default {
}
const registerFonts = async () => {
Font.registerHyphenationCallback((word) => {
if (word && word.length > 70) {
return word.split('')
}
return originalHyphenationCallback(word)
})
Font.register({
family: 'InterDisplay',
fonts: [
Expand Down
8 changes: 7 additions & 1 deletion print/components/generic/RichText.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<!-- eslint-disable-next-line vue/no-v-html -->
<div class="tw-prose tw-prose-neutral" v-html="purifiedHtml" />
<div class="tw-prose tw-prose-neutral wrap-anywhere" style="word-wrap: anywhere" v-html="purifiedHtml" />

Check failure on line 3 in print/components/generic/RichText.vue

View workflow job for this annotation

GitHub Actions / Lint: Print (ESLint)

Replace `·class="tw-prose·tw-prose-neutral·wrap-anywhere"·style="word-wrap:·anywhere"·v-html="purifiedHtml"` with `⏎····class="tw-prose·tw-prose-neutral·wrap-anywhere"⏎····style="word-wrap:·anywhere"⏎····v-html="purifiedHtml"⏎·`
</template>

<script>
Expand All @@ -23,3 +23,9 @@ export default {
},
}
</script>

<style lang="scss">

Check warning on line 27 in print/components/generic/RichText.vue

View workflow job for this annotation

GitHub Actions / Lint: Print (ESLint)

Missing attribute `scoped`
.wrap-anywhere {
word-wrap: anywhere;
}
</style>

0 comments on commit eb8c246

Please sign in to comment.