Skip to content

feat: expose dropPosition and listIndex on text-block and block-object render-props#2754

Draft
christianhg wants to merge 1 commit into
mainfrom
feat/expose-drop-position-and-list-index
Draft

feat: expose dropPosition and listIndex on text-block and block-object render-props#2754
christianhg wants to merge 1 commit into
mainfrom
feat/expose-drop-position-and-list-index

Conversation

@christianhg

Copy link
Copy Markdown
Member

defineTextBlock and defineBlockObject now receive two engine-derived signals that aren't available on the value, letting catch-all consumers recreate the legacy drop indicator and numbered-list affordances:

  • dropPosition: 'start' | 'end' | undefined on both TextBlockRenderProps and BlockObjectRenderProps. Set mid-drag when this block is the current drop target. Consumers using a custom render can show their own drop affordance, or delegate via renderDefault.
  • listIndex: number | undefined on TextBlockRenderProps. The 1-based running index of a list-item within its visible list run — level-aware, resets across non-list interrupts. Engine already computes it (editor.listIndexMap); now exposed.

Both fields are optional in the consumer's destructure (catch-all consumers that don't care simply omit them).

Generic — applies to anyone using defineTextBlock({type: '*'}) / defineBlockObject({type: '*'}) or a positional override in a container's of array.

@changeset-bot

changeset-bot Bot commented Jun 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: dbc5258

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
@portabletext/editor Minor
@portabletext/plugin-character-pair-decorator Patch
@portabletext/plugin-emoji-picker Patch
@portabletext/plugin-input-rule Patch
@portabletext/plugin-markdown-shortcuts Patch
@portabletext/plugin-one-line Patch
@portabletext/plugin-paste-link Patch
@portabletext/plugin-sdk-value Patch
@portabletext/plugin-table Patch
@portabletext/plugin-typeahead-picker Patch
@portabletext/plugin-typography Patch
@portabletext/toolbar Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Jun 5, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
portable-text-editor-documentation Ready Ready Preview, Comment Jun 8, 2026 9:19am
portable-text-example-basic Ready Ready Preview, Comment Jun 8, 2026 9:19am
portable-text-playground Ready Ready Preview, Comment Jun 8, 2026 9:19am
racetrack Ready Ready Preview, Comment Jun 8, 2026 9:19am

Request Review

@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

📦 Bundle Stats — @portabletext/editor

Compared against main (c92beefe)

@portabletext/editor

Metric Value vs main (c92beef)
Internal (raw) 778.6 KB +806 B, +0.1%
Internal (gzip) 147.9 KB +112 B, +0.1%
Bundled (raw) 1.38 MB +806 B, +0.1%
Bundled (gzip) 309.8 KB +110 B, +0.0%
Import time 96ms -1ms, -1.2%

@portabletext/editor/behaviors

Metric Value vs main (c92beef)
Internal (raw) 467 B -
Internal (gzip) 207 B -
Bundled (raw) 424 B -
Bundled (gzip) 171 B -
Import time 2ms +0ms, +2.0%

@portabletext/editor/plugins

Metric Value vs main (c92beef)
Internal (raw) 2.7 KB -
Internal (gzip) 894 B -
Bundled (raw) 2.5 KB -
Bundled (gzip) 827 B -
Import time 7ms +0ms, +0.6%

@portabletext/editor/selectors

Metric Value vs main (c92beef)
Internal (raw) 79.4 KB -
Internal (gzip) 14.5 KB -
Bundled (raw) 74.9 KB -
Bundled (gzip) 13.4 KB -
Import time 8ms -0ms, -0.3%

@portabletext/editor/traversal

Metric Value vs main (c92beef)
Internal (raw) 25.5 KB -
Internal (gzip) 5.0 KB -
Bundled (raw) 25.5 KB -
Bundled (gzip) 5.0 KB -
Import time 6ms -0ms, -0.4%

@portabletext/editor/utils

Metric Value vs main (c92beef)
Internal (raw) 28.8 KB -
Internal (gzip) 6.0 KB -
Bundled (raw) 26.7 KB -
Bundled (gzip) 5.7 KB -
Import time 6ms +0ms, +0.5%

🗺️ . · ./behaviors · ./plugins · ./selectors · ./traversal · ./utils · Artifacts

Details
  • Import time regressions over 10% are flagged with ⚠️
  • Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.

📦 Bundle Stats — @portabletext/markdown

Compared against main (c92beefe)

Metric Value vs main (c92beef)
Internal (raw) 53.0 KB -
Internal (gzip) 9.6 KB -
Bundled (raw) 347.6 KB -
Bundled (gzip) 96.0 KB -
Import time 40ms +2ms, +5.2%

🗺️ View treemap · Artifacts

Details
  • Import time regressions over 10% are flagged with ⚠️
  • Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.

@christianhg christianhg marked this pull request as draft June 5, 2026 19:18
@christianhg christianhg force-pushed the feat/expose-drop-position-and-list-index branch from b823106 to 005627c Compare June 6, 2026 13:23
@christianhg christianhg force-pushed the feat/expose-drop-position-and-list-index branch from 005627c to 6f43480 Compare June 6, 2026 13:24
…t render-props

defineTextBlock and defineBlockObject now receive two engine-derived
signals that aren't available on the value:

- dropPosition: 'start' | 'end' | undefined - set mid-drag when this
  block is the current drop target. Consumers using a custom render
  can show their own drop affordance (or delegate via renderDefault).
- listIndex: number | undefined on TextBlockRenderProps - 1-based
  running index of a list-item within its visible list run
  (level-aware, resets across non-list interrupts).
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.

1 participant