Skip to content

Commit

Permalink
fix capturing screenshots on pdfs
Browse files Browse the repository at this point in the history
  • Loading branch information
blackforestboi committed May 7, 2024
1 parent 30b1f47 commit e2c82f6
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/content-scripts/content_script/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -650,14 +650,7 @@ export async function main(
}

let anchor: Anchor
const quote = getSelectionHtml(selection)
const descriptor = await anchoring.selectionToDescriptor({
_document: this.document,
_window: this.window,
isPdf: this.pdfViewer != null,
selection,
})
anchor = { quote, descriptor }
let quote: string

if (
!(await pageActionAllowed(
Expand Down Expand Up @@ -711,6 +704,15 @@ export async function main(
annotationId = results.annotationId
await results.createPromise
} else if (selection) {
quote = getSelectionHtml(selection)
const descriptor = await anchoring.selectionToDescriptor({
_document: this.document,
_window: this.window,
isPdf: this.pdfViewer != null,
selection,
})
anchor = { quote, descriptor }

const results = await saveHighlight(
shouldShare,
shouldCopyShareLink,
Expand Down

0 comments on commit e2c82f6

Please sign in to comment.