Prevents potential formatting issues by ensuring prompts are single-line and trimmed
Collapses multiple whitespaces and trims prompt text to maintain clean, uniform list rendering in markdown output
Enhances notification display logic to prevent flicker and ensure minimum visibility
- Adds floor of 0 for delay milliseconds to prevent negative values
- Ensures minimum notification duration of 300ms to improve user experience
- Maintains existing logic for longer delay times
Refactors cursor handling to use setCursor instead of setSelection when collapsing selections
Improves timestamp generation by using environment's default locale automatically instead of manually specifying language
Enhances code clarity and simplifies locale handling for timestamp formatting
Refines notification display timing logic to prevent flickering and ensure smoother user experience
Adjusts notification duration calculation for short delays, using a more nuanced approach that:
- Caps notification time at 900ms or delay-100ms for very short intervals
- Maintains existing behavior for longer delays
Uses the user's preferred language locale for timestamp formatting, enhancing regional customization and user experience
Allows automatic fallback to 'en-US' if navigator language is unavailable
Enhances execution flow to prevent race conditions during async prompt generation
Refines inProgress flag management to ensure reliable concurrent execution:
- Sets flag before async work begins
- Guarantees flag reset in finally block
- Prevents potential state inconsistencies during rapid command triggers
Clarifies code comments explaining concurrency protection mechanism
Refactors active note validation into a dedicated static method for improved readability and reusability
Enhances code maintainability by centralizing the check for valid editor and view
Refines notification display duration for timed prompts to handle both short and long delay intervals
Adjusts duration calculation to:
- Cap notifications at 500ms for very short delays
- Subtract 500ms from longer delays to prevent prompt overlap
- Ensures smoother user experience during prompt sequences
Refines text insertion handling for writing prompts:
- Collapses text selection before insertion
- Adds more intelligent newline management
- Uses Intl.DateTimeFormat for consistent timestamp generation
Enhances edge case handling for cursor and text positioning
Reorders initialization of in-progress flag to prevent potential race conditions during timed prompt generation
Ensures that the in-progress status is set before stopping existing sequences and generates prompts
Prevents multiple simultaneous timed prompt generations by displaying a notice when an operation is already in progress
Improves user experience by providing clear feedback during concurrent prompt generation attempts
Removes conditional logic for setting the cursor position
after inserting a prompt. Now, the cursor is consistently
placed at the end of the inserted text, regardless of the
previous cursor location. This change ensures consistent behavior
and simplifies the code.
Adds a flag to prevent the timed prompt execution from running concurrently, avoiding potential race conditions and unexpected behavior.
Also, addresses edge case in the status check where the displayed current prompt number could be inaccurate.
- Replace any types with proper Obsidian API types
- Add App type import for better type safety
- Add ButtonComponent type for settings button parameter
- Add null safety for button text content
- Remove redundant "Settings" from settings tab heading
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Ensures prompt notifications display correctly
by adjusting the notification duration based
on the configured delay. Prevents potential overlap
between successive prompts.
- Move inline styles from TypeScript to CSS for better theme compatibility
- Remove "Freewriting" from command names to follow Obsidian conventions
- Fix TypeScript type casting by properly typing model as AnthropicModel
- Update to latest Claude models including Opus 4.1 and Sonnet 4
Changes:
• commands/staggeredPrompts.ts: Replace inline styles with CSS class
• main.ts: Rename commands to "Show Staggered Prompts" and "Add Note Prompts"
• settings.ts: Remove 'as any' cast and update default model
• styles.css: Add .freewriting-prompt-notice class with proper styling
• types.ts: Change model field type from string to AnthropicModel
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Initial implementation of the Freewriting Prompts plugin.
This commit introduces the core functionality for generating
AI-powered writing prompts using Anthropic's Claude API.
It includes:
- API client for interacting with the Anthropic API
- Services for generating and caching prompts
- Commands for displaying staggered prompts and appending prompts to notes
- Settings tab for configuring the plugin