fix(document): blocknote editor service, wrap arround#256
Conversation
@coderabbitai please check - https://github.com/TypeCellOS/BlockNote - https://raw.githubusercontent.com/TypeCellOS/BlockNote/refs/heads/main/docs/content/docs/features/server-processing.mdx - https://raw.githubusercontent.com/TypeCellOS/BlockNote/refs/heads/main/docs/content/docs/reference/editor/manipulating-content.mdx Very worry about when it need editor, when it don't. And the transforming model
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughBlocknoteService is removed and replaced with BlocknoteEditorService, which is no longer a singleton injectable but an instance service that accepts schema and optional initial content. Type definitions are updated to support the new editor options and server-util interfaces. DocumentService now injects the schema directly and instantiates BlocknoteEditorService within commitDocument to extract blocks, tags, and link IDs for revisions and event publishing. ChangesBlocknoteService Replacement
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/document/src/blocknote/blocknote-editor.service.ts`:
- Around line 22-31: The code sets this.editor after potentially calling
replaceContent, which causes a runtime error when options.initialContent is
present; move the assignment this.editor = this.serverEditor.editor to occur
before any calls to replaceContent (including both the initialContent branch
that uses bufferToBlockNote and the other occurrence around lines 51-53) so
replaceContent always has a valid this.editor; ensure both code paths reference
the already-initialized this.editor before performing content replacement.
- Around line 43-44: Remove the conversational inline comments "// Idk, this
doesn't mutate the inner state of the editor?" and "// it just require the
editor to transform the data" from blocknote-editor.service.ts; these are
non-actionable noise—delete them or replace with a concise, factual comment if
necessary (e.g., explain the actual behavior or link to a TODO with a clear
task) and keep any real documentation in a JSDoc above the relevant
function/class (refer to the surrounding code where those comments appear to
locate the exact spot).
- Around line 63-65: The callback passed to forEachBlock in
extractTagsAndOutgoingLinkIds currently returns false when encountering a
non-array block.content, which stops traversal; change that return to true so
traversal continues through all blocks, ensuring extractTagsAndOutgoingLinkIds
visits subsequent blocks to collect tags and outgoing link ids—locate the check
on block.content in blocknote-editor.service.ts inside the forEachBlock callback
and replace the `return false;` with `return true;`.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: cd60a24a-5a79-4956-9cdc-fab4c9b79396
📒 Files selected for processing (6)
apps/document/src/blocknote/blocknote-editor.service.tsapps/document/src/blocknote/blocknote.module.tsapps/document/src/blocknote/blocknote.service.tsapps/document/src/blocknote/index.tsapps/document/src/document/document.service.tspackages/lib-server/src/block-note/types.d.ts
💤 Files with no reviewable changes (1)
- apps/document/src/blocknote/blocknote.service.ts
| // Idk, this doesn't mutate the inner state of the editor? | ||
| // it just require the editor to transform the data |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial | ⚡ Quick win
Remove conversational inline comments from production code.
These comments are non-actionable and add noise.
Proposed fix
- // Idk, this doesn't mutate the inner state of the editor?
- // it just require the editor to transform the data
bufferToBlockNote(data: Buffer): MyBlock[] {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // Idk, this doesn't mutate the inner state of the editor? | |
| // it just require the editor to transform the data | |
| bufferToBlockNote(data: Buffer): MyBlock[] { |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/document/src/blocknote/blocknote-editor.service.ts` around lines 43 -
44, Remove the conversational inline comments "// Idk, this doesn't mutate the
inner state of the editor?" and "// it just require the editor to transform the
data" from blocknote-editor.service.ts; these are non-actionable noise—delete
them or replace with a concise, factual comment if necessary (e.g., explain the
actual behavior or link to a TODO with a clear task) and keep any real
documentation in a JSDoc above the relevant function/class (refer to the
surrounding code where those comments appear to locate the exact spot).
@coderabbitai please check
https://raw.githubusercontent.com/TypeCellOS/BlockNote/refs/heads/main/docs/content/docs/features/server-processing.mdx
https://raw.githubusercontent.com/TypeCellOS/BlockNote/refs/heads/main/docs/content/docs/reference/editor/manipulating-content.mdx
Very worry about when it need editor, when it don't. And the
transforming model
Summary by CodeRabbit
Release Notes