Skip to content

Commit

Permalink
release: 0.40.12
Browse files Browse the repository at this point in the history
  • Loading branch information
RyotaUshio committed Oct 22, 2024
1 parent 9b07618 commit d451527
Show file tree
Hide file tree
Showing 61 changed files with 952 additions and 632 deletions.
8 changes: 7 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
"no-prototype-builtins": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/no-inferrable-types": ["error", { "ignoreParameters": true, "ignoreProperties": true }]
"@typescript-eslint/no-inferrable-types": ["error", { "ignoreParameters": true, "ignoreProperties": true }],
"semi": ["error", "always"],
"semi-spacing": ["error", {"after": true, "before": false}],
"semi-style": ["error", "last"],
"no-extra-semi": "error",
"no-unexpected-multiline": "error",
"no-unreachable": "error"
}
}
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.11",
"version": "0.40.12",
"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.11",
"version": "0.40.12",
"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.11",
"version": "0.40.12",
"description": "The most Obsidian-native PDF annotation tool ever.",
"scripts": {
"dev": "node esbuild.config.mjs",
Expand Down
2 changes: 1 addition & 1 deletion src/auto-copy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class AutoCopyMode extends PDFPlusComponent {
this.plugin.openSettingTab().scrollToHeading('auto-copy');
});
});
menu.onHide(() => { menuShown = false });
menu.onHide(() => { menuShown = false; });
menu.showAtMouseEvent(evt);
menuShown = true;
});
Expand Down
2 changes: 1 addition & 1 deletion src/backlink-visualizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export class BacklinkDomManager extends PDFPlusComponent {
backlinkItemEl.removeClass('hovered-backlink');
el.removeEventListener('mouseout', listener);
}
}
};
el.addEventListener('mouseout', listener);
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/bib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class BibliographyManager extends PDFPlusComponent {
hoverPopover.addChild(
new BibliographyDom(this, destId, bibContainerEl)
);
}
};

