Developer abandons contentEditable and draws an entire text editor on a 2D canvas

Tasfer: a text editor drawn on a 2D canvas

Developer abandons contentEditable and draws an entire text editor on a 2D canvas

Frustrated by contentEditable's quirks, Hamza built Tasfer, a text editor that measures and paints every letter, cursor, selection, and line break onto an HTML5 canvas, with a hidden input only to catch keystrokes. It is local-first with no accounts or cloud copy, syncs via a self-implemented CRDT over encrypted WebRTC, and now runs on web, desktop, and mobile. The engine is open source under MIT, the app under AGPL.

The browser listens, but it does not get to draw.
  1. gb2d_hn

    This looks great. I've been impressed at how flexible CodeMirror is though. When I started EtherPK (https://app.etherpk.com) I made a bet that CodeMirror could help me build an editor that could combine outliner blocks, standard prose and rich overlays / graphics / embeds in one editor. I was concerned that I'd hit a road block (I presumed Logseq used custom HTML, nested divs and click position mapping for rendered text to the underlying input for a reason), but 9 months in I couldn't be happier with my choice, and it's a blazing fast editor that feels really nice and light to type in (live demo: https://app.etherpk.com/demo)

  2. SubiculumCode

    I wish Office 365 would hire someone like the author. Online Word never renders the same as it would in the Desktop software...and this matters. I deal with only modestly complex documents when I write grants but I do need to stay within page length limits for sections, I need some layout stability...so I inevitably fire up my Windows VM to run the application.

    Before anyone suggests LateX, I know, I know, but when you write collaboratively, you don't always get to choose the platform.

  3. pcj-github

    I wrote a similar tool to this many years ago that used JATS as an internal document model, using contentEditable, and I can relate to the pain you refer to. Getting the semantics right in cases where you split or join text that has varying types of nested context was hard.

    I like what you did here in terms of the cursor that points one way or the other: it tells you if you're in "normal" mode, or for example, in a bold region. I don't think I've seen that before so, if you made it up, that itself is a cool invention.

  4. hnlmorg

    This looks slick but I think you need a better way to market it.

    The 2D canvas part is the norm for anyone who wants performance. Working with the DOM becomes painfully slow and resource intensive the moment you add syntax highlighting, spell checking, and other visual chrome, to large documents.

    This is why Monaco (the editor widget behind VSCode) is a canvas. Why terminal emulators built with web technologies use canvas. And so on.

    So I wouldn’t say the canvas part of the heading is a differentiator.

    Edit: apologies, seems I was wildly wrong here. Please disregard the above.

  5. annex-winged-cr

    Just tested it on Android, glide delete and glide cursor control doesn't work.

    Would it even be possible to make those work with a canvas?

More from this day

2026-11-07