Commit Graph
100 Commits
Author SHA1 Message Date
Aakansha Doshi 562249e981 Merge remote-tracking branch 'origin/master' into aakansha-create-text-containers-programmatically 2023-07-17 12:56:35 +05:30
Aakansha Doshi d994f72c40 cleanup 2023-07-14 20:37:53 +05:30
Aakansha Doshi 7a94ee3191 Add new type excalidraw-api/clipboard for programmatic api 2023-07-14 20:10:02 +05:30
Aakansha Doshi bb778892dc update snaps 2023-07-14 17:20:27 +05:30
Aakansha Doshi 11fd4efa32 lint 2023-07-14 17:15:37 +05:30
Aakansha Doshi d3361f910b remove convertToExcalidrawElements call from restore 2023-07-14 17:13:24 +05:30
Aakansha Doshi 2ff0528a4f Merge remote-tracking branch 'origin/master' into aakansha-create-text-containers-programmatically 2023-07-14 17:10:09 +05:30
Aakansha Doshi 25e2f80709 let host call convertToExcalidrawElements when using programmatic API 2023-07-14 14:50:27 +05:30
Aakansha DoshiandGitHub 6d56634289 fix: do not bind text to container using text tool when it has text already (#6694)
* fix: do not bind text to container using text tool when it has text already

* Update src/element/textWysiwyg.test.tsx
2023-06-19 17:28:45 +05:30
Aakansha DoshiandGitHub 7f7128ec09 fix: don't allow binding text to images (#6693) 2023-06-19 13:47:28 +05:30
Aakansha DoshiandGitHub 6de6a96abf docs: add info about roadmap (#6687) 2023-06-16 20:55:33 +05:30
Aakansha DoshiandGitHub 4d7d96eb7b feat: add canvas-roundrect-polyfill package (#6675)
* feat: add canvas-roundrect-polyfill instead of maintaining a copy of it and transplile it since its not transpiled in the package

* transform canvas-roundrect-polyfill in jest
2023-06-14 17:26:29 +05:30
Aakansha Doshi c1a61b06df tweak 2023-06-12 14:29:45 +05:30
Aakansha Doshi 9e6751c5fb Add more tests 2023-06-12 13:00:31 +05:30
Aakansha Doshi 1784f5b31e remove type when id provided in tests 2023-06-12 11:59:21 +05:30
Aakansha Doshi d76bc7890d make type optional when id present 2023-06-12 11:53:10 +05:30
Aakansha DoshiandGitHub ae7ff76126 fix: cleanup textWysiwyg and getAdjustedDimensions (#6520)
* fix: cleanup textWysiwyg and getAdjustedDimensions

* fix lint

* fix test
2023-06-06 14:36:18 +05:30
Aakansha Doshi d9e6910df0 Merge remote-tracking branch 'origin/master' into aakansha-create-text-containers-programmatically 2023-06-05 11:46:26 +05:30
Aakansha DoshiandGitHub 82d8d02697 test: Add coverage script (#6634)
Add coverage script
2023-05-31 17:30:14 +05:30
Aakansha Doshi 236a12d968 fix tests 2023-05-30 20:11:19 +05:30
Aakansha Doshi a9154b36d5 Add tests 2023-05-30 13:24:47 +05:30
Aakansha Doshi dfd3d4551f Add coverage script 2023-05-30 12:34:23 +05:30
Aakansha Doshi d4b34a380b remove 2023-05-30 11:51:57 +05:30
Aakansha Doshi 2c52107f6f remove ts ignore 2023-05-29 18:30:30 +05:30
Aakansha Doshi 03131750be remove more ts ignore 2023-05-29 14:48:22 +05:30
Aakansha Doshi f57e72443d fix 2023-05-29 14:09:30 +05:30
Aakansha Doshi 016662a7f6 fix types 2023-05-29 13:53:19 +05:30
Aakansha Doshi 5841e6a48d use same stroke color as parent for text containers and height 0 for linear element by default 2023-05-26 13:59:10 +05:30
Aakansha Doshi 5b458288e7 fix creation of regular text 2023-05-26 13:00:22 +05:30
Aakansha Doshi afc98c2d47 support binding arrow to text element 2023-05-25 22:56:50 +05:30
Aakansha Doshi 7560b59900 fix 2023-05-25 14:35:58 +05:30
Aakansha Doshi b72515a83b fix lint 2023-05-25 14:20:14 +05:30
Aakansha Doshi 1c291f8b3d fix single text element, unique id and tests 2023-05-25 14:12:01 +05:30
Aakansha Doshi 6c41e507db fix singular elements 2023-05-24 22:35:51 +05:30
Aakansha Doshi 596edaea62 allow multiple arrows to bind to single element 2023-05-24 18:42:35 +05:30
Aakansha Doshi 985318e960 support ids, clean up code and move the api related stuff to transform.ts 2023-05-24 17:12:26 +05:30
Aakansha Doshi da8e97ad14 preserve bindings for labelled arrows 2023-05-23 16:55:41 +05:30
Aakansha Doshi f113a393e6 preserve bindings if present and fix testcases 2023-05-23 16:47:52 +05:30
Aakansha Doshi 75cfe54b15 support id as well for elements 2023-05-23 13:21:22 +05:30
Aakansha Doshi b783b822d6 fix coords 2023-05-23 13:19:33 +05:30
Aakansha Doshi 596e64ca5a fix lint 2023-05-22 21:29:42 +05:30
Aakansha Doshi d8c901e0c1 support arrow bindings via start and end in api 2023-05-22 21:22:36 +05:30
Aakansha Doshi 0449cccc39 ignore 2023-05-22 14:01:32 +05:30
Aakansha Doshi 5bfe4dff5f fix lint 2023-05-22 13:57:05 +05:30
Aakansha Doshi dcf9e27e51 Merge remote-tracking branch 'origin/master' into aakansha-create-text-containers-programmatically 2023-05-22 13:51:36 +05:30
Aakansha Doshi e3fa2905f2 fix tests 2023-05-22 13:40:35 +05:30
Aakansha Doshi e68edb9f73 keep element as is unless we support prog api 2023-05-18 15:20:26 +05:30
Aakansha Doshi 453aa722eb fix 2023-05-17 18:22:59 +05:30
Aakansha Doshi 4348646705 better types 2023-05-17 17:58:18 +05:30
Aakansha Doshi 81bee8acb8 fix alignment 2023-05-17 14:09:25 +05:30
Aakansha Doshi 9e3032059d add in package example 2023-05-16 17:52:40 +05:30
Aakansha Doshi a443d65512 support labelled arrows 2023-05-16 17:49:24 +05:30
Aakansha Doshi fbf2d533c0 support creating arrows and line 2023-05-16 16:50:58 +05:30
Aakansha Doshi d83860c747 update test case in package example 2023-05-15 16:57:01 +05:30
Aakansha Doshi 32aaa8b95d fix api and support individual shapes and text element 2023-05-15 16:34:12 +05:30
Aakansha DoshiandGitHub e0f2869374 fix: assign the original text to text editor only during init (#6580) 2023-05-13 19:17:29 +02:00
Aakansha Doshi acde193a64 Merge remote-tracking branch 'origin/master' into aakansha-create-text-containers-programmatically 2023-05-12 17:19:45 +05:30
Aakansha Doshi bc5c58282f update api to use label 2023-05-12 17:19:36 +05:30
Aakansha Doshi e465a43f77 fix 2023-05-03 15:44:18 +05:30
Aakansha Doshi 9c63b0124c fix 2023-05-03 14:34:06 +05:30
Aakansha Doshi 59e8bf498d fix 2023-05-03 13:41:41 +05:30
Aakansha Doshi 7087db42c0 fix 2023-05-03 00:48:11 +05:30
Aakansha Doshi 15b5295baf feat: support creating text containers programatically 2023-05-02 22:11:35 +05:30
Aakansha DoshiandGitHub b1311a407a fix: Revert add version tags to Docker build (#6540)
Revert "build: Add version tags to Docker build (#6508)"

This reverts commit 1815cf3213.
2023-05-02 12:49:11 +05:30
Aakansha DoshiandGitHub 45a57d70de fix: don't refresh dimensions for text containers on font load (#6523) 2023-04-26 21:35:06 +05:30
Aakansha DoshiandGitHub da8dd389a9 fix: cleanup getMaxContainerHeight and getMaxContainerWidth (#6519)
* fix: cleanup getMaxContainerHeight and getMaxContainerWidth

* rename getMaxContainerWidth -> getBoundTextMaxMaxWidth and getMaxContainerHeight -> getBoundTextMaxHeight

* add specs
2023-04-25 18:06:23 +05:30
Aakansha DoshiandGitHub dae81c0a2c fix: cleanup redrawTextBoundingBox (#6518)
* chore: cleanup redrawTextBoundingBox

* fix
2023-04-25 17:57:53 +05:30
Aakansha DoshiandGitHub 2a4799d8c8 chore: upgrade excalidraw version to 0.15.2 (#6496)
chore: updragde excalidraw version to 0.15.2
2023-04-20 17:40:08 +05:30
Aakansha DoshiandGitHub c4445c181b docs: release @excalidraw/excalidraw@0.15.2 🎉 (#6495) 2023-04-20 17:34:06 +05:30
Aakansha DoshiandGitHub 5ddb28d378 fix: support breaking words containing hyphen - (#6014)
* fix: support breaking words containing hyphen -

* fix

* add spec

* fix

* fix

* fix

* fix and add spec

* improve code and add more tests
2023-04-20 11:10:46 +05:30
Aakansha DoshiandGitHub 98a77d7426 chore: show bounding box only when flag is true (#6490) 2023-04-19 17:02:20 +05:30
Aakansha DoshiandGitHub ff3c2e5a16 docs: fix docs link in readme (#6486)
* docs: fix docs link in readme

* update changelog
2023-04-18 21:52:08 +05:30
Aakansha DoshiandGitHub b64beaf5ba docs: release @excalidraw/excalidraw@0.15.1 🎉 (#6485) 2023-04-18 21:32:33 +05:30
Aakansha DoshiandGitHub 89304c9f66 fix: add readme back to npm package which was mistakenly removed (#6484)
* fix: remove update readme script from release

* update docs

* remove

* fix
2023-04-18 21:23:47 +05:30
1d0653ce50 docs: update docs for next version (#6251)
* update docs for opts param inr estore utils

* docs: add docs for `useI18n` hook (#6269)

Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>

* upgrade excal

---------

Co-authored-by: David Luzar <luzar.david@gmail.com>
2023-04-18 21:03:17 +05:30
Aakansha DoshiandGitHub c9c79646c5 docs: release @excalidraw/excalidraw@0.15.0 🎉 (#6481) 2023-04-18 20:48:30 +05:30
Aakansha DoshiandGitHub 979312f779 fix: center align text when wrapped in container via context menu (#6480)
* rename action to wrapTextInContainer

* fix: center align text when wrapped in container via context menu

* revert translation key

* fix tests
2023-04-18 19:44:14 +05:30
Aakansha DoshiandGitHub 801412bf6b fix: restore original container height when unbinding text which was binded via context menu (#6444)
* fix: restore original container height when unbinding text which was binded via context menu

* remove flag

* comment
2023-04-18 18:50:25 +05:30
Aakansha DoshiandGitHub 21726e22cc fix: mark more props as optional for element (#6448)
* fix: mark more props as optional for element

* fix
2023-04-18 18:42:48 +05:30
Aakansha DoshiandGitHub ca3be2c678 fix: exporting labelled arrows via export utils (#6443)
* fix: exporting labelled arrows via export utils

* add comments

* lint

* update changelog

* fix lint

* initialize scene in the utils so it can be availabe in the helper functions

* fix library rendering

* add comments
2023-04-13 17:19:46 +05:30
Aakansha DoshiandGitHub 13b27afe0f fix: update coords when text unbinded from its container (#6445)
* fix: update coords when text unbinded from its container

* Add specs
2023-04-13 11:45:58 +05:30
ec215362a1 fix: introduce baseline to fix the layout shift when switching to text editor (#6397)
* fix: introduce baseline to fix the layout shift when switching to text editor

* uncomment

* change offset to 8pixels

* [debug]

* introduce DOM baseline in canvas rendering instead

* introduce baseline in element making it backward compat

* fix

* lint

* fix

* update baseline when resizing text element

* fix safari backward compat

* fix for safari

* lint

* reduce safari LS

* floor line height and height when dom height increases than canvas height

* Revert "floor line height and height when dom height increases than canvas height"

This reverts commit 8de6516823.

* cleanup

* use DOM height only for safari to fix LS

* Revert "use DOM height only for safari to fix LS"

This reverts commit d75889238d.

* fix lint and test

* fix

* calculate line height by rounding off instead of DOM

* cleanup

---------

Co-authored-by: dwelle <luzar.david@gmail.com>
2023-04-10 18:52:46 +05:30
Aakansha DoshiandGitHub 0b8fc4f4b6 fix: don't refresh dimensions for deleted text elements (#6438) 2023-04-10 16:31:58 +05:30
Aakansha DoshiandGitHub d61b3cf83d fix: don't jump text to end when out of viewport in safari (#6416) 2023-04-05 12:17:18 +05:30
Aakansha DoshiandGitHub f8e65bb77e fix: Revert use ideographic textBaseline to improve layout shift when editing text" (#6400)
Revert "fix: use `ideographic` textBaseline to improve layout shift when editing text (#6384)"

This reverts commit 9e52c30ce8.
2023-03-29 18:53:03 +05:30
83383977f5 feat: add line height attribute to text element (#6360)
* feat: add line height attribute to text element

* lint

* update line height when redrawing text bounding box

* fix tests

* retain line height when pasting styles

* fix test

* create a util for calculating ling height using old algo

* update line height when resizing multiple text elements

* make line height backward compatible

* udpate line height for older element when font size updated

* remove logs

* Add specs

* lint

* review fixes

* simplify by changing `lineHeight` from px to unitless

* make param non-optional

* update comment

* fix: jumping text due to font size being calculated incorrectly

* update line height when font family is updated

* lint

* Add spec

* more specs

* rename to getDefaultLineHeight

* fix getting lineHeight for potentially undefined fontFamily

* reduce duplication

* fix fallback

* refactor and comment tweaks

* fix

---------

Co-authored-by: dwelle <luzar.david@gmail.com>
2023-03-22 11:32:38 +05:30
Aakansha DoshiandGitHub f6e8be399e fix: hide text align for labelled arrows (#6339)
* fix: hide text align for labelled arrows

* lintttt

* since we fetch seledcted Elements including the bound text hence this block can be removed

* fix
2023-03-14 17:21:46 +05:30
Aakansha DoshiandGitHub ab49cad6b1 perf: break early if the line width <= max width of the container (#6347)
* fix: break early if the line width <= max width of the container

* Remove dead code

* remove dead code

* lint

* remove
2023-03-14 17:18:16 +05:30
Aakansha DoshiandGitHub 6aeb18b784 fix: refresh dimensions when elements loaded from shareable link and blob (#6333)
* fix: refresh dimensions when elements loaded from shareable link

* refresh text dimensions when loading from file

* remove log
2023-03-14 17:08:23 +05:30
023313e92f fix: show error message when measureText API breaks in brave (#6336)
* fix: show error message when measureText API breaks in brave

* Add docs

* Add assets

* tweak message

* fix

* tweak message

* add translations

* lint

* fix

* fix

* lint

* lint

* lint please work now

* tweak doc

* fix

* split error component to new file

* add specs

* tweaks

Co-authored-by: David Luzar <luzar.david@gmail.com>

* wrap in div with a width of 30rem

* fix spec

* fix

* Fix typo

---------

Co-authored-by: David Luzar <luzar.david@gmail.com>
Co-authored-by: Daniel J. Geiger <1852529+DanielJGeiger@users.noreply.github.com>
2023-03-13 19:46:09 +05:30
Aakansha DoshiandGitHub dd4c333925 fix: add an offset of 0.5px for text editor in containers (#6328)
* fix: add an offset of 0.5px for text editor in containers

* fix specs and lint
2023-03-09 13:07:36 +05:30
Aakansha DoshiandGitHub 5c0b15ce2b fix: respect text align when wrapping in a container (#6310)
* fix: respect text align when wrapping in a container

* fix
2023-03-03 18:07:26 +05:30
Aakansha DoshiandGitHub 9f9666110e chore: Add debug flag to enable text container bounding box (#6296)
* debug: Add debug flag to enable text container bounding box

* newline

* fix
2023-03-03 18:01:55 +05:30
Aakansha DoshiandGitHub 0f06fa3851 feat: create bound container from text (#6301)
* feat: create container from text

* fix lint and spec

* fix

* round off dims

* ceil

* review fixes

* fix

* Add specs

* fix

* fix z-index and type

* consider group

* consider linear bindings

* lint
2023-03-03 17:40:42 +05:30
Aakansha DoshiandGitHub 1ce933d2f5 fix: compute bounding box correctly for text element when multiple element resizing (#6307) 2023-03-03 17:34:11 +05:30
Aakansha DoshiandGitHub bd4424bbe3 fix: consider arrow for bound text element (#6297)
* fix: consider arrow for bound text element

* add spec
2023-02-28 19:53:30 +05:30
Aakansha DoshiandGitHub 38fc51b4e3 fix: text never goes beyond max width for unbound text elements (#6288) 2023-02-27 16:54:29 +05:30
Aakansha DoshiandGitHub 0e95e2b386 fix: compute container height from bound text correctly (#6273)
* fix: compute container height from bound text correctly

* fix specs

* Add tests
2023-02-23 17:39:02 +05:30
Aakansha DoshiandGitHub 9659254fd6 feat: improve text measurements in bound containers (#6187)
* feat: move to canvas measureText

* calcualte height with better heuristic

* improve heuristic more

* remove vertical offset as its not needed

* lint

* calculate width of individual char and ceil to calculate width and remove adjustment factor

* push the word if equal to max width

* update height when text overflows for vertical alignment top/bottom

* remove the hack of updating height when line mismatch as its not needed

* remove scroll height and calculate the height instead

* remove unused code

* fix

* remove

* use math.ceil for whole width instead of individual chars

* fix tests

* fix

* fix

* redraw text bounding box instead when font loaded to fix alignment as well

* fix

* fix

* fix

* Add a 0.05px extra only for firefox

* Add spec

* stop taking ceil and increase firefox editor width by 0.05px

* Ad 0.05px in safari too

* lint

* lint

* remove baseline from measureFontSizeFromWH

* don't redraw on font load

* lint

* refactor name and signature
2023-02-23 16:33:10 +05:30
Aakansha DoshiandGitHub 5368ddef74 fix: improve text wrapping inside rhombus and more fixes (#6265)
* fix: improve text wrapping inside rhombus

* Add comments

* specs

* fix: shift resize and multiple element regression for ellipse and rhombus

* use container width for scaling font size

* fix

* fix multiple resize

* lint

* redraw on submit

* redraw only newly pasted elements

* no padding when center

* fix tests

* fix

* dont add padding in rhombus when aligning

* refactor

* fix

* move getMaxContainerHeight and getMaxContainerWidth to textElement.ts

* Add specs
2023-02-22 16:28:12 +05:30