Building Highlight-to-Rewrite AI Editing for TeachiBuilding Highlight-to-Rewrite AI Editing for Teachi
The network for creativity
Join 1.25M professional creatives like you
Connect with clients, get discovered, and run your business 100% commission-free
Creatives on Contra have earned over $150M and we are just getting started
How I built "highlight → rewrite with AI" for Teachi, an AI lesson planner used by 600+ teachers. Teachers wanted Google-Docs-style editing: type, bold, and rewrite any passage with AI, without wrecking the formatting they'd applied by hand. What made it work: • Tiptap editor with a floating toolbar on selection. Bold/italic apply instantly and never call an API. • The selected range is flattened to plain text before it goes to the model. The AI reasons about words, not markup. • The reply is inserted back at exactly that range, so every other paragraph keeps its formatting. • Select fewer than two words and it asks for a full sentence: one word gives the AI no context. • Plans stay in the same string field, now as HTML, so nothing needed a migration and old plans open as plain text. • Debounced autosave (1.5s idle) persists edits once they settle. Stack: Next.js, Supabase, OpenAI, Tiptap. Building AI features into a Next.js app? Happy to swap notes.
Post image
Azizxon's avatar
When the AI response comes back asynchronously, the editor selection may have moved. Did you store a Tiptap bookmark before the request and restore it on apply, or does the user confirm the insertion point?
Back to feed
The network for creativity
Join 1.25M professional creatives like you
Connect with clients, get discovered, and run your business 100% commission-free
Creatives on Contra have earned over $150M and we are just getting started