Open Quorafind opened 2 years ago
Seems like this interface hasn't been updated for Periodic Notes v1, which is currently in beta. I believe this is what's affecting users who are using the Upcoming plugin. @liamcain Do you see this as an issue you would address in this interface, or in the Periodic Notes plugin?
To support Periodic Notes 1.0, file src/settings.ts
needs to be updated like this:
import {
DEFAULT_DAILY_NOTE_FORMAT,
DEFAULT_MONTHLY_NOTE_FORMAT,
DEFAULT_WEEKLY_NOTE_FORMAT,
DEFAULT_QUARTERLY_NOTE_FORMAT,
DEFAULT_YEARLY_NOTE_FORMAT,
} from "./constants";
import { IPeriodicNoteSettings } from "./types";
export function shouldUsePeriodicNotesSettings(
- periodicity: "daily" | "weekly" | "monthly" | "quarterly" | "yearly"
+ periodicity: "day" | "week" | "month" | "quarter" | "year"
): boolean {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const periodicNotes = (<any>window.app).plugins.getPlugin("periodic-notes");
- return periodicNotes && periodicNotes.settings?.[periodicity]?.enabled;
+ return periodicNotes && periodicNotes.calendarSetManager?.getActiveSet?.()?.[periodicity]?.enabled;
}
/**
* Read the user settings for the `daily-notes` plugin
* to keep behavior of creating a new note in-sync.
*/
export function getDailyNoteSettings(): IPeriodicNoteSettings {
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const { internalPlugins, plugins } = <any>window.app;
if (shouldUsePeriodicNotesSettings("day")) {
- const { format, folder, template } =
- plugins.getPlugin("periodic-notes")?.settings?.daily || {};
+ const { format, folder, templatePath } =
+ plugins.getPlugin("periodic-notes")?.calendarSetManager?.getActiveSet?.()?.day || {};
return {
format: format || DEFAULT_DAILY_NOTE_FORMAT,
folder: folder?.trim() || "",
- template: template?.trim() || "",
+ template: templatePath?.trim() || "",
};
}
const { folder, format, template } =
internalPlugins.getPluginById("daily-notes")?.instance?.options || {};
return {
format: format || DEFAULT_DAILY_NOTE_FORMAT,
folder: folder?.trim() || "",
template: template?.trim() || "",
};
} catch (err) {
console.info("No custom daily note settings found!", err);
}
}
// ...
Same changes for weekly and so on.
Note that this isn't a proper diff, I just wrote this manually in the comment editor. Hopefully someone will make a Pull Request.
As a workaround I applied the fixes by @deltaidea using https://www.npmjs.com/package/patch-package on the obsidian-daily-notes-interface
dist files in node_modules
.
Here the patch file
obsidian-daily-notes-interface+0.9.4.patch
You can use this to create a patched version of, for example, the day planner plugin (https://github.com/ivan-lednev/obsidian-day-planner).
Like the title,
Even if I had set periodic notes settings, the settings didn't show correctly