Skip to content

[FR] Consider checking if the current note is found on Readwise *before* enabling the command #73

Description

@johannrichard

// TODO: We could even check if the current note is found on Readwise before enabling the command

readwise-mirror/src/main.ts

Lines 741 to 763 in 89437f9

// TODO: #73 We could even check if the current note is found on Readwise *before* enabling the command
this.addCommand({
id: 'update-current-note',
name: 'Update current note',
checkCallback: (checking: boolean) => {
const file = this.app.workspace.getActiveFile();
if (!file) return false;
const isReadwiseNote = isTrackedReadwiseNote(file, this.app, this.settings);
const isInLibrary = isInReadwiseLibrary(file, this.settings);
// If trackAcrossVault is enabled, only check if it's a Readwise note.
// Otherwise, check if it's a Readwise note AND in the Readwise library.
const shouldEnable = this.settings.trackAcrossVault ? isReadwiseNote : isReadwiseNote && isInLibrary;
if (shouldEnable && this.settings.trackFiles) {
if (!checking) {
this.updateCurrentNote(file);
}
return true;
}
return false;
},
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions