Skip to content

fix: insert dropped images after inline content end - #3353

Merged
nperez0111 merged 1 commit into
mainfrom
fix/2570-image-drop-after-line
Nov 18, 2026
Merged

nperez0111 merged 1 commit into
mainfrom
fix/2570-image-drop-after-line

Conversation

@nperez0111

@nperez0111 nperez0111 commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #2570.

  • Insert dropped image/files after the containing inline block when the pointer resolves to its content end within the block bounds, even in the upper half of the line.
  • Reuse the existing document position and block rectangle; no additional coordinate lookup.
  • Preserve midpoint placement for start/middle positions and points outside the resolved block. Padding within the block that resolves to content end intentionally follows end-position placement.
  • Add regression coverage for text end, start, middle, padding, and gaps; leave paste, upload handling, and multi-file ordering unchanged.

Validation

  • Red-first: the upper-half text-end regression failed against the original implementation.
  • vp run --filter @blocknote/core test fromClipboard: 60 tests passed.
  • bash tests/docker-run.sh -e CI=1 -- --run handleFileInsertion.browser.test.ts: 18 tests passed across Chromium, Firefox, and WebKit on the final simplified implementation.
  • Targeted type-aware lint: no warnings/errors; commit hook vp check --fix passed.
  • Earlier exploratory DOM file-drop events reproduced the original bug. Native OS file-manager drag was not automated.

Related: #2550, #3329.

Summary by CodeRabbit

  • Bug Fixes
    • File drops at the end of a paragraph now place images after the paragraph when dropped within its bounds. Drops elsewhere continue to use the paragraph’s vertical position to determine placement.

