Skip to content

Comments

fix: replace is-hotkey with @portabletext/keyboard-shortcuts#2239

Open
christianhg wants to merge 1 commit intomainfrom
fix/remove-is-hotkey
Open

fix: replace is-hotkey with @portabletext/keyboard-shortcuts#2239
christianhg wants to merge 1 commit intomainfrom
fix/remove-is-hotkey

Conversation

@christianhg
Copy link
Member

@christianhg christianhg commented Feb 23, 2026

What changed

Replaces the is-hotkey dependency with @portabletext/keyboard-shortcuts (already in the monorepo).

Why

is-hotkey doesn't ship ESM.

How

Rewrote packages/editor/src/slate-dom/utils/hotkeys.ts to use createKeyboardShortcut(). Each hotkey is defined with explicit KeyboardEventDefinition objects instead of is-hotkey string syntax.

All modifier constraints are explicit. is-hotkey defaults unmentioned modifiers to false (must be off), while createKeyboardShortcut treats undefined as don't-care. Every definition specifies all four modifiers to preserve the original behavior. The shift? optional modifier maps to omitting shift (undefined = don't care).

The original code checked generic hotkeys first, then platform-specific ones (both could match on Apple). createKeyboardShortcut selects apple OR default based on platform, so generic definitions are merged into the apple arrays where both should match.

Removed is-hotkey and @types/is-hotkey from package.json.

What to review

  • Hotkey mappings, especially:
    • deleteBackward: generic Backspace (shift optional) + apple ctrl+Backspace/ctrl+h
    • moveWordBackward/moveWordForward: generic ctrl+arrow + apple alt+arrow
    • redo: windows ctrl+y/ctrl+shift+z, apple cmd+shift+z
    • compose: plain key matching with explicit modifier rejection

@changeset-bot
Copy link

changeset-bot bot commented Feb 23, 2026

🦋 Changeset detected

Latest commit: 72cdea4

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

This PR includes changesets to release 11 packages
Name Type
@portabletext/editor Patch
@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-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
Copy link

vercel bot commented Feb 23, 2026

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 Feb 23, 2026 2:21pm
portable-text-example-basic Ready Ready Preview, Comment Feb 23, 2026 2:21pm
portable-text-playground Ready Ready Preview, Comment Feb 23, 2026 2:21pm

Request Review

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