Skip to content

Commit

Permalink
fix(pdf): preview in line break render image not support
Browse files Browse the repository at this point in the history
  • Loading branch information
Novout committed Feb 1, 2022
1 parent bc1116b commit b103c64
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/better-write-plugin-pdf/src/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ export const PluginPDFSet = (
}
}

const lineBreak = (fixed: boolean = true) => {
const lineBreak = (fixed: boolean = true, final: boolean) => {
if (!final && fixed) return

if (
stores.PDF.styles.lineBreak.image.data &&
stores.PDF.styles.lineBreak.image.active &&
Expand Down Expand Up @@ -434,14 +436,16 @@ export const PluginPDFSet = (

pages.forEach((page: ContextState) => {
page.entities.forEach((entity: Entity) => {
let _raw = {}
let _raw: any = {}

if (
entity.raw === hooks.env.emptyLine() &&
entity.type === 'paragraph'
) {
_raw = lineBreak(false)
arr.push(_raw)
_raw = lineBreak(false, options.final)

if (_raw) arr.push(_raw)

return
}

Expand All @@ -456,7 +460,7 @@ export const PluginPDFSet = (
} else if (entity.type === 'page-break') {
_raw = pageBreak()
} else if (entity.type === 'line-break') {
_raw = lineBreak()
_raw = lineBreak(true, options.final)
} else if (entity.type === 'image') {
if (!options.final) return

Expand Down

0 comments on commit b103c64

Please sign in to comment.