Broader validation

  • Full local core-suite attempts were not clean: 2 timeouts with default concurrency, then 5 timeouts with two workers (no assertion failures). All file-insertion tests passed. All four files containing timeouts passed in serial targeted reruns (48 tests in change-range/version-diff files; 14 passed and 2 expected failures in performance/nesting files). The full-suite attempts remain recorded as failed; no test timeout changes were made.
  • CI build, Chromium/Firefox E2E, PDF E2E, and security checks passed. WebKit shard 2 failed the existing Mantine instantaneous-click link-form test (https://ttps//example.com vs https://example.com/); the complete link-toolbar file passed locally in Docker/WebKit (132/132 tests, including the failed CI case). Failed-job CI rerun is in progress; the failure has not been reproduced locally. No unrelated fixes or timeout changes included.

@vercel

vercel Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
blocknote Ready Ready Preview Nov 16, 2026 12:21pm UTC
blocknote-website Ready Ready Preview Nov 16, 2026 12:21pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The file-drop handler now places a drop at an inline block’s content end after that block when the drop is within the block’s vertical bounds. Parameterized tests cover paragraph positions and adjacent gaps.

Changes: File drop placement

Layer / File(s) Summary
Inline content-end placement
packages/core/src/api/clipboard/fromClipboard/handleFileInsertion.ts, packages/core/src/api/clipboard/fromClipboard/handleFileInsertion.test.ts
The handler places drops at an inline block’s content end after the block when the drop is within its vertical bounds. Other drops use the existing midpoint rule. Tests cover paragraph start, middle, end, and adjacent gaps, and check that the drop event is prevented.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: matthewlipski

Merge Risk: Minimal · up to d89b7

This change fixes the placement of dropped images at the end of a line and is limited to the file-drop handler. No concrete merge-blocking risk was identified; the author's browser-test results are still pending.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix: insert dropped images after inline content end" matches the main change. The changeset places a dropped file or image after the containing inline block when the pointer resolves to tha…
Linked Issues check Passed Issue #2570 asks that a dropped image appear after the line when the pointer is at the end of the line, and that placing it above require the pointer to be above. The diff in handleFileInsertion.ts ad…
Out of Scope Changes check Passed The whole-PR diff against the merge base changes two files. handleFileInsertion.ts holds the placement logic change. handleFileInsertion.test.ts holds the regression tests for that logic. The PR descr…
Description check Passed The description follows the repository template. It has a clear Summary with a linked issue (#2570), explains the placement rule, and lists the changes. It also gives a Rationale-like scope statement,…
Full details: Title check

Explanation

The title "fix: insert dropped images after inline content end" matches the main change. The changeset places a dropped file or image after the containing inline block when the pointer resolves to that block's content end within its bounds. The title is short, specific, and follows a conventional commit prefix.

Full details: Linked Issues check

Explanation

Issue #2570 asks that a dropped image appear after the line when the pointer is at the end of the line, and that placing it above require the pointer to be above. The diff in handleFileInsertion.ts adds an atContentEnd check. It requires blockInfo.contentKind === "inline", pos.pos === blockInfo.contentEnd, and coords.top within [blockRect.top, blockRect.bottom]. When all hold, the image is inserted "after", regardless of the midpoint. Otherwise the original midpoint rule still applies, so start, middle, and out-of-block gap drops keep their previous behavior. The PR summary states that handleFileInsertion.test.ts adds parameterized cases for start, middle, end, padding, and gap positions, including upper-half drops. The PR also reports a red-first run for the upper-half text-end case. Targeted Docker browser tests are still pending, and native OS file-manager drag was not automated. Those gaps do not block this verdict, because the requirement is covered by unit-level tests and the code change. I did not re-run the test file.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff against the merge base changes two files. handleFileInsertion.ts holds the placement logic change. handleFileInsertion.test.ts holds the regression tests for that logic. The PR description states that paste, upload handling, and multi-file ordering are unchanged. The diff of handleFileInsertion.ts shows only the atContentEnd condition and its use in the insertOrUpdateBlock placement argument. No unrelated change appears in the reviewed evidence.

Full details: Description check

Explanation

The description follows the repository template. It has a clear Summary with a linked issue (#2570), explains the placement rule, and lists the changes. It also gives a Rationale-like scope statement, notes that no public declarations changed, and describes testing in detail (red-first regression, unit test run, browser tests across three engines, lint). Impact and Screenshots/Video are not explicitly addressed. The Checklist is not marked. The broader test-suite results are reported with timeouts and a WebKit failure, which the author notes as unresolved. These gaps are minor relative to the template, so the description is mostly complete.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

A rabbit drops a picture low,
At line-end, down it now will go.
Through paragraph and spaces near,
Each tested spot is placed clear.
The drop event is stopped with care.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1546768c-4b1b-4e87-9215-5e47c03536ff
Commits

Reviewing files that changed from the base of the PR and between 7f714c0 and d89b706.

Files selected for processing: 2

  • packages/core/src/api/clipboard/fromClipboard/handleFileInsertion.test.ts
  • packages/core/src/api/clipboard/fromClipboard/handleFileInsertion.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@pkg-pr-new

pkg-pr-new Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@blocknote/ariakit

npm i https://pkg.pr.new/@blocknote/ariakit@3353

@blocknote/code-block

npm i https://pkg.pr.new/@blocknote/code-block@3353

@blocknote/core

npm i https://pkg.pr.new/@blocknote/core@3353

@blocknote/diagram-block

npm i https://pkg.pr.new/@blocknote/diagram-block@3353

@blocknote/mantine

npm i https://pkg.pr.new/@blocknote/mantine@3353

@blocknote/math-block

npm i https://pkg.pr.new/@blocknote/math-block@3353

@blocknote/react

npm i https://pkg.pr.new/@blocknote/react@3353

@blocknote/server-util

npm i https://pkg.pr.new/@blocknote/server-util@3353

@blocknote/shadcn

npm i https://pkg.pr.new/@blocknote/shadcn@3353

@blocknote/xl-ai

npm i https://pkg.pr.new/@blocknote/xl-ai@3353

@blocknote/xl-docx-exporter

npm i https://pkg.pr.new/@blocknote/xl-docx-exporter@3353

@blocknote/xl-email-exporter

npm i https://pkg.pr.new/@blocknote/xl-email-exporter@3353

@blocknote/xl-multi-column

npm i https://pkg.pr.new/@blocknote/xl-multi-column@3353

@blocknote/xl-odt-exporter

npm i https://pkg.pr.new/@blocknote/xl-odt-exporter@3353

@blocknote/xl-pdf-exporter

npm i https://pkg.pr.new/@blocknote/xl-pdf-exporter@3353

@blocknote/xl-typst-exporter

npm i https://pkg.pr.new/@blocknote/xl-typst-exporter@3353

commit: d89b706

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
PR Preview Action v1.8.2
Preview removed because the pull request was closed.
2026-11-18 07:20 UTC

@nperez0111
nperez0111 merged commit 9ceef87 into main Nov 18, 2026
112 of 115 checks passed
@nperez0111
nperez0111 deleted the fix/2570-image-drop-after-line branch November 18, 2026 07:20

This branch was successfully deployed

2 active deployments
Preview – blocknote-website — d89b7063 Deployed Nov 16, 2026 by vercel[bot]
Preview – blocknote — d89b7063 Deployed Nov 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Drag and drop of image at the end of a line locates image up or down

1 participant