David Luzar eaa7fa32a6 feat(editor): paste multiline text as a single element, with a toast to split it into lines (#12712)
* fix(editor): stack text pasted as separate lines without overlap, as the text is aligned

Each line was centered on a running y advanced by the previous line's
height, so a line wrapping to more rows than the one above overlapped
it. Lines now stack top to bottom, half a line height apart (blank lines
no longer add room), and take the current text align: the block is
centered at the pointer and its lines aligned in it.

* fix(editor): don't restart the toast's timer on each render

Its onClose is a new function on each LayerUI render, and the timer
depended on it: every render cleared the timer and started a full-length
one, so a toast stayed for as long as the UI kept re-rendering. The
timer now restarts only when the toast shows something else.

* feat(editor): paste multiline text as a single element, splitting it into lines from a toast

Ctrl/Cmd+V of a text with more lines pasted an element per line. It's
one text element now, and a toast offers to split it: each non-blank
line an element of its own, in place of the pasted one (wrapped and
aligned as in it, half a line height apart), as one step to undo.

The toast takes an optional action for that: a link-like button after
its message.

* fix(editor): give a toast shown again its full duration

Since the timer no longer restarts on a render, the same plain toast
shown again within its duration got only what was left of the first
one's. The toast takes a timerKey (LayerUI passes the toast object), so
that another toast restarts the timer, and a re-render still doesn't.

* fix(editor): split a pasted text into lines as it's laid out, in its place

Review fixes for splitting a pasted text from the toast:

- the lines keep their indentation and the rows they were wrapped to
  (wrapping a line anew at the text's measured width could break a long
  word elsewhere)
- a line moved out of the frame by the gaps is taken out of it
- the lines take the text's place in the layer order, and arrows bound
  to the text are let go of
- the focus is back in the editor after the toast's button is gone, so
  that the next paste isn't ignored
- a later paste retires the offer to split the text pasted before
2026-11-24 19:24:56 +01:00
2024-08-06 13:21:20 +02:00
2020-04-03 19:19:01 +02:00
2024-09-09 17:12:07 +02:00
2020-09-15 21:59:00 +02:00
2025-05-25 21:23:40 +02:00
2023-05-18 16:06:27 +02:00
2025-05-25 21:23:40 +02:00
2020-01-05 13:09:29 -08:00

Excalidraw

Excalidraw Editor | Blog | Documentation | Excalidraw+

An open source virtual hand-drawn style whiteboard.
Collaborative and end-to-end encrypted.


Excalidraw is released under the MIT license. npm downloads/month PRs welcome! Chat on Discord Ask DeepWiki Follow Excalidraw on Twitter

Product showcase

Create beautiful hand-drawn like diagrams, wireframes, or whatever you like.

Features

The Excalidraw editor (npm package) supports:

  • 💯 Free & open-source.
  • 🎨 Infinite, canvas-based whiteboard.
  • ✍️ Hand-drawn like style.
  • 🌓 Dark mode.
  • 🏗️ Customizable.
  • 📷 Image support.
  • 😀 Shape libraries support.
  • 🌐 Localization (i18n) support.
  • 🖼️ Export to PNG, SVG & clipboard.
  • 💾 Open format - export drawings as an .excalidraw json file.
  • ⚒️ Wide range of tools - rectangle, circle, diamond, arrow, line, free-draw, eraser...
  • ➡️ Arrow-binding & labeled arrows.
  • 🔙 Undo / Redo.
  • 🔍 Zoom and panning support.

Excalidraw.com

The app hosted at excalidraw.com is a minimal showcase of what you can build with Excalidraw. Its source code is part of this repository as well, and the app features:

  • 📡 PWA support (works offline).
  • 🤼 Real-time collaboration.
  • 🔒 End-to-end encryption.
  • 💾 Local-first support (autosaves to the browser).
  • 🔗 Shareable links (export to a readonly link you can share with others).

We'll be adding these features as drop-in plugins for the npm package in the future.

Quick start

Note: following instructions are for installing the Excalidraw npm package when integrating Excalidraw into your own app. To run the repository locally for development, please refer to our Development Guide.

Use npm or yarn to install the package.

npm install react react-dom @excalidraw/excalidraw
# or
yarn add react react-dom @excalidraw/excalidraw

Check out our documentation for more details!

Contributing

Integrations

Who's integrating Excalidraw

Google Cloud • Meta • CodeSandbox • Obsidian Excalidraw • Replit • Slite • Notion • HackerRank • and many others

Sponsors & support

If you like the project, you can become a sponsor at Open Collective or use Excalidraw+.

Thank you for supporting Excalidraw

Last but not least, we're thankful to these companies for offering their services for free:

Vercel Sentry Crowdin

Languages
TypeScript 94.1%
SCSS 2.5%
JavaScript 1.6%
MDX 1.4%
HTML 0.4%