excalidraw/packages/excalidraw/actions
Ryan Di 971b4d4ae6
feat: text wrapping (#7999)
* resize single elements from the side

* fix lint

* do not resize texts from the sides (for we want to wrap/unwrap)

* omit side handles for frames too

* upgrade types

* enable resizing from the sides for multiple elements as well

* fix lint

* maintain aspect ratio when elements are not of the same angle

* lint

* always resize proportionally for multiple elements

* increase side resizing padding

* code cleanup

* adaptive handles

* do not resize for linear elements with only two points

* prioritize point dragging over edge resizing

* lint

* allow free resizing for multiple elements at degree 0

* always resize from the sides

* reduce hit threshold

* make small multiple elements movable

* lint

* show side handles on touch screen and mobile devices

* differentiate touchscreens

* keep proportional with text in multi-element resizing

* update snapshot

* update multi elements resizing logic

* lint

* reduce side resizing padding

* bound texts do not scale in normal cases

* lint

* test sides for texts

* wrap text

* do not update text size when changing its alignment

* keep text wrapped/unwrapped when editing

* change wrapped size to auto size from context menu

* fix test

* lint

* increase min width for wrapped texts

* wrap wrapped text in container

* unwrap when binding text to container

* rename `wrapped` to `autoResize`

* fix lint

* revert: use `center` align when wrapping text in container

* update snaps

* fix lint

* simplify logic on autoResize

* lint and test

* snapshots

* remove unnecessary code

* snapshots

* fix: defaults not set correctly

* tests for wrapping texts when resized

* tests for text wrapping when edited

* fix autoResize refactor

* include autoResize flag check

* refactor

* feat: rename action label & change contextmenu position

* fix: update version on `autoResize` action

* fix infinite loop when editing text in a container

* simplify

* always maintain `width` if `!autoResize`

* maintain `x` if `!autoResize`

* maintain `y` pos after fontSize change if `!autoResize`

* refactor

* when editing, do not wrap text in textWysiwyg

* simplify text editor

* make test more readable

* comment

* rename action to match file name

* revert function signature change

* only update  in app

---------

Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
2024-05-15 21:04:53 +08:00
..
actionAddToLibrary.ts feat: multiplayer undo / redo (#7348) 2024-04-17 14:01:24 +02:00
actionAlign.tsx build: enable consistent type imports eslint rule (#7992) 2024-05-08 14:21:50 +05:30
actionBoundText.tsx feat: text wrapping (#7999) 2024-05-15 21:04:53 +08:00
actionCanvas.tsx build: enable consistent type imports eslint rule (#7992) 2024-05-08 14:21:50 +05:30
actionClipboard.tsx feat: multiplayer undo / redo (#7348) 2024-04-17 14:01:24 +02:00
actionDeleteSelected.tsx build: enable consistent type imports eslint rule (#7992) 2024-05-08 14:21:50 +05:30
actionDistribute.tsx build: enable consistent type imports eslint rule (#7992) 2024-05-08 14:21:50 +05:30
actionDuplicateSelection.tsx build: enable consistent type imports eslint rule (#7992) 2024-05-08 14:21:50 +05:30
actionElementLock.test.tsx build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
actionElementLock.ts build: enable consistent type imports eslint rule (#7992) 2024-05-08 14:21:50 +05:30
actionExport.tsx build: enable consistent type imports eslint rule (#7992) 2024-05-08 14:21:50 +05:30
actionFinalize.tsx build: enable consistent type imports eslint rule (#7992) 2024-05-08 14:21:50 +05:30
actionFlip.ts build: enable consistent type imports eslint rule (#7992) 2024-05-08 14:21:50 +05:30
actionFrame.ts build: enable consistent type imports eslint rule (#7992) 2024-05-08 14:21:50 +05:30
actionGroup.tsx build: enable consistent type imports eslint rule (#7992) 2024-05-08 14:21:50 +05:30
actionHistory.tsx build: enable consistent type imports eslint rule (#7992) 2024-05-08 14:21:50 +05:30
actionLinearEditor.tsx build: enable consistent type imports eslint rule (#7992) 2024-05-08 14:21:50 +05:30
actionLink.tsx feat: multiplayer undo / redo (#7348) 2024-04-17 14:01:24 +02:00
actionMenu.tsx feat: multiplayer undo / redo (#7348) 2024-04-17 14:01:24 +02:00
actionNavigate.tsx build: enable consistent type imports eslint rule (#7992) 2024-05-08 14:21:50 +05:30
actionProperties.test.tsx build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
actionProperties.tsx feat: text wrapping (#7999) 2024-05-15 21:04:53 +08:00
actionSelectAll.ts build: enable consistent type imports eslint rule (#7992) 2024-05-08 14:21:50 +05:30
actionStyles.ts build: enable consistent type imports eslint rule (#7992) 2024-05-08 14:21:50 +05:30
actionTextAutoResize.ts feat: text wrapping (#7999) 2024-05-15 21:04:53 +08:00
actionToggleGridMode.tsx build: enable consistent type imports eslint rule (#7992) 2024-05-08 14:21:50 +05:30
actionToggleObjectsSnapMode.tsx feat: multiplayer undo / redo (#7348) 2024-04-17 14:01:24 +02:00
actionToggleStats.tsx feat: multiplayer undo / redo (#7348) 2024-04-17 14:01:24 +02:00
actionToggleViewMode.tsx feat: multiplayer undo / redo (#7348) 2024-04-17 14:01:24 +02:00
actionToggleZenMode.tsx feat: multiplayer undo / redo (#7348) 2024-04-17 14:01:24 +02:00
actionZindex.tsx feat: tweak a few icons & add line editor button to side panel (#7990) 2024-05-07 13:18:39 +02:00
index.ts fix: decouple pure functions from hyperlink to prevent mermaid bundling (#7710) 2024-02-20 20:59:01 +05:30
manager.tsx build: enable consistent type imports eslint rule (#7992) 2024-05-08 14:21:50 +05:30
register.ts build: enable consistent type imports eslint rule (#7992) 2024-05-08 14:21:50 +05:30
shortcuts.ts build: enable consistent type imports eslint rule (#7992) 2024-05-08 14:21:50 +05:30
types.ts feat: text wrapping (#7999) 2024-05-15 21:04:53 +08:00