diff --git a/src/lang/locale/en.ts b/src/lang/locale/en.ts index 2112229c..95bff323 100644 --- a/src/lang/locale/en.ts +++ b/src/lang/locale/en.ts @@ -110,6 +110,7 @@ export default { OPEN_RANDOM_NOTE: "Open a random note for review", OPEN_RANDOM_NOTE_DESC: "When you turn this off, notes are ordered by importance (PageRank).", AUTO_NEXT_NOTE: "Open next note automatically after a review", + AUTO_NEXT_NEW_NOTE: "Pick new before due notes when picking the next note to review", DISABLE_FILE_MENU_REVIEW_OPTIONS: "Disable review options in the file menu i.e. Review: Easy Good Hard", DISABLE_FILE_MENU_REVIEW_OPTIONS_DESC: diff --git a/src/main.ts b/src/main.ts index a8c3c278..98e94cb0 100644 --- a/src/main.ts +++ b/src/main.ts @@ -756,20 +756,33 @@ export default class SRPlugin extends Plugin { this.lastSelectedReviewDeck = deckKey; const deck = this.reviewDecks[deckKey]; - if (deck.dueNotesCount > 0) { - const index = this.data.settings.openRandomNote - ? Math.floor(Math.random() * deck.dueNotesCount) - : 0; - await this.app.workspace.getLeaf().openFile(deck.scheduledNotes[index].note); - return; - } + const noteChooserMap = { + due: async () => { + if (deck.newNotes.length > 0) { + const index = this.data.settings.openRandomNote + ? Math.floor(Math.random() * deck.newNotes.length) + : 0; + await this.app.workspace.getLeaf().openFile(deck.newNotes[index]); + return; + } + }, + new: async () => { + if (deck.dueNotesCount > 0) { + const index = this.data.settings.openRandomNote + ? Math.floor(Math.random() * deck.dueNotesCount) + : 0; + await this.app.workspace.getLeaf().openFile(deck.scheduledNotes[index].note); + return; + } + }, + }; - if (deck.newNotes.length > 0) { - const index = this.data.settings.openRandomNote - ? Math.floor(Math.random() * deck.newNotes.length) - : 0; - this.app.workspace.getLeaf().openFile(deck.newNotes[index]); - return; + if (this.data.settings.autoNextNewNote) { + await noteChooserMap.new(); + await noteChooserMap.due(); + } else { + await noteChooserMap.due(); + await noteChooserMap.new(); } new Notice(t("ALL_CAUGHT_UP")); diff --git a/src/settings.ts b/src/settings.ts index 3622e73c..cd9595d3 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -31,6 +31,7 @@ export interface SRSettings { noteFoldersToIgnore: string[]; openRandomNote: boolean; autoNextNote: boolean; + autoNextNewNote: boolean; disableFileMenuReviewOptions: boolean; maxNDaysNotesReviewQueue: number; // UI preferences @@ -75,6 +76,7 @@ export const DEFAULT_SETTINGS: SRSettings = { noteFoldersToIgnore: [], openRandomNote: false, autoNextNote: false, + autoNextNewNote: false, disableFileMenuReviewOptions: false, maxNDaysNotesReviewQueue: 365, // UI settings @@ -574,6 +576,13 @@ export class SRSettingTab extends PluginSettingTab { }), ); + new Setting(containerEl).setName(t("AUTO_NEXT_NEW_NOTE")).addToggle((toggle) => + toggle.setValue(this.plugin.data.settings.autoNextNewNote).onChange(async (value) => { + this.plugin.data.settings.autoNextNewNote = value; + await this.plugin.savePluginData(); + }), + ); + new Setting(containerEl) .setName(t("DISABLE_FILE_MENU_REVIEW_OPTIONS")) .setDesc(t("DISABLE_FILE_MENU_REVIEW_OPTIONS_DESC"))