-
-
Notifications
You must be signed in to change notification settings - Fork 883
[Feature] Add BlockNote editor #500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
[Feature] Add BlockNote editor #500
Conversation
|
@AnishSarkar22 is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review by RecurseML
🔍 Review performed on 70f3381..abbaa84
✨ No bugs found, your code is sparkling clean
✅ Files analyzed, no issues (23)
• surfsense_backend/alembic/versions/38_add_blocknote_fields_to_documents.py
• surfsense_backend/app/db.py
• surfsense_backend/app/routes/__init__.py
• surfsense_backend/app/routes/editor_routes.py
• surfsense_backend/app/tasks/document_processors/extension_processor.py
• surfsense_backend/app/tasks/document_processors/file_processors.py
• surfsense_backend/app/tasks/document_processors/markdown_processor.py
• surfsense_backend/app/tasks/document_processors/url_crawler.py
• surfsense_backend/app/tasks/document_processors/youtube_processor.py
• surfsense_backend/app/utils/blocknote_converter.py
• surfsense_web/app/api/convert-to-blocknote/route.ts
• surfsense_web/app/api/convert-to-markdown/route.ts
• surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/DocumentsTableShell.tsx
• surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/RowActions.tsx
• surfsense_web/app/dashboard/[search_space_id]/editor/[documentId]/page.tsx
• surfsense_web/components/BlockNoteEditor.tsx
• surfsense_web/components/DynamicBlockNoteEditor.tsx
• surfsense_web/components/dashboard-breadcrumb.tsx
• surfsense_web/messages/en.json
• surfsense_web/messages/zh.json
• surfsense_web/next.config.ts
• surfsense_web/package.json
• surfsense_web/pnpm-lock.yaml
|
@MODSetter I am unsure whether we should update documents with empty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review by RecurseML
🔍 Review performed on abbaa84..289b4de
✨ No bugs found, your code is sparkling clean
✅ Files analyzed, no issues (17)
• surfsense_backend/alembic/versions/38_add_blocknote_fields_to_documents.py
• surfsense_backend/app/db.py
• surfsense_backend/app/routes/editor_routes.py
• surfsense_backend/app/tasks/document_processors/extension_processor.py
• surfsense_backend/app/tasks/document_processors/file_processors.py
• surfsense_backend/app/tasks/document_processors/markdown_processor.py
• surfsense_backend/app/tasks/document_processors/url_crawler.py
• surfsense_backend/app/tasks/document_processors/youtube_processor.py
• surfsense_backend/app/utils/blocknote_converter.py
• surfsense_web/app/api/convert-to-blocknote/route.ts
• surfsense_web/app/api/convert-to-markdown/route.ts
• surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/RowActions.tsx
• surfsense_web/app/dashboard/[search_space_id]/editor/[documentId]/page.tsx
• surfsense_web/components/BlockNoteEditor.tsx
• surfsense_web/components/DynamicBlockNoteEditor.tsx
• surfsense_web/components/dashboard-breadcrumb.tsx
• surfsense_web/next.config.ts
Added BlockNote editor integration for document editing, enabling rich text editing with auto-save functionality. This PR introduces a new editor interface that allows users to edit documents directly in the browser using BlockNote's block-based editor, with support for dark/light themes and automatic saving every 30 seconds.
Description
This PR adds a complete BlockNote editor integration to SurfSense:
Frontend Changes:
BlockNoteEditorcomponent using@blocknote/reactand@blocknote/mantinewith theme supportDynamicBlockNoteEditorwrapper for proper SSR handling/dashboard/[search_space_id]/editor/[documentId]) with:Backend Changes:
GET /api/v1/documents/{document_id}/editor-content- Fetches document content for editingPUT /api/v1/documents/{document_id}/blocknote-content- Updates BlockNote document contentblocknote_documentJSONB field todocumentstableFeatures:
Motivation and Context
This change enables users to edit documents directly within SurfSense, providing a modern rich text editing experience. Previously, documents could only be viewed or re-uploaded. The BlockNote editor offers:
Screenshots
API Changes
Change Type
Testing Performed
Checklist
High-level PR Summary
This PR introduces a rich text editing capability to SurfSense by integrating the BlockNote editor. Users can now edit documents directly in the browser with a modern block-based interface. The implementation includes database schema changes to store BlockNote JSON documents, new API endpoints for fetching and saving editor content, and automatic conversion of markdown to BlockNote format during document processing. The frontend features a complete editor page with auto-save functionality every 30 seconds, theme support (dark/light), and unsaved changes tracking. All document processors have been updated to generate BlockNote-compatible content on upload, though legacy documents will require re-uploading to enable editing.
⏱️ Estimated Review Time: 3+ hours
💡 Review Order Suggestion
surfsense_backend/alembic/versions/38_add_blocknote_fields_to_documents.pysurfsense_backend/app/db.pysurfsense_backend/app/utils/blocknote_converter.pysurfsense_backend/app/routes/editor_routes.pysurfsense_backend/app/routes/__init__.pysurfsense_backend/app/tasks/document_processors/extension_processor.pysurfsense_backend/app/tasks/document_processors/file_processors.pysurfsense_backend/app/tasks/document_processors/markdown_processor.pysurfsense_backend/app/tasks/document_processors/url_crawler.pysurfsense_backend/app/tasks/document_processors/youtube_processor.pysurfsense_web/app/api/convert-to-blocknote/route.tssurfsense_web/app/api/convert-to-markdown/route.tssurfsense_web/components/BlockNoteEditor.tsxsurfsense_web/components/DynamicBlockNoteEditor.tsxsurfsense_web/app/dashboard/[search_space_id]/editor/[documentId]/page.tsxsurfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/RowActions.tsxsurfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/DocumentsTableShell.tsxsurfsense_web/components/dashboard-breadcrumb.tsxsurfsense_web/messages/en.jsonsurfsense_web/messages/zh.jsonsurfsense_web/next.config.tssurfsense_web/package.jsonsurfsense_web/pnpm-lock.yamlsurfsense_web/next.config.tsreactStrictMode: false) is a significant configuration change that affects the entire Next.js application beyond just the BlockNote editor feature. This could hide potential issues in other parts of the codebase and should be carefully considered.