Skip to content

Commit

Permalink
release: 0.8.5
Browse files Browse the repository at this point in the history
  • Loading branch information
RyotaUshio committed Dec 24, 2023
1 parent 66b8fd0 commit 8fbe15c
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ These features enrich Obsidian as a stand-alone PDF annotation tool. I recommend
### Opening links to PDF files

- **Open PDF links cleverly**: When opening a link to a PDF file, a new tab will not be opened if the file is already opened. Useful for annotating PDFs using "Copy link to selection."
- **Don\'t move focus to PDF viewer after opening a link**
- **Don\'t move focus to PDF viewer after opening a PDF link**
- **Clear highlights after a certain amount of time**

### Copying links to PDF files
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.8.4",
"version": "0.8.5",
"minAppVersion": "1.3.5",
"description": "Enhance PDF viewer & embeds.",
"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.8.4",
"version": "0.8.5",
"description": "An Obsidian.md plugin to enhance PDF viewer & embeds.",
"scripts": {
"dev": "node esbuild.config.mjs",
Expand Down
File renamed without changes.
7 changes: 6 additions & 1 deletion src/backlinks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PDFPlus from "main";
import { App, Component, HoverParent, HoverPopover, Keymap, MarkdownView, Notice, PaneType, SectionCache, TFile, parseLinktext } from "obsidian";
import { App, Component, HoverParent, HoverPopover, Keymap, Notice, SectionCache, TFile, parseLinktext } from "obsidian";
import { BacklinkView, ObsidianViewer } from "typings";


Expand All @@ -16,6 +16,7 @@ export class BacklinkManager extends Component implements HoverParent {
this.file = null;
this.hoverPopover = null;
this.eventManager = this.addChild(new Component());
plugin.addChild(this); // clear highlight on plugin unload
}

onload() {
Expand All @@ -27,6 +28,10 @@ export class BacklinkManager extends Component implements HoverParent {
}
}

onunload() {
this.clearTextHighlight();
}

highlightBacklinks() {
try {
this._highlightBacklinks();
Expand Down
4 changes: 2 additions & 2 deletions src/patch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export const patchWorkspace = (plugin: PDFPlus) => {
});
if (leaf) {
openViewState = openViewState ?? {};
openViewState.active = !plugin.settings.dontActivateAfterOpen;
openViewState.active = !plugin.settings.dontActivateAfterOpenPDF;
return leaf.openLinkText(linktext, sourcePath, openViewState).then(() => {
const view = leaf.view as PDFView;
const child = view.viewer.child;
Expand Down Expand Up @@ -197,7 +197,7 @@ export const patchPagePreview = (plugin: PDFPlus) => {
? app.workspace.createLeafInParent(markdownLeafParent, -1)
: app.workspace.getLeaf(plugin.settings.paneTypeForFirstMDLeaf || false);
}
markdownLeaf.openLinkText(linktext, sourcePath, { eState: { line: state.scroll } });
markdownLeaf.openLinkText(linktext, sourcePath, { active: !plugin.settings.dontActivateAfterOpenMD, eState: { line: state.scroll } });
return;
}
old.call(this, hoverParent, targetEl, linktext, sourcePath, state);
Expand Down
12 changes: 8 additions & 4 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export interface PDFPlusSettings {
embedUnscrollable: boolean;
zoomInEmbed: number;
openLinkCleverly: boolean;
dontActivateAfterOpen: boolean;
dontActivateAfterOpenPDF: boolean;
dontActivateAfterOpenMD: boolean;
highlightDuration: number;
persistentHighlightsInEmbed: boolean;
highlightBacklinks: boolean;
Expand All @@ -45,7 +46,8 @@ export const DEFAULT_SETTINGS: PDFPlusSettings = {
embedUnscrollable: false,
zoomInEmbed: 0,
openLinkCleverly: true,
dontActivateAfterOpen: true,
dontActivateAfterOpenPDF: true,
dontActivateAfterOpenMD: true,
highlightDuration: 0,
persistentHighlightsInEmbed: true,
highlightBacklinks: true,
Expand Down Expand Up @@ -264,6 +266,8 @@ export class PDFPlusSettingTab extends PluginSettingTab {
if (this.plugin.settings.hoverHighlightAction === 'open') {
this.addDropdowenSetting('paneTypeForFirstMDLeaf', PANE_TYPE)
.setName(`How to open markdown file with ${getModifierNameInPlatform('Mod').toLowerCase()}+hover when there is no open markdown file`);
this.addToggleSetting('dontActivateAfterOpenMD')
.setName('Don\'t move focus to markdown view after opening a backlink');
}
this.addSetting()
.setName(`Require ${getModifierNameInPlatform('Mod')} to the above action`)
Expand Down Expand Up @@ -324,8 +328,8 @@ export class PDFPlusSettingTab extends PluginSettingTab {
.setName('Open PDF links cleverly')
.setDesc('When opening a link to a PDF file, a new tab will not be opened if the file is already opened. Useful for annotating PDFs using "Copy link to selection."');
if (this.plugin.settings.openLinkCleverly) {
this.addToggleSetting('dontActivateAfterOpen')
.setName('Don\'t move focus to PDF viewer after opening a link');
this.addToggleSetting('dontActivateAfterOpenPDF')
.setName('Don\'t move focus to PDF viewer after opening a PDF link');
}

this.addSetting()
Expand Down

0 comments on commit 8fbe15c

Please sign in to comment.