Skip to content

feat: move block or list item up/down with Alt+ArrowUp/Down - #2411

Open
julien-f wants to merge 1 commit into
docmost:mainfrom
julien-f:feat/editor-move-block-shortcut
Open

feat: move block or list item up/down with Alt+ArrowUp/Down#2411
julien-f wants to merge 1 commit into
docmost:mainfrom
julien-f:feat/editor-move-block-shortcut

Conversation

@julien-f

Copy link
Copy Markdown
Contributor

Summary

Adds a keyboard shortcut to move the current block (or list item) up/down among its siblings: Alt+ArrowUp / Alt+ArrowDown.

  • Inside a list item (bullet/ordered/task), swaps it with the adjacent sibling item, keeping any nested sub-list attached.
  • Otherwise, swaps the top-level block (paragraph, heading, blockquote, table, etc.) with its adjacent sibling under the document root.
  • Cursor/selection is preserved at the same relative offset inside the moved content (a NodeSelection is re-created if that's what was active, e.g. an image).
  • No-ops at the top/bottom boundary.

Scope

This is intentionally scoped to swapping with a direct sibling only. Crossing into/out of other containers (e.g. moving a paragraph out of a blockquote, or into/out of a table cell) is left for a follow-up PR.

Testing

Manually verified in the browser (paragraph reordering, cursor preservation mid-word, boundary no-ops, list-item reordering with a nested sub-list). No existing test infra covers packages/editor-ext or client-side editor code in this repo, so no new tests were added, consistent with the rest of the package.

Adds a MoveNode TipTap extension that swaps the current block (or list
item, keeping any nested sub-list attached) with its previous/next
sibling. Scoped to direct siblings for now — crossing into/out of
other containers (blockquote, callout, table cell, ...) is left for a
follow-up.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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