mirror of
https://github.com/excalidraw/excalidraw.git
synced 2026-11-20 21:23:22 +03:00
* fix(editor): keep the text auto-resize toggle on the box while typing The toggle was positioned from `appState.editingTextElement`, the element as it was when editing started, so it stayed put as lines were added or removed. Resolve the current element instead, for the hit test too. * feat(editor): resize a text from its sides while editing it Dragging the left or right side of the free text being edited sets the width it wraps at, without leaving the editor (a mere click there still submits). The edited text isn't reliably the selection, so the drag is handled by the editor rather than the selection's transform handles — with grid and object snapping, as when resizing on the canvas. * feat(editor): let a typed or pasted text grow wider when zoomed out Below 100% zoom, the width a text wraps at is TEXT_MAX_WRAP_WIDTH on screen rather than in scene units, up to TEXT_MAX_WRAP_WIDTH_ZOOMED_OUT. * feat(editor): toggle text auto-resizing with Alt+W On the selected free texts (on if any of them wraps, else off) and on the text being edited. Turning it off keeps the text's width, wrapping at it — at the width a typed text stops growing at, if wider. Zen mode (Alt+Z) now goes by the key's letter too where the layout gives one, as on AZERTY both would otherwise claim the key labelled W. * feat(editor): hint at Alt+W for a wrapped text and while editing a text The hint for editing now also takes precedence over the one for a selected text: a text just created is selected while it's edited. * feat(editor): show the side of an edited text that can be dragged to wrap it A text that doesn't wrap yet has no box showing its sides while it's edited: the side under the pointer is now drawn (dashed, as the box of a wrapped text), along with the resize cursor. * fix(editor): no stale cursor or hidden transform handles around a text being edited - the canvas kept the cursor of what was hovered before editing (the selected text's move cursor, a resize handle's), which flashed once the pointer left the editor: it's reset as editing starts - a text just created is selected while it's edited, so its transform handles, which aren't drawn then, still resized it (ending the edit) * fix(editor): no gap or cursor flash between a text's editor and its side handles - the side handles of the text being edited get a hit test of their own: the selection's left the pixel at the text's right edge to neither the editor nor the handle - the canvas is given, from over the editor, the cursor of what the pointer would leave the editor onto: the browser shows the canvas' cursor as it is when the pointer gets there, and what the canvas then sets a frame later * fix(editor): give a text made to keep its width a pixel to spare A text exactly as wide as its longest line is on the verge of wrapping: Chrome lays the editor's text out in 1/64px steps, rounding each run of it up (a line being split into more runs as it's edited), so the line could wrap in the editor alone.
@excalidraw/common
Install
npm install @excalidraw/common
If you prefer Yarn over npm, use this command to install the Excalidraw utils package:
yarn add @excalidraw/common
With PNPM, similarly install the package with this command:
pnpm add @excalidraw/common