Skip to content

Commit

Permalink
fix(obsidian/annot-view): fix link with select not work with literatu…
Browse files Browse the repository at this point in the history
…re without attachment

slience warning notice if no attachment found for literature

close #184
  • Loading branch information
aidenlx committed Oct 4, 2023
1 parent 737ce62 commit a1a4c0e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/obsidian/src/components/atch-suggest.ts
@@ -1,7 +1,7 @@
import type { AttachmentInfo, RegularItemInfoBase } from "@obzt/database";
import { cacheActiveAtch, isFileAttachment } from "@obzt/database";
import type { App, FuzzyMatch } from "obsidian";
import { Notice, FuzzySuggestModal } from "obsidian";
import { FuzzySuggestModal } from "obsidian";
import { openModalFuzzy } from "./basic/modal";

export class AttachmentPopupSuggest extends FuzzySuggestModal<AttachmentInfo> {
Expand Down Expand Up @@ -40,7 +40,7 @@ export async function chooseAttachment(
) {
if (attachments.length === 1) return attachments[0];
if (!attachments.length) {
new Notice("No attachment found for this item");
// new Notice("No attachment found for this item");
return null;
}
const result = await openModalFuzzy(
Expand Down
3 changes: 1 addition & 2 deletions app/obsidian/src/note-feature/annot-view/view.tsx
Expand Up @@ -173,12 +173,11 @@ export class AnnotationView extends DerivedFileView {
const attachments = await plugin.databaseAPI.getAttachments(itemID, lib);

const atch = await choosePDFAtch(attachments, this.app);
if (!atch) return;
await this.setStatePrev(({ attachmentId, ...state }) => ({
...state,
follow: null,
itemId: itemID,
attachmentId: atch.itemID,
attachmentId: atch?.itemID,
}));
};
getContext(): AnnotViewContextType<AnnotRendererProps> {
Expand Down

0 comments on commit a1a4c0e

Please sign in to comment.