First of all, apologies for the typo lol, apparently I can't spell "WYSIWYG" :')
Some context: I've always been a huge fan of Notion's editor, and since Vercel launched the AI SDK yesterday (https://sdk.vercel.ai/docs), I decided to take this as an opportunity to recreate Notion's block editor + incorporate some of Notion's latest AI features with `npm i ai`
Here's basically how it works:
1. Tiptap Editor setup with custom slash command extension 2. `useCompletion` hook at the parent editor + the slash command menu – using `id` to share states 3. `/api/generate` route to stream responses from OpenAI
Novel also handles image uploads via drag & drop / copy & paste. Images are stored as base64 strings in localStorage currently, but I'm planning to implement uploads to Vercel Blob in the future.
The code is fully open-source – feel free to check it out: http://novel.sh/github
Hope y'all like this – let me know if you have any feedback!