Skip to content

Commit

Permalink
release: 0.9.5
Browse files Browse the repository at this point in the history
  • Loading branch information
RyotaUshio committed Dec 24, 2023
1 parent ae0dcfe commit 96c85f9
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 13 deletions.
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.9.4",
"version": "0.9.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.9.4",
"version": "0.9.5",
"description": "An Obsidian.md plugin to enhance PDF viewer & embeds.",
"scripts": {
"dev": "node esbuild.config.mjs",
Expand Down
7 changes: 5 additions & 2 deletions src/patch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,11 @@ export const patchPDF = (plugin: PDFPlus): boolean => {
setTimeout(() => {
const selected = self.dom!.viewerEl.querySelectorAll('.mod-focused');
if (selected.length) {
height = selected[selected.length - 1].getBoundingClientRect().bottom - selected[0].getBoundingClientRect().top;
height += plugin.settings.padding;
const containerRect = self.dom!.viewerContainerEl.getBoundingClientRect();
const firstRect = selected[0].getBoundingClientRect();
const lastRect = selected[selected.length - 1].getBoundingClientRect();
height = lastRect.bottom - firstRect.top;
height += 2 * Math.abs(firstRect.top - containerRect.top);
}
old.call(this, height);
}, 200);
Expand Down
8 changes: 1 addition & 7 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export const COLOR_PALETTE_ACTIONS = {
export interface PDFPlusSettings {
alias: boolean;
trimSelectionEmbed: boolean;
padding: number;
embedUnscrollable: boolean;
zoomInEmbed: number;
openLinkCleverly: boolean;
Expand All @@ -52,7 +51,6 @@ export interface PDFPlusSettings {
export const DEFAULT_SETTINGS: PDFPlusSettings = {
alias: true,
trimSelectionEmbed: true,
padding: 80,
embedUnscrollable: false,
zoomInEmbed: 0,
openLinkCleverly: true,
Expand Down Expand Up @@ -388,13 +386,9 @@ export class PDFPlusSettingTab extends PluginSettingTab {
this.addToggleSetting('clickEmbedToOpenLink')
.setName('Click PDF embeds to open links')
.setDesc('Clicking a PDF embed will open the embedded file.');
this.addToggleSetting('trimSelectionEmbed', () => this.redisplay())
this.addToggleSetting('trimSelectionEmbed')
.setName('Trim selection/annotation embeds')
.setDesc('When embedding a selection or an annotation from a PDF file, only the target selection/annotation and its surroundings are displayed rather than the entire page.');
if (this.plugin.settings.trimSelectionEmbed) {
this.addSliderSetting('padding', 0, 500, 1)
.setName('Padding for trimmed selection embeds (px)');
}
this.addToggleSetting('persistentHighlightsInEmbed')
.setName('Do not clear highlights in a selection/annotation embeds');
this.addToggleSetting('embedUnscrollable')
Expand Down
5 changes: 5 additions & 0 deletions src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { EditorView } from '@codemirror/view';
import { BacklinkManager } from 'backlinks';
import { App, CachedMetadata, Component, Debouncer, EditableFileView, FileView, Modal, PluginSettingTab, Scope, SearchComponent, SearchMatches, SettingTab, TFile, HoverParent } from 'obsidian';
import { PDFDocumentProxy, PDFPageProxy, PageViewport } from 'pdfjs-dist';
Expand Down Expand Up @@ -403,4 +404,8 @@ declare module "obsidian" {
items: MenuItem[];
setParentElement(el: HTMLElement): Menu;
}

interface Editor {
cm: EditorView;
}
}

0 comments on commit 96c85f9

Please sign in to comment.