diff --git a/src/api.ts b/src/api.ts index eb0a059..8ad032b 100644 --- a/src/api.ts +++ b/src/api.ts @@ -54,6 +54,7 @@ export interface Article { readingProgressPercent: number; isArchived: boolean; archivedAt?: string; + contentReader?: string; } export interface Label { @@ -122,6 +123,7 @@ export const loadArticles = async ( isArchived readingProgressPercent archivedAt + contentReader highlights { id quote diff --git a/src/main.ts b/src/main.ts index c01dd3e..eff9c9a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -89,11 +89,7 @@ export default class OmnivorePlugin extends Plugin { // add icon addIcon( iconId, - ` - - - - ` + `` ); // This creates an icon in the left ribbon. @@ -363,7 +359,17 @@ export default class OmnivorePlugin extends Plugin { continue; } // file doesn't exist, so we need to create it - await this.app.vault.create(normalizedPath, content); + try { + await this.app.vault.create(normalizedPath, content); + } catch (error) { + if (error.toString().includes("File already exists")) { + new Notice( + `Skipping file creation: ${normalizedPath}. Please check if you have duplicated article titles and delete the file if needed.` + ); + } else { + throw error; + } + } } } diff --git a/src/settings/template.ts b/src/settings/template.ts index ee42069..e80b1c3 100644 --- a/src/settings/template.ts +++ b/src/settings/template.ts @@ -62,7 +62,7 @@ export type ArticleView = labels?: LabelView[]; dateSaved: string; highlights: HighlightView[]; - content: string; + content?: string; datePublished?: string; fileAttachment?: string; description?: string; @@ -219,7 +219,7 @@ export const renderArticleContnet = async ( labels: renderLabels(article.labels), dateSaved, highlights, - content: article.content, + content: article.contentReader === 'WEB' ? article.content : undefined, datePublished, fileAttachment, description: article.description,