Back to Tldraw

v4.2.0

apps/docs/content/releases/v4.2.0.mdx

5.0.05.2 KB
Original Source

This month's release includes many bug fixes and small API additions, along with a major version bump of our TipTap rich text editor.

What's new

💥 TipTap v3 (#5717)

We've upgraded TipTap from v2 to v3. If you've done any customization to our standard TipTap kit, please refer to TipTap's guide How to upgrade Tiptap v2 to v3 for breaking changes you might experience.

<details> <summary>Migration guide</summary>

Starting in v4.2, tldraw bundles TipTap v3 as a transitive dependency. If your project pins @tiptap/* v2 packages directly, upgrade them to v3 before trying to fix any code-level errors — leaving v2 in place produces a dual install that surfaces as confusing type errors.

Dual-install symptom. Deeply-nested errors like "Property 'getCharacterCount' is missing in type 'Editor' but required in type 'Editor'", with the two Editor types resolving to different paths (one under node_modules/@tiptap/core, the other under node_modules/@tldraw/editor/node_modules/@tiptap/core), are not API changes — they are the v2/v3 dual install. The Editor classes are structurally similar but nominally different. Finishing the v3 upgrade collapses the duplicate and these errors disappear without code changes.

Code-level changes that affect tldraw users:

  • Default → named exports. Several extensions changed from default to named exports:

    ts
    // Before
    import StarterKit from '@tiptap/starter-kit'
    
    // After
    import { StarterKit } from '@tiptap/starter-kit'
    
  • TextStyleTextStyleKit, and FontFamily moved. The FontFamily extension is no longer in @tiptap/extension-font-family; it's part of TextStyleKit in @tiptap/extension-text-style. The setFontFamily and setFontSize chain commands only exist on TextStyleKit, not on bare TextStyle.

  • Transaction handler types. Inline parameter type annotations on TipTap event handlers no longer work. Import the proper event-map type:

    ts
    import { EditorEvents } from '@tiptap/core'
    // ...
    onTransaction: (props: EditorEvents['transaction']) => { /* ... */ }
    
  • Custom chained commands still register via declare module '@tiptap/core' augmentation in v3 — the augmentation target is the same.

</details>

API changes

  • Add Editor.setTool/Editor.removeTool for dynamically altering the editor's tool state chart. (#6909) (#7134)
  • Allow using custom socket implementations with useSync via a new connect option. (#6859) (contributed by @Digital39999)
  • Add support for nested property queries in the store. (#6981)
  • Add createBookmarkFromUrl helper for easier bookmark shape creation. (#6894)
  • Add custom reference points for handle angle snapping. (#6987) (contributed by @naaa760)
  • Add new "lined-fill" style, accessible via Option+Shift+F. (#7034)
  • Add onInteractionEnd callback option. (#6919)
  • Add allowReferrer option for window opening functions. (#7004)
  • Remove defunct Excalidraw embed definition. (#6897)

Improvements

  • Use window.prompt for renaming frames on mobile. (#6838)
  • Optimize string append operations in sync protocol. (#7007) (contributed by @quasor)

Bug fixes

  • Fix Replit embed URL handling. (#6892)
  • Fix accessibility issue that caused a misleading warning in the console. (#6904)
  • Fix convert-to-bookmark action. (#6894)
  • Fix dropdown menu pointer handling. (#7021)
  • Fix iOS Safari image uploads. (#7037)
  • Fix Alt+Tab conflict on Windows. (#7005)
  • Fix text focus issues. (#7043)
  • Fix TldrawEditor usability without TldrawUiContextProvider. (#7053)
  • Fix cross-realm clipboard functionality. (#7026)
  • Fix iOS ink rendering via coalesced events. (#6917)
  • Fix menu-open dragging behavior. (#6918)

View release on GitHub


Patch releases

v4.2.1

  • Fix CommonJS/cjs builds that were broken in v4.2.0. (#7282)

View release on GitHub