fix: address Obsidian review bot issues

- 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>
This commit is contained in:
Jarvis committed 2025-09-20 10:32:35 +02:00
1 parent cc63d92b6c
commit 49e3f5523c
5 files changed
+25 -25

No files matched your search

+1 -5
View File
@@ -86,13 +86,9 @@ export class StaggeredPromptsCommand {
8000 // Show for 8 seconds 8000 // Show for 8 seconds
); );
// Add some styling to make it more prominent // Add CSS class for styling
const noticeEl = notice.noticeEl; const noticeEl = notice.noticeEl;
if (noticeEl) { if (noticeEl) {
noticeEl.style.maxWidth = '400px';
noticeEl.style.whiteSpace = 'pre-wrap';
noticeEl.style.fontSize = '14px';
noticeEl.style.lineHeight = '1.4';
noticeEl.addClass('freewriting-prompt-notice'); noticeEl.addClass('freewriting-prompt-notice');
} }
} }
+6 -6
View File
@@ -59,19 +59,19 @@ export default class FreewritingPromptsPlugin extends Plugin {
// MARK: - Command Registration // MARK: - Command Registration
private registerCommands() { private registerCommands() {
// Staggered Freewriting Prompts command // Staggered prompts command
this.addCommand({ this.addCommand({
id: 'staggered-freewriting-prompts', id: 'staggered-prompts',
name: 'Staggered Freewriting Prompts', name: 'Show Staggered Prompts',
callback: async () => { callback: async () => {
await this.executeStaggeredPrompts(); await this.executeStaggeredPrompts();
} }
}); });
// Freewriting Prompt command (editor-based) // Note prompt command (editor-based)
this.addCommand({ this.addCommand({
id: 'freewriting-prompt', id: 'note-prompts',
name: 'Freewriting Prompt', name: 'Add Note Prompts',
editorCallback: async (editor: Editor, view: MarkdownView) => { editorCallback: async (editor: Editor, view: MarkdownView) => {
await this.executeNotePrompts(editor, view); await this.executeNotePrompts(editor, view);
} }
+2 -2
View File
@@ -7,7 +7,7 @@ import { FreewritingPromptsSettings, ANTHROPIC_MODELS } from './types';
export const DEFAULT_SETTINGS: FreewritingPromptsSettings = { export const DEFAULT_SETTINGS: FreewritingPromptsSettings = {
apiKey: '', apiKey: '',
model: 'claude-3-haiku-20240307', model: 'claude-3-5-haiku-latest' as const,
staggeredCount: 10, staggeredCount: 10,
delaySeconds: 6, delaySeconds: 6,
noteCount: 3, noteCount: 3,
@@ -194,7 +194,7 @@ export class FreewritingPromptsSettingTab extends PluginSettingTab {
try { try {
const client = this.plugin.promptGenerator.anthropicClient; const client = this.plugin.promptGenerator.anthropicClient;
const result = await client.testApiKey(this.plugin.settings.model as any); const result = await client.testApiKey(this.plugin.settings.model);
if (result.success) { if (result.success) {
// Success - show detailed information // Success - show detailed information
+9 -6
View File
@@ -1,8 +1,11 @@
/* /*
Freewriting Prompts Plugin Styles
This CSS file will be included with your plugin, and
available in the app when your plugin is enabled.
If your plugin does not need CSS, delete this file.
*/ */
/* Styling for staggered prompt notifications */
.freewriting-prompt-notice {
max-width: 400px !important;
white-space: pre-wrap !important;
font-size: 14px !important;
line-height: 1.4 !important;
}
+7 -6
View File
@@ -3,7 +3,7 @@
export interface FreewritingPromptsSettings { export interface FreewritingPromptsSettings {
apiKey: string; apiKey: string;
model: string; model: AnthropicModel;
staggeredCount: number; staggeredCount: number;
delaySeconds: number; delaySeconds: number;
noteCount: number; noteCount: number;
@@ -47,11 +47,12 @@ export interface GeneratedPrompt {
} }
export const ANTHROPIC_MODELS = [ export const ANTHROPIC_MODELS = [
'claude-3-haiku-20240307', 'claude-opus-4-1-20250805',
'claude-3-sonnet-20240229', 'claude-opus-4-20250514',
'claude-3-opus-20240229', 'claude-sonnet-4-20250514',
'claude-3-5-sonnet-20241022', 'claude-3-7-sonnet-latest',
'claude-3-5-haiku-20241022' 'claude-3-5-haiku-latest',
'claude-3-haiku-20240307'
] as const; ] as const;
export type AnthropicModel = typeof ANTHROPIC_MODELS[number]; export type AnthropicModel = typeof ANTHROPIC_MODELS[number];