74 Commits

Author SHA1 Message Date
David Luzar
9cccac1458
feat: further reduce darkmode init flash (#5701)
* feat: further reduce darkmode init flash

* fix lint

* tweak doc

* colocate code
2022-09-16 17:12:24 +02:00
Abdullah Adeel
7eaf47c9d4
fix: default light theme splash 🔧 (#5660)
Co-authored-by: dwelle <luzar.david@gmail.com>
Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
2022-09-16 13:59:03 +00:00
Abdullah Adeel
b3052f0178
fix: #5622 - prevent session theme reset during collaboration (#5640)
*  fixed #5622 - prevent session theme reset

 -  prevent newly initialized state to override theme preferences.
 - 🔧 fix for #5622

* refactor

Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
2022-09-01 15:41:44 +05:30
Aakansha Doshi
32d82219b1
refactor: Stats component (#5610)
refactor: stats component
2022-08-22 17:18:25 +05:30
Aakansha Doshi
5a8dbe8030
feat: show a mid point for linear elements (#5534)
* feat: Add a mid point for linear elements

* fix tests

* show mid point only on hover

* hacky fix :(

* don't add mid points if present and only add outside editor

* improve styling and always show phantom point instead of just on hover

* fix tests

* fix

* only add polyfill for test

* add hover state for phantom point

* fix tests

* fix

* Add Array.at polyfill

* reuse `centerPoint()` helper

* reuse `distance2d`

* use `Point` type

Co-authored-by: dwelle <luzar.david@gmail.com>
2022-08-11 20:16:25 +05:30
David Luzar
2d800feeeb
fix: shareable links being merged with current scene data (#5547) 2022-08-08 17:51:19 +02:00
David Luzar
5bc40402a6
fix: disable render throttling by default & during resize (#5451) 2022-07-16 11:36:55 +02:00
Aakansha Doshi
a7153d9d1d
feat: update toast api to account for duration and closable (#5427)
* feat: update toast api to account for duration and closable

* fix

* update snaps

* update docs

* male toast nullable

* fix snaps

* remove clearToast from App.tsx and replace clearToast prop in Toast comp with onClose
2022-07-11 18:11:13 +05:30
David Luzar
dac8dda4d4
feat: collab component state handling rewrite & fixes (#5046) 2022-07-05 16:03:40 +02:00
Aakansha Doshi
de95c68d75
fix: remove unnecessary options passed to language detector (#5336) 2022-06-22 01:33:08 +05:30
David Luzar
4712393b62
fix: stale appState.pendingImageElement (#5322)
* fix: stale `appState.pendingImageElement`

* unrelated fix for devTools race conditions

* snap fix
2022-06-19 14:13:43 +02:00
Milos Vetesnik
bed9fca4a5
feat: go-to-excalidrawplus button (#5202)
Co-authored-by: dwelle <luzar.david@gmail.com>
2022-05-18 18:30:34 +02:00
David Luzar
cad6097d60
feat: factor out url library init & switch to updateLibrary API (#5115)
Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
2022-05-11 15:08:54 +02:00
David Luzar
9423ac3263
fix: Excalidraw named export type (#5078) 2022-04-22 15:49:36 +02:00
David Luzar
cd942c3e3b
feat: rewrite library state management & related refactor (#5067)
* support libraryItems promise for `updateScene()` and use `importLibrary`

* fix typing for `getLibraryItemsFromStorage()`

* remove `libraryItemsFromStorage` hack

if there was a point to it then I'm missing it, but this part will be rewritten anyway

* rewrite state handling

(temporarily removed loading states)

* add async support

* refactor and deduplicate library importing logic

* hide hints when library open

* fix snaps

* support promise in `initialData.libraryItems`

* add default to params instead
2022-04-20 14:40:03 +02:00
David Luzar
4d13dbf625
feat: reconcile when saving to firebase (#4991)
* naming tweaks

* do not mark local element as duplicate when there's no remote counterpart

* merge instead of overwrite elements when saving to firebase & reconcile local state

* decouple syncing from persistence

* fix ts

* clarify doc

* fix reconciliation not removing duplicates
2022-04-17 22:40:39 +02:00
Aakansha Doshi
52d10bb41e
feat: hide trash button during collaboration (#5037)
* feat: hide trash button during collaboration

* visually hide the trash icon

* pointer events none

* tweak env docs

* fix typo

Co-authored-by: dwelle <luzar.david@gmail.com>
2022-04-15 09:21:41 -07:00
David Luzar
5359e4fec9
feat: refactor local persistence & fix race condition on SW reload (#5032) 2022-04-11 22:15:49 +02:00
David Luzar
f242721f3b
chore: add ga for most actions (#4829) 2022-03-28 14:46:40 +02:00
Aakansha Doshi
ca89d47d4c
feat: Sync local storage state across tabs when out of sync (#4545)
Co-authored-by: dwelle <luzar.david@gmail.com>
2022-01-27 13:21:55 +01:00
Milos Vetesnik
ac71ee7278
feat: link to new LP for excalidraw plus (#4549) 2022-01-07 16:32:35 +01:00
Aakansha Doshi
b475412199
feat: support updating library in updateScene API (#4546)
* feat: support updating library in updateScene API

* fix

* update docs

* Update src/packages/excalidraw/CHANGELOG.md
2022-01-06 21:37:33 +05:30
Lipis
39e53b4ae7
feat: Allow letters in IDs for storing files in backend (#4224) 2021-11-07 14:37:13 +01:00
Lipis
4bfc5bbcaa
chore: Update i18next-browser-languagedetector (#4196) 2021-11-03 21:07:13 +00:00
Lipis
f1eb969565
feat: Remove support for V1 unencrypted backend (#4189) 2021-11-02 14:52:25 +02:00
Lipis
8d4f455cd3
chore: Update Typescript to 4.4.4 (#4188) 2021-11-02 14:24:16 +02:00
Lipis
1c7056bdaa
chore: bump Prettier to the latest (#4185) 2021-11-01 15:24:05 +02:00
David Luzar
790e6da500
fix: images not initialized correctly (#4157)
* fix: image not initialized correctly due to not renewing `state.pendingImageElement`

* ensure we replace elements on update

* set file as errored on >= 400 status respones
2021-11-01 10:44:57 +01:00
David Luzar
c61f95a327
fix: image-related fixes (#4147)
* flush queues on portal close

* fix mouse broadcast race condition

* stop mutating image elements when updating status

to fix race condition when closing/opening collab room

* check `files` when resolving `LayerUI`

* fix displaying AbortError
2021-10-30 23:40:35 +02:00
David Luzar
163ad1f4c4
feat: image support (#4011)
Co-authored-by: Emil Atanasov <heitara@gmail.com>
Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
2021-10-21 22:05:48 +02:00
Aakansha Doshi
c6ffc06541
feat: support renderTopRightUI in mobile (#4065) 2021-10-17 21:44:46 +05:30
Aakansha Doshi
ff29780760
Refactor: convert initializeApp to func component and use JSX transform in the codebase (#4056) 2021-10-14 22:56:51 +05:30
David Luzar
99623334d1
feat: add undo/redo buttons & tweak footer (#3832)
Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
2021-07-15 18:48:03 +02:00
David Luzar
097362662d
feat: pass localElements to restore and restoreElement API's and bump versions of duplicate elements on import (#3797) 2021-07-04 22:23:35 +02:00
Arun
4249de41d4
feat: Add prop autoFocus to set focus on the Excalidraw component (#3691)
* feat: Add prop autofocus to set focus on Excalidraw component

* Update PR number

* Make requested changes

* Add note

* Update src/packages/excalidraw/CHANGELOG.md

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

* Update src/tests/excalidrawPackage.test.tsx

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

* Remove duplicate sentence

* Indent note

* autofocus -> autoFocus

Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
2021-06-02 19:54:21 +05:30
Aakansha Doshi
15f02ba191
refactor: code clean up (#3681)
* refactor: code clean up
Move types from App.tsx to types.ts
Move excalidrawPackage.test.tsx inside src/tests/package

* import type
2021-06-01 23:52:13 +05:30
David Luzar
a2e1199907
feat: support exporting json to excalidraw plus (#3678)
* feat: support exporting json to excalidraw plus

* add Firebase Storage rules to codebase

* factor the onClick handler out

* move excal icon to icons.tsx

* handle export error
2021-06-01 14:05:09 +02:00
Aakansha Doshi
d63b6a3469
feat: support custom UI rendering inside export dialog (#3666)
* feat: support custom UI rendering inside export dialog

* docs

* add

* remove assertion

Co-authored-by: dwelle <luzar.david@gmail.com>
2021-05-30 00:37:38 +05:30
Aakansha Doshi
ba48974351
feat: customise export dialog with UIOptions.canvasActions.export prop (#3658)
* refactor: update UIOptions.canvasActions.export to be a an object

* fix

* fix

* dnt show export icon when false

* fix

* inline

* memoize UIOptions

* update docs

* fix

* tweak readme

Co-authored-by: David Luzar <luzar.david@gmail.com>
2021-05-29 02:56:25 +05:30
David Luzar
357266e9ab
feat: auto-position tooltip and suport overflowing container (#3631) 2021-05-25 13:52:04 +02:00
Aakansha Doshi
6271a031a3
fix: move encrypted icon to excalidraw-app add separate animation for renderFooter prop (#3577)
* fix: move encrypted icon to excalidraw-app

* use grid & separate animation for custom footer

* update docs

* fix
2021-05-15 14:49:58 +05:30
Aakansha Doshi
78da4c075e
feat: support updating appState in updateScene API (#3576)
* feat: support updating appState in updateScene API

* make `updateScene.data.appState` more type-safe

* restore `appState` when passing to `updateScene`

* fix

Co-authored-by: dwelle <luzar.david@gmail.com>
2021-05-14 17:52:56 +05:30
Aakansha Doshi
3b9290831a
refactor: rename renderTopRight prop to renderTopRightUI (#3572)
* refactor: rename renderTopRight prop to renderTopRightUI

* update

* fix

* update
2021-05-13 21:02:59 +05:30
David Luzar
286e9a1524
feat: add temporary Excalidraw+ promo (#3540)
* feat: add temporary Excalidraw+ promo

* add seemingly required query params
2021-05-06 21:29:05 +02:00
David Luzar
bac76778ce
feat: add renderTopRight prop & remove GH corner from core (#3539)
* feat: add `renderTopRight` prop & remove GH corner from core

* reuse `--space-factor` var

* update readme & changelog
2021-05-06 21:00:17 +02:00
Aakansha Doshi
37d513ad59
feat: Make library local to given excalidraw instance and allow consumer to control it (#3451)
* feat: dnt share library & attach to the excalidraw instance

* fix

* Add addToLibrary, resetLibrary and libraryItems in initialData

* remove comment

* handle errors & improve types

* remove resetLibrary and addToLibrary and add onLibraryChange prop

* set library cache to empty arrary on reset

* Add i18n for remove/add library

* Update src/locales/en.json

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

* update docs

* Assign unique ID to
 each excalidraw component and remove csrfToken from library as its not needed

* tweaks

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

* update

* tweak

Co-authored-by: dwelle <luzar.david@gmail.com>
2021-04-21 23:38:24 +05:30
Aakansha Doshi
d126d04d17
feat: Bind keyboard events to the current excalidraw container and add handleKeyboardGlobally prop to allow host to bind to document (#3430)
* fix: Bind keyboard events to excalidraw container

* fix cases around blurring

* fix modal rendering so keyboard shortcuts work on modal as well

* Revert "fix modal rendering so keyboard shortcuts work on modal as well"

This reverts commit 2c8ec6be8eff7d308591467fe2c33cfbca16138f.

* Attach keyboard event in react way so we need not handle portals separately (modals)

* dnt propagate esc event when modal shown

* focus the container when help dialog closed with shift+?

* focus the help icon when help dialog on close triggered

* move focusNearestTabbableParent to util

* rename util to focusNearestParent and remove outline from excal and modal

* Add prop bindKeyGlobally to decide if keyboard events should be binded to document and allow it in excal app, revert tests

* fix

* focus container after installing library, reset library and closing error dialog

* fix tests and create util to focus container

* Add excalidraw-container class to focus on the container

* pass focus container to library to focus current instance of excal

* update docs

* remove util as it wont be used anywhere

* fix propagation not being stopped for React keyboard handling

* tweak reamde

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

* tweak changelog

* rename prop to handleKeyboardGlobally

Co-authored-by: dwelle <luzar.david@gmail.com>
2021-04-13 01:29:25 +05:30
David Luzar
a7cbe68ae8
refactor: improve types around dataState and libraryData (#3427) 2021-04-10 19:17:49 +02:00
Aakansha Doshi
c19c8ecd27
feat: Add scroll listener to the nearest scrollable container and allow consumer to disable it (#3408)
* fix: Add scroll listener to the nearest scrollable container

* fix

* use loop instead of recursion

* fix

* return document

* calculate nearest scrollable container in settimeout to unblock main thread

* Add prop detectNearestScroll and clear timeout on unmount

* disable scroll listener on excal app

* update prop name to detectScroll

* update docs

* remove settimeout

* tweak docs

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

* tweak changelog

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

* lint

Co-authored-by: David Luzar <luzar.david@gmail.com>
2021-04-09 20:44:54 +05:30
Aakansha Doshi
c54a099010
feat: Calculate width/height of canvas based on container dimensions (".excalidraw" selector) & remove props width & height (#3379)
* Remove width/height from the ".excalidraw" container so it will sized automatically.
* updated all ref calculation to ".excalidraw" instead of parent since now ".excalidraw" will get resized
* Remove props width/height as its not needed anymore.
* Resize handler is also not needed anymore.
* Position absolute canvas due to #3379 (comment)

* move css to style and remove one extra rerendering

* factor out mock logic for test

* set height, width so as to avoid unnecessary updates of regression snap

* better mock

* better type checking and omit width,height from getDefaultAppState and also restore

* revert

* default to window dimensions in constructor

* update docs

* update

* update

* tweaks
2021-04-04 15:05:16 +05:30