Skip to content

Commit

Permalink
release: 0.40.19
Browse files Browse the repository at this point in the history
  • Loading branch information
RyotaUshio committed Dec 28, 2024
1 parent 682ae51 commit 244bc06
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 9 deletions.
2 changes: 1 addition & 1 deletion manifest-beta.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "pdf-plus",
"name": "PDF++",
"version": "0.40.18",
"version": "0.40.19",
"minAppVersion": "1.5.8",
"description": "The most Obsidian-native PDF annotation tool ever.",
"author": "Ryota Ushio",
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "pdf-plus",
"name": "PDF++",
"version": "0.40.18",
"version": "0.40.19",
"minAppVersion": "1.5.8",
"description": "The most Obsidian-native PDF annotation tool ever.",
"author": "Ryota Ushio",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-pdf-plus",
"version": "0.40.18",
"version": "0.40.19",
"description": "The most Obsidian-native PDF annotation tool ever.",
"scripts": {
"dev": "node esbuild.config.mjs",
Expand Down
1 change: 1 addition & 0 deletions src/backlink-visualizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ export class PDFViewerBacklinkVisualizer extends PDFBacklinkVisualizer implement
set hoverPopover(hoverPopover: HoverPopover | null) {
// We can add some post-processing if needed
this.child.hoverPopover = hoverPopover;
hoverPopover?.hoverEl.addClass('pdf-plus-backlink-popover');
}

onload() {
Expand Down
10 changes: 9 additions & 1 deletion src/lib/copy-link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ export class copyLinkLib extends PDFPlusLibSubmodule {

(async () => {
let text = embedLink;
const page = child.getPage(pageNumber).pdfPage;
let page = child.getPage(pageNumber).pdfPage;
const extension = this.settings.rectImageExtension;

if (!this.settings.rectEmbedStaticImage) {
Expand All @@ -444,6 +444,14 @@ export class copyLinkLib extends PDFPlusLibSubmodule {
await navigator.clipboard.writeText(text);

const createImageFile = async () => {
// I don't know why, but if the PDF viewer is in a popup window (i.e. !== window),
// font rendering fails and characters are rendered as boxes.
// Therefore, we need to load the PDF document again.
// https://github.com/RyotaUshio/obsidian-pdf-plus/issues/323
if (child.containerEl.win !== window) {
const doc = await this.lib.loadPDFDocument(file);
page = await doc.getPage(pageNumber);
}
const buffer = await this.lib.pdfPageToImageArrayBuffer(page, { type: `image/${extension}`, cropRect: rect });
return await this.app.vault.createBinary(imagePath, buffer);
};
Expand Down
2 changes: 0 additions & 2 deletions src/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -871,8 +871,6 @@ export class PDFPlusLib {
return this.app.vault.getAvailablePath(removeExtension(file.path), file.extension);
}



get metadataCacheUpdatePromise() {
return new Promise<void>((resolve) => this.app.metadataCache.onCleanCache(resolve));
}
Expand Down
36 changes: 35 additions & 1 deletion styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,35 @@ settings:
step: 1
default: 2
format: px
-
id: hover-popover
title: Hover popovers
type: heading
level: 2
-
id: pdf-plus-backlink-popover
title: Backlink popovers
description: Style for popovers displayed when hovering over backlinked highlights or rectangular selections in PDF viewer
type: heading
level: 3
-
id: pdf-plus-backlink-popover-width
title: Backlink popover width (px)
type: variable-number-slider
min: 100
max: 1000
step: 10
default: 450
format: px
-
id: pdf-plus-backlink-popover-height
title: Backlink popover height (px)
type: variable-number-slider
min: 100
max: 1000
step: 10
default: 400
format: px
-
id: pdf-toolbar
title: PDF toolbars
Expand Down Expand Up @@ -526,6 +555,11 @@ body {
pointer-events: none;
}

.popover.hover-popover.pdf-plus-backlink-popover {
--popover-width: var(--pdf-plus-backlink-popover-width, 450px);
--popover-height: var(--pdf-plus-backlink-popover-height, 400px);
}

.popover.hover-popover.pdf-plus-bib-popover {
--popover-width: 400px;
--pdf-plus-bib-metadata-font-size: var(--font-ui-small);
Expand Down Expand Up @@ -606,4 +640,4 @@ body {
body.pdf-plus-vim-hint-inverted {
--pdf-plus-vim-hint-color: var(--text-on-accent);
--pdf-plus-vim-hint-background-color: hsl(var(--accent-h), var(--accent-s), var(--accent-l));
}
}

0 comments on commit 244bc06

Please sign in to comment.