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
);
// Add some styling to make it more prominent
// Add CSS class for styling
const noticeEl = notice.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');
}
}
+6 -6
View File
@@ -59,19 +59,19 @@ export default class FreewritingPromptsPlugin extends Plugin {
// MARK: - Command Registration
private registerCommands() {
// Staggered Freewriting Prompts command
// Staggered prompts command
this.addCommand({
id: 'staggered-freewriting-prompts',
name: 'Staggered Freewriting Prompts',
id: 'staggered-prompts',
name: 'Show Staggered Prompts',
callback: async () => {
await this.executeStaggeredPrompts();
}
});
// Freewriting Prompt command (editor-based)
// Note prompt command (editor-based)
this.addCommand({
id: 'freewriting-prompt',
name: 'Freewriting Prompt',
id: 'note-prompts',
name: 'Add Note Prompts',
editorCallback: async (editor: Editor, view: MarkdownView) => {
await this.executeNotePrompts(editor, view);
}
+2 -2
View File
@@ -7,7 +7,7 @@ import { FreewritingPromptsSettings, ANTHROPIC_MODELS } from './types';
export const DEFAULT_SETTINGS: FreewritingPromptsSettings = {
apiKey: '',
model: 'claude-3-haiku-20240307',
model: 'claude-3-5-haiku-latest' as const,
staggeredCount: 10,
delaySeconds: 6,
noteCount: 3,
@@ -194,7 +194,7 @@ export class FreewritingPromptsSettingTab extends PluginSettingTab {
try {
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) {
// Success - show detailed information
+9 -6
View File
@@ -1,8 +1,11 @@
/*
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.
Freewriting Prompts Plugin Styles
*/
/* 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 {
apiKey: string;
model: string;
model: AnthropicModel;
staggeredCount: number;
delaySeconds: number;
noteCount: number;
@@ -47,11 +47,12 @@ export interface GeneratedPrompt {
}
export const ANTHROPIC_MODELS = [
'claude-3-haiku-20240307',
'claude-3-sonnet-20240229',
'claude-3-opus-20240229',
'claude-3-5-sonnet-20241022',
'claude-3-5-haiku-20241022'
'claude-opus-4-1-20250805',
'claude-opus-4-20250514',
'claude-sonnet-4-20250514',
'claude-3-7-sonnet-latest',
'claude-3-5-haiku-latest',
'claude-3-haiku-20240307'
] as const;
export type AnthropicModel = typeof ANTHROPIC_MODELS[number];