if (this.plugin.requireModKeyForLinkHover(BibliographyManager.HOVER_LINK_SOURCE_ID)) {
onModKeyPress(event, targetEl, spawnBibPopover);
Expand Down
6 changes: 3 additions & 3 deletions src/color-palette.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export class ColorPalette extends PDFPlusComponent {
addCopyActionDropdown(paletteEl: HTMLElement) {
let tooltip = 'Link copy format';
if (!this.plugin.settings.colorPaletteInToolbar) {
tooltip = `${this.plugin.manifest.name}: link copy options (trigger via hotkeys)`
tooltip = `${this.plugin.manifest.name}: link copy options (trigger via hotkeys)`;
}

const buttonEl = this.addDropdown(
Expand Down Expand Up @@ -427,7 +427,7 @@ export class ColorPalette extends PDFPlusComponent {
addCropButton(paletteEl: HTMLElement) {
this.cropButtonEl = paletteEl.createDiv('clickable-icon pdf-plus-rect-select', (el) => {
setIcon(el, 'lucide-box-select');
setTooltip(el, 'Copy embed link to rectangular selection')
setTooltip(el, 'Copy embed link to rectangular selection');

el.addEventListener('click', () => {
this.startRectangularSelection(false);
Expand Down Expand Up @@ -470,7 +470,7 @@ export class ColorPalette extends PDFPlusComponent {
// Determine the target page based on the event target
if (!(isTargetHTMLElement(evt, evt.target))) return;

const pageEl = evt.target.closest<HTMLElement>('.pdf-viewer div.page[data-page-number]')
const pageEl = evt.target.closest<HTMLElement>('.pdf-viewer div.page[data-page-number]');
if (!pageEl) return;

const pageNumber = pageEl.dataset.pageNumber;
Expand Down
34 changes: 17 additions & 17 deletions src/context-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const onContextMenu = async (plugin: PDFPlus, child: PDFViewerChild, evt:
if (!evt.defaultPrevented) {
await showContextMenu(plugin, child, evt);
}
}
};

export async function showContextMenu(plugin: PDFPlus, child: PDFViewerChild, evt: MouseEvent) {
const menu = await PDFPlusContextMenu.fromMouseEvent(plugin, child, evt);
Expand All @@ -65,7 +65,7 @@ export async function showContextMenuAtSelection(plugin: PDFPlus, child: PDFView
const { x, y } = range.getBoundingClientRect();

const menu = new PDFPlusContextMenu(plugin, child);
await menu.addItems()
await menu.addItems();
child.clearEphemeralUI();
plugin.shownMenus.forEach((menu) => menu.hide());
menu.showAtPosition({ x, y }, doc);
Expand Down Expand Up @@ -94,7 +94,7 @@ export const onThumbnailContextMenu = (plugin: PDFPlus, child: PDFViewerChild, e
(evt.view ?? activeWindow).navigator.clipboard.writeText(link);
const file = child.file;
if (file) plugin.lastCopiedDestInfo = { file, destArray: [pageNumber - 1, 'XYZ', null, null, null] };
})
});
});

if (lib.isEditable(child)) {
Expand All @@ -108,7 +108,7 @@ export const onThumbnailContextMenu = (plugin: PDFPlus, child: PDFViewerChild, e
return;
}
lib.commands._insertPage(file, pageNumber, pageNumber);
})
});
})
.addItem((item) => {
item.setTitle('Insert page after this page')
Expand All @@ -120,7 +120,7 @@ export const onThumbnailContextMenu = (plugin: PDFPlus, child: PDFViewerChild, e
return;
}
lib.commands._insertPage(file, pageNumber + 1, pageNumber);
})
});
})
.addItem((item) => {
item.setTitle('Delete page')
Expand All @@ -132,7 +132,7 @@ export const onThumbnailContextMenu = (plugin: PDFPlus, child: PDFViewerChild, e
return;
}
lib.commands._deletePage(file, pageNumber);
})
});
})
.addItem((item) => {
item.setTitle('Extract page to new file')
Expand Down Expand Up @@ -166,12 +166,12 @@ export const onThumbnailContextMenu = (plugin: PDFPlus, child: PDFViewerChild, e
.onClick(() => {
plugin.openSettingTab().scrollToHeading('thumbnail');
});
})
});
}

menu.showAtMouseEvent(evt);
}
}
};

// TODO: split into smaller methods
export const onOutlineItemContextMenu = (plugin: PDFPlus, child: PDFViewerChild, file: TFile, item: PDFOutlineTreeNode, evt: MouseEvent) => {
Expand Down Expand Up @@ -201,7 +201,7 @@ export const onOutlineItemContextMenu = (plugin: PDFPlus, child: PDFViewerChild,
const destArray = lib.normalizePDFJsDestArray(dest, pageNumber);
plugin.lastCopiedDestInfo = { file, destArray };
}
})
});
});

if (lib.isEditable(child)) {
Expand Down Expand Up @@ -375,7 +375,7 @@ export const onOutlineItemContextMenu = (plugin: PDFPlus, child: PDFViewerChild,
}

menu.showAtMouseEvent(evt);
}
};


export const onOutlineContextMenu = (plugin: PDFPlus, child: PDFViewerChild, file: TFile, evt: MouseEvent) => {
Expand Down Expand Up @@ -410,7 +410,7 @@ export const onOutlineContextMenu = (plugin: PDFPlus, child: PDFViewerChild, fil
})
.showAtMouseEvent(evt);
}
}
};


