A modern, AI-powered text editor built with React and CodeMirror that provides intelligent text completions, suggestions, and rewrites.
- Inline Completions: Get real-time suggestions as you type
- Smart Rewrites: Select text and type any letter to get a custom rewrite
- Use uppercase letters (e.g. 'C', 'E', 'S') to apply the rewrite
- Use lowercase letters to preview different rewrite options
- Text Suggestions: Get contextual suggestions for improving your writing
- Clean Writing Experience: Markdown syntax is automatically hidden while writing
- Modern UI: Clean, minimalist interface with beautiful typography and smooth interactions
- Markdown Support: Full markdown editing capabilities with live preview styling
src/
├── components/
│ ├── editor/
│ │ ├── commands/
│ │ │ ├── completion.ts # Completion command handlers
│ │ │ └── shortcuts.ts # Keyboard shortcut definitions
│ │ ├── config/
│ │ │ └── editorConfig.ts # Editor configuration
│ │ ├── plugins/
│ │ │ ├── inlineCompletion.ts # Inline completion plugin
│ │ │ ├── rewriteCompletion.ts # Text rewrite plugin
│ │ │ ├── textSuggestions.ts # Writing suggestions plugin
│ │ │ ├── hideMarkdown.ts # Markdown syntax hiding
│ │ │ └── selectionTracker.ts # Selection state management
│ │ └── state/
│ │ └── customRewrite.ts # Custom rewrite state
│ ├── Editor.tsx # Main editor component
│ └── ApiKeyInput.tsx # API key input component
├── services/
│ └── CompletionService.ts # OpenAI API integration
├── types/
│ └── completion.ts # TypeScript type definitions
├── styles.css # Global styles
└── App.tsx # Root application component
- Built with React 18 and TypeScript
- Uses CodeMirror 6 for the editor implementation
- Integrates with OpenAI's GPT models for AI features
- Implements efficient caching and debouncing for API calls
- Features a modern component architecture with React hooks
- Uses CSS variables for theming and consistent styling
- Clone the repository
- Install dependencies:
npm install
- Create a
.envfile with your OpenAI API key:VITE_OPENAI_API_KEY=your_api_key_here - Start the development server:
npm run dev
- Start typing to get inline completions
- Press Tab to accept inline completions
- Select text and type any letter to get custom rewrites:
- Type lowercase letters to preview different rewrites
- Type uppercase letters to apply the rewrite
- Look for suggestion tooltips that appear to improve your writing
- Enjoy distraction-free writing with hidden markdown syntax
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
MIT License - feel free to use this project for any purpose.