From e2c82f61c2e5e9f9b5e9b41c9a0b35ca3fae2cc4 Mon Sep 17 00:00:00 2001 From: Oliver Sauter Date: Tue, 7 May 2024 13:58:22 +0200 Subject: [PATCH] fix capturing screenshots on pdfs --- src/content-scripts/content_script/global.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/content-scripts/content_script/global.ts b/src/content-scripts/content_script/global.ts index 7693a2467d..615c415774 100644 --- a/src/content-scripts/content_script/global.ts +++ b/src/content-scripts/content_script/global.ts @@ -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( @@ -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,