export class PDFPlusMenu extends Menu {
Expand All @@ -435,7 +435,7 @@ export class PDFPlusMenu extends Menu {
}

export class PDFPlusContextMenu extends PDFPlusMenu {
child: PDFViewerChild
child: PDFViewerChild;

constructor(plugin: PDFPlus, child: PDFViewerChild) {
super(plugin);
Expand Down Expand Up @@ -474,7 +474,7 @@ export class PDFPlusContextMenu extends PDFPlusMenu {

const isVisible = (id: string) => {
return this.settings.contextMenuConfig.find((section) => section.id === id)?.visible;
}
};

// If macOS, add "look up selection" action
if (Platform.isMacOS && Platform.isDesktopApp && this.win.electron && selectedText && isVisible('action')) {
Expand Down Expand Up @@ -660,7 +660,7 @@ export class PDFPlusContextMenu extends PDFPlusMenu {
.onClick(() => {
navigator.clipboard.writeText(url);
});
})
});
}
}
}
Expand Down Expand Up @@ -722,7 +722,7 @@ export class PDFPlusContextMenu extends PDFPlusMenu {
// How does the electron version differ?
navigator.clipboard.writeText(annotatedText!);
});
})
});
}

if (selectedText && selection && isVisible('search')) {
Expand Down Expand Up @@ -887,13 +887,13 @@ export class PDFPlusProductMenuComponent extends PDFPlusComponent {

if (this.section && menu === this.rootMenu) item.setSection(this.section);

this.itemToColorName.set(item, i >= 0 ? colorNames[i] : null)
this.itemToColorName.set(item, i >= 0 ? colorNames[i] : null);

const hex = this.settings.colors[i >= 0 ? colorNames[i] : 'transparent'];
item.dom.addClass('pdf-plus-color-menu-item');
item.titleEl.before(createDiv('pdf-plus-color-indicator', (el) => {
el.setCssStyles({ backgroundColor: hex });
}))
}));
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/dom-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class PDFPlusCalloutRenderer extends MarkdownRenderChild {
onload() {
const metadata = this.containerEl.dataset.calloutMetadata;
if (metadata) {
const rgb = metadata.split(',').map((val) => parseInt(val))
const rgb = metadata.split(',').map((val) => parseInt(val));
const isRgb = rgb.length === 3 && rgb.every((val) => 0 <= val && val <= 255);

if (isRgb) {
Expand Down
18 changes: 9 additions & 9 deletions src/drag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const registerOutlineDrag = async (plugin: PDFPlus, pdfOutlineViewer: PDF
title,
getText: textGenerator,
item
}
};
});

app.dragManager.handleDrop(item.selfEl, (evt, draggable, dragging) => {
Expand Down Expand Up @@ -74,10 +74,10 @@ export const registerOutlineDrag = async (plugin: PDFPlus, pdfOutlineViewer: PDF
dropEffect: 'move',
hoverEl: item.el,
hoverClass: 'is-being-dragged-over',
}
};
}
}, false);
})())
})());
}

await Promise.all(promises);
Expand Down Expand Up @@ -116,10 +116,10 @@ export const registerOutlineDrag = async (plugin: PDFPlus, pdfOutlineViewer: PDF
dropEffect: 'move',
hoverEl: pdfOutlineViewer.childrenEl,
hoverClass: 'is-being-dragged-over',
}
};
}
}, false);
}
};

export const registerThumbnailDrag = (plugin: PDFPlus, child: PDFViewerChild, file: TFile) => {
const { app, lib } = plugin;
Expand Down Expand Up @@ -150,11 +150,11 @@ export const registerThumbnailDrag = (plugin: PDFPlus, child: PDFViewerChild, fi
file, pageNumber, `#page=${pageNumber}`, '', '', sourcePath
);
}
}
};
});

});
}
};

export const registerAnnotationPopupDrag = (plugin: PDFPlus, popupEl: HTMLElement, child: PDFViewerChild, file: TFile, page: number, id: string) => {
const { app, lib } = plugin;
Expand All @@ -177,7 +177,7 @@ export const registerAnnotationPopupDrag = (plugin: PDFPlus, popupEl: HTMLElemen
getText: (sourcePath: string) => {
return lib.copyLink.getTextToCopy(child, template, undefined, file, page, `#page=${page}&annotation=${id}`, text ?? '', '', sourcePath);
}
}
};
});
});
}
};
Loading

0 comments on commit d451527

Please sign in to comment.