fix: Formatting toolbar opening when inserting file block with trailingBlock: false (BLO-860)#2704
fix: Formatting toolbar opening when inserting file block with trailingBlock: false (BLO-860)#2704matthewlipski wants to merge 1 commit intomainfrom
trailingBlock: false (BLO-860)#2704Conversation
…lingBlock: false`
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThis PR adds a new example demonstrating the ChangesNo Trailing Block Example and Toolbar Fix
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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 |
@blocknote/ariakit
@blocknote/code-block
@blocknote/core
@blocknote/mantine
@blocknote/react
@blocknote/server-util
@blocknote/shadcn
@blocknote/xl-ai
@blocknote/xl-docx-exporter
@blocknote/xl-email-exporter
@blocknote/xl-multi-column
@blocknote/xl-odt-exporter
@blocknote/xl-pdf-exporter
commit: |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@examples/01-basic/17-no-trailing-block/index.html`:
- Line 1: Add the HTML5 doctype declaration before the existing <html> tag:
insert <!doctype html> as the very first line so the document doesn’t trigger
quirks mode and is parsed in standards mode; ensure it precedes the existing
<html lang="en"> line.
In `@examples/01-basic/17-no-trailing-block/main.tsx`:
- Line 4: The import in main.tsx references a non-existent ./src/App.jsx; update
the import statement (the top-level import that brings in App) to point to the
existing ./src/App.tsx (e.g., import App from "./src/App.tsx" or simply
"./src/App") so the TypeScript build (allowJs: false) resolves the correct file
and the App symbol is imported from the actual file.
In `@examples/01-basic/17-no-trailing-block/vite.config.ts`:
- Around line 16-29: The package alias paths and the existence check are one
directory too shallow: update the fs.existsSync path.resolve call that checks
for "packages/core/src" (used with conf.command) and the alias targets for
"@blocknote/core" and "@blocknote/react" so they use "../../../packages/..."
instead of "../../packages/..."; locate the conditional that uses conf.command,
fs.existsSync(path.resolve(__dirname, "...")) and the alias object with keys
"@blocknote/core" and "@blocknote/react" and change the "../../packages/..."
occurrences to "../../../packages/...".
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 82c9e44d-3169-49b5-adf6-886bfdb36a68
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (12)
examples/01-basic/17-no-trailing-block/.bnexample.jsonexamples/01-basic/17-no-trailing-block/README.mdexamples/01-basic/17-no-trailing-block/index.htmlexamples/01-basic/17-no-trailing-block/main.tsxexamples/01-basic/17-no-trailing-block/package.jsonexamples/01-basic/17-no-trailing-block/src/App.tsxexamples/01-basic/17-no-trailing-block/tsconfig.jsonexamples/01-basic/17-no-trailing-block/vite.config.tspackages/core/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.tsplayground/src/examples.gen.tsxtests/src/end-to-end/images/images.test.tstests/src/utils/const.ts
Summary
This PR fixes a minor issue that can occur when a file block is inserted via the slash menu when the
trailingBlockeditor option is set tofalse.Normally, after inserting the block, the slash menu command will then move the selection to the next block with inline content. When
trailingBlockis set totrue, we can guarantee that there will be such a block at the end of the document.When
trailingBlockis set tofalse, however, this is not the case. So when the inserted file block is at the end of the document, the selection is set to it instead, so the formatting toolbar opens under the file panel.Closes #884
Rationale
While minor, this is an issue that harms UX.
Changes
Impact
N/A
Testing
Added e2e test and an example for it.
Screenshots/Video
N/A
Checklist
Additional Notes
N/A
Summary by CodeRabbit