Added the ability to edit and select custom prompts for text improvement actions in the context menu. Users can now customize how the AI processes their text by editing prompts before execution, and save frequently used prompts for quick access.
- ✅ Beautiful modal dialog for editing prompts
- ✅ Shows the default prompt as a starting point
- ✅ Save and load custom prompts
- ✅ Delete saved prompts
- ✅ Prompts persist in localStorage
Three text improvement actions now support custom prompts:
- "Update Wording" - Edit the prompt before improving wording
- "Improve Clarity" - Edit the prompt before making text clearer
- "Make Concise" - Edit the prompt before shortening text
- Save Custom Prompts: Name and save your custom prompts
- Load Saved Prompts: Quickly load previously saved prompts
- Delete Prompts: Remove prompts you no longer need
- Reset to Default: Quickly revert to the default prompt
- Select elements on the canvas (must have text)
- Right-click to open the context menu
- Select a text action:
- "Update Wording"
- "Improve Clarity"
- "Make Concise"
- Prompt Editor opens showing the default prompt
- Edit the prompt to customize the AI's behavior
- Click "Apply Prompt" to execute with your custom prompt
- Open the prompt editor for any action
- Edit the prompt to your liking
- Enter a name in the "Prompt name" field
- Click "+ Save Current"
- Your prompt is now saved and can be loaded anytime
- Open the prompt editor
- Click "▶ Saved Prompts"
- Click "Load" next to any saved prompt
- The prompt is loaded into the editor
- Click "Apply Prompt" to use it
You are an AI assistant helping users improve text in visual diagrams.
Rewrite the text to use a more professional, business-appropriate tone.
Keep the same meaning but use formal language.
Respond with ONLY the improved text, nothing else.
You are an AI assistant helping users improve text in visual diagrams.
Rewrite the text using simpler words and shorter sentences.
Make it easy for non-experts to understand.
Respond with ONLY the improved text, nothing else.
You are an AI assistant helping users improve marketing text.
Rewrite the text to be more persuasive and engaging.
Use action verbs and focus on benefits.
Keep it concise and impactful.
Respond with ONLY the improved text, nothing else.
You are an AI assistant helping users improve technical documentation.
Rewrite the text to be more precise and unambiguous.
Use standard technical terminology and avoid jargon when possible.
Respond with ONLY the improved text, nothing else.
-
src/components/UI/PromptEditorModal.tsx(NEW)- Modal component for editing prompts
- Save/load/delete functionality
- localStorage persistence
-
src/App.tsx(MODIFIED)- Added prompt editor state management
- Updated context menu actions to open prompt editor
- Added
handlePromptConfirmcallback
-
src/services/aiActions.ts(MODIFIED)- Added optional
customPromptparameter to text action functions updateWording(elements, allElements, customPrompt?)improveClarity(elements, allElements, customPrompt?)makeConcise(elements, allElements, customPrompt?)- Enhanced logging to track custom prompt usage
- Added optional
Saved Prompt:
{
name: string // User-defined name
prompt: string // The custom prompt text
}localStorage Key: excalidraw-saved-prompts
┌─────────────────┐
│ Select Element │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Right-click │
└────────┬────────┘
│
▼
┌─────────────────┐ ┌──────────────────────┐
│ "Update Wording"│ ──► │ Prompt Editor Opens │
└─────────────────┘ │ Shows default prompt │
└──────────┬───────────┘
│
┌────────────────────┴────────────────────┐
│ User edits prompt or loads saved prompt │
└────────────────────┬────────────────────┘
│
▼
┌──────────────────────────────────────┐
│ User clicks "Apply Prompt" │
└────────────────────┬─────────────────┘
│
▼
┌──────────────────────────────────────┐
│ AI processes text with custom prompt │
│ Elements updated on canvas │
└──────────────────────────────────────┘
- Large textarea for easy editing
- Monospace font for better readability
- Character count (implied by textarea size)
- Saved prompts dropdown with expand/collapse
- Quick actions: Save, Load, Delete, Reset
- Modal overlay to focus attention
- Name display - Shows the user-defined name
- Preview - Shows first 80 characters of prompt
- Actions: Load, Delete
- Scrollable - Handles many saved prompts
- Empty state - Helpful message when no prompts saved
- Apply Prompt - Blue, primary action
- Cancel - Gray, secondary action
- Save Current - Green, positive action
- Load - Blue, action button
- Delete - Red, destructive action
- Reset - Gray, neutral action
- Local Storage Only: Prompts are stored in browser's localStorage
- No Server Upload: Prompts never leave your browser
- Per-Browser: Saved prompts are browser-specific
- Persistent: Prompts remain even after closing the browser
Q: My saved prompts disappeared
- A: Check that localStorage is enabled in your browser
- A: Make sure you're using the same browser and device
Q: The prompt editor doesn't open
- A: Make sure you have selected at least one element
- A: Ensure the selected elements have text content
Q: Custom prompt isn't being used
- A: Check the browser console for the "Using custom prompt" log message
- A: Verify you clicked "Apply Prompt" (not just "Cancel")
Potential improvements for future versions:
- Export/Import saved prompts
- Prompt templates library
- Prompt variables (e.g., {{language}}, {{tone}})
- Prompt history/undo
- Share prompts with other users
- Prompt validation/testing
- AI prompt suggestions
CLAUDE.md- Main project documentationUTILITIES.md- Utility functions documentationsrc/config/prompts.ts- Default prompt definitions
To verify the feature works:
- ✅ Draw a text element on the canvas
- ✅ Select the element
- ✅ Right-click → "Update Wording"
- ✅ Prompt editor should open with default prompt
- ✅ Edit the prompt text
- ✅ Enter a name and click "+ Save Current"
- ✅ Verify the prompt appears in the saved list
- ✅ Click "Apply Prompt"
- ✅ Verify the text is updated using your custom prompt
- ✅ Open the prompt editor again
- ✅ Verify your saved prompt is in the list
- ✅ Click "Load" to load it again
- ✅ Delete the saved prompt and verify it's removed
All tests should pass! 🎉