29 lines
967 B
Markdown
29 lines
967 B
Markdown
You are helping the user add settings to their Obsidian plugin.
|
|
|
|
1. Ask the user what settings they need:
|
|
- Text inputs (API keys, paths, etc.)
|
|
- Number inputs (limits, thresholds)
|
|
- Toggles (boolean options)
|
|
- Dropdowns (predefined choices)
|
|
- Sliders (ranged values)
|
|
|
|
2. Update the plugin structure:
|
|
- Add settings interface with proper types
|
|
- Update DEFAULT_SETTINGS constant
|
|
- Add settings tab class extending PluginSettingTab
|
|
- Register the settings tab in onload()
|
|
- Implement display() method with Setting components
|
|
|
|
3. Implement setting controls using Obsidian's Setting API:
|
|
- addText() for text inputs
|
|
- addToggle() for boolean switches
|
|
- addDropdown() for select options
|
|
- addSlider() for numeric ranges
|
|
- addTextArea() for multi-line input
|
|
|
|
4. Ensure proper saving/loading:
|
|
- Call saveSettings() onChange
|
|
- Use proper TypeScript types
|
|
|
|
Reference the instruct plugin for comprehensive settings examples.
|