// TODO: We could even check if the current note is found on Readwise before enabling the command
|
// 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; |
|
}, |
|
}); |
// 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