Skip to content

Commit 182d6ce

Browse files
Copilotcubap
andcommitted
Fix blank page when loading pages with no lines
Handle pages without lines in updateTranscriptionImages by still loading and displaying the canvas even when there are no line annotations. Shows the full page image instead of returning early. Co-authored-by: cubap <1119165+cubap@users.noreply.github.com>
1 parent e5497b1 commit 182d6ce

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

interfaces/transcription/index.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,21 @@ export default class TranscriptionInterface extends HTMLElement {
518518
const { orderedItems, columnsInPage } = orderPageItemsByColumns(projectPage, this.#page)
519519
this.#page.items = orderedItems
520520
let thisLine = this.#page.items?.[0]
521-
if (!thisLine) return
521+
522+
// Handle pages with no lines - still load the canvas
523+
if (!thisLine) {
524+
// Get canvas from page target even when there are no lines
525+
const { canvasID } = this.setCanvasAndSelector(null, this.#page)
526+
if (!canvasID) return
527+
const canvas = this.#canvas = await vault.get(canvasID, 'canvas')
528+
// Show full page when there are no lines
529+
const regionValue = `0,0,${canvas?.width ?? 'full'},${(canvas?.height && canvas?.height / 10) ?? 120}`
530+
topImage.canvas = canvasID
531+
bottomImage.canvas = canvas
532+
topImage.setAttribute('region', regionValue)
533+
return
534+
}
535+
522536
if (!(thisLine?.body)) thisLine = await vault.get(thisLine, 'annotation', true)
523537
const { canvasID, region } = this.setCanvasAndSelector(thisLine, this.#page)
524538
const canvas = this.#canvas = await vault.get(canvasID, 'canvas')

0 commit comments

Comments
 (0)