Cleanup and documentation

This commit is contained in:
Jeremy Neiman 2025-06-10 20:19:57 -04:00
parent 057ab6598a
commit e60f707270
3 changed files with 33 additions and 25 deletions

View file

@ -22,10 +22,23 @@ A plugin for Obsidian that helps you manage your daily notes with pinned tabs. I
## Configuration
No configuration needed! The plugin uses your existing Daily Notes settings for:
- Note folder location
- Date format
- Other Daily Notes preferences
The plugin allows you to configure where new pinned daily notes should appear:
- **Editor**: Opens the daily note in the main editor area
- **Left Sidebar**: Opens the daily note in a new tab in the left sidebar
- **Right Sidebar**: Opens the daily note in a new tab in the right sidebar
To change the pin location:
1. Open Obsidian Settings
2. Go to Community Plugins
3. Find "Pinned Daily Notes" in your list of installed plugins
4. Click the gear icon to open plugin settings
5. Select your preferred location from the dropdown menu
The setting will take effect the next time you open a daily note using the plugin.
If you already have a pinned daily note in a location other than this setting, it
won't move it.
## Installation
@ -39,6 +52,7 @@ No configuration needed! The plugin uses your existing Daily Notes settings for:
If you encounter any issues or have suggestions, please file them on [GitHub](https://github.com/docmarionum1/obsidian-pinned-daily-notes/issues).
## License
MIT

View file

@ -36,7 +36,7 @@ interface ObsidianView extends View {
export default class PinDailyNotePlugin extends Plugin {
private obsidianApp: ObsidianApp;
settings: Setting; // non private for access from Setting class
settings: Setting;
constructor(app: App, manifest: any) {
super(app, manifest);
@ -49,12 +49,6 @@ export default class PinDailyNotePlugin extends Plugin {
whereToPin = this.settings.whereToPin;
}
/**
* if we get right/left leaf with true param
* the side leaf is split horizontally
*
* Further todo? configure split or not
*/
switch (whereToPin) {
case PinOptions.RIGHT_SIDE_BAR:
return this.obsidianApp.workspace.getRightLeaf(false)

View file

@ -1,5 +1,5 @@
import PinDailyNotePlugin from "./main"
import { App, DropdownComponent, PluginSettingTab, Setting } from "obsidian"
import PinDailyNotePlugin from "./main";
import { App, PluginSettingTab, Setting } from "obsidian";
export interface PinDailyNotePluginSetting {
whereToPin: PinOptions
@ -12,24 +12,30 @@ export enum PinOptions {
}
export const DEFAULT_SETTING: Partial<PinDailyNotePluginSetting> = {
whereToPin: PinOptions.EDITOR
whereToPin: PinOptions.EDITOR,
}
const whereToPinDropdownOptions: Record<PinOptions, string> = {
[PinOptions.EDITOR]: 'Editor',
[PinOptions.LEFT_SIDE_BAR]: 'Left Sidebar',
[PinOptions.RIGHT_SIDE_BAR]: 'Right Sidebar',
}
export class PinDailyNotePluginSettingTab extends PluginSettingTab {
plugin: PinDailyNotePlugin
constructor(app: App, plugin: PinDailyNotePlugin) {
super(app, plugin)
super(app, plugin);
this.plugin = plugin;
}
display(): void {
const { containerEl } = this;
containerEl.empty()
containerEl.empty();
new Setting(containerEl)
.setName('Where to Pin')
.setDesc('Default place to pin Daily Note')
.setName('Pin Location')
.setDesc('Default place to pin new daily note')
.addDropdown((dropdown) => {
dropdown.addOptions(whereToPinDropdownOptions)
dropdown.setValue(this.plugin.settings.whereToPin)
@ -37,12 +43,6 @@ export class PinDailyNotePluginSettingTab extends PluginSettingTab {
this.plugin.settings.whereToPin = value as PinOptions;
await this.plugin.saveSettings()
})
})
});
}
}
const whereToPinDropdownOptions: Record<string, PinOptions> = {
editor: PinOptions.EDITOR,
leftSideBar: PinOptions.LEFT_SIDE_BAR,
rightSideBar: PinOptions.RIGHT_SIDE_BAR
}