Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(editor): add Alt+Arrow keyboard shortcuts to move blocks up/down#1956

Open
BowTiedRaccoon wants to merge 1 commit intodocmost:mainfrom
BowTiedRaccoon:feat/move-block-shortcuts
Open

feat(editor): add Alt+Arrow keyboard shortcuts to move blocks up/down#1956
BowTiedRaccoon wants to merge 1 commit intodocmost:mainfrom
BowTiedRaccoon:feat/move-block-shortcuts

Conversation

@BowTiedRaccoon
Copy link

@BowTiedRaccoon BowTiedRaccoon commented Feb 18, 2026

Summary

Adds a MoveBlock Tiptap extension that lets users reorder top-level blocks using keyboard shortcuts:

  • Alt+ArrowUp — move the current block up
  • Alt+ArrowDown — move the current block down

The cursor selection is preserved at its new position after the move. This follows the same convention used by VS Code and other editors.

Demo

Move block shortcuts demo

Changes

  • packages/editor-ext/src/lib/move-block.ts — new Tiptap extension using ProseMirror transactions (Fragment, TextSelection, replaceWith)
  • packages/editor-ext/src/index.ts — export the new extension
  • apps/client/src/features/editor/extensions/extensions.ts — register MoveBlock in mainExtensions

Test plan

  • Place cursor in a paragraph, press Alt+ArrowUp — block moves up
  • Press Alt+ArrowDown — block moves back down
  • Works with headings, lists, code blocks, and other top-level nodes
  • First block ignores Alt+ArrowUp, last block ignores Alt+ArrowDown
  • Text selection is preserved after the move
  • Undo (Ctrl+Z) reverses the move

🤖 Generated with Claude Code

@CLAassistant
Copy link

CLAassistant commented Feb 18, 2026

CLA assistant check
All committers have signed the CLA.

@BowTiedRaccoon BowTiedRaccoon force-pushed the feat/move-block-shortcuts branch from 2a2575b to 70bdc60 Compare February 18, 2026 15:28
Adds a MoveBlock Tiptap extension that allows moving top-level blocks
up or down using Alt+ArrowUp and Alt+ArrowDown. Selection is preserved
at its new position after the move.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@BowTiedRaccoon BowTiedRaccoon force-pushed the feat/move-block-shortcuts branch from 70bdc60 to 0dcee25 Compare February 18, 2026 23:27
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.

2 participants