Compare commits

..

25 Commits

Author SHA1 Message Date
dwelle 4060682c57 dedupe & handle embeddables 2026-02-18 22:57:55 +01:00
Márk Tolmács 5852d0d410 fix: Arrow overlap arrow behavior (#10732)
* fix(arrow): Overlap arrow behavior

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Lint

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* feat(editor): reduce binding gap (#10739)

* feat(editor): reduce binding gap to 7px

* feat(editor): reduce binding gap to 5px

* feat(editor): reduce binding gap to 3px

* go back to 5px

* update tests

* feat: Simplified update bind points

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Remove non-needed export

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix. Possessed arrows #1

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Focus point projection stabilization

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Remove arrow stability hack

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Unbound other endpoint

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* feat(editor): visualize binding midpoints + support for simple arrows (#10611)

* feat: Force exact center focus point

When the projected point is close to center snap it to the exact center.

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Tests

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Snap to center around side mid point.

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* Trigger CI

* fix: Midpoint outline focus point

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Tests

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Dragging existing arrow reset focus point on outline

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Tests

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* feat: Midpoint indicator

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Rotated mid points

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: No hole

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* feat: Cache hits and scene lookups

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* chore: Remove debug

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Consider hit threshold and inside override too

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Increase outline midpoint sticky distance

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Don't show midpoint indicator when no snapping is possible

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* feat: Indicate lock-in

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* chore: Remove Map caching

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: incorrect threshold

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: threshold setting

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Hit caching

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Simple arrow mid point selection inconsistency

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: cache override

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Precise know dragging with midpoint refactor

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fear: Frame support

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Crossing arrow won't trigger mid point

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Arrow creation point highlight

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Restore types & tests

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* chore: Restore restore.ts

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: restore.ts

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Elbow arrows reliably highlight center point

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Highlight point ordering

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* feat: Bind with focus point across shape

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Lint

* fix: Midpoint and binding alignment

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* chore: Indicator color

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* chore: More knob tuning

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Radius

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Tests

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* simplify point indicators

---------

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>

* fix: Tests

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Snapshots

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Target point selection

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* chore: Remove non-needed change

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* chore: Try again removing non-needed modification

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Inside-inside binding arrow endpoint drag trigger focus point editor

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Area based edge case

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Overlapping new arrow jump

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

---------

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Co-authored-by: David Luzar <5153846+dwelle@users.noreply.github.com>
2026-02-17 14:10:05 +01:00
Christopher Tangonan c1e00c44f5 fix: convert ArrowheadNoneIcon to component matching arrowhead icon pattern (#10789) 2026-02-17 07:57:09 +01:00
Márk Tolmács ffcb67b21f fix: Inside-inside bound arrow endpoint drag trigger focus point editor (#10771)
fix: Inside-inside binding arrow endpoint drag trigger focus point editor

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
2026-02-16 22:25:28 +01:00
David Luzar 46ddd60948 feat(editor): support embedding google drive videos (#10788) 2026-02-16 22:19:11 +01:00
Christopher Tangonan 89a9badc27 fix: update arrowhead property defaultValue handling (#10778) 2026-02-13 22:33:52 +01:00
zsviczian 8b3e149db6 fix: hex8 regression #10578 (#10773) 2026-02-12 22:03:13 +01:00
Márk Tolmács a70417f23f feat(editor): visualize binding midpoints + support for simple arrows (#10611)
* feat: Force exact center focus point

When the projected point is close to center snap it to the exact center.

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Tests

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Snap to center around side mid point.

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* Trigger CI

* fix: Midpoint outline focus point

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Tests

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Dragging existing arrow reset focus point on outline

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Tests

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* feat: Midpoint indicator

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Rotated mid points

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: No hole

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* feat: Cache hits and scene lookups

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* chore: Remove debug

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Consider hit threshold and inside override too

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Increase outline midpoint sticky distance

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Don't show midpoint indicator when no snapping is possible

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* feat: Indicate lock-in

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* chore: Remove Map caching

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: incorrect threshold

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: threshold setting

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Hit caching

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Simple arrow mid point selection inconsistency

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: cache override

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Precise know dragging with midpoint refactor

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fear: Frame support

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Crossing arrow won't trigger mid point

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Arrow creation point highlight

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Restore types & tests

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* chore: Restore restore.ts

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: restore.ts

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Elbow arrows reliably highlight center point

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Highlight point ordering

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* feat: Bind with focus point across shape

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Lint

* fix: Midpoint and binding alignment

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* chore: Indicator color

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* chore: More knob tuning

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Radius

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Tests

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* simplify point indicators

---------

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
2026-02-11 11:06:27 +01:00
Márk Tolmács 1c8e8bb0f3 fix: Arrow update when cloned (#10747)
* fix: Arrow update when cloned

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* feat(editor): reduce binding gap (#10739)

* feat(editor): reduce binding gap to 7px

* feat(editor): reduce binding gap to 5px

* feat(editor): reduce binding gap to 3px

* go back to 5px

* update tests

* chore: Refactor

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Align focus points

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

---------

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Co-authored-by: David Luzar <5153846+dwelle@users.noreply.github.com>
2026-02-09 13:03:05 +01:00
David Luzar 3a5ef4020d feat(app): add preferences to main menu (#10760)
feat(editor): add preferences to main menu
2026-02-08 23:30:45 +01:00
David Luzar 063533aede feat(packages/excalidraw): support nested dropdown menu (#10749)
Co-authored-by: Barnabás Molnár <38168628+barnabasmolnar@users.noreply.github.com>
2026-02-08 22:27:34 +01:00
Márk Tolmács b43260d97b fix: Other binding converted from fixed to orbit unconditionally (#10748)
* fix: Other binding converted from fixed to orbit unconditionally

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: New arrow creation

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Alt point setting on inside binding

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Initial arrow creation with Alt

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

---------

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
2026-02-06 15:01:07 +01:00
David Luzar 83d3943cd0 feat(editor): reduce binding gap (#10739)
* feat(editor): reduce binding gap to 7px

* feat(editor): reduce binding gap to 5px

* feat(editor): reduce binding gap to 3px

* go back to 5px

* update tests
2026-02-05 12:00:56 +01:00
Márk Tolmács f39ac4a653 fix(editor): On focus drag only update other binding if it's orbit (#10730)
fix(focus): Only update other binding if it's orbit

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
2026-02-02 20:12:56 +01:00
David Luzar 54a9826817 fix(editor): copying to clipboard with no ClipboardEvent (#10729)
* fix(editor): copying to clipboard with no ClipboardEvent

* fix(editor): use green for `success` state of `FilledButton`
2026-02-01 11:06:37 +01:00
David Luzar d29fd62e41 fix(editor): crop editor cursor drift (#10727)
* fix(editor): do not scale cropping editor pointer offsets

* fix lint

* fix more lint

* fix drift related to image canvas scale
2026-02-01 10:45:04 +01:00
David Luzar b57f3e0096 fix(editor): image positioning in crop editor (#10726) 2026-02-01 09:21:30 +01:00
Excalidraw Bot f12ae80ba1 chore: Update translations from Crowdin (#10598)
* New translations en.json (Russian)

* New translations en.json (Vietnamese)

* New translations en.json (Russian)

* New translations en.json (Romanian)

* New translations en.json (French)

* New translations en.json (Spanish)

* New translations en.json (Arabic)

* New translations en.json (Bulgarian)

* New translations en.json (Catalan)

* New translations en.json (Czech)

* New translations en.json (Danish)

* New translations en.json (German)

* New translations en.json (Greek)

* New translations en.json (Basque)

* New translations en.json (Finnish)

* New translations en.json (Hebrew)

* New translations en.json (Hungarian)

* New translations en.json (Italian)

* New translations en.json (Japanese)

* New translations en.json (Korean)

* New translations en.json (Kurdish)

* New translations en.json (Lithuanian)

* New translations en.json (Dutch)

* New translations en.json (Punjabi)

* New translations en.json (Polish)

* New translations en.json (Portuguese)

* New translations en.json (Slovak)

* New translations en.json (Slovenian)

* New translations en.json (Swedish)

* New translations en.json (Turkish)

* New translations en.json (Ukrainian)

* New translations en.json (Chinese Simplified)

* New translations en.json (Chinese Traditional)

* New translations en.json (Galician)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Indonesian)

* New translations en.json (Persian)

* New translations en.json (Khmer)

* New translations en.json (Tamil)

* New translations en.json (Bengali)

* New translations en.json (Marathi)

* New translations en.json (Thai)

* New translations en.json (Norwegian Nynorsk)

* New translations en.json (Kazakh)

* New translations en.json (Latvian)

* New translations en.json (Azerbaijani)

* New translations en.json (Hindi)

* New translations en.json (Burmese)

* New translations en.json (Chinese Traditional, Hong Kong)

* New translations en.json (Sinhala)

* New translations en.json (Uzbek)

* New translations en.json (Norwegian Bokmal)

* New translations en.json (Occitan)

* New translations en.json (German, Switzerland)

* New translations en.json (Bengali, India)

* New translations en.json (Kabyle)

* New translations en.json (Karakalpak)

* Auto commit: Calculate translation coverage

* New translations en.json (Russian)

* Auto commit: Calculate translation coverage

* New translations en.json (Romanian)

* Auto commit: Calculate translation coverage

* New translations en.json (Italian)

* Auto commit: Calculate translation coverage

* New translations en.json (Italian)

* Auto commit: Calculate translation coverage

* New translations en.json (Hungarian)

* New translations en.json (Hungarian)

* New translations en.json (Hindi)

* New translations en.json (Dutch)

* New translations en.json (Dutch)

* New translations en.json (Vietnamese)

* New translations en.json (Russian)

* New translations en.json (Romanian)

* New translations en.json (French)

* New translations en.json (Spanish)

* New translations en.json (Arabic)

* New translations en.json (Bulgarian)

* New translations en.json (Catalan)

* New translations en.json (Czech)

* New translations en.json (Danish)

* New translations en.json (German)

* New translations en.json (Greek)

* New translations en.json (Basque)

* New translations en.json (Finnish)

* New translations en.json (Hebrew)

* New translations en.json (Hungarian)

* New translations en.json (Italian)

* New translations en.json (Japanese)

* New translations en.json (Korean)

* New translations en.json (Kurdish)

* New translations en.json (Lithuanian)

* New translations en.json (Dutch)

* New translations en.json (Punjabi)

* New translations en.json (Polish)

* New translations en.json (Portuguese)

* New translations en.json (Slovak)

* New translations en.json (Slovenian)

* New translations en.json (Swedish)

* New translations en.json (Turkish)

* New translations en.json (Ukrainian)

* New translations en.json (Chinese Simplified)

* New translations en.json (Chinese Traditional)

* New translations en.json (Galician)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Indonesian)

* New translations en.json (Persian)

* New translations en.json (Khmer)

* New translations en.json (Tamil)

* New translations en.json (Bengali)

* New translations en.json (Marathi)

* New translations en.json (Thai)

* New translations en.json (Norwegian Nynorsk)

* New translations en.json (Kazakh)

* New translations en.json (Latvian)

* New translations en.json (Azerbaijani)

* New translations en.json (Hindi)

* New translations en.json (Burmese)

* New translations en.json (Chinese Traditional, Hong Kong)

* New translations en.json (Sinhala)

* New translations en.json (Uzbek)

* New translations en.json (Norwegian Bokmal)

* New translations en.json (Occitan)

* New translations en.json (German, Switzerland)

* New translations en.json (Bengali, India)

* New translations en.json (Kabyle)

* New translations en.json (Karakalpak)

* New translations en.json (Romanian)

* New translations en.json (Vietnamese)

* New translations en.json (Russian)

* New translations en.json (Romanian)

* New translations en.json (French)

* New translations en.json (Spanish)

* New translations en.json (Arabic)

* New translations en.json (Bulgarian)

* New translations en.json (Catalan)

* New translations en.json (Czech)

* New translations en.json (Danish)

* New translations en.json (German)

* New translations en.json (Greek)

* New translations en.json (Basque)

* New translations en.json (Finnish)

* New translations en.json (Hebrew)

* New translations en.json (Hungarian)

* New translations en.json (Italian)

* New translations en.json (Japanese)

* New translations en.json (Korean)

* New translations en.json (Kurdish)

* New translations en.json (Lithuanian)

* New translations en.json (Dutch)

* New translations en.json (Punjabi)

* New translations en.json (Polish)

* New translations en.json (Portuguese)

* New translations en.json (Slovak)

* New translations en.json (Slovenian)

* New translations en.json (Swedish)

* New translations en.json (Turkish)

* New translations en.json (Ukrainian)

* New translations en.json (Chinese Simplified)

* New translations en.json (Chinese Traditional)

* New translations en.json (Galician)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Indonesian)

* New translations en.json (Persian)

* New translations en.json (Khmer)

* New translations en.json (Tamil)

* New translations en.json (Bengali)

* New translations en.json (Marathi)

* New translations en.json (Thai)

* New translations en.json (Norwegian Nynorsk)

* New translations en.json (Kazakh)

* New translations en.json (Latvian)

* New translations en.json (Azerbaijani)

* New translations en.json (Hindi)

* New translations en.json (Burmese)

* New translations en.json (Chinese Traditional, Hong Kong)

* New translations en.json (Sinhala)

* New translations en.json (Uzbek)

* New translations en.json (Norwegian Bokmal)

* New translations en.json (Occitan)

* New translations en.json (German, Switzerland)

* New translations en.json (Bengali, India)

* New translations en.json (Kabyle)

* New translations en.json (Karakalpak)

* New translations en.json (Romanian)

* New translations en.json (Italian)

* New translations en.json (Russian)

* New translations en.json (Romanian)

* New translations en.json (French)

* New translations en.json (Spanish)

* New translations en.json (Arabic)

* New translations en.json (Bulgarian)

* New translations en.json (Catalan)

* New translations en.json (Czech)

* New translations en.json (Danish)

* New translations en.json (German)

* New translations en.json (Greek)

* New translations en.json (Basque)

* New translations en.json (Finnish)

* New translations en.json (Hebrew)

* New translations en.json (Hungarian)

* New translations en.json (Italian)

* New translations en.json (Japanese)

* New translations en.json (Korean)

* New translations en.json (Kurdish)

* New translations en.json (Lithuanian)

* New translations en.json (Dutch)

* New translations en.json (Punjabi)

* New translations en.json (Polish)

* New translations en.json (Portuguese)

* New translations en.json (Slovak)

* New translations en.json (Slovenian)

* New translations en.json (Swedish)

* New translations en.json (Vietnamese)

* New translations en.json (Turkish)

* New translations en.json (Ukrainian)

* New translations en.json (Chinese Simplified)

* New translations en.json (Chinese Traditional)

* New translations en.json (Galician)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Indonesian)

* New translations en.json (Persian)

* New translations en.json (Khmer)

* New translations en.json (Tamil)

* New translations en.json (Bengali)

* New translations en.json (Marathi)

* New translations en.json (Thai)

* New translations en.json (Norwegian Nynorsk)

* New translations en.json (Kazakh)

* New translations en.json (Latvian)

* New translations en.json (Azerbaijani)

* New translations en.json (Hindi)

* New translations en.json (Burmese)

* New translations en.json (Chinese Traditional, Hong Kong)

* New translations en.json (Sinhala)

* New translations en.json (Uzbek)

* New translations en.json (Norwegian Bokmal)

* New translations en.json (Occitan)

* New translations en.json (German, Switzerland)

* New translations en.json (Bengali, India)

* New translations en.json (Kabyle)

* New translations en.json (Karakalpak)

* New translations en.json (Romanian)

* Auto commit: Calculate translation coverage
2026-01-31 22:12:24 +01:00
David Luzar f7b537a8b1 feat(packages/excalidraw): export CommandPalette (#10724)
feat: export CommandPalette
2026-01-31 20:24:20 +01:00
Yash 94364af68f fix: Clarify welcome screen message about browser storage limitations (#10721)
* fix: Clarify welcome screen message about browser storage limitations

* css tweaks

* update snaps

---------

Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
2026-01-31 17:15:14 +01:00
zsviczian dfa1ce572b fix: SVG Inversion on Safari (#10712)
* invert image on safari

* lint

* Inversion to match theme filter

* cleanup

* Adjust canvas dimensions for device pixel ratio when inverting on Safari

* revert inversion algo & handle darkMode placeholder

---------

Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
2026-01-31 16:28:21 +01:00
Márk Tolmács b552c60714 feat: Focus indicator (#10613)
* feat: Focus indicator

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Snapshot update

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* feat: Move visualdebug to utils and introduce volume bindable volume visualization

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Move visualdebug to elements

Due to dep circles

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Possible test timeout

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Incorrect hit test point input

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* feat: Add fallback when dragged outside of allowed area

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Elbow arrows don't need focus point mgmt

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: End bound indirect fix

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Show indicator when arrow endpoint dragging

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Update bound arrow endpoint at mid-point drag

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* chore: Refactor

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Curve endpoint intersection

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Outline focus point is reset on existing arrow drag

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Tests

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* chore: Fix lint

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* feat: Dragging focus point off

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Don't show the focus indicator when arrow endpoint is dragged

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Drag area for focus handles

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Focus point size unified

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Size bump for focus knob

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* feat: Cache hits and scene lookups

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* chore: Remove debug

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Consider hit threshold and inside override too

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Other shape switching

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* perf: Update tolerance params

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Focus know line width

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: knob offset

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Full overlap

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* chore: Remove Map caching

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: incorrect threshold

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: threshold setting

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Hit caching

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: cache override

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Snapshots

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* feat: Redesigned focus point handling

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Inside-inside mode

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* chore: Remove comment

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* feat: Allow focus knob outside the shape

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Arrow endpoint offset

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Focus knob element distance

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Increase iteration on curve intersection calc

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Handle disabled binding

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Alt mode

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Nested shape focus rewrite

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Alt + Ctrl + arrow endpoitn

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Hit ordering for focus points

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Focus point visibility

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* dry out renderFocusPointIndicator

* do not higlight point when dragging & make focus point smaller

* optimize retrieval of selectedLinearElement

* move focus highlighting into renderFocusPointIndicator to DRY out and colocate

* remove `disabled` state from focus highlight

* make focus point stroke color less prominent

* fix: No focus point for multi-point arrows

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Arrow edit mode drag focus point release

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* DRY out arrow point-like drag

* move `focus.ts` to `arrows/focus.ts`

---------

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
2026-01-31 15:08:28 +01:00
Márk Tolmács 216afc3625 fix: Coherent stats binding (#10718)
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
2026-01-30 22:20:46 +01:00
David Luzar 802cde3501 feat: support customizing TTD welcome screen (#10719)
* feat: support customizing TTD welcome screen

* remove debug
2026-01-30 16:28:36 +01:00
David Luzar f5cf81ce42 feat: prevent pasting excalidraw into textarea & paste element text if avail (#10710)
* feat: prevent pasting excalidraw json into textarea & paste element text if avail

Co-authored-by: Ashutosh Kumar <130897584+codeaashu@users.noreply.github.com>

* fix FF

---------

Co-authored-by: Ashutosh Kumar <130897584+codeaashu@users.noreply.github.com>
2026-01-28 22:35:39 +01:00
150 changed files with 7452 additions and 1539 deletions
+2 -1
View File
@@ -62,7 +62,7 @@ export const AppMainMenu: React.FC<{
{isDevEnv() && (
<MainMenu.Item
icon={eyeIcon}
onClick={() => {
onSelect={() => {
if (window.visualDebug) {
delete window.visualDebug;
saveDebugState({ enabled: false });
@@ -77,6 +77,7 @@ export const AppMainMenu: React.FC<{
</MainMenu.Item>
)}
<MainMenu.Separator />
<MainMenu.DefaultItems.Preferences />
<MainMenu.DefaultItems.ToggleTheme
allowSystemTheme
theme={props.theme}
@@ -33,7 +33,15 @@ export const AppWelcomeScreen: React.FC<{
return bit;
});
} else {
headingContent = t("welcomeScreen.app.center_heading");
headingContent = (
<>
{t("welcomeScreen.app.center_heading")}
<br />
{t("welcomeScreen.app.center_heading_line2")}
<br />
{t("welcomeScreen.app.center_heading_line3")}
</>
);
}
return (
@@ -50,7 +50,11 @@ exports[`Test MobileMenu > should initialize with welcome screen and hide once u
<div
class="welcome-screen-center__heading welcome-screen-decor excalifont"
>
All your data is saved locally in your browser.
Your drawings are saved in your browser's storage.
<br />
Browser storage can be cleared unexpectedly.
<br />
Save your work to a file regularly to avoid losing it.
</div>
<div
class="welcome-screen-menu"
+1 -1
View File
@@ -346,7 +346,7 @@ export const normalizeInputColor = (color: string): string | null => {
if (tc.isValid()) {
// testing for `#` first fixes a bug on Electron (more specfically, an
// Obsidian popout window), where a hex color without `#` is considered valid
if (tc.getFormat() === "hex" && !color.startsWith("#")) {
if (["hex", "hex8"].includes(tc.getFormat()) && !color.startsWith("#")) {
return `#${color}`;
}
return color;
+2
View File
@@ -106,6 +106,7 @@ export const CLASSES = {
CONVERT_ELEMENT_TYPE_POPUP: "ConvertElementTypePopup",
SHAPE_ACTIONS_THEME_SCOPE: "shape-actions-theme-scope",
FRAME_NAME: "frame-name",
DROPDOWN_MENU_EVENT_WRAPPER: "dropdown-menu-event-wrapper",
};
export const FONT_SIZES = {
@@ -251,6 +252,7 @@ export const STRING_MIME_TYPES = {
json: "application/json",
// excalidraw data
excalidraw: "application/vnd.excalidraw+json",
excalidrawClipboard: "application/vnd.excalidraw.clipboard+json",
// LEGACY: fully-qualified library JSON data
excalidrawlib: "application/vnd.excalidrawlib+json",
// list of excalidraw library item ids
+558
View File
@@ -0,0 +1,558 @@
import { pointDistance, pointFrom, type GlobalPoint } from "@excalidraw/math";
import { invariant } from "@excalidraw/common";
import type { AppState, NullableGridSize } from "@excalidraw/excalidraw/types";
import {
bindBindingElement,
calculateFixedPointForNonElbowArrowBinding,
FOCUS_POINT_SIZE,
getBindingGap,
getGlobalFixedPointForBindableElement,
isBindingEnabled,
maxBindingDistance_simple,
unbindBindingElement,
updateBoundPoint,
} from "../binding";
import {
isBindableElement,
isBindingElement,
isElbowArrow,
} from "../typeChecks";
import { LinearElementEditor } from "../linearElementEditor";
import { getHoveredElementForFocusPoint, hitElementItself } from "../collision";
import { moveArrowAboveBindable } from "../zindex";
import type {
ElementsMap,
ExcalidrawArrowElement,
ExcalidrawBindableElement,
NonDeletedSceneElementsMap,
PointsPositionUpdates,
} from "../types";
import type { Scene } from "../Scene";
export const isFocusPointVisible = (
focusPoint: GlobalPoint,
arrow: ExcalidrawArrowElement,
bindableElement: ExcalidrawBindableElement,
elementsMap: ElementsMap,
appState: {
isBindingEnabled: AppState["isBindingEnabled"];
zoom: AppState["zoom"];
},
startOrEnd: "start" | "end",
ignoreOverlap = false,
): boolean => {
// No focus point management for elbow arrows, because elbow arrows
// always have their focus point at the arrow point itself
if (
isElbowArrow(arrow) ||
!isBindingEnabled(appState) ||
arrow.points.length !== 2
) {
return false;
}
// Avoid showing the focus point indicator if the focus point is essentially
// on top of the arrow point it belongs to itself, if not ignoring specifically
if (!ignoreOverlap) {
const associatedPointIdx =
arrow.startBinding?.elementId === bindableElement.id
? 0
: arrow.points.length - 1;
const associatedArrowPoint =
LinearElementEditor.getPointAtIndexGlobalCoordinates(
arrow,
associatedPointIdx,
elementsMap,
);
if (
pointDistance(focusPoint, associatedArrowPoint) <
(FOCUS_POINT_SIZE * 1.5) / appState.zoom.value
) {
return false;
}
}
const arrowPoint = LinearElementEditor.getPointAtIndexGlobalCoordinates(
arrow,
startOrEnd === "end" ? arrow.points.length - 1 : 0,
elementsMap,
);
// Check if the focus point is within the element's shape bounds
// Endpoint dragging takes precedence
return (
pointDistance(focusPoint, arrowPoint) >=
(FOCUS_POINT_SIZE * 1.5) / appState.zoom.value &&
hitElementItself({
element: bindableElement,
elementsMap,
point: focusPoint,
threshold: getBindingGap(bindableElement, arrow),
overrideShouldTestInside: true,
})
);
};
// Updates the arrow endpoints in "orbit" configuration
const focusPointUpdate = (
arrow: ExcalidrawArrowElement,
bindableElement: ExcalidrawBindableElement | null,
isStartBinding: boolean,
elementsMap: NonDeletedSceneElementsMap,
scene: Scene,
appState: AppState,
switchToInsideBinding: boolean,
) => {
const pointUpdates = new Map();
const bindingField = isStartBinding ? "startBinding" : "endBinding";
const adjacentBindingField = isStartBinding ? "endBinding" : "startBinding";
let currentBinding = arrow[bindingField];
let adjacentBinding = arrow[adjacentBindingField];
// Update the dragged focus point related end
if (currentBinding && bindableElement) {
// Update the targeted bindings
const boundToSameElement =
bindableElement &&
adjacentBinding &&
currentBinding.elementId === adjacentBinding.elementId;
if (switchToInsideBinding || boundToSameElement) {
currentBinding = {
...currentBinding,
mode: "inside",
};
} else {
currentBinding = {
...currentBinding,
mode: "orbit",
};
}
const pointIndex = isStartBinding ? 0 : arrow.points.length - 1;
const newPoint = updateBoundPoint(
arrow,
bindingField as "startBinding" | "endBinding",
currentBinding,
bindableElement,
elementsMap,
true,
);
if (newPoint) {
pointUpdates.set(pointIndex, { point: newPoint });
}
}
// Also update the adjacent end if it has a binding
if (adjacentBinding && adjacentBinding.mode === "orbit") {
const adjacentBindableElement = elementsMap.get(
adjacentBinding.elementId,
) as ExcalidrawBindableElement;
if (
adjacentBindableElement &&
isBindableElement(adjacentBindableElement) &&
isBindingEnabled(appState)
) {
// Same shape bound on both ends
const boundToSameElementAfterUpdate =
bindableElement && adjacentBinding.elementId === bindableElement.id;
if (switchToInsideBinding || boundToSameElementAfterUpdate) {
adjacentBinding = {
...adjacentBinding,
mode: "inside",
};
} else {
adjacentBinding = {
...adjacentBinding,
mode: "orbit",
};
}
const adjacentPointIndex = isStartBinding ? arrow.points.length - 1 : 0;
const adjacentNewPoint = updateBoundPoint(
arrow,
adjacentBindingField,
adjacentBinding,
adjacentBindableElement,
elementsMap,
);
if (adjacentNewPoint) {
pointUpdates.set(adjacentPointIndex, {
point: adjacentNewPoint,
});
}
}
}
if (pointUpdates.size > 0) {
LinearElementEditor.movePoints(arrow, scene, pointUpdates, {
[bindingField]: currentBinding,
[adjacentBindingField]: adjacentBinding,
});
}
};
export const handleFocusPointDrag = (
linearElementEditor: LinearElementEditor,
elementsMap: NonDeletedSceneElementsMap,
pointerCoords: { x: number; y: number },
scene: Scene,
appState: AppState,
gridSize: NullableGridSize,
switchToInsideBinding: boolean,
) => {
const arrow = LinearElementEditor.getElement(
linearElementEditor.elementId,
elementsMap,
) as any;
// Sanity checks
if (
!arrow ||
!isBindingElement(arrow) ||
isElbowArrow(arrow) ||
!linearElementEditor.hoveredFocusPointBinding ||
!linearElementEditor.draggedFocusPointBinding
) {
return;
}
const isStartBinding =
linearElementEditor.draggedFocusPointBinding === "start";
const binding = isStartBinding ? arrow.startBinding : arrow.endBinding;
const { x: offsetX, y: offsetY } = linearElementEditor.pointerOffset;
const point = pointFrom<GlobalPoint>(
pointerCoords.x - offsetX,
pointerCoords.y - offsetY,
);
const bindingField = isStartBinding ? "startBinding" : "endBinding";
const hit = getHoveredElementForFocusPoint(
point,
arrow,
scene.getNonDeletedElements(),
elementsMap,
maxBindingDistance_simple(appState.zoom),
);
// Hovering a bindable element
if (hit && isBindingEnabled(appState)) {
// Break existing binding if bound to another shape or if binding is disabled
if (arrow[bindingField] && hit.id !== binding?.elementId) {
unbindBindingElement(
arrow,
linearElementEditor.draggedFocusPointBinding,
scene,
);
}
// Handle binding mode switch
const newMode =
switchToInsideBinding && arrow[bindingField]?.mode === "orbit"
? "inside"
: !switchToInsideBinding && arrow[bindingField]?.mode === "inside"
? "orbit"
: null;
// If no existing binding, create it
if (!arrow[bindingField] || newMode) {
// Create a new binding if none exists
bindBindingElement(
arrow,
hit,
newMode || "orbit",
linearElementEditor.draggedFocusPointBinding,
scene,
point,
);
}
// Update the binding's fixed point
scene.mutateElement(arrow, {
[bindingField]: {
...arrow[bindingField],
elementId: hit.id,
mode: newMode || arrow[bindingField]?.mode || "orbit",
...calculateFixedPointForNonElbowArrowBinding(
arrow,
hit,
linearElementEditor.draggedFocusPointBinding,
elementsMap,
point,
),
},
});
} else {
// Not hovering any bindable element, move the arrow endpoint
const pointUpdates: PointsPositionUpdates = new Map();
const pointIndex = isStartBinding ? 0 : arrow.points.length - 1;
pointUpdates.set(pointIndex, {
point: LinearElementEditor.createPointAt(
arrow,
elementsMap,
point[0],
point[1],
gridSize,
),
});
LinearElementEditor.movePoints(arrow, scene, pointUpdates);
if (arrow[bindingField]) {
unbindBindingElement(arrow, isStartBinding ? "start" : "end", scene);
}
}
// Update the arrow endpoints
focusPointUpdate(
arrow,
hit,
isStartBinding,
elementsMap,
scene,
appState,
switchToInsideBinding,
);
if (hit && isBindingEnabled(appState)) {
moveArrowAboveBindable(
point,
arrow,
scene.getElementsIncludingDeleted(),
elementsMap,
scene,
hit,
);
}
};
export const handleFocusPointPointerDown = (
arrow: ExcalidrawArrowElement,
pointerDownState: { origin: { x: number; y: number } },
elementsMap: NonDeletedSceneElementsMap,
appState: AppState,
): {
hitFocusPoint: "start" | "end" | null;
pointerOffset: { x: number; y: number };
} => {
const pointerPos = pointFrom(
pointerDownState.origin.x,
pointerDownState.origin.y,
);
const hitThreshold = (FOCUS_POINT_SIZE * 1.5) / appState.zoom.value;
// Check start binding focus point
if (arrow.startBinding?.elementId) {
const bindableElement = elementsMap.get(arrow.startBinding.elementId);
if (
bindableElement &&
isBindableElement(bindableElement) &&
!bindableElement.isDeleted
) {
const focusPoint = getGlobalFixedPointForBindableElement(
arrow.startBinding.fixedPoint,
bindableElement,
elementsMap,
);
if (
isFocusPointVisible(
focusPoint,
arrow,
bindableElement,
elementsMap,
appState,
"start",
) &&
pointDistance(pointerPos, focusPoint) <= hitThreshold
) {
return {
hitFocusPoint: "start",
pointerOffset: {
x: pointerPos[0] - focusPoint[0],
y: pointerPos[1] - focusPoint[1],
},
};
}
}
}
// Check end binding focus point (only if start not already hit)
if (arrow.endBinding?.elementId) {
const bindableElement = elementsMap.get(arrow.endBinding.elementId);
if (
bindableElement &&
isBindableElement(bindableElement) &&
!bindableElement.isDeleted
) {
const focusPoint = getGlobalFixedPointForBindableElement(
arrow.endBinding.fixedPoint,
bindableElement,
elementsMap,
);
if (
isFocusPointVisible(
focusPoint,
arrow,
bindableElement,
elementsMap,
appState,
"end",
) &&
pointDistance(pointerPos, focusPoint) <= hitThreshold
) {
return {
hitFocusPoint: "end",
pointerOffset: {
x: pointerPos[0] - focusPoint[0],
y: pointerPos[1] - focusPoint[1],
},
};
}
}
}
return {
hitFocusPoint: null,
pointerOffset: { x: 0, y: 0 },
};
};
export const handleFocusPointPointerUp = (
linearElementEditor: LinearElementEditor,
scene: Scene,
) => {
invariant(
linearElementEditor.draggedFocusPointBinding,
"Must have a dragged focus point at pointer release",
);
const arrow = LinearElementEditor.getElement<ExcalidrawArrowElement>(
linearElementEditor.elementId,
scene.getNonDeletedElementsMap(),
);
invariant(arrow, "Arrow must be in the scene");
// Clean up
const bindingKey =
linearElementEditor.draggedFocusPointBinding === "start"
? "startBinding"
: "endBinding";
const otherBindingKey =
linearElementEditor.draggedFocusPointBinding === "start"
? "endBinding"
: "startBinding";
const boundElementId = arrow[bindingKey]?.elementId;
const otherBoundElementId = arrow[otherBindingKey]?.elementId;
const oldBoundElement =
boundElementId &&
scene
.getNonDeletedElements()
.find(
(element) =>
element.id !== boundElementId &&
element.id !== otherBoundElementId &&
isBindableElement(element) &&
element.boundElements?.find(({ id }) => id === arrow.id),
);
if (oldBoundElement) {
scene.mutateElement(oldBoundElement, {
boundElements: oldBoundElement.boundElements?.filter(
({ id }) => id !== arrow.id,
),
});
}
// Record the new bound element
const boundElement =
boundElementId && scene.getNonDeletedElementsMap().get(boundElementId);
if (boundElement) {
scene.mutateElement(boundElement, {
boundElements: [
...(boundElement.boundElements || [])?.filter(
({ id }) => id !== arrow.id,
),
{
id: arrow.id,
type: "arrow",
},
],
});
}
};
export const handleFocusPointHover = (
arrow: ExcalidrawArrowElement,
scenePointerX: number,
scenePointerY: number,
scene: Scene,
appState: AppState,
): "start" | "end" | null => {
const elementsMap = scene.getNonDeletedElementsMap();
const pointerPos = pointFrom(scenePointerX, scenePointerY);
const hitThreshold = (FOCUS_POINT_SIZE * 1.5) / appState.zoom.value;
// Check start binding focus point
if (arrow.startBinding?.elementId) {
const bindableElement = elementsMap.get(arrow.startBinding.elementId);
if (
bindableElement &&
isBindableElement(bindableElement) &&
!bindableElement.isDeleted
) {
const focusPoint = getGlobalFixedPointForBindableElement(
arrow.startBinding.fixedPoint,
bindableElement,
elementsMap,
);
if (
isFocusPointVisible(
focusPoint,
arrow,
bindableElement,
elementsMap,
appState,
"start",
) &&
pointDistance(pointerPos, focusPoint) <= hitThreshold
) {
return "start";
}
}
}
// Check end binding focus point (only if start not already hovered)
if (arrow.endBinding?.elementId) {
const bindableElement = elementsMap.get(arrow.endBinding.elementId);
if (
bindableElement &&
isBindableElement(bindableElement) &&
!bindableElement.isDeleted
) {
const focusPoint = getGlobalFixedPointForBindableElement(
arrow.endBinding.fixedPoint,
bindableElement,
elementsMap,
);
if (
isFocusPointVisible(
focusPoint,
arrow,
bindableElement,
elementsMap,
appState,
"end",
) &&
pointDistance(pointerPos, focusPoint) <= hitThreshold
) {
return "end";
}
}
}
return null;
};
+45
View File
@@ -0,0 +1,45 @@
import type { App } from "@excalidraw/excalidraw/types";
import { LinearElementEditor } from "../linearElementEditor";
import { handleFocusPointDrag } from "./focus";
export const maybeHandleArrowPointlikeDrag = ({
app,
event,
}: {
app: App;
event: KeyboardEvent | React.KeyboardEvent<Element> | PointerEvent;
}): boolean => {
const appState = app.state;
if (appState.selectedLinearElement && app.lastPointerMoveCoords) {
// Update focus point status if the binding mode is changing
if (appState.selectedLinearElement.draggedFocusPointBinding) {
handleFocusPointDrag(
appState.selectedLinearElement,
app.scene.getNonDeletedElementsMap(),
app.lastPointerMoveCoords,
app.scene,
appState,
app.getEffectiveGridSize(),
event.altKey,
);
return true;
} else if (
appState.selectedLinearElement.hoverPointIndex !== null &&
app.lastPointerMoveEvent &&
appState.selectedLinearElement.initialState.lastClickedPoint >= 0 &&
appState.selectedLinearElement.isDragging
) {
LinearElementEditor.handlePointDragging(
app.lastPointerMoveEvent,
app,
app.lastPointerMoveCoords.x,
app.lastPointerMoveCoords.y,
appState.selectedLinearElement,
);
return true;
}
}
return false;
};
+303 -186
View File
@@ -27,14 +27,11 @@ import type { AppState } from "@excalidraw/excalidraw/types";
import type { MapEntry, Mutable } from "@excalidraw/common/utility-types";
import type { Bounds } from "@excalidraw/common";
import {
doBoundsIntersect,
getCenterForBounds,
getElementBounds,
} from "./bounds";
import { getCenterForBounds } from "./bounds";
import {
getAllHoveredElementAtPoint,
getHoveredElementForBinding,
hitElementItself,
intersectElementWithLineSegment,
isBindableElementInsideOtherBindable,
isPointInElement,
@@ -113,8 +110,10 @@ export type BindingStrategy =
*
* IMPORTANT: currently must be > 0 (this also applies to the computed gap)
*/
export const BASE_BINDING_GAP = 10;
export const BASE_BINDING_GAP = 5;
export const BASE_BINDING_GAP_ELBOW = 5;
export const BASE_ARROW_MIN_LENGTH = 10;
export const FOCUS_POINT_SIZE = 10 / 1.5;
export const getBindingGap = (
bindTarget: ExcalidrawBindableElement,
@@ -144,7 +143,9 @@ export const shouldEnableBindingForPointerEvent = (
return !event[KEYS.CTRL_OR_CMD];
};
export const isBindingEnabled = (appState: AppState): boolean => {
export const isBindingEnabled = (appState: {
isBindingEnabled: AppState["isBindingEnabled"];
}): boolean => {
return appState.isBindingEnabled;
};
@@ -258,7 +259,7 @@ const bindingStrategyForElbowArrowEndpointDragging = (
globalPoint,
elements,
elementsMap,
(element) => maxBindingDistance_simple(zoom),
maxBindingDistance_simple(zoom),
);
const current = hit
@@ -683,7 +684,7 @@ const getBindingStrategyForDraggingBindingElementEndpoints_simple = (
globalPoint,
elements,
elementsMap,
(e) => maxBindingDistance_simple(appState.zoom),
maxBindingDistance_simple(appState.zoom),
);
const pointInElement =
hit &&
@@ -710,7 +711,13 @@ const getBindingStrategyForDraggingBindingElementEndpoints_simple = (
const otherFocusPointIsInElement =
otherBindableElement &&
otherFocusPoint &&
isPointInElement(otherFocusPoint, otherBindableElement, elementsMap);
hitElementItself({
point: otherFocusPoint,
element: otherBindableElement,
elementsMap,
threshold: 0,
overrideShouldTestInside: true,
});
// Handle outside-outside binding to the same element
if (otherBinding && otherBinding.elementId === hit?.id) {
@@ -790,6 +797,7 @@ const getBindingStrategyForDraggingBindingElementEndpoints_simple = (
hit,
startDragged ? "start" : "end",
elementsMap,
appState.zoom,
) || globalPoint,
}
: { mode: null };
@@ -799,11 +807,24 @@ const getBindingStrategyForDraggingBindingElementEndpoints_simple = (
startDragged ? -1 : 0,
elementsMap,
);
const other: BindingStrategy =
const pointIsCloseToOtherElement =
otherFocusPoint &&
otherBindableElement &&
!otherFocusPointIsInElement &&
appState.selectedLinearElement?.initialState.altFocusPoint
hitElementItself({
point: globalPoint,
element: otherBindableElement,
elementsMap,
threshold: maxBindingDistance_simple(appState.zoom),
overrideShouldTestInside: true,
});
const otherNeverOverride = opts?.newArrow
? appState.selectedLinearElement?.initialState.arrowStartIsInside
: otherBinding?.mode === "inside";
const other: BindingStrategy = !otherNeverOverride
? otherBindableElement &&
!otherFocusPointIsInElement &&
!pointIsCloseToOtherElement &&
appState.selectedLinearElement?.initialState.altFocusPoint
? {
mode: "orbit",
element: otherBindableElement,
@@ -820,9 +841,11 @@ const getBindingStrategyForDraggingBindingElementEndpoints_simple = (
otherBindableElement,
startDragged ? "end" : "start",
elementsMap,
appState.zoom,
) || otherEndpoint,
}
: { mode: undefined };
: { mode: undefined }
: { mode: undefined };
return {
start: startDragged ? current : other,
@@ -1086,7 +1109,7 @@ export const updateBoundElements = (
});
}
boundElementsVisitor(elementsMap, changedElement, (element) => {
const visitor = (element: ExcalidrawElement | undefined) => {
if (!isArrowElement(element) || element.isDeleted) {
return;
}
@@ -1158,7 +1181,71 @@ export const updateBoundElements = (
if (boundText && !boundText.isDeleted) {
handleBindTextResize(element, scene, false);
}
});
};
boundElementsVisitor(elementsMap, changedElement, visitor);
};
const updateArrowBindings = (
latestElement: ExcalidrawArrowElement,
startOrEnd: "startBinding" | "endBinding",
elementsMap: NonDeletedSceneElementsMap,
scene: Scene,
appState: AppState,
) => {
invariant(
!isElbowArrow(latestElement),
"Elbow arrows not supported for indirect updates",
);
const binding = latestElement[startOrEnd];
const bindableElement =
binding &&
(elementsMap.get(binding.elementId) as ExcalidrawBindableElement);
const point = LinearElementEditor.getPointAtIndexGlobalCoordinates(
latestElement,
startOrEnd === "startBinding" ? 0 : -1,
elementsMap,
);
const hit =
bindableElement &&
hitElementItself({
element: bindableElement,
point,
elementsMap,
threshold: maxBindingDistance_simple(appState.zoom),
});
const strategyName = startOrEnd === "startBinding" ? "start" : "end";
unbindBindingElement(latestElement, strategyName, scene);
if (hit) {
const pointIdx =
startOrEnd === "startBinding" ? 0 : latestElement.points.length - 1;
const localPoint = latestElement.points[pointIdx];
const strategy =
getBindingStrategyForDraggingBindingElementEndpoints_simple(
latestElement,
new Map([[pointIdx, { point: localPoint }]]),
point[0],
point[1],
elementsMap,
scene.getNonDeletedElements(),
appState,
);
if (
strategy[strategyName] &&
strategy[strategyName].element?.id === bindableElement.id &&
strategy[strategyName].mode
) {
bindBindingElement(
latestElement,
bindableElement,
strategy[strategyName].mode,
strategyName,
scene,
strategy[strategyName].focusPoint,
);
}
}
};
export const updateBindings = (
@@ -1171,14 +1258,27 @@ export const updateBindings = (
},
) => {
if (isArrowElement(latestElement)) {
bindOrUnbindBindingElement(
latestElement,
new Map(),
Infinity,
Infinity,
scene,
appState,
);
const elementsMap = scene.getNonDeletedElementsMap();
if (latestElement.startBinding) {
updateArrowBindings(
latestElement,
"startBinding",
elementsMap,
scene,
appState,
);
}
if (latestElement.endBinding) {
updateArrowBindings(
latestElement,
"endBinding",
elementsMap,
scene,
appState,
);
}
} else {
updateBoundElements(latestElement, scene, {
...options,
@@ -1292,14 +1392,16 @@ export const bindPointToSnapToElementOutline = (
headingForPointFromElement(bindableElement, aabb, point),
);
const snapPoint = snapToMid(
arrowElement,
bindableElement,
elementsMap,
edgePoint,
0.05,
arrowElement,
);
const resolved = snapPoint || point;
const otherPoint = pointFrom<GlobalPoint>(
isHorizontal ? bindableCenter[0] : snapPoint[0],
!isHorizontal ? bindableCenter[1] : snapPoint[1],
isHorizontal ? bindableCenter[0] : resolved[0],
!isHorizontal ? bindableCenter[1] : resolved[1],
);
const intersector =
customIntersector ??
@@ -1307,7 +1409,7 @@ export const bindPointToSnapToElementOutline = (
otherPoint,
pointFromVector(
vectorScale(
vectorNormalize(vectorFromPoint(snapPoint, otherPoint)),
vectorNormalize(vectorFromPoint(resolved, otherPoint)),
Math.max(bindableElement.width, bindableElement.height) * 2,
),
otherPoint,
@@ -1322,14 +1424,14 @@ export const bindPointToSnapToElementOutline = (
if (!intersection) {
const anotherPoint = pointFrom<GlobalPoint>(
!isHorizontal ? bindableCenter[0] : snapPoint[0],
isHorizontal ? bindableCenter[1] : snapPoint[1],
!isHorizontal ? bindableCenter[0] : resolved[0],
isHorizontal ? bindableCenter[1] : resolved[1],
);
const anotherIntersector = lineSegment(
anotherPoint,
pointFromVector(
vectorScale(
vectorNormalize(vectorFromPoint(snapPoint, anotherPoint)),
vectorNormalize(vectorFromPoint(resolved, anotherPoint)),
Math.max(bindableElement.width, bindableElement.height) * 2,
),
anotherPoint,
@@ -1476,18 +1578,18 @@ export const avoidRectangularCorner = (
return p;
};
const snapToMid = (
arrowElement: ExcalidrawArrowElement,
export const snapToMid = (
bindTarget: ExcalidrawBindableElement,
elementsMap: ElementsMap,
p: GlobalPoint,
tolerance: number = 0.05,
): GlobalPoint => {
arrowElement?: ExcalidrawArrowElement,
): GlobalPoint | undefined => {
const { x, y, width, height, angle } = bindTarget;
const center = elementCenterPoint(bindTarget, elementsMap, -0.1, -0.1);
const nonRotated = pointRotateRads(p, center, -angle as Radians);
const bindingGap = getBindingGap(bindTarget, arrowElement);
const bindingGap = arrowElement ? getBindingGap(bindTarget, arrowElement) : 0;
// snap-to-center point is adaptive to element size, but we don't want to go
// above and below certain px distance
@@ -1496,7 +1598,7 @@ const snapToMid = (
// Too close to the center makes it hard to resolve direction precisely
if (pointDistance(center, nonRotated) < bindingGap) {
return p;
return undefined;
}
if (
@@ -1505,8 +1607,8 @@ const snapToMid = (
nonRotated[1] < center[1] + verticalThreshold
) {
// LEFT
return pointRotateRads<GlobalPoint>(
pointFrom(x - bindingGap, center[1]),
return pointRotateRads(
pointFrom<GlobalPoint>(x - bindingGap, center[1]),
center,
angle,
);
@@ -1516,7 +1618,11 @@ const snapToMid = (
nonRotated[0] < center[0] + horizontalThreshold
) {
// TOP
return pointRotateRads(pointFrom(center[0], y - bindingGap), center, angle);
return pointRotateRads(
pointFrom<GlobalPoint>(center[0], y - bindingGap),
center,
angle,
);
} else if (
nonRotated[0] >= x + width / 2 &&
nonRotated[1] > center[1] - verticalThreshold &&
@@ -1524,7 +1630,7 @@ const snapToMid = (
) {
// RIGHT
return pointRotateRads(
pointFrom(x + width + bindingGap, center[1]),
pointFrom<GlobalPoint>(x + width + bindingGap, center[1]),
center,
angle,
);
@@ -1535,7 +1641,7 @@ const snapToMid = (
) {
// DOWN
return pointRotateRads(
pointFrom(center[0], y + height + bindingGap),
pointFrom<GlobalPoint>(center[0], y + height + bindingGap),
center,
angle,
);
@@ -1584,13 +1690,44 @@ const snapToMid = (
}
}
return p;
return undefined;
};
const compareElementArea = (
a: ExcalidrawBindableElement,
b: ExcalidrawBindableElement,
) => b.width ** 2 + b.height ** 2 - (a.width ** 2 + a.height ** 2);
const extractBinding = (
arrow: ExcalidrawArrowElement,
startOrEnd: "startBinding" | "endBinding",
elementsMap: ElementsMap,
) => {
const binding = arrow[startOrEnd];
if (!binding) {
return {
element: null,
fixedPoint: null,
focusPoint: null,
binding,
mode: null,
};
}
const element = elementsMap.get(
binding.elementId,
) as ExcalidrawBindableElement;
return {
element,
fixedPoint: binding.fixedPoint,
focusPoint: getGlobalFixedPointForBindableElement(
normalizeFixedPoint(binding.fixedPoint),
element,
elementsMap,
),
binding,
mode: binding.mode,
};
};
const elementArea = (element: ExcalidrawBindableElement) =>
element.width * element.height;
export const updateBoundPoint = (
arrow: NonDeleted<ExcalidrawArrowElement>,
@@ -1598,7 +1735,7 @@ export const updateBoundPoint = (
binding: FixedPointBinding | null | undefined,
bindableElement: ExcalidrawBindableElement,
elementsMap: ElementsMap,
customIntersector?: LineSegment<GlobalPoint>,
dragging?: boolean,
): LocalPoint | null => {
if (
binding == null ||
@@ -1613,152 +1750,136 @@ export const updateBoundPoint = (
return null;
}
const global = getGlobalFixedPointForBindableElement(
const focusPoint = getGlobalFixedPointForBindableElement(
normalizeFixedPoint(binding.fixedPoint),
bindableElement,
elementsMap,
);
const pointIndex =
startOrEnd === "startBinding" ? 0 : arrow.points.length - 1;
const elbowed = isElbowArrow(arrow);
const otherBinding =
startOrEnd === "startBinding" ? arrow.endBinding : arrow.startBinding;
const otherBindableElement =
otherBinding &&
(elementsMap.get(otherBinding.elementId)! as ExcalidrawBindableElement);
const bounds = getElementBounds(bindableElement, elementsMap);
const otherBounds =
otherBindableElement && getElementBounds(otherBindableElement, elementsMap);
const isLargerThanOther =
otherBindableElement &&
compareElementArea(bindableElement, otherBindableElement) <
// if both shapes the same size, pretend the other is larger
(startOrEnd === "endBinding" ? 1 : 0);
const isOverlapping = otherBounds && doBoundsIntersect(bounds, otherBounds);
// GOAL: If the arrow becomes too short, we want to jump the arrow endpoints
// to the exact focus points on the elements.
// INTUITION: We're not interested in the exacts length of the arrow (which
// will change if we change where we route it), we want to know the length of
// the part which lies outside of both shapes and consider that as a trigger
// to change where we point the arrow. Avoids jumping the arrow in and out
// at every frame.
let arrowTooShort = false;
if (
!isOverlapping &&
!elbowed &&
arrow.startBinding &&
arrow.endBinding &&
otherBindableElement &&
arrow.points.length === 2
) {
const startFocusPoint = getGlobalFixedPointForBindableElement(
arrow.startBinding.fixedPoint,
startOrEnd === "startBinding" ? bindableElement : otherBindableElement,
elementsMap,
);
const endFocusPoint = getGlobalFixedPointForBindableElement(
arrow.endBinding.fixedPoint,
startOrEnd === "endBinding" ? bindableElement : otherBindableElement,
elementsMap,
);
const segment = lineSegment(startFocusPoint, endFocusPoint);
const startIntersection = intersectElementWithLineSegment(
startOrEnd === "endBinding" ? bindableElement : otherBindableElement,
elementsMap,
segment,
0,
true,
);
const endIntersection = intersectElementWithLineSegment(
startOrEnd === "startBinding" ? bindableElement : otherBindableElement,
elementsMap,
segment,
0,
true,
);
if (startIntersection.length > 0 && endIntersection.length > 0) {
const len = pointDistance(startIntersection[0], endIntersection[0]);
arrowTooShort = len < 40;
}
}
const isNested = (arrowTooShort || isOverlapping) && isLargerThanOther;
let _customIntersector = customIntersector;
if (!elbowed && !_customIntersector) {
const [x1, y1, x2, y2] = LinearElementEditor.getElementAbsoluteCoords(
// 0. Short-circuit for inside binding as it doesn't require any
// calculations and is not affected by other bindings
if (binding.mode === "inside") {
return LinearElementEditor.createPointAt(
arrow,
elementsMap,
);
const center = pointFrom<GlobalPoint>((x1 + x2) / 2, (y1 + y2) / 2);
const edgePoint = isRectanguloidElement(bindableElement)
? avoidRectangularCorner(arrow, bindableElement, elementsMap, global)
: global;
const adjacentPoint = pointRotateRads(
pointFrom<GlobalPoint>(
arrow.x +
arrow.points[pointIndex === 0 ? 1 : arrow.points.length - 2][0],
arrow.y +
arrow.points[pointIndex === 0 ? 1 : arrow.points.length - 2][1],
),
center,
arrow.angle as Radians,
);
const bindingGap = getBindingGap(bindableElement, arrow);
const halfVector = vectorScale(
vectorNormalize(vectorFromPoint(edgePoint, adjacentPoint)),
pointDistance(edgePoint, adjacentPoint) +
Math.max(bindableElement.width, bindableElement.height) +
bindingGap * 2,
);
_customIntersector = lineSegment(
pointFromVector(halfVector, adjacentPoint),
pointFromVector(vectorScale(halfVector, -1), adjacentPoint),
focusPoint[0],
focusPoint[1],
null,
);
}
const maybeOutlineGlobal =
binding.mode === "orbit" && bindableElement
? isNested
? global
: bindPointToSnapToElementOutline(
{
...arrow,
points: [
pointIndex === 0
? LinearElementEditor.createPointAt(
arrow,
elementsMap,
global[0],
global[1],
null,
)
: arrow.points[0],
...arrow.points.slice(1, -1),
pointIndex === arrow.points.length - 1
? LinearElementEditor.createPointAt(
arrow,
elementsMap,
global[0],
global[1],
null,
)
: arrow.points[arrow.points.length - 1],
],
},
bindableElement,
pointIndex === 0 ? "start" : "end",
elementsMap,
_customIntersector,
)
: global;
const { element: otherBindable, focusPoint: otherFocusPoint } =
extractBinding(
arrow,
startOrEnd === "startBinding" ? "endBinding" : "startBinding",
elementsMap,
);
const otherArrowPoint = LinearElementEditor.getPointAtIndexGlobalCoordinates(
arrow,
startOrEnd === "startBinding" ? -1 : 0,
elementsMap,
);
const otherFocusPointOrArrowPoint = otherFocusPoint || otherArrowPoint;
const intersector =
otherFocusPointOrArrowPoint &&
lineSegment(focusPoint, otherFocusPointOrArrowPoint);
const otherOutlinePoint =
otherBindable &&
intersector &&
intersectElementWithLineSegment(
otherBindable,
elementsMap,
intersector,
getBindingGap(otherBindable, arrow),
).sort(
(a, b) => pointDistanceSq(a, focusPoint) - pointDistanceSq(b, focusPoint),
)[0];
const outlinePoint =
intersector &&
intersectElementWithLineSegment(
bindableElement,
elementsMap,
intersector,
getBindingGap(bindableElement, arrow),
).sort(
(a, b) =>
pointDistanceSq(a, otherFocusPointOrArrowPoint) -
pointDistanceSq(b, otherFocusPointOrArrowPoint),
)[0];
const startHasArrowhead = arrow.startArrowhead !== null;
const endHasArrowhead = arrow.endArrowhead !== null;
const resolvedTarget =
(!startHasArrowhead && !endHasArrowhead) ||
(startOrEnd === "startBinding" && startHasArrowhead) ||
(startOrEnd === "endBinding" && endHasArrowhead)
? focusPoint
: outlinePoint || focusPoint;
// 1. Handle case when the outline point (or focus point) is inside
// the other shape by short-circuiting to the focus point, otherwise
// the arrow would invert
if (
otherBindable &&
outlinePoint &&
!dragging &&
// Arbitrary threshold to handle wireframing use cases
elementArea(otherBindable) < elementArea(bindableElement) * 2 &&
hitElementItself({
element: otherBindable,
point: outlinePoint,
elementsMap,
threshold: getBindingGap(otherBindable, arrow),
overrideShouldTestInside: true,
})
) {
return LinearElementEditor.createPointAt(
arrow,
elementsMap,
resolvedTarget[0],
resolvedTarget[1],
null,
);
}
const otherTargetPoint = otherBindable
? otherOutlinePoint || otherFocusPoint || otherArrowPoint
: otherArrowPoint;
const arrowTooShort =
pointDistance(otherTargetPoint, outlinePoint || focusPoint) <=
BASE_ARROW_MIN_LENGTH;
// 2. If the arrow is unconnected at the other end, just check arrow size
// and short-circuit to the focus point if the arrow is too short to
// avoid inversion
if (!otherBindable) {
return LinearElementEditor.createPointAt(
arrow,
elementsMap,
arrowTooShort ? focusPoint[0] : outlinePoint?.[0] ?? focusPoint[0],
arrowTooShort ? focusPoint[1] : outlinePoint?.[1] ?? focusPoint[1],
null,
);
}
// 3. If the arrow is too short while connected on both ends and
// the other arrow endpoint will not be inside the bindable, just
// check the arrow size and make a decision based on that
if (arrowTooShort) {
return LinearElementEditor.createPointAt(
arrow,
elementsMap,
resolvedTarget?.[0] || focusPoint[0],
resolvedTarget?.[1] || focusPoint[1],
null,
);
}
// 4. In the general case, snap to the outline if possible
return LinearElementEditor.createPointAt(
arrow,
elementsMap,
maybeOutlineGlobal[0],
maybeOutlineGlobal[1],
outlinePoint?.[0] || focusPoint[0],
outlinePoint?.[1] || focusPoint[1],
null,
);
};
@@ -1808,7 +1929,7 @@ export const calculateFixedPointForNonElbowArrowBinding = (
elementsMap: ElementsMap,
focusPoint?: GlobalPoint,
): { fixedPoint: FixedPoint } => {
const edgePoint = focusPoint
const edgePoint: GlobalPoint = focusPoint
? focusPoint
: LinearElementEditor.getPointAtIndexGlobalCoordinates(
linearElement,
@@ -1816,11 +1937,7 @@ export const calculateFixedPointForNonElbowArrowBinding = (
elementsMap,
);
// Convert the global point to element-local coordinates
const elementCenter = pointFrom(
hoveredElement.x + hoveredElement.width / 2,
hoveredElement.y + hoveredElement.height / 2,
);
const elementCenter = elementCenterPoint(hoveredElement, elementsMap);
// Rotate the point to account for element rotation
const nonRotatedPoint = pointRotateRads(
+57 -4
View File
@@ -59,8 +59,11 @@ import { LinearElementEditor } from "./linearElementEditor";
import { distanceToElement } from "./distance";
import { getBindingGap } from "./binding";
import type {
ElementsMap,
ExcalidrawArrowElement,
ExcalidrawBindableElement,
ExcalidrawDiamondElement,
ExcalidrawElement,
@@ -290,7 +293,7 @@ export const getAllHoveredElementAtPoint = (
point: Readonly<GlobalPoint>,
elements: readonly Ordered<NonDeletedExcalidrawElement>[],
elementsMap: NonDeletedSceneElementsMap,
toleranceFn?: (element: ExcalidrawBindableElement) => number,
tolerance?: number,
): NonDeleted<ExcalidrawBindableElement>[] => {
const candidateElements: NonDeleted<ExcalidrawBindableElement>[] = [];
// We need to to hit testing from front (end of the array) to back (beginning of the array)
@@ -306,7 +309,7 @@ export const getAllHoveredElementAtPoint = (
if (
isBindableElement(element, false) &&
bindingBorderTest(element, point, elementsMap, toleranceFn?.(element))
bindingBorderTest(element, point, elementsMap, tolerance)
) {
candidateElements.push(element);
@@ -323,13 +326,13 @@ export const getHoveredElementForBinding = (
point: Readonly<GlobalPoint>,
elements: readonly Ordered<NonDeletedExcalidrawElement>[],
elementsMap: NonDeletedSceneElementsMap,
toleranceFn?: (element: ExcalidrawBindableElement) => number,
tolerance?: number,
): NonDeleted<ExcalidrawBindableElement> | null => {
const candidateElements = getAllHoveredElementAtPoint(
point,
elements,
elementsMap,
toleranceFn,
tolerance,
);
if (!candidateElements || candidateElements.length === 0) {
@@ -348,6 +351,56 @@ export const getHoveredElementForBinding = (
.pop() as NonDeleted<ExcalidrawBindableElement>;
};
export const getHoveredElementForFocusPoint = (
point: GlobalPoint,
arrow: ExcalidrawArrowElement,
elements: readonly Ordered<NonDeletedExcalidrawElement>[],
elementsMap: NonDeletedSceneElementsMap,
tolerance?: number,
): ExcalidrawBindableElement | null => {
const candidateElements: NonDeleted<ExcalidrawBindableElement>[] = [];
// We need to to hit testing from front (end of the array) to back (beginning of the array)
// because array is ordered from lower z-index to highest and we want element z-index
// with higher z-index
for (let index = elements.length - 1; index >= 0; --index) {
const element = elements[index];
invariant(
!element.isDeleted,
"Elements in the function parameter for getAllElementsAtPositionForBinding() should not contain deleted elements",
);
if (
isBindableElement(element, false) &&
bindingBorderTest(element, point, elementsMap, tolerance)
) {
candidateElements.push(element);
}
}
if (!candidateElements || candidateElements.length === 0) {
return null;
}
if (candidateElements.length === 1) {
return candidateElements[0];
}
const distanceFilteredCandidateElements = candidateElements
// Resolve by distance
.filter(
(el) =>
distanceToElement(el, elementsMap, point) <= getBindingGap(el, arrow) ||
isPointInElement(point, el, elementsMap),
);
if (distanceFilteredCandidateElements.length === 0) {
return null;
}
return distanceFilteredCandidateElements[0] as NonDeleted<ExcalidrawBindableElement>;
};
/**
* Intersect a line with an element for binding test
*
+1 -1
View File
@@ -2276,7 +2276,7 @@ const getHoveredElement = (
origPoint,
elements,
elementsMap,
(element) => maxBindingDistance_simple(zoom),
maxBindingDistance_simple(zoom),
);
};
+79 -2
View File
@@ -56,7 +56,7 @@ const RE_REDDIT =
const RE_REDDIT_EMBED =
/^<blockquote[\s\S]*?\shref=["'](https?:\/\/(?:www\.)?reddit\.com\/[^"']*)/i;
const parseYouTubeTimestamp = (url: string): number => {
const parseYouTubeLikeTimestamp = (url: string): number => {
let timeParam: string | null | undefined;
try {
@@ -85,11 +85,57 @@ const parseYouTubeTimestamp = (url: string): number => {
return parseInt(hours) * 3600 + parseInt(minutes) * 60 + parseInt(seconds);
};
const parseGoogleDriveVideoLink = (
url: string,
): { fileId: string; resourceKey?: string; timestamp?: number } | null => {
try {
const urlObj = new URL(url.startsWith("http") ? url : `https://${url}`);
const hostname = urlObj.hostname.replace(/^www\./, "");
if (hostname !== "drive.google.com") {
return null;
}
let fileId: string | null = null;
const pathMatch = urlObj.pathname.match(/^\/file\/d\/([^/]+)(?:\/|$)/);
if (pathMatch?.[1]) {
fileId = pathMatch[1];
} else if (urlObj.pathname === "/open" || urlObj.pathname === "/uc") {
// Shared Drive links can be emitted as:
// - /open?id=<fileId> (common "open in Drive" format)
// - /uc?...&id=<fileId> (download/export endpoint often seen in copied links)
fileId = urlObj.searchParams.get("id");
}
if (!fileId || !/^[a-zA-Z0-9_-]+$/.test(fileId)) {
return null;
}
// Some Drive share links include `resourcekey` for access to link-shared
// files; preserve it in the preview URL so embeds keep working.
const resourceKey = urlObj.searchParams.get("resourcekey");
const timestamp = parseYouTubeLikeTimestamp(urlObj.toString());
return {
fileId,
resourceKey:
resourceKey && /^[a-zA-Z0-9_-]+$/.test(resourceKey)
? resourceKey
: undefined,
// Drive accepts YouTube-like `t` formats (e.g. `t=90`, `t=1m30s`);
// normalize to seconds for a stable preview URL.
timestamp: timestamp > 0 ? timestamp : undefined,
};
} catch (error) {
return null;
}
};
const ALLOWED_DOMAINS = new Set([
"youtube.com",
"youtu.be",
"vimeo.com",
"player.vimeo.com",
"drive.google.com",
"figma.com",
"link.excalidraw.com",
"gist.github.com",
@@ -108,6 +154,7 @@ const ALLOW_SAME_ORIGIN = new Set([
"youtu.be",
"vimeo.com",
"player.vimeo.com",
"drive.google.com",
"figma.com",
"twitter.com",
"x.com",
@@ -142,7 +189,7 @@ export const getEmbedLink = (
let aspectRatio = { w: 560, h: 840 };
const ytLink = link.match(RE_YOUTUBE);
if (ytLink?.[2]) {
const startTime = parseYouTubeTimestamp(originalLink);
const startTime = parseYouTubeLikeTimestamp(originalLink);
const time = startTime > 0 ? `&start=${startTime}` : ``;
const isPortrait = link.includes("shorts");
type = "video";
@@ -201,6 +248,36 @@ export const getEmbedLink = (
};
}
const googleDriveVideo = parseGoogleDriveVideoLink(link);
if (googleDriveVideo) {
type = "video";
const searchParams = new URLSearchParams();
if (googleDriveVideo.resourceKey) {
searchParams.set("resourcekey", googleDriveVideo.resourceKey);
}
if (googleDriveVideo.timestamp) {
searchParams.set("t", `${googleDriveVideo.timestamp}`);
}
const search = searchParams.toString();
link = `https://drive.google.com/file/d/${googleDriveVideo.fileId}/preview${
search ? `?${search}` : ""
}`;
aspectRatio = { w: 560, h: 315 };
embeddedLinkCache.set(originalLink, {
link,
intrinsicSize: aspectRatio,
type,
sandbox: { allowSameOrigin },
});
return {
link,
intrinsicSize: aspectRatio,
type,
sandbox: { allowSameOrigin },
};
}
const figmaLink = link.match(RE_FIGMA);
if (figmaLink) {
type = "generic";
+2
View File
@@ -70,6 +70,7 @@ export * from "./elbowArrow";
export * from "./elementLink";
export * from "./embeddable";
export * from "./flowchart";
export * from "./arrows/focus";
export * from "./fractionalIndex";
export * from "./frame";
export * from "./groups";
@@ -97,3 +98,4 @@ export * from "./transformHandles";
export * from "./typeChecks";
export * from "./utils";
export * from "./zindex";
export * from "./arrows/helpers";
+128 -37
View File
@@ -9,7 +9,6 @@ import {
vectorFromPoint,
curveLength,
curvePointAtLength,
lineSegment,
} from "@excalidraw/math";
import { getCurvePathOps } from "@excalidraw/utils/shape";
@@ -26,6 +25,7 @@ import {
import {
deconstructLinearOrFreeDrawElement,
getSnapOutlineMidPoint,
isPathALoop,
moveArrowAboveBindable,
projectFixedPointOntoDiagonal,
@@ -48,6 +48,7 @@ import {
calculateFixedPointForNonElbowArrowBinding,
getBindingStrategyForDraggingBindingElementEndpoints,
isBindingEnabled,
snapToMid,
updateBoundPoint,
} from "./binding";
import {
@@ -149,6 +150,8 @@ export class LinearElementEditor {
public readonly pointerOffset: Readonly<{ x: number; y: number }>;
public readonly hoverPointIndex: number;
public readonly segmentMidPointHoveredCoords: GlobalPoint | null;
public readonly hoveredFocusPointBinding: "start" | "end" | null;
public readonly draggedFocusPointBinding: "start" | "end" | null;
public readonly elbowed: boolean;
public readonly customLineAngle: number | null;
public readonly isEditing: boolean;
@@ -194,6 +197,8 @@ export class LinearElementEditor {
};
this.hoverPointIndex = -1;
this.segmentMidPointHoveredCoords = null;
this.hoveredFocusPointBinding = null;
this.draggedFocusPointBinding = null;
this.elbowed = isElbowArrow(element) && element.elbowed;
this.customLineAngle = null;
this.isEditing = isEditing;
@@ -351,6 +356,7 @@ export class LinearElementEditor {
app,
shouldRotateWithDiscreteAngle(event),
event.altKey,
linearElementEditor,
);
LinearElementEditor.movePoints(element, app.scene, positions, {
@@ -404,13 +410,14 @@ export class LinearElementEditor {
altFocusPoint:
!linearElementEditor.initialState.altFocusPoint &&
startBindingElement &&
updates?.suggestedBinding?.id !== startBindingElement.id
updates?.suggestedBinding?.element.id !== startBindingElement.id
? projectFixedPointOntoDiagonal(
element,
pointFrom<GlobalPoint>(element.x, element.y),
startBindingElement,
"start",
elementsMap,
app.state.zoom,
)
: linearElementEditor.initialState.altFocusPoint,
},
@@ -528,6 +535,7 @@ export class LinearElementEditor {
app,
shouldRotateWithDiscreteAngle(event) && singlePointDragged,
event.altKey,
linearElementEditor,
);
LinearElementEditor.movePoints(element, app.scene, positions, {
@@ -603,11 +611,11 @@ export class LinearElementEditor {
const altFocusPointBindableElement =
endIsSelected && // The "other" end (i.e. "end") is dragged
startBindingElement &&
updates?.suggestedBinding?.id !== startBindingElement.id // The end point is not hovering the start bindable + it's binding gap
updates?.suggestedBinding?.element.id !== startBindingElement.id // The end point is not hovering the start bindable + it's binding gap
? startBindingElement
: startIsSelected && // The "other" end (i.e. "start") is dragged
endBindingElement &&
updates?.suggestedBinding?.id !== endBindingElement.id // The start point is not hovering the end bindable + it's binding gap
updates?.suggestedBinding?.element.id !== endBindingElement.id // The start point is not hovering the end bindable + it's binding gap
? endBindingElement
: null;
@@ -627,6 +635,7 @@ export class LinearElementEditor {
altFocusPointBindableElement,
"start",
elementsMap,
app.state.zoom,
)
: linearElementEditor.initialState.altFocusPoint,
},
@@ -2076,6 +2085,7 @@ const pointDraggingUpdates = (
app: AppClassProperties,
angleLocked: boolean,
altKey: boolean,
linearElementEditor: LinearElementEditor,
): {
positions: PointsPositionUpdates;
updates?: PointMoveOtherUpdates;
@@ -2123,18 +2133,89 @@ const pointDraggingUpdates = (
);
if (isElbowArrow(element)) {
const suggestedBindingElement = startIsDragged
? start.element
: endIsDragged
? end.element
: null;
return {
positions: naiveDraggingPoints,
updates: {
suggestedBinding: startIsDragged
? start.element
: endIsDragged
? end.element
suggestedBinding: suggestedBindingElement
? {
element: suggestedBindingElement,
midPoint: snapToMid(
suggestedBindingElement,
elementsMap,
pointFrom<GlobalPoint>(
scenePointerX - linearElementEditor.pointerOffset.x,
scenePointerY - linearElementEditor.pointerOffset.y,
),
),
}
: null,
},
};
}
// Handle the case where neither endpoint is being dragged
// but we need to update bound endpoints
if (!startIsDragged && !endIsDragged) {
const nextArrow = {
...element,
points: element.points.map((p, idx) => {
return naiveDraggingPoints.get(idx)?.point ?? p;
}),
};
const positions = new Map(naiveDraggingPoints);
if (element.startBinding) {
const startBindable = elementsMap.get(element.startBinding.elementId) as
| ExcalidrawBindableElement
| undefined;
if (startBindable) {
const startPoint =
updateBoundPoint(
nextArrow,
"startBinding",
element.startBinding,
startBindable,
elementsMap,
) ?? null;
if (startPoint) {
positions.set(0, { point: startPoint, isDragging: true });
}
}
}
if (element.endBinding) {
const endBindable = elementsMap.get(element.endBinding.elementId) as
| ExcalidrawBindableElement
| undefined;
if (endBindable) {
const endPoint =
updateBoundPoint(
nextArrow,
"endBinding",
element.endBinding,
endBindable,
elementsMap,
) ?? null;
if (endPoint) {
positions.set(element.points.length - 1, {
point: endPoint,
isDragging: true,
});
}
}
}
return {
positions,
};
}
if (startIsDragged === endIsDragged) {
return {
positions: naiveDraggingPoints,
@@ -2165,7 +2246,20 @@ const pointDraggingUpdates = (
(updates.startBinding.mode === "orbit" ||
!getFeatureFlag("COMPLEX_BINDINGS"))
) {
updates.suggestedBinding = start.element;
updates.suggestedBinding = start.element
? {
element: start.element,
midPoint: getSnapOutlineMidPoint(
pointFrom<GlobalPoint>(
scenePointerX - linearElementEditor.pointerOffset.x,
scenePointerY - linearElementEditor.pointerOffset.y,
),
start.element,
elementsMap,
app.state.zoom,
),
}
: null;
}
} else if (startIsDragged) {
updates.suggestedBinding = app.state.suggestedBinding;
@@ -2191,7 +2285,20 @@ const pointDraggingUpdates = (
(updates.endBinding.mode === "orbit" ||
!getFeatureFlag("COMPLEX_BINDINGS"))
) {
updates.suggestedBinding = end.element;
updates.suggestedBinding = end.element
? {
element: end.element,
midPoint: getSnapOutlineMidPoint(
pointFrom<GlobalPoint>(
scenePointerX - linearElementEditor.pointerOffset.x,
scenePointerY - linearElementEditor.pointerOffset.y,
),
end.element,
elementsMap,
app.state.zoom,
),
}
: null;
}
} else if (endIsDragged) {
updates.suggestedBinding = app.state.suggestedBinding;
@@ -2231,19 +2338,6 @@ const pointDraggingUpdates = (
: updates.endBinding,
};
// We need to use a custom intersector to ensure that if there is a big "jump"
// in the arrow's position, we can position it with outline avoidance
// pixel-perfectly and avoid "dancing" arrows.
// NOTE: Direction matters here, so we create two intersectors
const startCustomIntersector =
start.focusPoint && end.focusPoint
? lineSegment(start.focusPoint, end.focusPoint)
: undefined;
const endCustomIntersector =
start.focusPoint && end.focusPoint
? lineSegment(end.focusPoint, start.focusPoint)
: undefined;
// Needed to handle a special case where an existing arrow is dragged over
// the same element it is bound to on the other side
const startIsDraggingOverEndElement =
@@ -2279,7 +2373,7 @@ const pointDraggingUpdates = (
nextArrow.endBinding,
endBindable,
elementsMap,
endCustomIntersector,
endIsDragged,
) || nextArrow.points[nextArrow.points.length - 1]
: nextArrow.points[nextArrow.points.length - 1];
@@ -2302,7 +2396,7 @@ const pointDraggingUpdates = (
: startIsDraggingOverEndElement &&
app.state.bindMode !== "inside" &&
getFeatureFlag("COMPLEX_BINDINGS")
? nextArrow.points[nextArrow.points.length - 1]
? endLocalPoint
: startBindable
? updateBoundPoint(
element,
@@ -2310,15 +2404,18 @@ const pointDraggingUpdates = (
nextArrow.startBinding,
startBindable,
elementsMap,
startCustomIntersector,
startIsDragged,
) || nextArrow.points[0]
: nextArrow.points[0];
const endChanged =
pointDistance(
endLocalPoint,
nextArrow.points[nextArrow.points.length - 1],
) !== 0;
!startIsDraggingOverEndElement &&
!(
endIsDraggingOverStartElement &&
app.state.bindMode !== "inside" &&
getFeatureFlag("COMPLEX_BINDINGS")
) &&
!!endBindable;
const startChanged =
pointDistance(startLocalPoint, nextArrow.points[0]) !== 0;
@@ -2332,13 +2429,7 @@ const pointDraggingUpdates = (
const indices = Array.from(indicesSet);
return {
updates:
updates.startBinding || updates.suggestedBinding
? {
startBinding: updates.startBinding,
suggestedBinding: updates.suggestedBinding,
}
: undefined,
updates,
positions: new Map(
indices.map((idx) => {
return [
+74 -20
View File
@@ -23,6 +23,7 @@ import {
getVerticalOffset,
invariant,
applyDarkModeFilter,
isSafari,
} from "@excalidraw/common";
import type {
@@ -360,8 +361,9 @@ IMAGE_ERROR_PLACEHOLDER_IMG.src = `data:${MIME_TYPES.svg},${encodeURIComponent(
const drawImagePlaceholder = (
element: ExcalidrawImageElement,
context: CanvasRenderingContext2D,
theme: StaticCanvasRenderConfig["theme"],
) => {
context.fillStyle = "#E7E7E7";
context.fillStyle = theme === THEME.DARK ? "#2E2E2E" : "#E7E7E7";
context.fillRect(0, 0, element.width, element.height);
const imageMinWidthOrHeight = Math.min(element.width, element.height);
@@ -443,13 +445,6 @@ const drawElementOnCanvas = (
? cacheEntry?.image
: undefined;
const shouldInvertImage =
renderConfig.theme === THEME.DARK &&
cacheEntry?.mimeType === MIME_TYPES.svg;
if (shouldInvertImage) {
context.filter = DARK_THEME_FILTER;
}
if (img != null && !(img instanceof Promise)) {
if (element.roundness && context.roundRect) {
context.beginPath();
@@ -472,19 +467,78 @@ const drawElementOnCanvas = (
height: img.naturalHeight,
};
context.drawImage(
img,
x,
y,
width,
height,
0 /* hardcoded for the selection box*/,
0,
element.width,
element.height,
);
const shouldInvertImage =
renderConfig.theme === THEME.DARK &&
cacheEntry?.mimeType === MIME_TYPES.svg;
if (shouldInvertImage && isSafari) {
const devicePixelRatio = window.devicePixelRatio || 1;
const tempCanvas = document.createElement("canvas");
tempCanvas.width = element.width * devicePixelRatio;
tempCanvas.height = element.height * devicePixelRatio;
const tempContext = tempCanvas.getContext("2d");
if (tempContext) {
tempContext.scale(devicePixelRatio, devicePixelRatio);
tempContext.drawImage(
img,
x,
y,
width,
height,
0,
0,
element.width,
element.height,
);
const imageData = tempContext.getImageData(
0,
0,
tempCanvas.width,
tempCanvas.height,
);
const data = imageData.data;
for (let i = 0; i < data.length; i += 4) {
data[i] = 255 - data[i];
data[i + 1] = 255 - data[i + 1];
data[i + 2] = 255 - data[i + 2];
}
tempContext.putImageData(imageData, 0, 0);
context.drawImage(
tempCanvas,
0,
0,
tempCanvas.width,
tempCanvas.height,
0,
0,
element.width,
element.height,
);
}
} else {
if (shouldInvertImage) {
context.filter = DARK_THEME_FILTER;
}
context.drawImage(
img,
x,
y,
width,
height,
0 /* hardcoded for the selection box*/,
0,
element.width,
element.height,
);
}
} else {
drawImagePlaceholder(element, context);
drawImagePlaceholder(element, context, renderConfig.theme);
}
context.restore();
break;
+3 -14
View File
@@ -318,18 +318,7 @@ export const resizeSingleTextElement = (
) => {
const elementsMap = scene.getNonDeletedElementsMap();
const isCornerHandle = transformHandleType.length === 2;
let metricsWidth = element.width * (nextHeight / element.height);
let metricsHeight = nextHeight;
if (isCornerHandle) {
const widthRatio = Math.abs(nextWidth) / element.width;
const heightRatio = Math.abs(nextHeight) / element.height;
const ratio = Math.max(widthRatio, heightRatio);
const sign = Math.sign(nextHeight) || 1;
metricsWidth = element.width * ratio * sign;
metricsHeight = element.height * ratio * sign;
}
const metricsWidth = element.width * (nextHeight / element.height);
const metrics = measureFontSizeFromWidth(element, elementsMap, metricsWidth);
if (metrics === null) {
@@ -344,7 +333,7 @@ export const resizeSingleTextElement = (
origElement.width,
origElement.height,
metricsWidth,
metricsHeight,
nextHeight,
origElement.angle,
transformHandleType,
false,
@@ -354,7 +343,7 @@ export const resizeSingleTextElement = (
scene.mutateElement(element, {
fontSize: metrics.size,
width: metricsWidth,
height: metricsHeight,
height: nextHeight,
x: newOrigin.x,
y: newOrigin.y,
});
+149 -26
View File
@@ -7,6 +7,7 @@ import {
} from "@excalidraw/common";
import {
bezierEquation,
curve,
curveCatmullRomCubicApproxPoints,
curveOffsetPoints,
@@ -27,19 +28,30 @@ import {
import type { Curve, LineSegment, LocalPoint } from "@excalidraw/math";
import type { NormalizedZoomValue, Zoom } from "@excalidraw/excalidraw/types";
import type {
AppState,
NormalizedZoomValue,
Zoom,
} from "@excalidraw/excalidraw/types";
import { elementCenterPoint, getDiamondPoints } from "./bounds";
import { generateLinearCollisionShape } from "./shape";
import { isPointInElement } from "./collision";
import { hitElementItself, isPointInElement } from "./collision";
import { LinearElementEditor } from "./linearElementEditor";
import { isRectangularElement } from "./typeChecks";
import { maxBindingDistance_simple } from "./binding";
import {
getGlobalFixedPointForBindableElement,
normalizeFixedPoint,
} from "./binding";
import type {
ElementsMap,
ExcalidrawArrowElement,
ExcalidrawBindableElement,
ExcalidrawDiamondElement,
ExcalidrawElement,
ExcalidrawFreeDrawElement,
@@ -329,24 +341,10 @@ export function deconstructRectanguloidElement(
return shape;
}
/**
* Get the **unrotated** building components of a diamond element
* in the form of line segments and curves as a tuple, in this order.
*
* @param element The element to deconstruct
* @param offset An optional offset
* @returns Tuple of line **unrotated** segments (0) and curves (1)
*/
export function deconstructDiamondElement(
export function getDiamondBaseCorners(
element: ExcalidrawDiamondElement,
offset: number = 0,
): [LineSegment<GlobalPoint>[], Curve<GlobalPoint>[]] {
const cachedShape = getElementShapesCacheEntry(element, offset);
if (cachedShape) {
return cachedShape;
}
): Curve<GlobalPoint>[] {
const [topX, topY, rightX, rightY, bottomX, bottomY, leftX, leftY] =
getDiamondPoints(element);
const verticalRadius = element.roundness
@@ -363,7 +361,7 @@ export function deconstructDiamondElement(
pointFrom(element.x + leftX, element.y + leftY),
];
const baseCorners = [
return [
curve(
pointFrom<GlobalPoint>(
right[0] - verticalRadius,
@@ -413,6 +411,27 @@ export function deconstructDiamondElement(
),
), // TOP
];
}
/**
* Get the **unrotated** building components of a diamond element
* in the form of line segments and curves as a tuple, in this order.
*
* @param element The element to deconstruct
* @param offset An optional offset
* @returns Tuple of line **unrotated** segments (0) and curves (1)
*/
export function deconstructDiamondElement(
element: ExcalidrawDiamondElement,
offset: number = 0,
): [LineSegment<GlobalPoint>[], Curve<GlobalPoint>[]] {
const cachedShape = getElementShapesCacheEntry(element, offset);
if (cachedShape) {
return cachedShape;
}
const baseCorners = getDiamondBaseCorners(element, offset);
const corners = baseCorners.map(
(corner) =>
@@ -570,28 +589,128 @@ const getDiagonalsForBindableElement = (
return [diagonalOne, diagonalTwo];
};
export const getSnapOutlineMidPoint = (
point: GlobalPoint,
element: ExcalidrawBindableElement,
elementsMap: ElementsMap,
zoom: AppState["zoom"],
) => {
const center = elementCenterPoint(element, elementsMap);
const sideMidpoints =
element.type === "diamond"
? getDiamondBaseCorners(element).map((curve) => {
const point = bezierEquation(curve, 0.5);
const rotatedPoint = pointRotateRads(point, center, element.angle);
return pointFrom<GlobalPoint>(rotatedPoint[0], rotatedPoint[1]);
})
: [
// RIGHT midpoint
pointRotateRads(
pointFrom<GlobalPoint>(
element.x + element.width,
element.y + element.height / 2,
),
center,
element.angle,
),
// BOTTOM midpoint
pointRotateRads(
pointFrom<GlobalPoint>(
element.x + element.width / 2,
element.y + element.height,
),
center,
element.angle,
),
// LEFT midpoint
pointRotateRads(
pointFrom<GlobalPoint>(element.x, element.y + element.height / 2),
center,
element.angle,
),
// TOP midpoint
pointRotateRads(
pointFrom<GlobalPoint>(element.x + element.width / 2, element.y),
center,
element.angle,
),
];
const candidate = sideMidpoints.find(
(midpoint) =>
pointDistance(point, midpoint) <=
maxBindingDistance_simple(zoom) + element.strokeWidth / 2 &&
!hitElementItself({
point,
element,
threshold: 0,
elementsMap,
overrideShouldTestInside: true,
}),
);
return candidate;
};
export const projectFixedPointOntoDiagonal = (
arrow: ExcalidrawArrowElement,
point: GlobalPoint,
element: ExcalidrawElement,
element: ExcalidrawBindableElement,
startOrEnd: "start" | "end",
elementsMap: ElementsMap,
zoom: AppState["zoom"],
): GlobalPoint | null => {
invariant(arrow.points.length >= 2, "Arrow must have at least two points");
if (arrow.width < 3 && arrow.height < 3) {
return null;
}
const sideMidPoint = getSnapOutlineMidPoint(
point,
element,
elementsMap,
zoom,
);
if (sideMidPoint) {
return sideMidPoint;
}
// Do the projection onto the diagonals (or center lines
// for non-rectangular shapes)
const [diagonalOne, diagonalTwo] = getDiagonalsForBindableElement(
element,
elementsMap,
);
const a = LinearElementEditor.getPointAtIndexGlobalCoordinates(
// To avoid working with stale arrow state, we use the opposite focus point
// of the current endpoint, which will always be unchanged during moving of
// the endpoint. This is only needed when the arrow has only two points.
let a = LinearElementEditor.getPointAtIndexGlobalCoordinates(
arrow,
startOrEnd === "start" ? 1 : arrow.points.length - 2,
elementsMap,
);
if (arrow.points.length === 2) {
const otherBinding =
startOrEnd === "start" ? arrow.endBinding : arrow.startBinding;
const otherBindable =
otherBinding &&
(elementsMap.get(otherBinding.elementId) as
| ExcalidrawBindableElement
| undefined);
const otherFocusPoint =
otherBinding &&
otherBindable &&
getGlobalFixedPointForBindableElement(
normalizeFixedPoint(otherBinding.fixedPoint),
otherBindable,
elementsMap,
);
if (otherFocusPoint) {
a = otherFocusPoint;
}
}
const b = pointFromVector<GlobalPoint>(
vectorScale(
vectorFromPoint(point, a),
@@ -603,18 +722,22 @@ export const projectFixedPointOntoDiagonal = (
),
a,
);
const intersector = lineSegment<GlobalPoint>(point, b);
const intersector = lineSegment<GlobalPoint>(b, a);
const p1 = lineSegmentIntersectionPoints(diagonalOne, intersector);
const p2 = lineSegmentIntersectionPoints(diagonalTwo, intersector);
const d1 = p1 && pointDistance(a, p1);
const d2 = p2 && pointDistance(a, p2);
let p = null;
let projection = null;
if (d1 != null && d2 != null) {
p = d1 < d2 ? p1 : p2;
projection = d1 < d2 ? p1 : p2;
} else {
p = p1 || p2 || null;
projection = p1 || p2 || null;
}
return p && isPointInElement(p, element, elementsMap) ? p : null;
if (projection && isPointInElement(projection, element, elementsMap)) {
return projection;
}
return null;
};
+4 -5
View File
@@ -156,12 +156,11 @@ export const moveArrowAboveBindable = (
elements: readonly Ordered<NonDeletedExcalidrawElement>[],
elementsMap: NonDeletedSceneElementsMap,
scene: Scene,
hit?: NonDeletedExcalidrawElement,
): readonly OrderedExcalidrawElement[] => {
const hoveredElement = getHoveredElementForBinding(
point,
elements,
elementsMap,
);
const hoveredElement = hit
? hit
: getHoveredElementForBinding(point, elements, elementsMap);
if (!hoveredElement) {
return elements;
+81 -1
View File
@@ -1,4 +1,4 @@
import { getEmbedLink } from "../src/embeddable";
import { embeddableURLValidator, getEmbedLink } from "../src/embeddable";
describe("YouTube timestamp parsing", () => {
it("should parse YouTube URLs with timestamp in seconds", () => {
@@ -151,3 +151,83 @@ describe("YouTube timestamp parsing", () => {
}
});
});
describe("Google Drive video embedding", () => {
it.each([
{
url: "https://drive.google.com/file/d/1AbCdEfGhIjKlMnOpQrStUvWxYz123456/view?usp=sharing",
expectedLink:
"https://drive.google.com/file/d/1AbCdEfGhIjKlMnOpQrStUvWxYz123456/preview",
},
{
url: "https://drive.google.com/open?id=1AbCdEfGhIjKlMnOpQrStUvWxYz123456",
expectedLink:
"https://drive.google.com/file/d/1AbCdEfGhIjKlMnOpQrStUvWxYz123456/preview",
},
{
url: "https://drive.google.com/uc?export=download&id=1AbCdEfGhIjKlMnOpQrStUvWxYz123456",
expectedLink:
"https://drive.google.com/file/d/1AbCdEfGhIjKlMnOpQrStUvWxYz123456/preview",
},
])("should normalize Google Drive link: $url", ({ url, expectedLink }) => {
const result = getEmbedLink(url);
expect(result).toBeTruthy();
expect(result?.type).toBe("video");
if (result?.type === "video" || result?.type === "generic") {
expect(result.link).toBe(expectedLink);
}
expect(result?.intrinsicSize).toEqual({ w: 560, h: 315 });
});
it("should preserve resourcekey when available", () => {
const url =
"https://drive.google.com/file/d/1AbCdEfGhIjKlMnOpQrStUvWxYz123456/view?resourcekey=0-abcdef123456";
const result = getEmbedLink(url);
expect(result).toBeTruthy();
expect(result?.type).toBe("video");
if (result?.type === "video" || result?.type === "generic") {
expect(result.link).toBe(
"https://drive.google.com/file/d/1AbCdEfGhIjKlMnOpQrStUvWxYz123456/preview?resourcekey=0-abcdef123456",
);
}
});
it("should preserve timestamp when available", () => {
const url =
"https://drive.google.com/file/d/1AbCdEfGhIjKlMnOpQrStUvWxYz123456/view?t=9";
const result = getEmbedLink(url);
expect(result).toBeTruthy();
expect(result?.type).toBe("video");
if (result?.type === "video" || result?.type === "generic") {
expect(result.link).toBe(
"https://drive.google.com/file/d/1AbCdEfGhIjKlMnOpQrStUvWxYz123456/preview?t=9",
);
}
});
it("should preserve resourcekey and timestamp together", () => {
const url =
"https://drive.google.com/file/d/1AbCdEfGhIjKlMnOpQrStUvWxYz123456/view?resourcekey=0-abcdef123456&t=9";
const result = getEmbedLink(url);
expect(result).toBeTruthy();
expect(result?.type).toBe("video");
if (result?.type === "video" || result?.type === "generic") {
expect(result.link).toBe(
"https://drive.google.com/file/d/1AbCdEfGhIjKlMnOpQrStUvWxYz123456/preview?resourcekey=0-abcdef123456&t=9",
);
}
});
it("should validate Google Drive domain by default", () => {
expect(
embeddableURLValidator(
"https://drive.google.com/file/d/1AbCdEfGhIjKlMnOpQrStUvWxYz123456/view",
undefined,
),
).toBe(true);
});
});
@@ -378,7 +378,7 @@ describe("Test Linear Elements", () => {
// drag line from midpoint
drag(midpoint, pointFrom(midpoint[0] + delta, midpoint[1] + delta));
expect(renderInteractiveScene.mock.calls.length).toMatchInlineSnapshot(
`11`,
`12`,
);
expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`7`);
@@ -419,7 +419,7 @@ describe("Test Linear Elements", () => {
fireEvent.click(screen.getByTitle("Round"));
expect(renderInteractiveScene.mock.calls.length).toMatchInlineSnapshot(
`9`,
`10`,
);
expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`6`);
@@ -480,7 +480,7 @@ describe("Test Linear Elements", () => {
drag(startPoint, endPoint);
expect(renderInteractiveScene.mock.calls.length).toMatchInlineSnapshot(
`11`,
`12`,
);
expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`7`);
@@ -548,7 +548,7 @@ describe("Test Linear Elements", () => {
);
expect(renderInteractiveScene.mock.calls.length).toMatchInlineSnapshot(
`14`,
`15`,
);
expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`9`);
@@ -599,7 +599,7 @@ describe("Test Linear Elements", () => {
drag(hitCoords, pointFrom(hitCoords[0] - delta, hitCoords[1] - delta));
expect(renderInteractiveScene.mock.calls.length).toMatchInlineSnapshot(
`11`,
`12`,
);
expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`7`);
@@ -640,7 +640,7 @@ describe("Test Linear Elements", () => {
drag(hitCoords, pointFrom(hitCoords[0] + delta, hitCoords[1] + delta));
expect(renderInteractiveScene.mock.calls.length).toMatchInlineSnapshot(
`11`,
`12`,
);
expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`7`);
@@ -688,7 +688,7 @@ describe("Test Linear Elements", () => {
deletePoint(points[2]);
expect(line.points.length).toEqual(3);
expect(renderInteractiveScene.mock.calls.length).toMatchInlineSnapshot(
`17`,
`18`,
);
expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`10`);
@@ -746,7 +746,7 @@ describe("Test Linear Elements", () => {
),
);
expect(renderInteractiveScene.mock.calls.length).toMatchInlineSnapshot(
`14`,
`15`,
);
expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`9`);
expect(line.points.length).toEqual(5);
@@ -844,7 +844,7 @@ describe("Test Linear Elements", () => {
drag(hitCoords, pointFrom(hitCoords[0] + delta, hitCoords[1] + delta));
expect(renderInteractiveScene.mock.calls.length).toMatchInlineSnapshot(
`11`,
`12`,
);
expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`7`);
@@ -1317,7 +1317,7 @@ describe("Test Linear Elements", () => {
const textElement = h.elements[2] as ExcalidrawTextElementWithContainer;
expect(arrow.endBinding?.elementId).toBe(rect.id);
expect(arrow.width).toBeCloseTo(399);
expect(arrow.width).toBeCloseTo(404);
expect(rect.x).toBe(400);
expect(rect.y).toBe(0);
expect(
@@ -1336,7 +1336,7 @@ describe("Test Linear Elements", () => {
mouse.downAt(rect.x, rect.y);
mouse.moveTo(200, 0);
mouse.upAt(200, 0);
expect(arrow.width).toBeCloseTo(199);
expect(arrow.width).toBeCloseTo(204);
expect(rect.x).toBe(200);
expect(rect.y).toBe(0);
expect(handleBindTextResizeSpy).toHaveBeenCalledWith(
+2 -20
View File
@@ -563,24 +563,6 @@ describe("text element", () => {
expect(text.fontSize).toBeCloseTo(fontSize * scale);
});
it("resizes proportionally using horizontal delta from corner handles", async () => {
const text = UI.createElement("text");
await UI.editText(text, "hello\nworld");
const { x, y, width, height, fontSize } = text;
const deltaX = width;
const deltaY = 0;
const scale = (width + deltaX) / width;
UI.resize(text, "se", [deltaX, deltaY]);
expect(text.x).toBeCloseTo(x);
expect(text.y).toBeCloseTo(y);
expect(text.width).toBeCloseTo(width * scale);
expect(text.height).toBeCloseTo(height * scale);
expect(text.angle).toBeCloseTo(0);
expect(text.fontSize).toBeCloseTo(fontSize * scale);
});
// TODO enable this test after adding single text element flipping
it.skip("flips while resizing", async () => {
const text = UI.createElement("text");
@@ -1368,8 +1350,8 @@ describe("multiple selection", () => {
expect(boundArrow.x).toBeCloseTo(380 * scaleX);
expect(boundArrow.y).toBeCloseTo(240 * scaleY);
expect(boundArrow.points[1][0]).toBeCloseTo(59.7979);
expect(boundArrow.points[1][1]).toBeCloseTo(-79.7305);
expect(boundArrow.points[1][0]).toBeCloseTo(63.40354208105561);
expect(boundArrow.points[1][1]).toBeCloseTo(-84.53805610807356);
expect(arrowLabelPos.x + arrowLabel.width / 2).toBeCloseTo(
boundArrow.x + boundArrow.points[1][0] / 2,
@@ -108,7 +108,6 @@ export const actionFinalize = register<FormData>({
return map;
}, new Map()) ?? new Map();
bindOrUnbindBindingElement(
element,
draggedPoints,
@@ -1555,7 +1555,7 @@ const getArrowheadOptions = (flip: boolean) => {
value: null,
text: t("labels.arrowhead_none"),
keyBinding: "q",
icon: ArrowheadNoneIcon,
icon: <ArrowheadNoneIcon flip={flip} />,
},
{
value: "arrow",
@@ -1683,7 +1683,8 @@ export const actionChangeArrowhead = register<{
? element.startArrowhead
: appState.currentItemStartArrowhead,
true,
appState.currentItemStartArrowhead,
(hasSelection) =>
hasSelection ? null : appState.currentItemStartArrowhead,
)}
onChange={(value) => updateData({ position: "start", type: value })}
numberOfOptionsToAlwaysShow={4}
@@ -1700,7 +1701,8 @@ export const actionChangeArrowhead = register<{
? element.endArrowhead
: appState.currentItemEndArrowhead,
true,
appState.currentItemEndArrowhead,
(hasSelection) =>
hasSelection ? null : appState.currentItemEndArrowhead,
)}
onChange={(value) => updateData({ position: "end", type: value })}
numberOfOptionsToAlwaysShow={4}
+3 -1
View File
@@ -55,7 +55,8 @@ export type ShortcutName =
| "saveScene"
| "imageExport"
| "commandPalette"
| "searchMenu";
| "searchMenu"
| "toolLock";
const shortcutMap: Record<ShortcutName, string[]> = {
toggleTheme: [getShortcutKey("Shift+Alt+D")],
@@ -117,6 +118,7 @@ const shortcutMap: Record<ShortcutName, string[]> = {
toggleShortcuts: [getShortcutKey("?")],
searchMenu: [getShortcutKey("CtrlOrCmd+F")],
wrapSelectionInFrame: [],
toolLock: [getShortcutKey("Q")],
};
export const getShortcutFromShortcutName = (name: ShortcutName, idx = 0) => {
+69 -25
View File
@@ -204,8 +204,13 @@ export const copyToClipboard = async (
/** supply if available to make the operation more certain to succeed */
clipboardEvent?: ClipboardEvent | null,
) => {
const json = serializeAsClipboardJSON({ elements, files });
await copyTextToSystemClipboard(
serializeAsClipboardJSON({ elements, files }),
{
[MIME_TYPES.excalidrawClipboard]: json,
[MIME_TYPES.text]: json,
},
clipboardEvent,
);
};
@@ -401,7 +406,7 @@ export type ParsedDataTransferFile = Extract<
{ kind: "file" }
>;
type ParsedDataTranferList = ParsedDataTransferItem[] & {
export type ParsedDataTranferList = ParsedDataTransferItem[] & {
/**
* Only allows filtering by known `string` data types, since `file`
* types can have multiple items of the same type (e.g. multiple image files)
@@ -452,6 +457,29 @@ const getDataTransferFiles = function (
);
};
/** @returns list of MIME types, synchronously */
export const parseDataTransferEventMimeTypes = (
event: ClipboardEvent | DragEvent | React.DragEvent<HTMLDivElement>,
): Set<string> => {
let items: DataTransferItemList | undefined = undefined;
if (isClipboardEvent(event)) {
items = event.clipboardData?.items;
} else {
items = event.dataTransfer?.items;
}
const types: Set<string> = new Set();
for (const item of Array.from(items || [])) {
if (!types.has(item.type)) {
types.add(item.type);
}
}
return types;
};
export const parseDataTransferEvent = async (
event: ClipboardEvent | DragEvent | React.DragEvent<HTMLDivElement>,
): Promise<ParsedDataTranferList> => {
@@ -460,8 +488,7 @@ export const parseDataTransferEvent = async (
if (isClipboardEvent(event)) {
items = event.clipboardData?.items;
} else {
const dragEvent = event;
items = dragEvent.dataTransfer?.items;
items = event.dataTransfer?.items;
}
const dataItems = (
@@ -567,7 +594,7 @@ export const copyBlobToClipboardAsPng = async (blob: Blob | Promise<Blob>) => {
// ClipboardItem constructor, but throws on an unrelated MIME type error.
// So we need to await this and fallback to awaiting the blob if applicable.
await navigator.clipboard.write([
new window.ClipboardItem({
new ClipboardItem({
[MIME_TYPES.png]: blob,
}),
]);
@@ -576,7 +603,7 @@ export const copyBlobToClipboardAsPng = async (blob: Blob | Promise<Blob>) => {
// with resolution value instead
if (isPromiseLike(blob)) {
await navigator.clipboard.write([
new window.ClipboardItem({
new ClipboardItem({
[MIME_TYPES.png]: await blob,
}),
]);
@@ -586,28 +613,27 @@ export const copyBlobToClipboardAsPng = async (blob: Blob | Promise<Blob>) => {
}
};
export const copyTextToSystemClipboard = async (
text: string | null,
export const copyTextToSystemClipboard = async <
MimeType extends ValueOf<typeof STRING_MIME_TYPES>,
>(
text: string | { [K in MimeType]: string } | null,
clipboardEvent?: ClipboardEvent | null,
) => {
// (1) first try using Async Clipboard API
if (probablySupportsClipboardWriteText) {
try {
// NOTE: doesn't work on FF on non-HTTPS domains, or when document
// not focused
await navigator.clipboard.writeText(text || "");
return;
} catch (error: any) {
console.error(error);
}
}
text = text || "";
// (2) if fails and we have access to ClipboardEvent, use plain old setData()
const entries = Object.entries(
typeof text === "string" ? { [MIME_TYPES.text]: text } : text,
);
// (1) if we have clipboardEvent, try using it first as it's the most
// versatile
try {
if (clipboardEvent) {
clipboardEvent.clipboardData?.setData(MIME_TYPES.text, text || "");
if (clipboardEvent.clipboardData?.getData(MIME_TYPES.text) !== text) {
throw new Error("Failed to setData on clipboardEvent");
for (const [mimeType, value] of entries) {
clipboardEvent.clipboardData?.setData(mimeType, value);
if (clipboardEvent.clipboardData?.getData(mimeType) !== value) {
throw new Error("Failed to setData on clipboardEvent");
}
}
return;
}
@@ -615,8 +641,26 @@ export const copyTextToSystemClipboard = async (
console.error(error);
}
// (3) if that fails, use document.execCommand
if (!copyTextViaExecCommand(text)) {
const plainTextEntry = entries.find(
([mimeType]) => mimeType === MIME_TYPES.text,
);
// (2) if we don't have access to clipboardEvent, or that fails,
// at least try setting text/plain via navigator.clipboard.writeText
// (navigator.clipboard.write doesn't work with non-standard mime types)
if (probablySupportsClipboardWriteText && plainTextEntry) {
try {
// NOTE: doesn't work on FF on non-HTTPS domains, or when document
// not focused
await navigator.clipboard.writeText(plainTextEntry[1]);
return;
} catch (error: any) {
console.error(error);
}
}
// (3) if previous fails, use document.execCommand
if (plainTextEntry && !copyTextViaExecCommand(plainTextEntry[1])) {
throw new Error("Error copying to clipboard.");
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
import clsx from "clsx";
import { useRef, useState } from "react";
import * as Popover from "@radix-ui/react-popover";
import { Popover } from "radix-ui";
import {
CLASSES,
+335 -127
View File
@@ -11,7 +11,6 @@ import {
pointDistance,
vector,
pointRotateRads,
vectorScale,
vectorFromPoint,
vectorSubtract,
vectorDot,
@@ -250,6 +249,13 @@ import {
maxBindingDistance_simple,
convertToExcalidrawElements,
type ExcalidrawElementSkeleton,
getSnapOutlineMidPoint,
handleFocusPointDrag,
handleFocusPointHover,
handleFocusPointPointerDown,
handleFocusPointPointerUp,
maybeHandleArrowPointlikeDrag,
getUncroppedWidthAndHeight,
} from "@excalidraw/element";
import type { GlobalPoint, LocalPoint, Radians } from "@excalidraw/math";
@@ -436,10 +442,7 @@ import { searchItemInFocusAtom } from "./SearchMenu";
import { isSidebarDockedAtom } from "./Sidebar/Sidebar";
import { StaticCanvas, InteractiveCanvas } from "./canvases";
import NewElementCanvas from "./canvases/NewElementCanvas";
import {
isPointHittingLink,
isPointHittingLinkIcon,
} from "./hyperlink/helpers";
import { isPointHittingLink } from "./hyperlink/helpers";
import { MagicIcon, copyIcon, fullscreenIcon } from "./icons";
import { Toast } from "./Toast";
@@ -643,7 +646,10 @@ class App extends React.Component<AppProps, AppState> {
lastPointerUpEvent: React.PointerEvent<HTMLElement> | PointerEvent | null =
null;
lastPointerMoveEvent: PointerEvent | null = null;
/** current frame pointer cords */
lastPointerMoveCoords: { x: number; y: number } | null = null;
/** previous frame pointer coords */
previousPointerMoveCoords: { x: number; y: number } | null = null;
lastViewportPosition = { x: 0, y: 0 };
animationFrameHandler = new AnimationFrameHandler();
@@ -1201,12 +1207,99 @@ class App extends React.Component<AppProps, AppState> {
return this.iFrameRefs.get(element.id);
}
private handleEmbeddableCenterClick(element: ExcalidrawIframeLikeElement) {
private handleIframeLikeElementHover = ({
hitElement,
scenePointer,
moveEvent,
}: {
hitElement: NonDeleted<ExcalidrawElement> | null;
scenePointer: { x: number; y: number };
moveEvent: React.PointerEvent<HTMLCanvasElement>;
}): boolean => {
if (
this.state.activeEmbeddable?.element === element &&
hitElement &&
isIframeLikeElement(hitElement) &&
this.isIframeLikeElementCenter(
hitElement,
moveEvent,
scenePointer.x,
scenePointer.y,
)
) {
setCursor(this.interactiveCanvas, CURSOR_TYPE.POINTER);
this.setState({
activeEmbeddable: { element: hitElement, state: "hover" },
});
return true;
} else if (this.state.activeEmbeddable?.state === "hover") {
this.setState({ activeEmbeddable: null });
}
return false;
};
/** @returns true if iframe-like element click handled */
private handleIframeLikeCenterClick(): boolean {
if (!this.lastPointerDownEvent || !this.lastPointerUpEvent) {
return false;
}
const scenePointerStart = viewportCoordsToSceneCoords(
{
clientX: this.lastPointerDownEvent.clientX,
clientY: this.lastPointerDownEvent.clientY,
},
this.state,
);
const scenePointerEnd = viewportCoordsToSceneCoords(
{
clientX: this.lastPointerUpEvent.clientX,
clientY: this.lastPointerUpEvent.clientY,
},
this.state,
);
const hitElementStart = this.getElementAtPosition(
scenePointerStart.x,
scenePointerStart.y,
);
const hitElementEnd = this.getElementAtPosition(
scenePointerEnd.x,
scenePointerEnd.y,
);
if (
!hitElementStart ||
!hitElementEnd ||
hitElementStart !== hitElementEnd ||
this.lastPointerUpEvent.timeStamp - this.lastPointerDownEvent.timeStamp >
300 ||
gesture.pointers.size > 1 ||
!isIframeLikeElement(hitElementStart) ||
!isIframeLikeElement(hitElementEnd) ||
!this.isIframeLikeElementCenter(
hitElementStart,
this.lastPointerUpEvent,
scenePointerStart.x,
scenePointerStart.y,
) ||
!this.isIframeLikeElementCenter(
hitElementEnd,
this.lastPointerUpEvent,
scenePointerEnd.x,
scenePointerEnd.y,
)
) {
return false;
}
const iframeLikeElement = hitElementEnd;
if (
this.state.activeEmbeddable?.element === iframeLikeElement &&
this.state.activeEmbeddable?.state === "active"
) {
return;
return true;
}
// The delay serves two purposes
@@ -1217,31 +1310,34 @@ class App extends React.Component<AppProps, AppState> {
// in fullscreen mode
setTimeout(() => {
this.setState({
activeEmbeddable: { element, state: "active" },
selectedElementIds: { [element.id]: true },
activeEmbeddable: { element: iframeLikeElement, state: "active" },
selectedElementIds: { [iframeLikeElement.id]: true },
newElement: null,
selectionElement: null,
});
}, 100);
if (isIframeElement(element)) {
return;
if (isIframeElement(iframeLikeElement)) {
return true;
}
const iframe = this.getHTMLIFrameElement(element);
const iframe = this.getHTMLIFrameElement(iframeLikeElement);
if (!iframe?.contentWindow) {
return;
return true;
}
if (iframe.src.includes("youtube")) {
const state = YOUTUBE_VIDEO_STATES.get(element.id);
const state = YOUTUBE_VIDEO_STATES.get(iframeLikeElement.id);
if (!state) {
YOUTUBE_VIDEO_STATES.set(element.id, YOUTUBE_STATES.UNSTARTED);
YOUTUBE_VIDEO_STATES.set(
iframeLikeElement.id,
YOUTUBE_STATES.UNSTARTED,
);
iframe.contentWindow.postMessage(
JSON.stringify({
event: "listening",
id: element.id,
id: iframeLikeElement.id,
}),
"*",
);
@@ -1278,6 +1374,8 @@ class App extends React.Component<AppProps, AppState> {
"*",
);
}
return true;
}
private isIframeLikeElementCenter(
@@ -4734,8 +4832,12 @@ class App extends React.Component<AppProps, AppState> {
}
// Handle Alt key for bind mode
if (event.key === KEYS.ALT && getFeatureFlag("COMPLEX_BINDINGS")) {
this.handleSkipBindMode();
if (event.key === KEYS.ALT) {
if (getFeatureFlag("COMPLEX_BINDINGS")) {
this.handleSkipBindMode();
} else {
maybeHandleArrowPointlikeDrag({ app: this, event });
}
}
if (this.actionManager.handleKeyDown(event)) {
@@ -4751,7 +4853,11 @@ class App extends React.Component<AppProps, AppState> {
this.resetDelayedBindMode();
}
this.setState({ isBindingEnabled: false });
flushSync(() => {
this.setState({ isBindingEnabled: false });
});
maybeHandleArrowPointlikeDrag({ app: this, event });
}
if (isArrowKey(event.key)) {
@@ -5024,6 +5130,11 @@ class App extends React.Component<AppProps, AppState> {
}
isHoldingSpace = false;
}
if (event.key === KEYS.ALT) {
maybeHandleArrowPointlikeDrag({ app: this, event });
}
if (
(event.key === KEYS.ALT && this.state.bindMode === "skip") ||
(!event[KEYS.CTRL_OR_CMD] && !isBindingEnabled(this.state))
@@ -5034,7 +5145,7 @@ class App extends React.Component<AppProps, AppState> {
});
// Restart the timer if we're creating/editing a linear element and hovering over an element
if (this.lastPointerMoveEvent) {
if (this.lastPointerMoveEvent && getFeatureFlag("COMPLEX_BINDINGS")) {
const scenePointer = viewportCoordsToSceneCoords(
{
clientX: this.lastPointerMoveEvent.clientX,
@@ -5055,14 +5166,18 @@ class App extends React.Component<AppProps, AppState> {
this.scene.getNonDeletedElementsMap(),
);
if (isBindingElement(element) && getFeatureFlag("COMPLEX_BINDINGS")) {
if (isBindingElement(element)) {
this.handleDelayedBindModeChange(element, hoveredElement);
}
}
}
}
if (!event[KEYS.CTRL_OR_CMD] && !this.state.isBindingEnabled) {
this.setState({ isBindingEnabled: true });
flushSync(() => {
this.setState({ isBindingEnabled: true });
});
maybeHandleArrowPointlikeDrag({ app: this, event });
}
if (isArrowKey(event.key)) {
bindOrUnbindBindingElements(
@@ -6375,15 +6490,28 @@ class App extends React.Component<AppProps, AppState> {
// and point
const { newElement } = this.state;
if (!newElement && isBindingEnabled(this.state)) {
const globalPoint = pointFrom<GlobalPoint>(
scenePointerX,
scenePointerY,
);
const elementsMap = this.scene.getNonDeletedElementsMap();
const hoveredElement = getHoveredElementForBinding(
pointFrom<GlobalPoint>(scenePointerX, scenePointerY),
globalPoint,
this.scene.getNonDeletedElements(),
this.scene.getNonDeletedElementsMap(),
(el) => maxBindingDistance_simple(this.state.zoom),
elementsMap,
maxBindingDistance_simple(this.state.zoom),
);
if (hoveredElement) {
this.setState({
suggestedBinding: hoveredElement,
suggestedBinding: {
element: hoveredElement,
midPoint: getSnapOutlineMidPoint(
globalPoint,
hoveredElement,
elementsMap,
this.state.zoom,
),
},
});
} else if (this.state.suggestedBinding) {
this.setState({
@@ -6410,7 +6538,7 @@ class App extends React.Component<AppProps, AppState> {
pointFrom<GlobalPoint>(scenePointerX, scenePointerY),
this.scene.getNonDeletedElements(),
this.scene.getNonDeletedElementsMap(),
(el) => maxBindingDistance_simple(this.state.zoom),
maxBindingDistance_simple(this.state.zoom),
);
if (hoveredElement) {
this.actionManager.executeAction(actionFinalize, "ui", {
@@ -6564,26 +6692,33 @@ class App extends React.Component<AppProps, AppState> {
pointFrom<GlobalPoint>(scenePointerX, scenePointerY),
this.scene.getNonDeletedElements(),
this.scene.getNonDeletedElementsMap(),
(el) => maxBindingDistance_simple(this.state.zoom),
maxBindingDistance_simple(this.state.zoom),
);
if (
hit &&
!isPointInElement(
pointFrom<GlobalPoint>(scenePointerX, scenePointerY),
hit,
this.scene.getNonDeletedElementsMap(),
)
) {
const scenePointer = pointFrom<GlobalPoint>(scenePointerX, scenePointerY);
const elementsMap = this.scene.getNonDeletedElementsMap();
if (hit && !isPointInElement(scenePointer, hit, elementsMap)) {
this.setState({
suggestedBinding: hit,
suggestedBinding: {
element: hit,
midPoint: getSnapOutlineMidPoint(
scenePointer,
hit,
elementsMap,
this.state.zoom,
),
},
});
}
}
const hasDeselectedButton = Boolean(event.buttons);
const isPressingAnyButton = Boolean(event.buttons);
const isLaserTool = this.state.activeTool.type === "laser";
if (
hasDeselectedButton ||
(this.state.activeTool.type !== "selection" &&
isPressingAnyButton ||
// checking against laser so that if you mouseover with a laser tool
// over a link/embeddable, we change the cursor
(!isLaserTool &&
this.state.activeTool.type !== "selection" &&
this.state.activeTool.type !== "lasso" &&
this.state.activeTool.type !== "text" &&
this.state.activeTool.type !== "eraser")
@@ -6703,6 +6838,14 @@ class App extends React.Component<AppProps, AppState> {
);
} else {
hideHyperlinkToolip();
if (isLaserTool) {
this.handleIframeLikeElementHover({
hitElement,
scenePointer,
moveEvent: event,
});
return;
}
if (
hitElement &&
(hitElement.link || isEmbeddableElement(hitElement)) &&
@@ -6735,24 +6878,15 @@ class App extends React.Component<AppProps, AppState> {
!hitElement?.locked
) {
if (
hitElement &&
isIframeLikeElement(hitElement) &&
this.isIframeLikeElementCenter(
!this.handleIframeLikeElementHover({
hitElement,
event,
scenePointerX,
scenePointerY,
)
) {
setCursor(this.interactiveCanvas, CURSOR_TYPE.POINTER);
this.setState({
activeEmbeddable: { element: hitElement, state: "hover" },
});
} else if (
!hitElement ||
// Elbow arrows can only be moved when unconnected
!isElbowArrow(hitElement) ||
!(hitElement.startBinding || hitElement.endBinding)
scenePointer,
moveEvent: event,
}) &&
(!hitElement ||
// Elbow arrows can only be moved when unconnected
!isElbowArrow(hitElement) ||
!(hitElement.startBinding || hitElement.endBinding))
) {
if (
this.state.activeTool.type !== "lasso" ||
@@ -6760,9 +6894,6 @@ class App extends React.Component<AppProps, AppState> {
) {
setCursor(this.interactiveCanvas, CURSOR_TYPE.MOVE);
}
if (this.state.activeEmbeddable?.state === "hover") {
this.setState({ activeEmbeddable: null });
}
}
}
} else {
@@ -6923,6 +7054,37 @@ class App extends React.Component<AppProps, AppState> {
},
});
}
// Check for focus point hover
let hoveredFocusPointBinding: "start" | "end" | null = null;
const arrow = element as any;
if (arrow.startBinding || arrow.endBinding) {
hoveredFocusPointBinding = handleFocusPointHover(
element as ExcalidrawArrowElement,
scenePointerX,
scenePointerY,
this.scene,
this.state,
);
}
if (
this.state.selectedLinearElement.hoveredFocusPointBinding !==
hoveredFocusPointBinding
) {
this.setState({
selectedLinearElement: {
...this.state.selectedLinearElement,
isDragging: false,
hoveredFocusPointBinding,
},
});
}
// Set cursor to pointer when hovering over a focus point
if (hoveredFocusPointBinding) {
setCursor(this.interactiveCanvas, CURSOR_TYPE.POINTER);
}
} else {
setCursor(this.interactiveCanvas, CURSOR_TYPE.AUTO);
}
@@ -7383,26 +7545,9 @@ class App extends React.Component<AppProps, AppState> {
x: scenePointerX,
y: scenePointerY,
};
const clicklength =
event.timeStamp - (this.lastPointerDownEvent?.timeStamp ?? 0);
if (this.editorInterface.formFactor === "phone" && clicklength < 300) {
const hitElement = this.getElementAtPosition(
scenePointer.x,
scenePointer.y,
);
if (
isIframeLikeElement(hitElement) &&
this.isIframeLikeElementCenter(
hitElement,
event,
scenePointer.x,
scenePointer.y,
)
) {
this.handleEmbeddableCenterClick(hitElement);
return;
}
if (this.handleIframeLikeCenterClick()) {
return;
}
if (this.editorInterface.isTouchScreen) {
@@ -7423,20 +7568,7 @@ class App extends React.Component<AppProps, AppState> {
this.hitLinkElement &&
!this.state.selectedElementIds[this.hitLinkElement.id]
) {
if (
clicklength < 300 &&
isIframeLikeElement(this.hitLinkElement) &&
!isPointHittingLinkIcon(
this.hitLinkElement,
this.scene.getNonDeletedElementsMap(),
this.state,
pointFrom(scenePointer.x, scenePointer.y),
)
) {
this.handleEmbeddableCenterClick(this.hitLinkElement);
} else {
this.redirectToLink(event, this.editorInterface.isTouchScreen);
}
this.redirectToLink(event, this.editorInterface.isTouchScreen);
} else if (this.state.viewModeEnabled) {
this.setState({
activeEmbeddable: null,
@@ -7844,6 +7976,37 @@ class App extends React.Component<AppProps, AppState> {
if (ret.didAddPoint) {
return true;
}
// Also check at current pointer position if focus point is being hovered
// (in case we're clicking directly without a prior move event)
const elementsMap = this.scene.getNonDeletedElementsMap();
const arrow = LinearElementEditor.getElement(
linearElementEditor.elementId,
elementsMap,
) as any;
if (arrow && isBindingElement(arrow)) {
const { hitFocusPoint, pointerOffset } =
handleFocusPointPointerDown(
arrow,
pointerDownState,
elementsMap,
this.state,
);
// If focus point is hit, update state and prevent element selection
if (hitFocusPoint) {
this.setState({
selectedLinearElement: {
...linearElementEditor,
hoveredFocusPointBinding: hitFocusPoint,
draggedFocusPointBinding: hitFocusPoint,
pointerOffset,
},
});
return false;
}
}
}
const allHitElements = this.getElementsAtPosition(
@@ -8656,6 +8819,7 @@ class App extends React.Component<AppProps, AppState> {
selectedPointsIndices: [endIdx],
initialState: {
...linearElementEditor.initialState,
arrowStartIsInside: event.altKey,
lastClickedPoint: endIdx,
origin: pointFrom<GlobalPoint>(
pointerDownState.origin.x,
@@ -8674,7 +8838,18 @@ class App extends React.Component<AppProps, AppState> {
bindMode: "orbit",
newElement: element,
startBoundElement: boundElement,
suggestedBinding: boundElement || null,
suggestedBinding:
boundElement && isBindingElement(element)
? {
element: boundElement,
midPoint: getSnapOutlineMidPoint(
point,
boundElement,
elementsMap,
this.state.zoom,
),
}
: null,
selectedElementIds: nextSelectedElementIds,
selectedLinearElement: linearElementEditor,
};
@@ -8936,8 +9111,8 @@ class App extends React.Component<AppProps, AppState> {
}
const lastPointerCoords =
this.lastPointerMoveCoords ?? pointerDownState.origin;
this.lastPointerMoveCoords = pointerCoords;
this.previousPointerMoveCoords ?? pointerDownState.origin;
this.previousPointerMoveCoords = pointerCoords;
// We need to initialize dragOffsetXY only after we've updated
// `state.selectedElementIds` on pointerDown. Doing it here in pointerMove
@@ -8991,6 +9166,31 @@ class App extends React.Component<AppProps, AppState> {
if (this.state.selectedLinearElement) {
const linearElementEditor = this.state.selectedLinearElement;
// Handle focus point dragging if needed
if (linearElementEditor.draggedFocusPointBinding) {
handleFocusPointDrag(
linearElementEditor,
elementsMap,
pointerCoords,
this.scene,
this.state,
this.getEffectiveGridSize(),
event.altKey,
);
this.setState({
selectedLinearElement: {
...linearElementEditor,
isDragging: false,
selectedPointsIndices: [],
initialState: {
...linearElementEditor.initialState,
lastClickedPoint: -1,
},
},
});
return;
}
if (
LinearElementEditor.shouldAddMidpoint(
this.state.selectedLinearElement,
@@ -9229,14 +9429,21 @@ class App extends React.Component<AppProps, AppState> {
this.imageCache.get(croppingElement.fileId)?.image;
if (image && !(image instanceof Promise)) {
const instantDragOffset = vectorScale(
vector(
pointerCoords.x - lastPointerCoords.x,
pointerCoords.y - lastPointerCoords.y,
),
Math.max(this.state.zoom.value, 2),
const uncroppedSize =
getUncroppedWidthAndHeight(croppingElement);
const instantDragOffset = vector(
pointerCoords.x - lastPointerCoords.x,
pointerCoords.y - lastPointerCoords.y,
);
// to reduce cursor:image drift, we need to take into account
// the canvas image element scaling so we can accurately
// track the pixels on movement
instantDragOffset[0] *=
image.naturalWidth / uncroppedSize.width;
instantDragOffset[1] *=
image.naturalHeight / uncroppedSize.height;
const [x1, y1, x2, y2, cx, cy] = getElementAbsoluteCoords(
croppingElement,
elementsMap,
@@ -9279,13 +9486,13 @@ class App extends React.Component<AppProps, AppState> {
const nextCrop = {
...crop,
x: clamp(
crop.x +
crop.x -
offsetVector[0] * Math.sign(croppingElement.scale[0]),
0,
image.naturalWidth - crop.width,
),
y: clamp(
crop.y +
crop.y -
offsetVector[1] * Math.sign(croppingElement.scale[1]),
0,
image.naturalHeight - crop.height,
@@ -9778,6 +9985,7 @@ class App extends React.Component<AppProps, AppState> {
// just in case, tool changes mid drag, always clean up
this.lassoTrail.endPath();
this.previousPointerMoveCoords = null;
SnapCache.setReferenceSnapPoints(null);
SnapCache.setVisibleGaps(null);
@@ -9859,12 +10067,14 @@ class App extends React.Component<AppProps, AppState> {
// and sets binding element
if (
this.state.selectedLinearElement?.isEditing &&
!this.state.newElement
!this.state.newElement &&
this.state.selectedLinearElement.draggedFocusPointBinding === null
) {
if (
!pointerDownState.boxSelection.hasOccurred &&
pointerDownState.hit?.element?.id !==
this.state.selectedLinearElement.elementId
this.state.selectedLinearElement.elementId &&
this.state.selectedLinearElement.draggedFocusPointBinding === null
) {
this.actionManager.executeAction(actionFinalize);
} else {
@@ -9900,7 +10110,18 @@ class App extends React.Component<AppProps, AppState> {
}
}
if (
if (this.state.selectedLinearElement.draggedFocusPointBinding) {
handleFocusPointPointerUp(
this.state.selectedLinearElement,
this.scene,
);
this.setState({
selectedLinearElement: {
...this.state.selectedLinearElement,
draggedFocusPointBinding: null,
},
});
} else if (
pointerDownState.hit?.element?.id !==
this.state.selectedLinearElement.elementId
) {
@@ -9910,6 +10131,12 @@ class App extends React.Component<AppProps, AppState> {
this.setState({ selectedLinearElement: null });
}
} else if (this.state.selectedLinearElement.isDragging) {
this.setState({
selectedLinearElement: {
...this.state.selectedLinearElement,
isDragging: false,
},
});
this.actionManager.executeAction(actionFinalize, "ui", {
event: childEvent,
sceneCoords,
@@ -10684,25 +10911,6 @@ class App extends React.Component<AppProps, AppState> {
suggestedBinding: null,
});
}
if (
hitElement &&
this.lastPointerUpEvent &&
this.lastPointerDownEvent &&
this.lastPointerUpEvent.timeStamp -
this.lastPointerDownEvent.timeStamp <
300 &&
gesture.pointers.size <= 1 &&
isIframeLikeElement(hitElement) &&
this.isIframeLikeElementCenter(
hitElement,
this.lastPointerUpEvent,
pointerDownState.origin.x,
pointerDownState.origin.y,
)
) {
this.handleEmbeddableCenterClick(hitElement);
}
});
}
@@ -1,4 +1,4 @@
import * as Popover from "@radix-ui/react-popover";
import { Popover } from "radix-ui";
import clsx from "clsx";
import { useRef, useEffect } from "react";
@@ -53,6 +53,7 @@
&.ExcButton--status-loading,
&.ExcButton--status-success {
pointer-events: none;
background-color: var(--color-success);
.ExcButton__contents {
visibility: hidden;
@@ -0,0 +1,31 @@
import { KEYS } from "@excalidraw/common";
import { Excalidraw } from "../..";
import { Keyboard } from "../../tests/helpers/ui";
import { act, render } from "../../tests/test-utils";
describe("FontPicker", () => {
it("should be able to open font picker", async () => {
(global as any).ResizeObserver =
(global as any).ResizeObserver ||
class ResizeObserver {
observe() {}
unobserve() {}
disconnect() {}
};
const { queryByTestId } = await render(
<Excalidraw handleKeyboardGlobally={true} />,
);
Keyboard.keyPress(KEYS.T);
const fontPickerTrigger = queryByTestId("font-family-show-fonts");
expect(fontPickerTrigger).not.toBeNull();
act(() => {
fontPickerTrigger!.click();
});
});
});
@@ -1,4 +1,4 @@
import * as Popover from "@radix-ui/react-popover";
import { Popover } from "radix-ui";
import clsx from "clsx";
import React, { useCallback, useMemo } from "react";
@@ -30,10 +30,12 @@ import { PropertiesPopover } from "../PropertiesPopover";
import { QuickSearch } from "../QuickSearch";
import { ScrollableList } from "../ScrollableList";
import DropdownMenuGroup from "../dropdownMenu/DropdownMenuGroup";
import DropdownMenuItem, {
import {
DropDownMenuItemBadgeType,
DropDownMenuItemBadge,
} from "../dropdownMenu/DropdownMenuItem";
import MenuItemContent from "../dropdownMenu/DropdownMenuItemContent";
import { getDropdownMenuItemClassName } from "../dropdownMenu/common";
import {
FontFamilyCodeIcon,
FontFamilyHeadingIcon,
@@ -269,45 +271,74 @@ export const FontPickerList = React.memo(
[filteredFonts, sceneFamilies],
);
const renderFont = (font: FontDescriptor, index: number) => (
<DropdownMenuItem
key={font.value}
icon={font.icon}
value={font.value}
order={index}
textStyle={{
fontFamily: getFontFamilyString({ fontFamily: font.value }),
}}
hovered={font.value === hoveredFont?.value}
selected={font.value === selectedFontFamily}
// allow to tab between search and selected font
tabIndex={font.value === selectedFontFamily ? 0 : -1}
onClick={(e) => {
wrappedOnSelect(Number(e.currentTarget.value));
}}
onMouseMove={() => {
if (hoveredFont?.value !== font.value) {
onHover(font.value);
}
}}
badge={
font.badge && (
<DropDownMenuItemBadge type={font.badge.type}>
{font.badge.placeholder}
</DropDownMenuItemBadge>
)
const FontPickerListItem = ({
font,
order,
}: {
font: FontDescriptor;
order: number;
}) => {
const ref = useRef<HTMLButtonElement>(null);
const isHovered = font.value === hoveredFont?.value;
const isSelected = font.value === selectedFontFamily;
useEffect(() => {
if (!isHovered) {
return;
}
>
{font.text}
</DropdownMenuItem>
);
if (order === 0) {
// scroll into the first item differently, so it's visible what is above (i.e. group title)
ref.current?.scrollIntoView?.({ block: "end" });
} else {
ref.current?.scrollIntoView?.({ block: "nearest" });
}
}, [isHovered, order]);
return (
<button
ref={ref}
type="button"
value={font.value}
className={getDropdownMenuItemClassName("", isSelected, isHovered)}
title={font.text}
// allow to tab between search and selected font
tabIndex={isSelected ? 0 : -1}
onClick={(e) => {
wrappedOnSelect(Number(e.currentTarget.value));
}}
onMouseMove={() => {
if (hoveredFont?.value !== font.value) {
onHover(font.value);
}
}}
>
<MenuItemContent
icon={font.icon}
badge={
font.badge && (
<DropDownMenuItemBadge type={font.badge.type}>
{font.badge.placeholder}
</DropDownMenuItemBadge>
)
}
textStyle={{
fontFamily: getFontFamilyString({ fontFamily: font.value }),
}}
>
{font.text}
</MenuItemContent>
</button>
);
};
const groups = [];
if (sceneFilteredFonts.length) {
groups.push(
<DropdownMenuGroup title={t("fontList.sceneFonts")} key="group_1">
{sceneFilteredFonts.map(renderFont)}
{sceneFilteredFonts.map((font, index) => (
<FontPickerListItem key={font.value} font={font} order={index} />
))}
</DropdownMenuGroup>,
);
}
@@ -315,9 +346,13 @@ export const FontPickerList = React.memo(
if (availableFilteredFonts.length) {
groups.push(
<DropdownMenuGroup title={t("fontList.availableFonts")} key="group_2">
{availableFilteredFonts.map((font, index) =>
renderFont(font, index + sceneFilteredFonts.length),
)}
{availableFilteredFonts.map((font, index) => (
<FontPickerListItem
key={font.value}
font={font}
order={index + sceneFilteredFonts.length}
/>
))}
</DropdownMenuGroup>,
);
}
@@ -1,4 +1,4 @@
import * as Popover from "@radix-ui/react-popover";
import { Popover } from "radix-ui";
import { MOBILE_ACTION_BUTTON_BG } from "@excalidraw/common";
@@ -1,4 +1,4 @@
import * as Popover from "@radix-ui/react-popover";
import { Popover } from "radix-ui";
import clsx from "clsx";
import React, { useEffect } from "react";
@@ -126,9 +126,10 @@
.dropdown-menu-container {
width: 196px;
box-shadow: var(--library-dropdown-shadow);
border-radius: var(--border-radius-lg);
padding: 0.25rem 0.5rem;
--box-shadow: var(--library-dropdown-shadow);
}
}
@@ -375,7 +375,7 @@ export const MobileToolBar = ({
)}
{/* Other Shapes */}
<DropdownMenu open={isOtherShapesMenuOpen} placement="top">
<DropdownMenu open={isOtherShapesMenuOpen}>
<DropdownMenu.Trigger
className={clsx(
"App-toolbar__extra-tools-trigger App-toolbar__extra-tools-trigger--mobile",
@@ -403,6 +403,7 @@ export const MobileToolBar = ({
onClickOutside={() => setIsOtherShapesMenuOpen(false)}
onSelect={() => setIsOtherShapesMenuOpen(false)}
className="App-toolbar__extra-tools-dropdown"
align="start"
>
{!showTextToolOutside && (
<DropdownMenu.Item
@@ -1,4 +1,4 @@
import * as Popover from "@radix-ui/react-popover";
import { Popover } from "radix-ui";
import clsx from "clsx";
import React, { type ReactNode } from "react";
@@ -1,4 +1,4 @@
import * as RadixTabs from "@radix-ui/react-tabs";
import { Tabs as RadixTabs } from "radix-ui";
import type { SidebarTabName } from "../../types";
@@ -1,4 +1,4 @@
import * as RadixTabs from "@radix-ui/react-tabs";
import { Tabs as RadixTabs } from "radix-ui";
import type { SidebarTabName } from "../../types";
@@ -1,4 +1,4 @@
import * as RadixTabs from "@radix-ui/react-tabs";
import { Tabs as RadixTabs } from "radix-ui";
export const SidebarTabTriggers = ({
children,
@@ -1,4 +1,4 @@
import * as RadixTabs from "@radix-ui/react-tabs";
import { Tabs as RadixTabs } from "radix-ui";
import { useUIAppState } from "../../context/ui-appState";
import { useExcalidrawSetAppState } from "../App";
@@ -135,7 +135,7 @@ describe("binding with linear elements", () => {
) as HTMLInputElement;
expect(linear.startBinding).not.toBe(null);
expect(inputX).not.toBeNull();
UI.updateInput(inputX, String("186"));
UI.updateInput(inputX, String("184"));
expect(linear.startBinding).not.toBe(null);
});
@@ -1,4 +1,4 @@
@import "../../../css/variables.module.scss";
@use "../../../css/variables.module.scss" as *;
$verticalBreakpoint: 861px;
@@ -48,14 +48,14 @@ $verticalBreakpoint: 861px;
}
}
&__empty-state {
&__welcome-screen {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
min-height: 200px;
&-content {
&__welcome-message {
text-align: center;
h3 {
@@ -52,11 +52,7 @@ export const ChatHistoryMenu = ({
>
{historyIcon}
</DropdownMenu.Trigger>
<DropdownMenu.Content
onClickOutside={onClose}
onSelect={onClose}
placement="bottom"
>
<DropdownMenu.Content onClickOutside={onClose} onSelect={onClose}>
<>
{savedChats.map((chat) => (
<DropdownMenu.ItemCustom
@@ -6,6 +6,8 @@ import { InlineIcon } from "../../InlineIcon";
import { t } from "../../../i18n";
import { TTDWelcomeMessage } from "../TTDWelcomeMessage";
import { ChatMessage } from "./ChatMessage";
import type { TChat, TTTDDialog } from "../types";
@@ -20,13 +22,13 @@ export const ChatInterface = ({
onGenerate,
isGenerating,
rateLimits,
placeholder,
onAbort,
onMermaidTabClick,
onAiRepairClick,
onDeleteMessage,
onInsertMessage,
onRetry,
renderWelcomeScreen,
renderWarning,
}: {
chatId: string;
@@ -41,17 +43,13 @@ export const ChatInterface = ({
} | null;
onViewAsMermaid?: () => void;
generatedResponse?: string | null;
placeholder: {
title: string;
description: string;
hint: string;
};
onAbort?: () => void;
onMermaidTabClick?: (message: TChat.ChatMessage) => void;
onAiRepairClick?: (message: TChat.ChatMessage) => void;
onDeleteMessage?: (messageId: string) => void;
onInsertMessage?: (message: TChat.ChatMessage) => void;
onRetry?: (message: TChat.ChatMessage) => void;
renderWelcomeScreen?: TTTDDialog.renderWelcomeScreen;
renderWarning?: TTTDDialog.renderWarning;
}) => {
const messagesEndRef = useRef<HTMLDivElement>(null);
@@ -113,12 +111,12 @@ export const ChatInterface = ({
<div className="chat-interface">
<div className="chat-interface__messages">
{messages.length === 0 ? (
<div className="chat-interface__empty-state">
<div className="chat-interface__empty-state-content">
<h3>{placeholder.title}</h3>
<p>{placeholder.description}</p>
<p>{placeholder.hint}</p>
</div>
<div className="chat-interface__welcome-screen">
{renderWelcomeScreen ? (
renderWelcomeScreen({ rateLimits: rateLimits ?? null })
) : (
<TTDWelcomeMessage />
)}
</div>
) : (
messages.map((message, index) => (
@@ -40,6 +40,7 @@ export const TTDChatPanel = ({
onInsertMessage,
onRetry,
onViewAsMermaid,
renderWelcomeScreen,
renderWarning,
}: {
chatId: string;
@@ -68,6 +69,7 @@ export const TTDChatPanel = ({
onViewAsMermaid: () => void;
renderWelcomeScreen?: TTTDDialog.renderWelcomeScreen;
renderWarning?: TTTDDialog.renderWarning;
}) => {
const [rateLimits] = useAtom(rateLimitsAtom);
@@ -151,11 +153,7 @@ export const TTDChatPanel = ({
onInsertMessage={onInsertMessage}
onRetry={onRetry}
rateLimits={rateLimits}
placeholder={{
title: t("chat.placeholder.title"),
description: t("chat.placeholder.description"),
hint: t("chat.placeholder.hint"),
}}
renderWelcomeScreen={renderWelcomeScreen}
renderWarning={renderWarning}
/>
</TTDDialogPanel>
@@ -15,6 +15,8 @@ import { TTDDialogTab } from "./TTDDialogTab";
import "./TTDDialog.scss";
import { TTDWelcomeMessage } from "./TTDWelcomeMessage";
import type {
MermaidToExcalidrawLibProps,
TTDPersistenceAdapter,
@@ -25,6 +27,7 @@ export const TTDDialog = (
props:
| {
onTextSubmit: TTTDDialog.onTextSubmit;
renderWelcomeScreen?: TTTDDialog.renderWelcomeScreen;
renderWarning?: TTTDDialog.renderWarning;
persistenceAdapter: TTDPersistenceAdapter;
}
@@ -39,6 +42,8 @@ export const TTDDialog = (
return <TTDDialogBase {...props} tab={appState.openDialog.tab} />;
};
TTDDialog.WelcomeMessage = TTDWelcomeMessage;
/**
* Text to diagram (TTD) dialog
*/
@@ -54,6 +59,7 @@ const TTDDialogBase = withInternalFallback(
onTextSubmit(
props: TTTDDialog.OnTextSubmitProps,
): Promise<TTTDDialog.OnTextSubmitRetValue>;
renderWelcomeScreen?: TTTDDialog.renderWelcomeScreen;
renderWarning?: TTTDDialog.renderWarning;
persistenceAdapter: TTDPersistenceAdapter;
}
@@ -110,6 +116,7 @@ const TTDDialogBase = withInternalFallback(
<TextToDiagram
mermaidToExcalidrawLib={mermaidToExcalidrawLib}
onTextSubmit={rest.onTextSubmit}
renderWelcomeScreen={rest.renderWelcomeScreen}
renderWarning={rest.renderWarning}
persistenceAdapter={rest.persistenceAdapter}
/>
@@ -1,4 +1,4 @@
import * as RadixTabs from "@radix-ui/react-tabs";
import { Tabs as RadixTabs } from "radix-ui";
export const TTDDialogTab = ({
tab,
@@ -1,4 +1,4 @@
import * as RadixTabs from "@radix-ui/react-tabs";
import { Tabs as RadixTabs } from "radix-ui";
export const TTDDialogTabTrigger = ({
children,
@@ -1,4 +1,4 @@
import * as RadixTabs from "@radix-ui/react-tabs";
import { Tabs as RadixTabs } from "radix-ui";
export const TTDDialogTabTriggers = ({
children,
@@ -1,4 +1,4 @@
import * as RadixTabs from "@radix-ui/react-tabs";
import { Tabs as RadixTabs } from "radix-ui";
import { useRef } from "react";
import { isMemberOf } from "@excalidraw/common";
@@ -0,0 +1,11 @@
import { t } from "../../i18n";
export const TTDWelcomeMessage = () => {
return (
<div className="chat-interface__welcome-screen__welcome-message">
<h3>{t("chat.placeholder.title")}</h3>
<p>{t("chat.placeholder.description")}</p>
<p>{t("chat.placeholder.hint")}</p>
</div>
);
};
@@ -35,6 +35,7 @@ import type {
const TextToDiagramContent = ({
mermaidToExcalidrawLib,
onTextSubmit,
renderWelcomeScreen,
renderWarning,
persistenceAdapter,
}: {
@@ -42,6 +43,7 @@ const TextToDiagramContent = ({
onTextSubmit: (
props: TTTDDialog.OnTextSubmitProps,
) => Promise<TTTDDialog.OnTextSubmitRetValue>;
renderWelcomeScreen?: TTTDDialog.renderWelcomeScreen;
renderWarning?: TTTDDialog.renderWarning;
persistenceAdapter: TTDPersistenceAdapter;
}) => {
@@ -220,6 +222,7 @@ const TextToDiagramContent = ({
onRetry={handleRetry}
onViewAsMermaid={onViewAsMermaid}
renderWarning={renderWarning}
renderWelcomeScreen={renderWelcomeScreen}
/>
{showPreview && (
<TTDPreviewPanel
@@ -237,6 +240,7 @@ const TextToDiagramContent = ({
export const TextToDiagram = ({
mermaidToExcalidrawLib,
onTextSubmit,
renderWelcomeScreen,
renderWarning,
persistenceAdapter,
}: {
@@ -244,6 +248,7 @@ export const TextToDiagram = ({
onTextSubmit(
props: TTTDDialog.OnTextSubmitProps,
): Promise<TTTDDialog.OnTextSubmitRetValue>;
renderWelcomeScreen?: TTTDDialog.renderWelcomeScreen;
renderWarning?: TTTDDialog.renderWarning;
persistenceAdapter: TTDPersistenceAdapter;
}) => {
@@ -251,6 +256,7 @@ export const TextToDiagram = ({
<TextToDiagramContent
mermaidToExcalidrawLib={mermaidToExcalidrawLib}
onTextSubmit={onTextSubmit}
renderWelcomeScreen={renderWelcomeScreen}
renderWarning={renderWarning}
persistenceAdapter={persistenceAdapter}
/>
@@ -116,4 +116,9 @@ export namespace TTTDDialog {
export type renderWarning = (
chatMessage: TChat.ChatMessage,
) => React.ReactNode | undefined;
export type renderWelcomeScreen = (props: {
/** null if not rate limit data currently available */
rateLimits: RateLimits | null;
}) => React.ReactNode | undefined;
}
@@ -3,7 +3,7 @@ import clsx from "clsx";
import { capitalizeString } from "@excalidraw/common";
import * as Popover from "@radix-ui/react-popover";
import { Popover } from "radix-ui";
import { trackEvent } from "../analytics";
+1 -1
View File
@@ -1,4 +1,4 @@
import * as Popover from "@radix-ui/react-popover";
import { Popover } from "radix-ui";
import clsx from "clsx";
import React, { useLayoutEffect } from "react";
@@ -2,24 +2,35 @@
.excalidraw {
.dropdown-menu {
position: absolute;
top: 2.5rem;
margin-top: 0.5rem;
max-width: 16rem;
z-index: 1;
&--placement-top {
top: auto;
bottom: 100%;
margin-top: 0;
margin-bottom: 0.5rem;
}
&__submenu-trigger {
&[aria-expanded="true"] {
.dropdown-menu-item {
background-color: var(--button-hover-bg);
}
}
}
&__submenu-trigger-icon {
margin-left: auto;
opacity: 0.5;
svg g {
stroke-width: 2;
}
}
&--mobile {
width: 100%;
row-gap: 0.75rem;
// When main menu is in the top toolbar, position relative to trigger
&.main-menu-dropdown {
&.main-menu {
min-width: 232px;
margin-top: 0;
margin-bottom: 0;
@@ -32,10 +43,6 @@
.dropdown-menu-container {
padding: 8px 8px;
box-sizing: border-box;
max-height: calc(
100svh - var(--editor-container-padding) * 2 - 2.25rem
);
box-shadow: var(--shadow-island);
border-radius: var(--border-radius-lg);
position: relative;
transition: box-shadow 0.5s ease-in-out;
@@ -51,14 +58,25 @@
.dropdown-menu-container {
background-color: var(--island-bg-color);
overflow-y: auto;
--gap: 2;
display: flex;
flex-direction: column;
gap: 1px;
box-shadow: var(--box-shadow, var(--shadow-island));
max-height: calc(100svh - var(--editor-container-padding) * 2 - 2.25rem);
@at-root .excalidraw.theme--dark#{&} {
box-shadow: var(--box-shadow, var(--shadow-island)),
0 0 0 1px rgba(0, 0, 0, 0.15);
}
}
.dropdown-menu-item-base {
display: flex;
column-gap: 0.625rem;
padding: 0 0.5rem;
font-size: 0.875rem;
color: var(--color-on-surface);
width: 100%;
@@ -115,11 +133,9 @@
.dropdown-menu-item {
height: 2rem;
margin: 1px;
padding: 0 0.5rem;
width: calc(100% - 2px);
background-color: transparent;
border: 1px solid transparent;
border: none;
align-items: center;
cursor: pointer;
border-radius: var(--border-radius-md);
@@ -162,7 +178,7 @@
&:active {
background-color: var(--button-hover-bg);
border-color: var(--color-brand-active);
box-shadow: 0 0 0 1px var(--color-brand-active);
}
svg {
@@ -223,7 +239,7 @@
}
&:active {
border-color: var(--color-primary);
box-shadow: 0 0 0 1px var(--color-primary);
}
&[disabled] {
@@ -235,7 +251,7 @@
}
&:active {
border-color: transparent;
box-shadow: none;
}
@at-root .excalidraw.theme--dark#{&} {
@@ -1,12 +1,18 @@
import React from "react";
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
import { CLASSES } from "@excalidraw/common";
import DropdownMenuContent from "./DropdownMenuContent";
import DropdownMenuGroup from "./DropdownMenuGroup";
import DropdownMenuItem from "./DropdownMenuItem";
import DropdownMenuItemCustom from "./DropdownMenuItemCustom";
import DropdownMenuItemLink from "./DropdownMenuItemLink";
import MenuSeparator from "./DropdownMenuSeparator";
import DropdownMenuSub from "./DropdownMenuSub";
import DropdownMenuTrigger from "./DropdownMenuTrigger";
import DropdownMenuItemCheckbox from "./DropdownMenuItemCheckbox";
import {
getMenuContentComponent,
getMenuTriggerComponent,
@@ -17,44 +23,47 @@ import "./DropdownMenu.scss";
const DropdownMenu = ({
children,
open,
placement,
}: {
children?: React.ReactNode;
open: boolean;
placement?: "top" | "bottom";
}) => {
const MenuTriggerComp = getMenuTriggerComponent(children);
const MenuContentComp = getMenuContentComponent(children);
// clone the MenuContentComp to pass the placement prop
const MenuContentCompWithPlacement =
const MenuContentWithState =
MenuContentComp && React.isValidElement(MenuContentComp)
? React.cloneElement(MenuContentComp as React.ReactElement<any>, {
placement,
})
? React.cloneElement(
MenuContentComp as React.ReactElement<
React.ComponentProps<typeof DropdownMenuContent>
>,
{ open },
)
: MenuContentComp;
return (
<div
className="dropdown-menu-container"
style={{
// remove this div from box layout
display: "contents",
}}
>
{MenuTriggerComp}
{open && MenuContentCompWithPlacement}
</div>
<DropdownMenuPrimitive.Root open={open} modal={false}>
<div
className={CLASSES.DROPDOWN_MENU_EVENT_WRAPPER}
style={{
// remove this div from box layout
display: "contents",
}}
>
{MenuTriggerComp}
{MenuContentWithState}
</div>
</DropdownMenuPrimitive.Root>
);
};
DropdownMenu.Trigger = DropdownMenuTrigger;
DropdownMenu.Content = DropdownMenuContent;
DropdownMenu.Item = DropdownMenuItem;
DropdownMenu.ItemCheckbox = DropdownMenuItemCheckbox;
DropdownMenu.ItemLink = DropdownMenuItemLink;
DropdownMenu.ItemCustom = DropdownMenuItemCustom;
DropdownMenu.Group = DropdownMenuGroup;
DropdownMenu.Separator = MenuSeparator;
DropdownMenu.Sub = DropdownMenuSub;
export default DropdownMenu;
@@ -1,7 +1,9 @@
import clsx from "clsx";
import React, { useEffect, useRef } from "react";
import React, { useCallback, useEffect, useRef } from "react";
import { EVENT, KEYS } from "@excalidraw/common";
import { CLASSES, EVENT, KEYS } from "@excalidraw/common";
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
import { useOutsideClick } from "../../hooks/useOutsideClick";
import { useStable } from "../../hooks/useStable";
@@ -16,8 +18,9 @@ const MenuContent = ({
onClickOutside,
className = "",
onSelect,
open = true,
align = "end",
style,
placement = "bottom",
}: {
children?: React.ReactNode;
onClickOutside?: () => void;
@@ -26,26 +29,36 @@ const MenuContent = ({
* Called when any menu item is selected (clicked on).
*/
onSelect?: (event: Event) => void;
open?: boolean;
style?: React.CSSProperties;
placement?: "top" | "bottom";
align?: "start" | "center" | "end";
}) => {
const editorInterface = useEditorInterface();
const menuRef = useRef<HTMLDivElement>(null);
const callbacksRef = useStable({ onClickOutside });
useOutsideClick(menuRef, (event) => {
// prevents closing if clicking on the trigger button
if (
!menuRef.current
?.closest(".dropdown-menu-container")
?.contains(event.target)
) {
callbacksRef.onClickOutside?.();
}
});
useOutsideClick(
menuRef,
useCallback(
(event) => {
// prevents closing if clicking on the trigger button
if (
!menuRef.current
?.closest(`.${CLASSES.DROPDOWN_MENU_EVENT_WRAPPER}`)
?.contains(event.target)
) {
callbacksRef.onClickOutside?.();
}
},
[callbacksRef],
),
);
useEffect(() => {
if (!open) {
return;
}
const onKeyDown = (event: KeyboardEvent) => {
if (event.key === KEYS.ESCAPE) {
event.stopImmediatePropagation();
@@ -63,35 +76,33 @@ const MenuContent = ({
return () => {
document.removeEventListener(EVENT.KEYDOWN, onKeyDown, option);
};
}, [callbacksRef]);
}, [callbacksRef, open]);
const classNames = clsx(`dropdown-menu ${className}`, {
"dropdown-menu--mobile": editorInterface.formFactor === "phone",
"dropdown-menu--placement-top": placement === "top",
}).trim();
return (
<DropdownMenuContentPropsContext.Provider value={{ onSelect }}>
<div
<DropdownMenuPrimitive.Content
ref={menuRef}
className={classNames}
style={style}
data-testid="dropdown-menu"
align={align}
sideOffset={8}
onCloseAutoFocus={(event: Event) => event.preventDefault()}
>
{/* the zIndex ensures this menu has higher stacking order,
see https://github.com/excalidraw/excalidraw/pull/1445 */}
{editorInterface.formFactor === "phone" ? (
<Stack.Col className="dropdown-menu-container">{children}</Stack.Col>
) : (
<Island
className="dropdown-menu-container"
padding={2}
style={{ zIndex: 2 }}
>
<Island className="dropdown-menu-container" padding={2}>
{children}
</Island>
)}
</div>
</DropdownMenuPrimitive.Content>
</DropdownMenuContentPropsContext.Provider>
);
};
@@ -1,78 +1,62 @@
import React, { useEffect, useRef } from "react";
import React from "react";
import { THEME } from "@excalidraw/common";
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
import type { ValueOf } from "@excalidraw/common/utility-types";
import { useExcalidrawAppState } from "../App";
import MenuItemContent from "./DropdownMenuItemContent";
import {
getDropdownMenuItemClassName,
useHandleDropdownMenuItemClick,
useHandleDropdownMenuItemSelect,
} from "./common";
import MenuItemContent from "./DropdownMenuItemContent";
import type { JSX } from "react";
const DropdownMenuItem = ({
icon,
value,
order,
children,
shortcut,
className,
hovered,
selected,
textStyle,
onSelect,
onClick,
badge,
...rest
}: {
export type DropdownMenuItemProps = {
icon?: JSX.Element;
badge?: React.ReactNode;
value?: string | number | undefined;
order?: number;
onSelect?: (event: Event) => void;
children: React.ReactNode;
shortcut?: string;
hovered?: boolean;
selected?: boolean;
textStyle?: React.CSSProperties;
className?: string;
badge?: React.ReactNode;
} & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "onSelect">) => {
const handleClick = useHandleDropdownMenuItemClick(onClick, onSelect);
const ref = useRef<HTMLButtonElement>(null);
} & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "onSelect">;
useEffect(() => {
if (hovered) {
if (order === 0) {
// scroll into the first item differently, so it's visible what is above (i.e. group title)
ref.current?.scrollIntoView({ block: "end" });
} else {
ref.current?.scrollIntoView({ block: "nearest" });
}
}
}, [hovered, order]);
const DropdownMenuItem = ({
icon,
badge,
value,
children,
shortcut,
className,
selected,
onSelect,
...rest
}: DropdownMenuItemProps) => {
const handleSelect = useHandleDropdownMenuItemSelect(onSelect);
return (
<button
{...rest}
ref={ref}
value={value}
onClick={handleClick}
className={getDropdownMenuItemClassName(className, selected, hovered)}
title={rest.title ?? rest["aria-label"]}
<DropdownMenuPrimitive.Item
className="radix-menu-item"
onSelect={handleSelect}
asChild
>
<MenuItemContent
textStyle={textStyle}
icon={icon}
shortcut={shortcut}
badge={badge}
<button
{...rest}
value={value}
className={getDropdownMenuItemClassName(className, selected)}
title={rest.title ?? rest["aria-label"]}
>
{children}
</MenuItemContent>
</button>
<MenuItemContent icon={icon} shortcut={shortcut} badge={badge}>
{children}
</MenuItemContent>
</button>
</DropdownMenuPrimitive.Item>
);
};
DropdownMenuItem.displayName = "DropdownMenuItem";
@@ -0,0 +1,15 @@
import { checkIcon, emptyIcon } from "../icons";
import DropdownMenuItem from "./DropdownMenuItem";
import type { DropdownMenuItemProps } from "./DropdownMenuItem";
const DropdownMenuItemCheckbox = (
props: Omit<DropdownMenuItemProps, "icon"> & { checked: boolean },
) => {
return (
<DropdownMenuItem {...props} icon={props.checked ? checkIcon : emptyIcon} />
);
};
export default DropdownMenuItemCheckbox;
@@ -27,9 +27,7 @@ const DropdownMenuItemContentRadio = <T,>({
return (
<>
<div className="dropdown-menu-item-base dropdown-menu-item-bare">
<label className="dropdown-menu-item__text" htmlFor={name}>
{children}
</label>
<label className="dropdown-menu-item__text">{children}</label>
<RadioGroup
name={name}
value={value}
@@ -1,9 +1,11 @@
import React from "react";
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
import MenuItemContent from "./DropdownMenuItemContent";
import {
getDropdownMenuItemClassName,
useHandleDropdownMenuItemClick,
useHandleDropdownMenuItemSelect,
} from "./common";
import type { JSX } from "react";
@@ -28,23 +30,28 @@ const DropdownMenuItemLink = ({
onSelect?: (event: Event) => void;
rel?: string;
} & React.AnchorHTMLAttributes<HTMLAnchorElement>) => {
const handleClick = useHandleDropdownMenuItemClick(rest.onClick, onSelect);
const handleSelect = useHandleDropdownMenuItemSelect(onSelect);
return (
// eslint-disable-next-line react/jsx-no-target-blank
<a
{...rest}
href={href}
target="_blank"
rel={rel || "noopener"}
className={getDropdownMenuItemClassName(className, selected)}
title={rest.title ?? rest["aria-label"]}
onClick={handleClick}
<DropdownMenuPrimitive.Item
className="radix-menu-item"
onSelect={handleSelect}
asChild
>
<MenuItemContent icon={icon} shortcut={shortcut}>
{children}
</MenuItemContent>
</a>
<a
{...rest}
href={href}
target="_blank"
rel={`noopener ${rel}`}
className={getDropdownMenuItemClassName(className, selected)}
title={rest.title ?? rest["aria-label"]}
>
<MenuItemContent icon={icon} shortcut={shortcut}>
{children}
</MenuItemContent>
</a>
</DropdownMenuPrimitive.Item>
);
};
@@ -5,7 +5,7 @@ const MenuSeparator = () => (
style={{
height: "1px",
backgroundColor: "var(--default-border-color)",
margin: ".5rem 0",
margin: "6px 0",
flex: "0 0 auto",
}}
/>
@@ -0,0 +1,26 @@
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
import DropdownMenuSubContent from "./DropdownMenuSubContent";
import DropdownMenuSubTrigger from "./DropdownMenuSubTrigger";
import {
getSubMenuContentComponent,
getSubMenuTriggerComponent,
} from "./dropdownMenuUtils";
const DropdownMenuSub = ({ children }: { children?: React.ReactNode }) => {
const MenuTriggerComp = getSubMenuTriggerComponent(children);
const MenuContentComp = getSubMenuContentComponent(children);
return (
<DropdownMenuPrimitive.Sub>
{MenuTriggerComp}
{MenuContentComp}
</DropdownMenuPrimitive.Sub>
);
};
DropdownMenuSub.Trigger = DropdownMenuSubTrigger;
DropdownMenuSub.Content = DropdownMenuSubContent;
DropdownMenuSub.displayName = "DropdownMenuSub";
export default DropdownMenuSub;
@@ -0,0 +1,71 @@
import clsx from "clsx";
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
import { useCallback, useState } from "react";
import { useEditorInterface } from "../App";
import { Island } from "../Island";
import Stack from "../Stack";
const BASE_ALIGN_OFFSET = -4;
const BASE_SIDE_OFFSET = 4;
const DropdownMenuSubContent = ({
children,
className,
}: {
children?: React.ReactNode;
className?: string;
}) => {
const editorInterface = useEditorInterface();
const classNames = clsx(`dropdown-menu dropdown-submenu ${className}`, {
"dropdown-menu--mobile": editorInterface.formFactor === "phone",
}).trim();
const callbacksRef = useCallback((node: HTMLDivElement | null) => {
if (node) {
const parentContainer = node.closest(".dropdown-menu-container");
const parentRect = parentContainer?.getBoundingClientRect();
if (parentRect) {
const menuWidth = node.getBoundingClientRect().width;
const viewportWidth = window.innerWidth;
const spaceRemaining = viewportWidth - parentRect.right;
if (spaceRemaining < menuWidth + 20) {
setSideOffset(spaceRemaining - menuWidth + BASE_ALIGN_OFFSET);
setAlignOffset(BASE_ALIGN_OFFSET + 8);
}
}
}
}, []);
const [sideOffset, setSideOffset] = useState(BASE_SIDE_OFFSET);
const [alignOffset, setAlignOffset] = useState(BASE_ALIGN_OFFSET);
return (
<DropdownMenuPrimitive.SubContent
className={classNames}
sideOffset={sideOffset}
alignOffset={alignOffset}
collisionPadding={8}
ref={callbacksRef}
>
{editorInterface.formFactor === "phone" ? (
<Stack.Col className="dropdown-menu-container">{children}</Stack.Col>
) : (
<Island
className="dropdown-menu-container"
padding={2}
style={{ zIndex: 1 }}
>
{children}
</Island>
)}
</DropdownMenuPrimitive.SubContent>
);
};
export default DropdownMenuSubContent;
DropdownMenuSubContent.displayName = "DropdownMenuSubContent";
@@ -0,0 +1,38 @@
import React from "react";
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
import { chevronRight } from "../icons";
import { getDropdownMenuItemClassName } from "./common";
import MenuItemContent from "./DropdownMenuItemContent";
import type { JSX } from "react";
const DropdownMenuSubTrigger = ({
children,
icon,
shortcut,
className,
}: {
children: React.ReactNode;
icon?: JSX.Element;
shortcut?: string;
className?: string;
}) => {
return (
<DropdownMenuPrimitive.SubTrigger
className={`${getDropdownMenuItemClassName(
className,
)} dropdown-menu__submenu-trigger`}
>
<MenuItemContent icon={icon} shortcut={shortcut}>
{children}
</MenuItemContent>
<div className="dropdown-menu__submenu-trigger-icon">{chevronRight}</div>
</DropdownMenuPrimitive.SubTrigger>
);
};
export default DropdownMenuSubTrigger;
DropdownMenuSubTrigger.displayName = "DropdownMenuSubTrigger";
@@ -1,5 +1,7 @@
import clsx from "clsx";
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
import { useEditorInterface } from "../App";
const MenuTrigger = ({
@@ -23,7 +25,7 @@ const MenuTrigger = ({
},
).trim();
return (
<button
<DropdownMenuPrimitive.Trigger
className={classNames}
onClick={onToggle}
type="button"
@@ -32,7 +34,7 @@ const MenuTrigger = ({
{...rest}
>
{children}
</button>
</DropdownMenuPrimitive.Trigger>
);
};
@@ -1,6 +1,6 @@
import React, { useContext } from "react";
import { EVENT, composeEventHandlers } from "@excalidraw/common";
import { composeEventHandlers } from "@excalidraw/common";
export const DropdownMenuContentPropsContext = React.createContext<{
onSelect?: (event: Event) => void;
@@ -11,28 +11,17 @@ export const getDropdownMenuItemClassName = (
selected = false,
hovered = false,
) => {
return `dropdown-menu-item dropdown-menu-item-base ${className}
${selected ? "dropdown-menu-item--selected" : ""} ${
hovered ? "dropdown-menu-item--hovered" : ""
}`.trim();
return `dropdown-menu-item dropdown-menu-item-base ${className} ${
selected ? "dropdown-menu-item--selected" : ""
} ${hovered ? "dropdown-menu-item--hovered" : ""}`.trim();
};
export const useHandleDropdownMenuItemClick = (
origOnClick:
| React.MouseEventHandler<HTMLAnchorElement | HTMLButtonElement>
| undefined,
export const useHandleDropdownMenuItemSelect = (
onSelect: ((event: Event) => void) | undefined,
) => {
const DropdownMenuContentProps = useContext(DropdownMenuContentPropsContext);
return composeEventHandlers(origOnClick, (event) => {
const itemSelectEvent = new CustomEvent(EVENT.MENU_ITEM_SELECT, {
bubbles: true,
cancelable: true,
});
onSelect?.(itemSelectEvent);
if (!itemSelectEvent.defaultPrevented) {
DropdownMenuContentProps.onSelect?.(itemSelectEvent);
}
return composeEventHandlers(onSelect, (event) => {
DropdownMenuContentProps.onSelect?.(event);
});
};
@@ -1,6 +1,6 @@
import React from "react";
export const getMenuTriggerComponent = (children: React.ReactNode) => {
const getMenuComponent = (component: string) => (children: React.ReactNode) => {
const comp = React.Children.toArray(children).find(
(child) =>
React.isValidElement(child) &&
@@ -8,7 +8,7 @@ export const getMenuTriggerComponent = (children: React.ReactNode) => {
//@ts-ignore
child?.type.displayName &&
//@ts-ignore
child.type.displayName === "DropdownMenuTrigger",
child.type.displayName === component,
);
if (!comp) {
return null;
@@ -17,19 +17,11 @@ export const getMenuTriggerComponent = (children: React.ReactNode) => {
return comp;
};
export const getMenuContentComponent = (children: React.ReactNode) => {
const comp = React.Children.toArray(children).find(
(child) =>
React.isValidElement(child) &&
typeof child.type !== "string" &&
//@ts-ignore
child?.type.displayName &&
//@ts-ignore
child.type.displayName === "DropdownMenuContent",
);
if (!comp) {
return null;
}
//@ts-ignore
return comp;
};
export const getMenuTriggerComponent = getMenuComponent("DropdownMenuTrigger");
export const getMenuContentComponent = getMenuComponent("DropdownMenuContent");
export const getSubMenuTriggerComponent = getMenuComponent(
"DropdownMenuSubTrigger",
);
export const getSubMenuContentComponent = getMenuComponent(
"DropdownMenuSubContent",
);
+44 -7
View File
@@ -1287,13 +1287,21 @@ export const EdgeRoundIcon = createIcon(
tablerIconProps,
);
export const ArrowheadNoneIcon = createIcon(
<g stroke="currentColor" opacity={0.3} strokeWidth={2}>
<path d="M12 12l9 0" />
<path d="M3 9l6 6" />
<path d="M3 15l6 -6" />
</g>,
tablerIconProps,
export const ArrowheadNoneIcon = React.memo(
({ flip = false }: { flip?: boolean }) =>
createIcon(
<g
transform={flip ? "translate(24, 0) scale(-1, 1)" : ""}
stroke="currentColor"
opacity={0.3}
strokeWidth={2}
>
<path d="M12 12l-9 0" />
<path d="M21 9l-6 6" />
<path d="M21 15l-6 -6" />
</g>,
tablerIconProps,
),
);
export const ArrowheadArrowIcon = React.memo(
@@ -2396,3 +2404,32 @@ export const presentationIcon = createIcon(
</g>,
tablerIconProps,
);
// empty placeholder icon (used for alignment in menus)
export const emptyIcon = <div style={{ width: "1rem", height: "1rem" }} />;
//tabler-icons: chevron-right
export const chevronRight = createIcon(
<g strokeWidth="1.5">
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<polyline points="9 6 15 12 9 18" />
</g>,
tablerIconProps,
);
// tabler-icons: adjustments-horizontal
export const settingsIcon = createIcon(
<g strokeWidth={1.25}>
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M14 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" />
<path d="M4 6l8 0" />
<path d="M16 6l4 0" />
<path d="M8 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" />
<path d="M4 12l2 0" />
<path d="M10 12l10 0" />
<path d="M17 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" />
<path d="M4 18l11 0" />
<path d="M19 18l1 0" />
</g>,
tablerIconProps,
);
@@ -9,9 +9,14 @@ import {
actionLoadScene,
actionSaveToActiveFile,
actionShortcuts,
actionToggleGridMode,
actionToggleObjectsSnapMode,
actionToggleSearchMenu,
actionToggleStats,
actionToggleTheme,
actionToggleZenMode,
} from "../../actions";
import { actionToggleViewMode } from "../../actions/actionToggleViewMode";
import { getShortcutFromShortcutName } from "../../actions/shortcuts";
import { trackEvent } from "../../analytics";
import { useUIAppState } from "../../context/ui-appState";
@@ -23,13 +28,16 @@ import {
useExcalidrawActionManager,
useExcalidrawElements,
useAppProps,
useApp,
} from "../App";
import { openConfirmModal } from "../OverwriteConfirm/OverwriteConfirmState";
import Trans from "../Trans";
import DropdownMenuItem from "../dropdownMenu/DropdownMenuItem";
import DropdownMenuItemCheckbox from "../dropdownMenu/DropdownMenuItemCheckbox";
import DropdownMenuItemContentRadio from "../dropdownMenu/DropdownMenuItemContentRadio";
import DropdownMenuItemLink from "../dropdownMenu/DropdownMenuItemLink";
import { GithubIcon, DiscordIcon, XBrandIcon } from "../icons";
import DropdownMenuSub from "../dropdownMenu/DropdownMenuSub";
import { GithubIcon, DiscordIcon, XBrandIcon, settingsIcon } from "../icons";
import {
boltIcon,
DeviceDesktopIcon,
@@ -306,10 +314,14 @@ export const ChangeCanvasBackground = () => {
return null;
}
return (
<div style={{ marginTop: "0.5rem" }}>
<div style={{ marginTop: "0.75rem" }}>
<div
data-testid="canvas-background-label"
style={{ fontSize: ".75rem", marginBottom: ".5rem" }}
style={{
fontSize: "0.875rem",
marginBottom: "0.25rem",
marginLeft: "0.5rem",
}}
>
{t("labels.canvasBackground")}
</div>
@@ -393,3 +405,152 @@ export const LiveCollaborationTrigger = ({
};
LiveCollaborationTrigger.displayName = "LiveCollaborationTrigger";
const PreferencesToggleToolLockItem = () => {
const { t } = useI18n();
const app = useApp();
const appState = useUIAppState();
return (
<DropdownMenuItemCheckbox
checked={appState.activeTool.locked}
shortcut={getShortcutFromShortcutName("toolLock")}
onSelect={(event) => {
app.toggleLock();
event.preventDefault();
}}
>
{t("labels.preferences_toolLock")}
</DropdownMenuItemCheckbox>
);
};
const PreferencesToggleSnapModeItem = () => {
const { t } = useI18n();
const actionManager = useExcalidrawActionManager();
const appState = useUIAppState();
return (
<DropdownMenuItemCheckbox
checked={appState.objectsSnapModeEnabled}
shortcut={getShortcutFromShortcutName("objectsSnapMode")}
onSelect={(event) => {
actionManager.executeAction(actionToggleObjectsSnapMode);
event.preventDefault();
}}
>
{t("buttons.objectsSnapMode")}
</DropdownMenuItemCheckbox>
);
};
export const PreferencesToggleGridModeItem = () => {
const { t } = useI18n();
const actionManager = useExcalidrawActionManager();
const appState = useUIAppState();
return (
<DropdownMenuItemCheckbox
checked={appState.gridModeEnabled}
shortcut={getShortcutFromShortcutName("gridMode")}
onSelect={(event) => {
actionManager.executeAction(actionToggleGridMode);
event.preventDefault();
}}
>
{t("labels.toggleGrid")}
</DropdownMenuItemCheckbox>
);
};
export const PreferencesToggleZenModeItem = () => {
const { t } = useI18n();
const actionManager = useExcalidrawActionManager();
const appState = useUIAppState();
return (
<DropdownMenuItemCheckbox
checked={appState.zenModeEnabled}
shortcut={getShortcutFromShortcutName("zenMode")}
onSelect={(event) => {
actionManager.executeAction(actionToggleZenMode);
event.preventDefault();
}}
>
{t("buttons.zenMode")}
</DropdownMenuItemCheckbox>
);
};
const PreferencesToggleViewModeItem = () => {
const { t } = useI18n();
const actionManager = useExcalidrawActionManager();
const appState = useUIAppState();
return (
<DropdownMenuItemCheckbox
checked={appState.viewModeEnabled}
shortcut={getShortcutFromShortcutName("viewMode")}
onSelect={(event) => {
actionManager.executeAction(actionToggleViewMode);
event.preventDefault();
}}
>
{t("labels.viewMode")}
</DropdownMenuItemCheckbox>
);
};
const PreferencesToggleElementPropertiesItem = () => {
const { t } = useI18n();
const actionManager = useExcalidrawActionManager();
const appState = useUIAppState();
return (
<DropdownMenuItemCheckbox
checked={appState.stats.open}
shortcut={getShortcutFromShortcutName("stats")}
onSelect={(event) => {
actionManager.executeAction(actionToggleStats);
event.preventDefault();
}}
>
{t("stats.fullTitle")}
</DropdownMenuItemCheckbox>
);
};
export const Preferences = ({
children,
additionalItems,
}: {
children?: React.ReactNode;
additionalItems?: React.ReactNode;
}) => {
const { t } = useI18n();
return (
<DropdownMenuSub>
<DropdownMenuSub.Trigger icon={settingsIcon}>
{t("labels.preferences")}
</DropdownMenuSub.Trigger>
<DropdownMenuSub.Content className="excalidraw-main-menu-preferences-submenu">
{children || (
<>
<PreferencesToggleToolLockItem />
<PreferencesToggleSnapModeItem />
<PreferencesToggleGridModeItem />
<PreferencesToggleZenModeItem />
<PreferencesToggleViewModeItem />
<PreferencesToggleElementPropertiesItem />
</>
)}
{additionalItems}
</DropdownMenuSub.Content>
</DropdownMenuSub>
);
};
Preferences.ToggleToolLock = PreferencesToggleToolLockItem;
Preferences.ToggleSnapMode = PreferencesToggleSnapModeItem;
Preferences.ToggleGridMode = PreferencesToggleGridModeItem;
Preferences.ToggleZenMode = PreferencesToggleZenModeItem;
Preferences.ToggleViewMode = PreferencesToggleViewModeItem;
Preferences.ToggleElementProperties = PreferencesToggleElementPropertiesItem;
Preferences.displayName = "Preferences";
@@ -8,6 +8,7 @@ import { t } from "../../i18n";
import { useEditorInterface, useExcalidrawSetAppState } from "../App";
import { UserList } from "../UserList";
import DropdownMenu from "../dropdownMenu/DropdownMenu";
import DropdownMenuSub from "../dropdownMenu/DropdownMenuSub";
import { withInternalFallback } from "../hoc/withInternalFallback";
import { HamburgerMenuIcon } from "../icons";
@@ -52,12 +53,8 @@ const MainMenu = Object.assign(
onSelect={composeEventHandlers(onSelect, () => {
setAppState({ openMenu: null });
})}
placement="bottom"
className={
editorInterface.formFactor === "phone"
? "main-menu-dropdown"
: ""
}
className="main-menu"
align="start"
>
{children}
{editorInterface.formFactor === "phone" &&
@@ -84,6 +81,7 @@ const MainMenu = Object.assign(
ItemCustom: DropdownMenu.ItemCustom,
Group: DropdownMenu.Group,
Separator: DropdownMenu.Separator,
Sub: DropdownMenuSub,
DefaultItems,
},
);
@@ -29,7 +29,7 @@
// ---------------------------------------------------------------------------
.welcome-screen-decor-hint {
@media (max-height: 599px) {
@media (max-height: 780px) {
display: none !important;
}
@@ -148,6 +148,7 @@
.welcome-screen-center__heading {
font-size: 1.125rem;
text-align: center;
line-height: 1.35rem;
}
.welcome-screen-menu {
+16
View File
@@ -16,6 +16,7 @@
--zIndex-ui-context-menu: 90;
--zIndex-ui-styles-popup: 100;
--zIndex-ui-top: 100;
--zIndex-ui-main-menu: 110;
--zIndex-ui-library: 120;
--zIndex-modal: 1000;
@@ -223,6 +224,18 @@ body.excalidraw-cursor-resize * {
box-shadow: 0 0 0 1px var(--color-brand-hover);
}
// radix doesn't allow differntiating between hover and keyboard active
// states (it's forcing :focus on both).
//
// proper handling would be to disable :focus-visible by default, and enable
// on keyboard arrows (it'd then have to be disabled again, e.g. on keydown
// or container focus)
//
// alas, that is left for another day
[data-radix-collection-item]:focus-visible {
box-shadow: none !important;
}
.buttonList {
.ToolIcon__icon {
all: unset !important;
@@ -670,6 +683,9 @@ body.excalidraw-cursor-resize * {
}
}
.main-menu {
z-index: var(--zIndex-ui-main-menu);
}
.main-menu-trigger {
@include filledButtonOnCanvas;
}
+7 -1
View File
@@ -82,7 +82,12 @@ import {
getNormalizedZoom,
} from "../scene";
import type { AppState, BinaryFiles, LibraryItem } from "../types";
import type {
AppState,
BinaryFiles,
LibraryItem,
NormalizedZoomValue,
} from "../types";
import type { ImportedDataState, LegacyAppState } from "./types";
type RestoredAppState = Omit<
@@ -212,6 +217,7 @@ const repairBinding = <T extends ExcalidrawArrowElement>(
boundElement,
startOrEnd,
elementsMap,
{ value: 1 as NormalizedZoomValue },
) || p;
const { fixedPoint } = calculateFixedPointForNonElbowArrowBinding(
element,
+2
View File
@@ -317,3 +317,5 @@ export { getDataURL } from "./data/blob";
export { isElementLink } from "@excalidraw/element";
export { setCustomTextMetricsProvider } from "@excalidraw/element";
export { CommandPalette } from "./components/CommandPalette/CommandPalette";
+52 -2
View File
@@ -557,7 +557,9 @@
},
"welcomeScreen": {
"app": {
"center_heading": "جميع بياناتك محفوظة محليًا في المتصفح الخاص بك.",
"center_heading": "",
"center_heading_line2": "",
"center_heading_line3": "",
"center_heading_plus": "هل تريد الانتقال إلى Excalidraw+ بدلاً من ذلك؟",
"menuHint": "التصدير، التفضيلات، اللغات..."
},
@@ -612,7 +614,55 @@
"button": "إدراج",
"description": "حاليًا، يتم دعم <flowchartLink>مخططات التدفق</flowchartLink>، <sequenceLink>التسلسلات</sequenceLink>، و<classLink>الفئات</classLink> فقط. سيتم عرض الأنواع الأخرى كصورة في Excalidraw.",
"syntax": "صيغة Mermaid",
"preview": "معاينة"
"preview": "معاينة",
"label": "",
"inputPlaceholder": ""
},
"ttd": {
"error": ""
},
"chat": {
"inputPlaceholder": "",
"inputPlaceholderWithMessages": "",
"generating": "",
"rateLimitRemaining": "",
"role": {
"user": "",
"assistant": "",
"system": ""
},
"aiBeta": "",
"label": "",
"menu": "",
"newChat": "",
"deleteChat": "",
"deleteMessage": "",
"viewAsMermaid": "",
"placeholder": {
"title": "",
"description": "",
"hint": ""
},
"preview": "",
"insert": "",
"retry": "",
"errors": {
"promptTooShort": "",
"promptTooLong": "",
"generationFailed": "",
"invalidDiagram": "",
"fixInMermaid": "",
"aiRepair": "",
"requestAborted": "",
"requestFailed": "",
"mermaidParseError": ""
},
"rateLimit": {
"messageLimit": "",
"generalRateLimit": "",
"messageLimitInputPlaceholder": ""
},
"upsellBtnLabel": ""
},
"quickSearch": {
"placeholder": "بحث سريع"
+51 -1
View File
@@ -558,6 +558,8 @@
"welcomeScreen": {
"app": {
"center_heading": "",
"center_heading_line2": "",
"center_heading_line3": "",
"center_heading_plus": "",
"menuHint": ""
},
@@ -612,7 +614,55 @@
"button": "",
"description": "",
"syntax": "",
"preview": ""
"preview": "",
"label": "",
"inputPlaceholder": ""
},
"ttd": {
"error": ""
},
"chat": {
"inputPlaceholder": "",
"inputPlaceholderWithMessages": "",
"generating": "",
"rateLimitRemaining": "",
"role": {
"user": "",
"assistant": "",
"system": ""
},
"aiBeta": "",
"label": "",
"menu": "",
"newChat": "",
"deleteChat": "",
"deleteMessage": "",
"viewAsMermaid": "",
"placeholder": {
"title": "",
"description": "",
"hint": ""
},
"preview": "",
"insert": "",
"retry": "",
"errors": {
"promptTooShort": "",
"promptTooLong": "",
"generationFailed": "",
"invalidDiagram": "",
"fixInMermaid": "",
"aiRepair": "",
"requestAborted": "",
"requestFailed": "",
"mermaidParseError": ""
},
"rateLimit": {
"messageLimit": "",
"generalRateLimit": "",
"messageLimitInputPlaceholder": ""
},
"upsellBtnLabel": ""
},
"quickSearch": {
"placeholder": ""
+52 -2
View File
@@ -557,7 +557,9 @@
},
"welcomeScreen": {
"app": {
"center_heading": "Всичките Ви данни са запазени локално в браузъра Ви.",
"center_heading": "",
"center_heading_line2": "",
"center_heading_line3": "",
"center_heading_plus": "",
"menuHint": "Експорт, предпочитания, езици, ..."
},
@@ -612,7 +614,55 @@
"button": "Вмъкни",
"description": "",
"syntax": "Mermaid Синтаксис",
"preview": "Преглед"
"preview": "Преглед",
"label": "",
"inputPlaceholder": ""
},
"ttd": {
"error": ""
},
"chat": {
"inputPlaceholder": "",
"inputPlaceholderWithMessages": "",
"generating": "",
"rateLimitRemaining": "",
"role": {
"user": "",
"assistant": "",
"system": ""
},
"aiBeta": "",
"label": "",
"menu": "",
"newChat": "",
"deleteChat": "",
"deleteMessage": "",
"viewAsMermaid": "",
"placeholder": {
"title": "",
"description": "",
"hint": ""
},
"preview": "",
"insert": "",
"retry": "",
"errors": {
"promptTooShort": "",
"promptTooLong": "",
"generationFailed": "",
"invalidDiagram": "",
"fixInMermaid": "",
"aiRepair": "",
"requestAborted": "",
"requestFailed": "",
"mermaidParseError": ""
},
"rateLimit": {
"messageLimit": "",
"generalRateLimit": "",
"messageLimitInputPlaceholder": ""
},
"upsellBtnLabel": ""
},
"quickSearch": {
"placeholder": ""
+51 -1
View File
@@ -558,6 +558,8 @@
"welcomeScreen": {
"app": {
"center_heading": "",
"center_heading_line2": "",
"center_heading_line3": "",
"center_heading_plus": "",
"menuHint": ""
},
@@ -612,7 +614,55 @@
"button": "",
"description": "",
"syntax": "",
"preview": ""
"preview": "",
"label": "",
"inputPlaceholder": ""
},
"ttd": {
"error": ""
},
"chat": {
"inputPlaceholder": "",
"inputPlaceholderWithMessages": "",
"generating": "",
"rateLimitRemaining": "",
"role": {
"user": "",
"assistant": "",
"system": ""
},
"aiBeta": "",
"label": "",
"menu": "",
"newChat": "",
"deleteChat": "",
"deleteMessage": "",
"viewAsMermaid": "",
"placeholder": {
"title": "",
"description": "",
"hint": ""
},
"preview": "",
"insert": "",
"retry": "",
"errors": {
"promptTooShort": "",
"promptTooLong": "",
"generationFailed": "",
"invalidDiagram": "",
"fixInMermaid": "",
"aiRepair": "",
"requestAborted": "",
"requestFailed": "",
"mermaidParseError": ""
},
"rateLimit": {
"messageLimit": "",
"generalRateLimit": "",
"messageLimitInputPlaceholder": ""
},
"upsellBtnLabel": ""
},
"quickSearch": {
"placeholder": ""
+51 -1
View File
@@ -558,6 +558,8 @@
"welcomeScreen": {
"app": {
"center_heading": "",
"center_heading_line2": "",
"center_heading_line3": "",
"center_heading_plus": "",
"menuHint": ""
},
@@ -612,7 +614,55 @@
"button": "",
"description": "",
"syntax": "",
"preview": ""
"preview": "",
"label": "",
"inputPlaceholder": ""
},
"ttd": {
"error": ""
},
"chat": {
"inputPlaceholder": "",
"inputPlaceholderWithMessages": "",
"generating": "",
"rateLimitRemaining": "",
"role": {
"user": "",
"assistant": "",
"system": ""
},
"aiBeta": "",
"label": "",
"menu": "",
"newChat": "",
"deleteChat": "",
"deleteMessage": "",
"viewAsMermaid": "",
"placeholder": {
"title": "",
"description": "",
"hint": ""
},
"preview": "",
"insert": "",
"retry": "",
"errors": {
"promptTooShort": "",
"promptTooLong": "",
"generationFailed": "",
"invalidDiagram": "",
"fixInMermaid": "",
"aiRepair": "",
"requestAborted": "",
"requestFailed": "",
"mermaidParseError": ""
},
"rateLimit": {
"messageLimit": "",
"generalRateLimit": "",
"messageLimitInputPlaceholder": ""
},
"upsellBtnLabel": ""
},
"quickSearch": {
"placeholder": ""
+52 -2
View File
@@ -557,7 +557,9 @@
},
"welcomeScreen": {
"app": {
"center_heading": "Totes les vostres dades es guarden localment al vostre navegador.",
"center_heading": "",
"center_heading_line2": "",
"center_heading_line3": "",
"center_heading_plus": "Vols anar a Excalidraw+ en comptes?",
"menuHint": "Exportar, preferències, llenguatges..."
},
@@ -612,7 +614,55 @@
"button": "Inseriu",
"description": "Actualment només s'admeten els diagrames <flowchartLink>Flowchart</flowchartLink>, <sequenceLink> Sequence, </sequenceLink> i <classLink> Class </classLink>. Els altres tipus es representaran com a imatge a Excalidraw.",
"syntax": "Sintaxi de Mermaid",
"preview": "Previsualització"
"preview": "Previsualització",
"label": "",
"inputPlaceholder": ""
},
"ttd": {
"error": ""
},
"chat": {
"inputPlaceholder": "",
"inputPlaceholderWithMessages": "",
"generating": "",
"rateLimitRemaining": "",
"role": {
"user": "",
"assistant": "",
"system": ""
},
"aiBeta": "",
"label": "",
"menu": "",
"newChat": "",
"deleteChat": "",
"deleteMessage": "",
"viewAsMermaid": "",
"placeholder": {
"title": "",
"description": "",
"hint": ""
},
"preview": "",
"insert": "",
"retry": "",
"errors": {
"promptTooShort": "",
"promptTooLong": "",
"generationFailed": "",
"invalidDiagram": "",
"fixInMermaid": "",
"aiRepair": "",
"requestAborted": "",
"requestFailed": "",
"mermaidParseError": ""
},
"rateLimit": {
"messageLimit": "",
"generalRateLimit": "",
"messageLimitInputPlaceholder": ""
},
"upsellBtnLabel": ""
},
"quickSearch": {
"placeholder": "Cerca ràpida"
+52 -2
View File
@@ -557,7 +557,9 @@
},
"welcomeScreen": {
"app": {
"center_heading": "Všechna vaše data jsou uložena lokálně ve vašem prohlížeči.",
"center_heading": "",
"center_heading_line2": "",
"center_heading_line3": "",
"center_heading_plus": "Chcete místo toho přejít na Excalidraw+?",
"menuHint": "Export, nastavení, jazyky, ..."
},
@@ -612,7 +614,55 @@
"button": "Vložit",
"description": "",
"syntax": "Mermaid syntaxe",
"preview": "Náhled"
"preview": "Náhled",
"label": "",
"inputPlaceholder": ""
},
"ttd": {
"error": ""
},
"chat": {
"inputPlaceholder": "",
"inputPlaceholderWithMessages": "",
"generating": "",
"rateLimitRemaining": "",
"role": {
"user": "",
"assistant": "",
"system": ""
},
"aiBeta": "",
"label": "",
"menu": "",
"newChat": "",
"deleteChat": "",
"deleteMessage": "",
"viewAsMermaid": "",
"placeholder": {
"title": "",
"description": "",
"hint": ""
},
"preview": "",
"insert": "",
"retry": "",
"errors": {
"promptTooShort": "",
"promptTooLong": "",
"generationFailed": "",
"invalidDiagram": "",
"fixInMermaid": "",
"aiRepair": "",
"requestAborted": "",
"requestFailed": "",
"mermaidParseError": ""
},
"rateLimit": {
"messageLimit": "",
"generalRateLimit": "",
"messageLimitInputPlaceholder": ""
},
"upsellBtnLabel": ""
},
"quickSearch": {
"placeholder": "Rychlé vyhledávání"
+51 -1
View File
@@ -558,6 +558,8 @@
"welcomeScreen": {
"app": {
"center_heading": "",
"center_heading_line2": "",
"center_heading_line3": "",
"center_heading_plus": "",
"menuHint": ""
},
@@ -612,7 +614,55 @@
"button": "",
"description": "",
"syntax": "",
"preview": ""
"preview": "",
"label": "",
"inputPlaceholder": ""
},
"ttd": {
"error": ""
},
"chat": {
"inputPlaceholder": "",
"inputPlaceholderWithMessages": "",
"generating": "",
"rateLimitRemaining": "",
"role": {
"user": "",
"assistant": "",
"system": ""
},
"aiBeta": "",
"label": "",
"menu": "",
"newChat": "",
"deleteChat": "",
"deleteMessage": "",
"viewAsMermaid": "",
"placeholder": {
"title": "",
"description": "",
"hint": ""
},
"preview": "",
"insert": "",
"retry": "",
"errors": {
"promptTooShort": "",
"promptTooLong": "",
"generationFailed": "",
"invalidDiagram": "",
"fixInMermaid": "",
"aiRepair": "",
"requestAborted": "",
"requestFailed": "",
"mermaidParseError": ""
},
"rateLimit": {
"messageLimit": "",
"generalRateLimit": "",
"messageLimitInputPlaceholder": ""
},
"upsellBtnLabel": ""
},
"quickSearch": {
"placeholder": ""
+58 -8
View File
@@ -196,7 +196,7 @@
"multipleResults": "Ergebnisse",
"placeholder": "Text auf Zeichenfläche suchen...",
"frames": "",
"texts": ""
"texts": "Texte"
},
"buttons": {
"clearReset": "Zeichenfläche löschen & Hintergrundfarbe zurücksetzen",
@@ -557,7 +557,9 @@
},
"welcomeScreen": {
"app": {
"center_heading": "Alle Daten werden lokal in Deinem Browser gespeichert.",
"center_heading": "",
"center_heading_line2": "",
"center_heading_line3": "",
"center_heading_plus": "Möchtest du stattdessen zu Excalidraw+ gehen?",
"menuHint": "Exportieren, Einstellungen, Sprachen, ..."
},
@@ -569,7 +571,7 @@
}
},
"colorPicker": {
"color": "",
"color": "Farbe",
"mostUsedCustomColors": "Beliebteste benutzerdefinierte Farben",
"colors": "Farben",
"shades": "Schattierungen",
@@ -612,7 +614,55 @@
"button": "Einfügen",
"description": "Derzeit werden nur <flowchartLink>Flussdiagramme</flowchartLink>, <sequenceLink>Sequenzdiagramme</sequenceLink> und <classLink>Klassendiagramme</classLink> unterstützt. Die anderen Typen werden als Bild in Excalidraw dargestellt.",
"syntax": "Mermaid-Syntax",
"preview": "Vorschau"
"preview": "Vorschau",
"label": "",
"inputPlaceholder": ""
},
"ttd": {
"error": ""
},
"chat": {
"inputPlaceholder": "",
"inputPlaceholderWithMessages": "",
"generating": "",
"rateLimitRemaining": "",
"role": {
"user": "",
"assistant": "",
"system": ""
},
"aiBeta": "",
"label": "",
"menu": "",
"newChat": "",
"deleteChat": "",
"deleteMessage": "",
"viewAsMermaid": "",
"placeholder": {
"title": "",
"description": "",
"hint": ""
},
"preview": "",
"insert": "",
"retry": "",
"errors": {
"promptTooShort": "",
"promptTooLong": "",
"generationFailed": "",
"invalidDiagram": "",
"fixInMermaid": "",
"aiRepair": "",
"requestAborted": "",
"requestFailed": "",
"mermaidParseError": ""
},
"rateLimit": {
"messageLimit": "",
"generalRateLimit": "",
"messageLimitInputPlaceholder": ""
},
"upsellBtnLabel": ""
},
"quickSearch": {
"placeholder": "Schnellsuche"
@@ -651,15 +701,15 @@
"shortcutHint": "Benutze {{shortcut}} für Befehlspalette"
},
"keys": {
"ctrl": "",
"ctrl": "Strg",
"option": "",
"cmd": "",
"alt": "",
"escape": "",
"enter": "",
"shift": "",
"spacebar": "",
"delete": "",
"mmb": ""
"spacebar": "Leertaste",
"delete": "Löschen",
"mmb": "Mausrad"
}
}
+52 -2
View File
@@ -557,7 +557,9 @@
},
"welcomeScreen": {
"app": {
"center_heading": "Alle Daten werden lokal in Deinem Browser gespeichert.",
"center_heading": "",
"center_heading_line2": "",
"center_heading_line3": "",
"center_heading_plus": "Möchtest du stattdessen zu Excalidraw+ gehen?",
"menuHint": "Exportieren, Einstellungen, Sprachen, ..."
},
@@ -612,7 +614,55 @@
"button": "Einfügen",
"description": "Derzeit werden nur <flowchartLink>Flussdiagramme</flowchartLink>, <sequenceLink>Sequenzdiagramme</sequenceLink> und <classLink>Klassendiagramme</classLink> unterstützt. Die anderen Typen werden als Bild in Excalidraw dargestellt.",
"syntax": "Mermaid-Syntax",
"preview": "Vorschau"
"preview": "Vorschau",
"label": "",
"inputPlaceholder": ""
},
"ttd": {
"error": ""
},
"chat": {
"inputPlaceholder": "",
"inputPlaceholderWithMessages": "",
"generating": "",
"rateLimitRemaining": "",
"role": {
"user": "",
"assistant": "",
"system": ""
},
"aiBeta": "",
"label": "",
"menu": "",
"newChat": "",
"deleteChat": "",
"deleteMessage": "",
"viewAsMermaid": "",
"placeholder": {
"title": "",
"description": "",
"hint": ""
},
"preview": "",
"insert": "",
"retry": "",
"errors": {
"promptTooShort": "",
"promptTooLong": "",
"generationFailed": "",
"invalidDiagram": "",
"fixInMermaid": "",
"aiRepair": "",
"requestAborted": "",
"requestFailed": "",
"mermaidParseError": ""
},
"rateLimit": {
"messageLimit": "",
"generalRateLimit": "",
"messageLimitInputPlaceholder": ""
},
"upsellBtnLabel": ""
},
"quickSearch": {
"placeholder": "Schnellsuche"
+52 -2
View File
@@ -557,7 +557,9 @@
},
"welcomeScreen": {
"app": {
"center_heading": "Όλα τα δεδομένα σας αποθηκεύονται τοπικά στο πρόγραμμα περιήγησης.",
"center_heading": "",
"center_heading_line2": "",
"center_heading_line3": "",
"center_heading_plus": "Μήπως θέλατε να πάτε στο Excalidraw+;",
"menuHint": "Εξαγωγή, προτιμήσεις, γλώσσες, ..."
},
@@ -612,7 +614,55 @@
"button": "Εισαγωγή",
"description": "Επί του παρόντος υποστηρίζονται μόνο Διαγράμματα <flowchartLink>Ροής</flowchartLink>,<sequenceLink> Ακολουθίας, </sequenceLink> και <classLink>Κλάσεων</classLink>. Οι άλλοι τύποι θα αποδοθούν ως εικόνα στο Excalidraw.",
"syntax": "Σύνταξη Mermaid",
"preview": "Προεπισκόπηση"
"preview": "Προεπισκόπηση",
"label": "",
"inputPlaceholder": ""
},
"ttd": {
"error": ""
},
"chat": {
"inputPlaceholder": "",
"inputPlaceholderWithMessages": "",
"generating": "",
"rateLimitRemaining": "",
"role": {
"user": "",
"assistant": "",
"system": ""
},
"aiBeta": "",
"label": "",
"menu": "",
"newChat": "",
"deleteChat": "",
"deleteMessage": "",
"viewAsMermaid": "",
"placeholder": {
"title": "",
"description": "",
"hint": ""
},
"preview": "",
"insert": "",
"retry": "",
"errors": {
"promptTooShort": "",
"promptTooLong": "",
"generationFailed": "",
"invalidDiagram": "",
"fixInMermaid": "",
"aiRepair": "",
"requestAborted": "",
"requestFailed": "",
"mermaidParseError": ""
},
"rateLimit": {
"messageLimit": "",
"generalRateLimit": "",
"messageLimitInputPlaceholder": ""
},
"upsellBtnLabel": ""
},
"quickSearch": {
"placeholder": "Γρήγορη αναζήτηση"
+6 -2
View File
@@ -171,7 +171,9 @@
"linkToElement": "Link to object",
"wrapSelectionInFrame": "Wrap selection in frame",
"tab": "Tab",
"shapeSwitch": "Switch shape"
"shapeSwitch": "Switch shape",
"preferences": "Preferences",
"preferences_toolLock": "Tool lock"
},
"elementLink": {
"title": "Link to object",
@@ -557,7 +559,9 @@
},
"welcomeScreen": {
"app": {
"center_heading": "All your data is saved locally in your browser.",
"center_heading": "Your drawings are saved in your browser's storage.",
"center_heading_line2": "Browser storage can be cleared unexpectedly.",
"center_heading_line3": "Save your work to a file regularly to avoid losing it.",
"center_heading_plus": "Did you want to go to the Excalidraw+ instead?",
"menuHint": "Export, preferences, languages, ..."
},
+52 -2
View File
@@ -557,7 +557,9 @@
},
"welcomeScreen": {
"app": {
"center_heading": "Toda su información es guardada localmente en su navegador.",
"center_heading": "",
"center_heading_line2": "",
"center_heading_line3": "",
"center_heading_plus": "¿Quieres ir a Excalidraw+?",
"menuHint": "Exportar, preferencias, idiomas, ..."
},
@@ -612,7 +614,55 @@
"button": "Insertar",
"description": "Actualmente sólo estos tipos de <flowchartLink>diagrama de flujo</flowchartLink>,<sequenceLink> Secuencia, </sequenceLink> y <classLink>Clase </classLink> son soportados. Los otros tipos de diagramas se renderizarán como imagen en Excalidraw.",
"syntax": "Sintaxis Mermaid",
"preview": "Vista previa"
"preview": "Vista previa",
"label": "",
"inputPlaceholder": ""
},
"ttd": {
"error": ""
},
"chat": {
"inputPlaceholder": "",
"inputPlaceholderWithMessages": "",
"generating": "",
"rateLimitRemaining": "",
"role": {
"user": "",
"assistant": "",
"system": ""
},
"aiBeta": "",
"label": "",
"menu": "",
"newChat": "",
"deleteChat": "",
"deleteMessage": "",
"viewAsMermaid": "",
"placeholder": {
"title": "",
"description": "",
"hint": ""
},
"preview": "",
"insert": "",
"retry": "",
"errors": {
"promptTooShort": "",
"promptTooLong": "",
"generationFailed": "",
"invalidDiagram": "",
"fixInMermaid": "",
"aiRepair": "",
"requestAborted": "",
"requestFailed": "",
"mermaidParseError": ""
},
"rateLimit": {
"messageLimit": "",
"generalRateLimit": "",
"messageLimitInputPlaceholder": ""
},
"upsellBtnLabel": ""
},
"quickSearch": {
"placeholder": "Búsqueda rápida"
+52 -2
View File
@@ -557,7 +557,9 @@
},
"welcomeScreen": {
"app": {
"center_heading": "Zure datu guztiak lokalean gordetzen dira zure nabigatzailean.",
"center_heading": "",
"center_heading_line2": "",
"center_heading_line3": "",
"center_heading_plus": "Horren ordez Excalidraw+-era joan nahi al zenuen?",
"menuHint": "Esportatu, hobespenak, hizkuntzak..."
},
@@ -612,7 +614,55 @@
"button": "Txertatu",
"description": "Momentu honetan <flowchartLink>Flowchart</flowchartLink>, <sequenceLink> Sequence, </sequenceLink> eta <classLink>Class </classLink>Diagramak onartzen dira. Beste motak irudi gisa errendatuko dira Excalidrawn.",
"syntax": "Mermaid sintaxia",
"preview": "Aurrebista"
"preview": "Aurrebista",
"label": "",
"inputPlaceholder": ""
},
"ttd": {
"error": ""
},
"chat": {
"inputPlaceholder": "",
"inputPlaceholderWithMessages": "",
"generating": "",
"rateLimitRemaining": "",
"role": {
"user": "",
"assistant": "",
"system": ""
},
"aiBeta": "",
"label": "",
"menu": "",
"newChat": "",
"deleteChat": "",
"deleteMessage": "",
"viewAsMermaid": "",
"placeholder": {
"title": "",
"description": "",
"hint": ""
},
"preview": "",
"insert": "",
"retry": "",
"errors": {
"promptTooShort": "",
"promptTooLong": "",
"generationFailed": "",
"invalidDiagram": "",
"fixInMermaid": "",
"aiRepair": "",
"requestAborted": "",
"requestFailed": "",
"mermaidParseError": ""
},
"rateLimit": {
"messageLimit": "",
"generalRateLimit": "",
"messageLimitInputPlaceholder": ""
},
"upsellBtnLabel": ""
},
"quickSearch": {
"placeholder": ""
+52 -2
View File
@@ -557,7 +557,9 @@
},
"welcomeScreen": {
"app": {
"center_heading": "تمام داده های شما به صورت محلی در مرورگر شما ذخیره می شود.",
"center_heading": "",
"center_heading_line2": "",
"center_heading_line3": "",
"center_heading_plus": "آیا می‌خواهید به جای آن به Excalidraw+ بروید؟",
"menuHint": "خروجی، ترجیحات، زبان ها، ..."
},
@@ -612,7 +614,55 @@
"button": "درج",
"description": "فعلا فقط <flowchartLink> فلوچارت </flowchartLink> ، <sequenceLink> توالی </sequenceLink> و <classLink> کلاس </classLink> نمودارها پشتیبانی می شوند. انواع دیگر به صورت تصویر در Excalidraw ارائه خواهند شد.",
"syntax": "مرمید syntax",
"preview": "پیشنمایش"
"preview": "پیشنمایش",
"label": "",
"inputPlaceholder": ""
},
"ttd": {
"error": ""
},
"chat": {
"inputPlaceholder": "",
"inputPlaceholderWithMessages": "",
"generating": "",
"rateLimitRemaining": "",
"role": {
"user": "",
"assistant": "",
"system": ""
},
"aiBeta": "",
"label": "",
"menu": "",
"newChat": "",
"deleteChat": "",
"deleteMessage": "",
"viewAsMermaid": "",
"placeholder": {
"title": "",
"description": "",
"hint": ""
},
"preview": "",
"insert": "",
"retry": "",
"errors": {
"promptTooShort": "",
"promptTooLong": "",
"generationFailed": "",
"invalidDiagram": "",
"fixInMermaid": "",
"aiRepair": "",
"requestAborted": "",
"requestFailed": "",
"mermaidParseError": ""
},
"rateLimit": {
"messageLimit": "",
"generalRateLimit": "",
"messageLimitInputPlaceholder": ""
},
"upsellBtnLabel": ""
},
"quickSearch": {
"placeholder": "جستجو فوری"
+52 -2
View File
@@ -557,7 +557,9 @@
},
"welcomeScreen": {
"app": {
"center_heading": "Kaikki tietosi on tallennettu paikallisesti selaimellesi.",
"center_heading": "",
"center_heading_line2": "",
"center_heading_line3": "",
"center_heading_plus": "Haluatko sen sijaan mennä Excalidraw+:aan?",
"menuHint": "Vie, asetukset, kielet, ..."
},
@@ -612,7 +614,55 @@
"button": "",
"description": "",
"syntax": "",
"preview": "Esikatsele"
"preview": "Esikatsele",
"label": "",
"inputPlaceholder": ""
},
"ttd": {
"error": ""
},
"chat": {
"inputPlaceholder": "",
"inputPlaceholderWithMessages": "",
"generating": "",
"rateLimitRemaining": "",
"role": {
"user": "",
"assistant": "",
"system": ""
},
"aiBeta": "",
"label": "",
"menu": "",
"newChat": "",
"deleteChat": "",
"deleteMessage": "",
"viewAsMermaid": "",
"placeholder": {
"title": "",
"description": "",
"hint": ""
},
"preview": "",
"insert": "",
"retry": "",
"errors": {
"promptTooShort": "",
"promptTooLong": "",
"generationFailed": "",
"invalidDiagram": "",
"fixInMermaid": "",
"aiRepair": "",
"requestAborted": "",
"requestFailed": "",
"mermaidParseError": ""
},
"rateLimit": {
"messageLimit": "",
"generalRateLimit": "",
"messageLimitInputPlaceholder": ""
},
"upsellBtnLabel": ""
},
"quickSearch": {
"placeholder": ""
+52 -2
View File
@@ -557,7 +557,9 @@
},
"welcomeScreen": {
"app": {
"center_heading": "Toutes vos données sont sauvegardées en local dans votre navigateur.",
"center_heading": "",
"center_heading_line2": "",
"center_heading_line3": "",
"center_heading_plus": "Vouliez-vous plutôt aller à Excalidraw+ à la place ?",
"menuHint": "Exportation, préférences, langues, ..."
},
@@ -612,7 +614,55 @@
"button": "Insérer",
"description": "Actuellement, seuls les diagrammes <flowchartLink>Flowchart</flowchartLink>,<sequenceLink> Sequence, </sequenceLink> et <classLink>de classe </classLink>sont pris en charge. Les autres types seront rendus en tant qu'image dans Excalidraw.",
"syntax": "Syntaxe Mermaid",
"preview": "Prévisualisation"
"preview": "Prévisualisation",
"label": "",
"inputPlaceholder": ""
},
"ttd": {
"error": ""
},
"chat": {
"inputPlaceholder": "",
"inputPlaceholderWithMessages": "",
"generating": "",
"rateLimitRemaining": "",
"role": {
"user": "",
"assistant": "",
"system": ""
},
"aiBeta": "",
"label": "",
"menu": "",
"newChat": "",
"deleteChat": "",
"deleteMessage": "",
"viewAsMermaid": "",
"placeholder": {
"title": "",
"description": "",
"hint": ""
},
"preview": "",
"insert": "",
"retry": "",
"errors": {
"promptTooShort": "",
"promptTooLong": "",
"generationFailed": "",
"invalidDiagram": "",
"fixInMermaid": "",
"aiRepair": "",
"requestAborted": "",
"requestFailed": "",
"mermaidParseError": ""
},
"rateLimit": {
"messageLimit": "",
"generalRateLimit": "",
"messageLimitInputPlaceholder": ""
},
"upsellBtnLabel": ""
},
"quickSearch": {
"placeholder": "Recherche rapide"
+52 -2
View File
@@ -557,7 +557,9 @@
},
"welcomeScreen": {
"app": {
"center_heading": "Toda a información é gardada de maneira local no seu navegador.",
"center_heading": "",
"center_heading_line2": "",
"center_heading_line3": "",
"center_heading_plus": "Queres ir a Excalidraw+ no seu lugar?",
"menuHint": "Exportar, preferencias, idiomas, ..."
},
@@ -612,7 +614,55 @@
"button": "Inserir",
"description": "",
"syntax": "",
"preview": "Vista previa"
"preview": "Vista previa",
"label": "",
"inputPlaceholder": ""
},
"ttd": {
"error": ""
},
"chat": {
"inputPlaceholder": "",
"inputPlaceholderWithMessages": "",
"generating": "",
"rateLimitRemaining": "",
"role": {
"user": "",
"assistant": "",
"system": ""
},
"aiBeta": "",
"label": "",
"menu": "",
"newChat": "",
"deleteChat": "",
"deleteMessage": "",
"viewAsMermaid": "",
"placeholder": {
"title": "",
"description": "",
"hint": ""
},
"preview": "",
"insert": "",
"retry": "",
"errors": {
"promptTooShort": "",
"promptTooLong": "",
"generationFailed": "",
"invalidDiagram": "",
"fixInMermaid": "",
"aiRepair": "",
"requestAborted": "",
"requestFailed": "",
"mermaidParseError": ""
},
"rateLimit": {
"messageLimit": "",
"generalRateLimit": "",
"messageLimitInputPlaceholder": ""
},
"upsellBtnLabel": ""
},
"quickSearch": {
"placeholder": ""
+52 -2
View File
@@ -557,7 +557,9 @@
},
"welcomeScreen": {
"app": {
"center_heading": "כל המידע שלח נשמר מקומית בדפדפן.",
"center_heading": "",
"center_heading_line2": "",
"center_heading_line3": "",
"center_heading_plus": "אתה רוצה ללכת אל Excalidraw+ במקום?",
"menuHint": "ייצוא, העדפות, שפות, ..."
},
@@ -612,7 +614,55 @@
"button": "הוספה",
"description": "לעת עתה נתמכים רק <flowchartLink>תרשימי זרימה</flowchartLink>, <sequenceLink>תהליכים</sequenceLink>, <classLink>ודיאגרמת מחלקה</classLink>. שאר הסוגים ייוצרו כתמונות ב-Excalidraw.",
"syntax": "תחביר Mermaid",
"preview": "תצוגה מקדימה"
"preview": "תצוגה מקדימה",
"label": "",
"inputPlaceholder": ""
},
"ttd": {
"error": ""
},
"chat": {
"inputPlaceholder": "",
"inputPlaceholderWithMessages": "",
"generating": "",
"rateLimitRemaining": "",
"role": {
"user": "",
"assistant": "",
"system": ""
},
"aiBeta": "",
"label": "",
"menu": "",
"newChat": "",
"deleteChat": "",
"deleteMessage": "",
"viewAsMermaid": "",
"placeholder": {
"title": "",
"description": "",
"hint": ""
},
"preview": "",
"insert": "",
"retry": "",
"errors": {
"promptTooShort": "",
"promptTooLong": "",
"generationFailed": "",
"invalidDiagram": "",
"fixInMermaid": "",
"aiRepair": "",
"requestAborted": "",
"requestFailed": "",
"mermaidParseError": ""
},
"rateLimit": {
"messageLimit": "",
"generalRateLimit": "",
"messageLimitInputPlaceholder": ""
},
"upsellBtnLabel": ""
},
"quickSearch": {
"placeholder": "חיפוש מהיר"
+61 -11
View File
@@ -143,7 +143,7 @@
},
"polygon": {
"breakPolygon": "",
"convertToPolygon": ""
"convertToPolygon": "बहुभुज में कनवर्ट करें"
},
"elementLock": {
"lock": "ताले में रखें",
@@ -171,7 +171,7 @@
"linkToElement": "वस्तु की कड़ी",
"wrapSelectionInFrame": "चौकट में चुने हुवे को लपेटे",
"tab": "",
"shapeSwitch": ""
"shapeSwitch": "आकार बदलें"
},
"elementLink": {
"title": "वस्तु की कड़ी",
@@ -183,9 +183,9 @@
"hint_emptyLibrary": "यहाँ जोड़ने के लिए चित्रपटल से एक अवयव चुने, अथवा जन कोष से एक संग्रह नीचे स्थापित करें.",
"hint_emptyPrivateLibrary": "यहाँ जोड़ने के लिए चित्रपटल से एक अवयव चुने.",
"search": {
"inputPlaceholder": "",
"heading": "",
"noResults": "",
"inputPlaceholder": "लाइब्रेरी में खोजें",
"heading": "लाइब्रेरी मैच",
"noResults": "कोई मिलता जुलता नहीं मिला |||",
"clearSearch": ""
}
},
@@ -195,8 +195,8 @@
"singleResult": "परिणाम",
"multipleResults": "परिणाम",
"placeholder": "पटल पर पाठ्य धूंडे",
"frames": "",
"texts": ""
"frames": "फ्रेम्स",
"texts": "शब्द"
},
"buttons": {
"clearReset": "चित्रपटल स्वच्छ करें",
@@ -292,7 +292,7 @@
},
"toolBar": {
"selection": "चयन",
"lasso": "",
"lasso": "लासो सलेक्शन",
"image": "प्रतिमा सम्मिलित करें",
"rectangle": "आयात",
"diamond": "ईंट",
@@ -313,7 +313,7 @@
"hand": "हाथ ( खिसका के देखने का औज़ार)",
"extraTools": "अधिक उपकरण",
"mermaidToExcalidraw": "मर्मेड से एक्सकाली में",
"convertElementType": ""
"convertElementType": "आकार प्रकार टॉगल करें"
},
"element": {
"rectangle": "आयत",
@@ -557,7 +557,9 @@
},
"welcomeScreen": {
"app": {
"center_heading": "आपका सर्व डेटा ब्राउज़र के भीतर स्थानिक जगह पे सुरक्षित किया गया.",
"center_heading": "",
"center_heading_line2": "",
"center_heading_line3": "",
"center_heading_plus": "बजाय आपको एक्स-काली-ड्रॉ-प्लस पर जाना है?",
"menuHint": "निर्यात, पसंद, भाषायें, ..."
},
@@ -612,7 +614,55 @@
"button": "सन्निवेश करे",
"description": "वर्तमान में केवल <flowchartLink>बहाव चित्र</flowchartLink>, <sequenceLink> अनुक्रम चित्र </sequenceLink> और <classLink>वर्ग चित्र</classLink> का चित्रिकरण संभव हैं. अन्य चित्र प्रकार एक्सकाली प्रतिमा जैसे चित्रित किए जायेंगे.",
"syntax": "मर्मेड विन्यास",
"preview": "पूर्वावलोकन"
"preview": "पूर्वावलोकन",
"label": "",
"inputPlaceholder": ""
},
"ttd": {
"error": ""
},
"chat": {
"inputPlaceholder": "",
"inputPlaceholderWithMessages": "",
"generating": "",
"rateLimitRemaining": "",
"role": {
"user": "",
"assistant": "",
"system": ""
},
"aiBeta": "",
"label": "",
"menu": "",
"newChat": "",
"deleteChat": "",
"deleteMessage": "",
"viewAsMermaid": "",
"placeholder": {
"title": "",
"description": "",
"hint": ""
},
"preview": "",
"insert": "",
"retry": "",
"errors": {
"promptTooShort": "",
"promptTooLong": "",
"generationFailed": "",
"invalidDiagram": "",
"fixInMermaid": "",
"aiRepair": "",
"requestAborted": "",
"requestFailed": "",
"mermaidParseError": ""
},
"rateLimit": {
"messageLimit": "",
"generalRateLimit": "",
"messageLimitInputPlaceholder": ""
},
"upsellBtnLabel": ""
},
"quickSearch": {
"placeholder": "त्वरित खोज"
+141 -91
View File
@@ -11,8 +11,8 @@
"copyAsPng": "Vágólapra másolás mint PNG",
"copyAsSvg": "Vágólapra másolás mint SVG",
"copyText": "Vágólapra másolás szövegként",
"copySource": "",
"convertToCode": "",
"copySource": "Forrás másolása a vágólapra",
"convertToCode": "Kód generálás",
"bringForward": "Előrébb hozás",
"sendToBack": "Hátraküldés",
"bringToFront": "Előrehozás",
@@ -86,7 +86,7 @@
"layers": "Rétegek",
"actions": "Műveletek",
"language": "Nyelv",
"liveCollaboration": "",
"liveCollaboration": "Élő együttműködés...",
"duplicateSelection": "Duplikálás",
"untitled": "Névtelen",
"name": "Név",
@@ -95,13 +95,13 @@
"group": "Csoportosítás",
"ungroup": "Csoportbontás",
"collaborators": "Közreműködők",
"toggleGrid": "",
"toggleGrid": "Keresés törlése",
"addToLibrary": "Hozzáadás a könyvtárhoz",
"removeFromLibrary": "Eltávólítás a könyvtárból",
"libraryLoadingMessage": "Könyvtár betöltése…",
"libraries": "Könyvtárak böngészése",
"loadingScene": "Jelenet betöltése…",
"loadScene": "",
"loadScene": "Betöltés fájlból",
"align": "Igazítás",
"alignTop": "Felülre igazítás",
"alignBottom": "Alulra igazítás",
@@ -118,7 +118,7 @@
"showStroke": "Körvonal színválasztó megjelenítése",
"showBackground": "Háttérszín-választó megjelenítése",
"showFonts": "",
"toggleTheme": "",
"toggleTheme": "Világos/sötét háttér kapcsoló",
"theme": "Téma",
"personalLib": "Személyes könyvtár",
"excalidrawLib": "Excalidraw könyvtár",
@@ -126,7 +126,7 @@
"increaseFontSize": "Betűméret növelése",
"unbindText": "Szövegkötés feloldása",
"bindText": "",
"createContainerFromText": "",
"createContainerFromText": "Szöveg bekeretezése",
"link": {
"edit": "Hivatkozás szerkesztése",
"editEmbed": "",
@@ -147,34 +147,34 @@
},
"elementLock": {
"lock": "",
"unlock": "",
"unlock": "Zárolás feloldása",
"lockAll": "Összes zárolása",
"unlockAll": "Összes feloldása"
},
"statusPublished": "Közzétéve",
"sidebarLock": "",
"sidebarLock": "Oldalsó sáv nyitva tartása",
"selectAllElementsInFrame": "",
"removeAllElementsFromFrame": "",
"eyeDropper": "",
"textToDiagram": "Szövegből diagram",
"prompt": "",
"prompt": "Egyéb",
"followUs": "Kövess minket",
"discordChat": "Discord chat",
"zoomToFitViewport": "",
"zoomToFitSelection": "",
"zoomToFit": "",
"zoomToFitSelection": "Nagyítás a kijelölés méretére",
"zoomToFit": "Az összes elem látótérbe hozása",
"installPWA": "",
"autoResize": "",
"imageCropping": "",
"unCroppedDimension": "",
"copyElementLink": "",
"linkToElement": "",
"linkToElement": "Hivatkozás az objektumhoz",
"wrapSelectionInFrame": "",
"tab": "",
"tab": "Tab",
"shapeSwitch": ""
},
"elementLink": {
"title": "",
"title": "Hivatkozás az objektumhoz",
"desc": "",
"notFound": ""
},
@@ -183,31 +183,31 @@
"hint_emptyLibrary": "",
"hint_emptyPrivateLibrary": "",
"search": {
"inputPlaceholder": "",
"inputPlaceholder": "Keresés a könyvtárban",
"heading": "",
"noResults": "",
"clearSearch": ""
"clearSearch": "Keresés törlése"
}
},
"search": {
"title": "",
"title": "Rajzvászonon használt",
"noMatch": "",
"singleResult": "",
"multipleResults": "",
"placeholder": "",
"frames": "",
"texts": ""
"frames": "Keretek",
"texts": "Szövegek"
},
"buttons": {
"clearReset": "Vászon törlése",
"exportJSON": "Exportálás fájlba",
"exportImage": "",
"export": "",
"exportImage": "Kép exportálása...",
"export": "Mentés másként...",
"copyToClipboard": "Vágólapra másolás",
"copyLink": "",
"copyLink": "Link másolása",
"save": "Mentés az aktuális fájlba",
"saveAs": "Mentés másként",
"load": "",
"load": "Megnyitás",
"getShareableLink": "Megosztható link létrehozása",
"close": "Bezárás",
"selectLanguage": "Nyelv kiválasztása",
@@ -225,19 +225,19 @@
"fullScreen": "Teljes képernyő",
"darkMode": "Sötét mód",
"lightMode": "Világos mód",
"systemMode": "",
"systemMode": "Rendszer mód",
"zenMode": "Letisztult mód",
"objectsSnapMode": "",
"objectsSnapMode": "Objektumhoz illeszt",
"exitZenMode": "Kilépés a letisztult módból",
"cancel": "Mégsem",
"saveLibNames": "",
"clear": "Kiűrítés",
"remove": "Eltávolítás",
"embed": "",
"embed": "Beágyazás be/ki",
"publishLibrary": "",
"submit": "Elküldés",
"confirm": "Megerősítés",
"embeddableInteractionButton": ""
"embeddableInteractionButton": "Interakció Kattintással"
},
"alerts": {
"clearReset": "Ez a művelet törli a vászont. Biztos benne?",
@@ -246,7 +246,7 @@
"couldNotLoadInvalidFile": "Nem sikerült betölteni a helytelen fájlt",
"importBackendFailed": "Nem sikerült betölteni a szerverről.",
"cannotExportEmptyCanvas": "Üres vászont nem lehet exportálni.",
"couldNotCopyToClipboard": "",
"couldNotCopyToClipboard": "Nem lehet a vágólapra másolni.",
"decryptFailed": "Nem sikerült visszafejteni a titkosított adatot.",
"uploadedSecurly": "A feltöltést végpontok közötti titkosítással biztosítottuk, ami azt jelenti, hogy egy harmadik fél nem tudja megnézni a tartalmát, beleértve az Excalidraw szervereit is.",
"loadSceneOverridePrompt": "A betöltött külső rajz felül fogja írnia meglévőt. Szeretnéd folytatni?",
@@ -304,31 +304,31 @@
"library": "Könyvtár",
"lock": "Rajzolás után az aktív eszközt tartsa kijelölve",
"penMode": "",
"link": "",
"eraser": "",
"link": "Hivatkozás hozzáadása/frissítése a kiválasztott alakzathoz",
"eraser": "Radír",
"frame": "",
"magicframe": "",
"embeddable": "",
"laser": "",
"laser": "Lézermutató",
"hand": "",
"extraTools": "",
"extraTools": "További eszközök",
"mermaidToExcalidraw": "",
"convertElementType": ""
},
"element": {
"rectangle": "",
"diamond": "",
"ellipse": "",
"arrow": "",
"line": "",
"rectangle": "Téglalap",
"diamond": "Rombusz",
"ellipse": "Ellipszis",
"arrow": "Nyíl",
"line": "Vonal",
"freedraw": "",
"text": "",
"image": "",
"group": "",
"frame": "",
"text": "Szöveg",
"image": "Kép",
"group": "Csoport",
"frame": "Keret",
"magicframe": "",
"embeddable": "",
"selection": "",
"embeddable": "Weblap beágyazása",
"selection": "Kijelölés",
"iframe": ""
},
"headings": {
@@ -338,7 +338,7 @@
},
"hints": {
"dismissSearch": "",
"canvasPanning": "",
"canvasPanning": "A vászon mozgatásához tartsd lenyomva a {{shortcut_1}} vagy {{shortcut_2}} billentyűt húzás közben, vagy használd a kéz eszközt",
"linearElement": "Kattintással görbe, az eger húzásával pedig egyenes nyilat rajzolhatsz",
"arrowTool": "",
"arrowBindModifiers": "",
@@ -380,7 +380,7 @@
"sceneContent": "Jelenet tartalma:"
},
"shareDialog": {
"or": ""
"or": "Vagy"
},
"roomDialog": {
"desc_intro": "",
@@ -420,7 +420,7 @@
"drag": "vonszolás",
"editor": "Szerkesztő",
"editLineArrowPoints": "",
"editText": "",
"editText": "Szöveg szerkesztése / címke hozzáadása",
"github": "Hibát találtál? Küld be",
"howto": "Kövesd az útmutatóinkat",
"or": "vagy",
@@ -436,7 +436,7 @@
"toggleElementLock": "",
"movePageUpDown": "",
"movePageLeftRight": "",
"cropStart": "",
"cropStart": "Kép kivágása",
"cropFinish": ""
},
"clearCanvasDialog": {
@@ -481,25 +481,25 @@
"imageExportDialog": {
"header": "Kép exportálása",
"label": {
"withBackground": "",
"onlySelected": "",
"darkMode": "",
"embedScene": "",
"scale": "",
"padding": ""
"withBackground": "Háttér",
"onlySelected": "Csak a kijelölt",
"darkMode": "Sötét mód",
"embedScene": "Jelenet beágyazása",
"scale": "Nagyítás",
"padding": "Eltartás"
},
"tooltip": {
"embedScene": ""
"embedScene": "A jelenetet leíró adatok hozzá lesznek adva a PNG/SVG fájlhoz, így a jelenetet vissza lehet majd tölteni belőle. Ez megnöveli a fájl méretét."
},
"title": {
"exportToPng": "",
"exportToSvg": "",
"copyPngToClipboard": ""
"exportToPng": "Exportálás PNG-be",
"exportToSvg": "Exportálás SVG-be",
"copyPngToClipboard": "PNG másolása a vágólapra"
},
"button": {
"exportToPng": "",
"exportToSvg": "",
"copyPngToClipboard": ""
"exportToPng": "PNG",
"exportToSvg": "SVG",
"copyPngToClipboard": "Vágólapra másolás"
}
},
"encrypted": {
@@ -508,14 +508,14 @@
},
"stats": {
"angle": "Szög",
"shapes": "",
"shapes": "Alakzatok",
"height": "Magasság",
"scene": "Jelenet",
"selected": "Kijelölt",
"storage": "Tárhely",
"fullTitle": "",
"title": "",
"generalStats": "",
"title": "Tulajdonságok",
"generalStats": "Általános",
"elementProperties": "",
"total": "Összesen",
"version": "Verzió",
@@ -540,24 +540,26 @@
},
"colors": {
"transparent": "Átlátszó",
"black": "",
"white": "",
"red": "",
"pink": "",
"grape": "",
"violet": "",
"gray": "",
"blue": "",
"cyan": "",
"teal": "",
"green": "",
"yellow": "",
"orange": "",
"bronze": ""
"black": "Fekete",
"white": "Fehér",
"red": "Piros",
"pink": "Pink",
"grape": "Szőlő",
"violet": "Lila",
"gray": "Szürke",
"blue": "Kék",
"cyan": "Cián",
"teal": "Türkiz",
"green": "Zöld",
"yellow": "Sárga",
"orange": "Narancssárga",
"bronze": "Bronz"
},
"welcomeScreen": {
"app": {
"center_heading": "",
"center_heading_line2": "",
"center_heading_line3": "",
"center_heading_plus": "",
"menuHint": ""
},
@@ -569,7 +571,7 @@
}
},
"colorPicker": {
"color": "",
"color": "Szín",
"mostUsedCustomColors": "",
"colors": "",
"shades": "",
@@ -612,18 +614,66 @@
"button": "",
"description": "",
"syntax": "",
"preview": ""
"preview": "",
"label": "",
"inputPlaceholder": ""
},
"ttd": {
"error": ""
},
"chat": {
"inputPlaceholder": "",
"inputPlaceholderWithMessages": "",
"generating": "",
"rateLimitRemaining": "",
"role": {
"user": "Te",
"assistant": "AI asszisztens",
"system": "Rendszer"
},
"aiBeta": "",
"label": "Csevegés",
"menu": "Menü",
"newChat": "Új csevegés",
"deleteChat": "Csevegés törlése",
"deleteMessage": "Üzenet törlése",
"viewAsMermaid": "",
"placeholder": {
"title": "",
"description": "",
"hint": ""
},
"preview": "Előnézet",
"insert": "Beszúrás",
"retry": "Újra",
"errors": {
"promptTooShort": "",
"promptTooLong": "",
"generationFailed": "",
"invalidDiagram": "",
"fixInMermaid": "",
"aiRepair": "",
"requestAborted": "",
"requestFailed": "",
"mermaidParseError": ""
},
"rateLimit": {
"messageLimit": "",
"generalRateLimit": "",
"messageLimitInputPlaceholder": ""
},
"upsellBtnLabel": "Frissítés Plus csomagra"
},
"quickSearch": {
"placeholder": ""
"placeholder": "Gyorskeresés"
},
"fontList": {
"badge": {
"old": ""
"old": "régi"
},
"sceneFonts": "",
"availableFonts": "",
"empty": ""
"availableFonts": "Elérhető betűtípusok",
"empty": "Nem találhatóak betűtípusok"
},
"userList": {
"empty": "",
@@ -636,13 +686,13 @@
}
},
"commandPalette": {
"title": "",
"title": "Parancspanel",
"shortcuts": {
"select": "",
"confirm": "",
"close": ""
"select": "Kiválasztás",
"confirm": "Megerősítés",
"close": "Bezárás"
},
"recents": "",
"recents": "Legutóbb használt",
"search": {
"placeholder": "",
"noMatch": ""
@@ -651,8 +701,8 @@
"shortcutHint": ""
},
"keys": {
"ctrl": "",
"option": "",
"ctrl": "Ctrl",
"option": "Option",
"cmd": "",
"alt": "",
"escape": "",
+52 -2
View File
@@ -557,7 +557,9 @@
},
"welcomeScreen": {
"app": {
"center_heading": "Semua data Anda disimpan secara lokal di peramban Anda.",
"center_heading": "",
"center_heading_line2": "",
"center_heading_line3": "",
"center_heading_plus": "Apa Anda ingin berpindah ke Excalidraw+?",
"menuHint": "Ekspor, preferensi, bahasa, ..."
},
@@ -612,7 +614,55 @@
"button": "Sisipkan",
"description": "Saat ini hanya <flowchartLink>Flowchart</flowchartLink>, <sequenceLink>Sekuen, </sequenceLink>, dan <classLink>Kelas</classLink>Diagram yang didukung. Jenis lainnya akan dirender sebagai gambar di Excalidraw.",
"syntax": "Syntax Mermaid",
"preview": "Pratinjau"
"preview": "Pratinjau",
"label": "",
"inputPlaceholder": ""
},
"ttd": {
"error": ""
},
"chat": {
"inputPlaceholder": "",
"inputPlaceholderWithMessages": "",
"generating": "",
"rateLimitRemaining": "",
"role": {
"user": "",
"assistant": "",
"system": ""
},
"aiBeta": "",
"label": "",
"menu": "",
"newChat": "",
"deleteChat": "",
"deleteMessage": "",
"viewAsMermaid": "",
"placeholder": {
"title": "",
"description": "",
"hint": ""
},
"preview": "",
"insert": "",
"retry": "",
"errors": {
"promptTooShort": "",
"promptTooLong": "",
"generationFailed": "",
"invalidDiagram": "",
"fixInMermaid": "",
"aiRepair": "",
"requestAborted": "",
"requestFailed": "",
"mermaidParseError": ""
},
"rateLimit": {
"messageLimit": "",
"generalRateLimit": "",
"messageLimitInputPlaceholder": ""
},
"upsellBtnLabel": ""
},
"quickSearch": {
"placeholder": "Pencarian Cepat"
+52 -2
View File
@@ -557,7 +557,9 @@
},
"welcomeScreen": {
"app": {
"center_heading": "Tutti i tuoi dati sono salvati localmente nel browser.",
"center_heading": "",
"center_heading_line2": "",
"center_heading_line3": "",
"center_heading_plus": "Volevi invece andare su Excalidraw+?",
"menuHint": "Esporta, preferenze, lingue, ..."
},
@@ -612,7 +614,55 @@
"button": "Inserisci",
"description": "Attualmente sono supportati solo diagrammi di <flowchartLink>flusso</flowchartLink>,<sequenceLink> sequenza, </sequenceLink> e <classLink>classe </classLink>. Gli altri tipi saranno rappresentati come immagini in Excalidraw.",
"syntax": "Sintassi Mermaid",
"preview": "Anteprima"
"preview": "Anteprima",
"label": "Mermaid",
"inputPlaceholder": "Scrivi qui la definizione del diagramma Mermaid..."
},
"ttd": {
"error": "Errore!"
},
"chat": {
"inputPlaceholder": "Inizia a digitare qui la tua idea per il diagramma... ({{shortcut}} per una nuova riga)",
"inputPlaceholderWithMessages": "Continua a perfezionare il tuo diagramma...",
"generating": "Generazione in corso...",
"rateLimitRemaining": "{{count}} richieste rimaste oggi",
"role": {
"user": "Tu",
"assistant": "Assistente IA",
"system": "Sistema"
},
"aiBeta": "IA Beta",
"label": "Chat",
"menu": "Menu",
"newChat": "Nuova Chat",
"deleteChat": "Elimina Chat",
"deleteMessage": "Cancella messaggio",
"viewAsMermaid": "Visualizza come Mermaid",
"placeholder": {
"title": "Progettiamo il tuo diagramma",
"description": "Descrivi il diagramma che vuoi creare e noi lo genereremo per te.",
"hint": "Al momento conosciamo i diagrammi di flusso, di sequenza e di classe."
},
"preview": "Anteprima",
"insert": "Inserisci",
"retry": "Riprova",
"errors": {
"promptTooShort": "Il prompt è troppo corto (min {{min}} caratteri)",
"promptTooLong": "Il prompt è troppo lungo (max {{max}} caratteri)",
"generationFailed": "Generazione non riuscita",
"invalidDiagram": "È stato generato un diagramma non valido :(. Puoi modificarlo manualmente, riprovare con la correzione automatica o provare un prompt diverso.",
"fixInMermaid": "Modifica Mermaid manualmente→",
"aiRepair": "Rigenera (correzione automatica) →",
"requestAborted": "Richiesta annullata",
"requestFailed": "Richiesta non riuscita",
"mermaidParseError": "Errore di sintassi Mermaid"
},
"rateLimit": {
"messageLimit": "Hai raggiunto il tuo limite di IA sul piano gratuito. Prova Excalidraw+ per saperne di più o torna domani.",
"generalRateLimit": "Fermati, sei troppo veloce per noi! Attendi un attimo prima di riprovare.",
"messageLimitInputPlaceholder": "Hai raggiunto il limite di messaggi"
},
"upsellBtnLabel": "Aggiorna alla Plus"
},
"quickSearch": {
"placeholder": "Ricerca rapida"
+52 -2
View File
@@ -557,7 +557,9 @@
},
"welcomeScreen": {
"app": {
"center_heading": "すべてのデータはブラウザにローカル保存されます。",
"center_heading": "",
"center_heading_line2": "",
"center_heading_line3": "",
"center_heading_plus": "代わりにExcalidraw+を開きますか?",
"menuHint": "エクスポート、設定、言語..."
},
@@ -612,7 +614,55 @@
"button": "挿入",
"description": "現在、<flowchartLink>Flowchart</flowchartLink>、<sequenceLink>Sequence</sequenceLink>、<classLink>Class</classLink> のダイアグラムのみに対応しています。その他の種類は、Excalidraw では画像として描画されます。",
"syntax": "Mermaid 構文",
"preview": "プレビュー"
"preview": "プレビュー",
"label": "",
"inputPlaceholder": ""
},
"ttd": {
"error": ""
},
"chat": {
"inputPlaceholder": "",
"inputPlaceholderWithMessages": "",
"generating": "",
"rateLimitRemaining": "",
"role": {
"user": "",
"assistant": "",
"system": ""
},
"aiBeta": "",
"label": "",
"menu": "",
"newChat": "",
"deleteChat": "",
"deleteMessage": "",
"viewAsMermaid": "",
"placeholder": {
"title": "",
"description": "",
"hint": ""
},
"preview": "",
"insert": "",
"retry": "",
"errors": {
"promptTooShort": "",
"promptTooLong": "",
"generationFailed": "",
"invalidDiagram": "",
"fixInMermaid": "",
"aiRepair": "",
"requestAborted": "",
"requestFailed": "",
"mermaidParseError": ""
},
"rateLimit": {
"messageLimit": "",
"generalRateLimit": "",
"messageLimitInputPlaceholder": ""
},
"upsellBtnLabel": ""
},
"quickSearch": {
"placeholder": ""

Some files were not shown because too many files have changed in this diff Show More