Compare commits

..

791 Commits

Author SHA1 Message Date
31747b08a7 refine routes 2021-02-14 17:49:37 +02:00
c71ba5c02a add room 2021-02-14 17:43:09 +02:00
e86ae51c92 test handle filesystem 2021-02-14 17:34:41 +02:00
d87ced1711 separate routes 2021-02-14 17:25:27 +02:00
803785201e fix regexp 2021-02-14 17:23:10 +02:00
e844ef8c34 fix headers 2021-02-14 17:19:12 +02:00
9e2df2ac82 merge routes with headers 2021-02-14 17:18:07 +02:00
feae342283 resolve #2910 2021-02-14 17:15:40 +02:00
e6cd97c4f2 feat: adjust line-confirm-threshold based on zoom (#2884)
Co-authored-by: Lipis <lipiridis@gmail.com>
2021-02-14 14:43:23 +01:00
ba9b65b051 chore: npm audit fix 2021-02-14 15:18:17 +02:00
830fb64a25 fix: Support Excalidraw inside scrollable container (#3018)
* refactor: remove position fixed from excalidraw container, modal and stats

* remove unused css

* remove position fixed from toast and scroll to content

* Make excal interactable by fixing offsets and set popover as fixed since position needs to be calculate from viewport  top

* Assign 200px less than height of Excalidraw to the selected shapes actions o UI doesn't overflow

* update changelog, readme and package.json
2021-02-14 18:18:34 +05:30
5b343a9d46 chore(deps-dev): bump @babel/preset-env from 7.12.13 to 7.12.16 in /src/packages/utils (#3030)
Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.12.13 to 7.12.16.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.12.16/packages/babel-preset-env)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-14 11:47:25 +02:00
f8beb305de refactor: Removed redundant import from App.tsx (#3040)
Given it's followed by qualified import - unqualified import looks redundant, unless I'm missing some tricky edge case.
2021-02-14 11:25:57 +02:00
4b4eecbd27 chore(deps): bump react-scripts from 4.0.1 to 4.0.2 (#2979)
Bumps [react-scripts](https://github.com/facebook/create-react-app/tree/HEAD/packages/react-scripts) from 4.0.1 to 4.0.2.
- [Release notes](https://github.com/facebook/create-react-app/releases)
- [Changelog](https://github.com/facebook/create-react-app/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/create-react-app/commits/react-scripts@4.0.2/packages/react-scripts)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-14 09:23:05 +00:00
e8bd910b9b chore(deps-dev): bump @babel/preset-env from 7.12.13 to 7.12.16 in /src/packages/excalidraw (#3019)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-14 08:20:30 +00:00
a9a3e1bca5 chore(deps-dev): bump ts-loader from 8.0.15 to 8.0.17 in /src/packages/utils (#3027)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-14 08:16:28 +00:00
2a922dd477 chore(deps-dev): bump @babel/preset-typescript from 7.12.13 to 7.12.16 in /src/packages/excalidraw (#3025)
Bumps [@babel/preset-typescript](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-typescript) from 7.12.13 to 7.12.16.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.12.16/packages/babel-preset-typescript)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-14 08:12:33 +00:00
07dab85ebf chore(deps-dev): bump sass-loader from 11.0.0 to 11.0.1 in /src/packages/excalidraw (#3020)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-14 08:07:01 +00:00
d2ce4a7523 chore(deps-dev): bump ts-loader from 8.0.15 to 8.0.17 in /src/packages/excalidraw (#3029)
Bumps [ts-loader](https://github.com/TypeStrong/ts-loader) from 8.0.15 to 8.0.17.
- [Release notes](https://github.com/TypeStrong/ts-loader/releases)
- [Changelog](https://github.com/TypeStrong/ts-loader/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TypeStrong/ts-loader/compare/v8.0.15...v8.0.17)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-14 08:01:57 +00:00
dc73f3a9eb chore(deps-dev): bump @babel/core from 7.12.13 to 7.12.16 in /src/packages/excalidraw (#3031)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-14 07:59:28 +00:00
d100f38750 chore(deps-dev): bump @babel/preset-typescript from 7.12.13 to 7.12.16 in /src/packages/utils (#3024)
Bumps [@babel/preset-typescript](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-typescript) from 7.12.13 to 7.12.16.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.12.16/packages/babel-preset-typescript)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-14 07:55:41 +00:00
503500cc74 chore(deps-dev): bump @babel/plugin-transform-typescript from 7.12.13 to 7.12.16 in /src/packages/utils (#3028)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-14 07:46:40 +00:00
1a828a43d9 chore(deps): bump @types/react-dom from 17.0.0 to 17.0.1 (#3035)
Bumps [@types/react-dom](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react-dom) from 17.0.0 to 17.0.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react-dom)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-14 07:45:50 +00:00
d88884466b chore(deps-dev): bump @babel/core from 7.12.13 to 7.12.16 in /src/packages/utils (#3021)
Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.12.13 to 7.12.16.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.12.16/packages/babel-core)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-14 09:44:21 +02:00
d3d470ac3d chore(deps-dev): bump jest-canvas-mock from 2.3.0 to 2.3.1 (#3037)
Bumps [jest-canvas-mock](https://github.com/hustcc/jest-canvas-mock) from 2.3.0 to 2.3.1.
- [Release notes](https://github.com/hustcc/jest-canvas-mock/releases)
- [Changelog](https://github.com/hustcc/jest-canvas-mock/blob/master/CHANGELOG.md)
- [Commits](https://github.com/hustcc/jest-canvas-mock/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-14 09:43:49 +02:00
54df521a78 chore(deps-dev): bump mini-css-extract-plugin from 1.3.5 to 1.3.6 in /src/packages/excalidraw (#3022)
Bumps [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin) from 1.3.5 to 1.3.6.
- [Release notes](https://github.com/webpack-contrib/mini-css-extract-plugin/releases)
- [Changelog](https://github.com/webpack-contrib/mini-css-extract-plugin/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/mini-css-extract-plugin/compare/v1.3.5...v1.3.6)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-14 09:43:38 +02:00
c5557b5cc1 chore(deps): bump typescript from 4.1.3 to 4.1.5 (#3034)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.1.3 to 4.1.5.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v4.1.3...v4.1.5)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-14 09:43:27 +02:00
51875fd627 chore(deps): bump firebase from 8.2.6 to 8.2.7 (#3038)
Bumps [firebase](https://github.com/firebase/firebase-js-sdk) from 8.2.6 to 8.2.7.
- [Release notes](https://github.com/firebase/firebase-js-sdk/releases)
- [Changelog](https://github.com/firebase/firebase-js-sdk/blob/master/CHANGELOG.md)
- [Commits](https://github.com/firebase/firebase-js-sdk/compare/firebase@8.2.6...firebase@8.2.7)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-14 09:42:53 +02:00
b2ba61bbcf chore(deps-dev): bump webpack from 5.21.1 to 5.21.2 in /src/packages/excalidraw (#3032)
Bumps [webpack](https://github.com/webpack/webpack) from 5.21.1 to 5.21.2.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.21.1...v5.21.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-14 09:42:36 +02:00
3b7f62c9a0 chore(deps-dev): bump @babel/plugin-transform-typescript from 7.12.13 to 7.12.16 in /src/packages/excalidraw (#3033)
Bumps [@babel/plugin-transform-typescript](https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-transform-typescript) from 7.12.13 to 7.12.16.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.12.16/packages/babel-plugin-transform-typescript)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-14 09:42:26 +02:00
aeafb81479 chore(deps-dev): bump css-loader in /src/packages/excalidraw (#3026)
Bumps [css-loader](https://github.com/webpack-contrib/css-loader) from 5.0.1 to 5.0.2.
- [Release notes](https://github.com/webpack-contrib/css-loader/releases)
- [Changelog](https://github.com/webpack-contrib/css-loader/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/css-loader/compare/v5.0.1...v5.0.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-14 09:42:13 +02:00
dfe81bf6b2 chore(deps-dev): bump webpack from 5.21.1 to 5.21.2 in /src/packages/utils (#3023)
Bumps [webpack](https://github.com/webpack/webpack) from 5.21.1 to 5.21.2.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.21.1...v5.21.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-14 09:42:02 +02:00
1d332d597a chore(deps): bump @types/react from 17.0.1 to 17.0.2 (#3036)
Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 17.0.1 to 17.0.2.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-14 09:41:09 +02:00
b5fc8757a4 fix: allow to toggle between modes when view only mode to make UI consistent (#3009) 2021-02-12 10:40:40 +02:00
ecbd5ba55d docs: update readme, changelog and release 0.3.0 🎉 (#3003) 2021-02-11 19:55:38 +05:30
6967d8c985 chore: Update translations from Crowdin (#3000) 2021-02-11 14:13:32 +02:00
4b253c7362 fix: refresh wysiwyg position on canvas resize (#3008) 2021-02-11 12:24:26 +01:00
4fdddb518a docs(readme): link to @excalidraw/excalidraw npm package to give more visibility (#3002) 2021-02-10 21:58:29 +05:30
0b2e4dd60b build(webpack): remove publicPath so __webpack_public_path__ can be used to host assets (#2835)
* build(webpack): remove publicPath so __webpack_public_path__ can be use to host assets

* update readme and changelog

* fix

* revert version so its released in v3
2021-02-10 21:49:16 +05:30
f162512988 docs: link to specific sponsors (#2950) 2021-02-10 10:22:49 +02:00
2f7154cdf2 chore: Use Sentence case for Live collaboration 2021-02-09 15:55:03 +02:00
5ab0ce5a33 feat: Add the ability to clear library (#2997)
* Add the ability to clear libraries

* Update 'libraries' to 'library'

* Update en.json
2021-02-09 11:19:04 +01:00
073f4032f3 chore: Update translations from Crowdin (#2986) 2021-02-09 11:06:23 +02:00
73cba59d2d feat: Updates to Collaboration and RTL UX (#2994) 2021-02-08 21:43:51 +01:00
4085071347 docs: Fix typo (#2996) 2021-02-08 18:39:59 +02:00
8a63187d4f Update the lang attribute with the current lang. (#2995)
Currently, when changing the app language, the `lang` attribute still in `en`.
2021-02-08 12:38:38 +02:00
9c51ba6067 feat: show toast when saving to existing file (#2988) 2021-02-07 22:01:22 +01:00
bf50c9cae7 chore: Update translations from Crowdin (#2946) 2021-02-07 12:33:37 +02:00
1801048763 chore(deps-dev): bump @babel/plugin-transform-arrow-functions from 7.12.1 to 7.12.13 in /src/packages/excalidraw (#2961)
Bumps [@babel/plugin-transform-arrow-functions](https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-transform-arrow-functions) from 7.12.1 to 7.12.13.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.12.13/packages/babel-plugin-transform-arrow-functions)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-07 11:25:00 +02:00
414deea084 chore(deps-dev): bump @babel/preset-typescript from 7.12.7 to 7.12.13 in /src/packages/excalidraw (#2955)
Bumps [@babel/preset-typescript](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-typescript) from 7.12.7 to 7.12.13.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.12.13/packages/babel-preset-typescript)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-07 09:15:47 +00:00
979d28d5c6 chore(deps-dev): bump @babel/preset-env from 7.12.11 to 7.12.13 in /src/packages/utils (#2970)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-07 09:14:45 +00:00
1f8b7e417f chore(deps-dev): bump @babel/plugin-transform-async-to-generator from 7.12.1 to 7.12.13 in /src/packages/excalidraw (#2957)
Bumps [@babel/plugin-transform-async-to-generator](https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-transform-async-to-generator) from 7.12.1 to 7.12.13.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.12.13/packages/babel-plugin-transform-async-to-generator)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-07 09:05:16 +00:00
8c968cd13e chore(deps-dev): bump @babel/preset-typescript from 7.12.7 to 7.12.13 in /src/packages/utils (#2964)
Bumps [@babel/preset-typescript](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-typescript) from 7.12.7 to 7.12.13.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.12.13/packages/babel-preset-typescript)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-07 08:59:54 +00:00
f798000006 chore(deps-dev): bump @babel/plugin-transform-async-to-generator from 7.12.1 to 7.12.13 in /src/packages/utils (#2972)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-07 08:55:43 +00:00
7ff3a71179 chore(deps-dev): bump @babel/preset-env from 7.12.11 to 7.12.13 in /src/packages/excalidraw (#2973)
Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.12.11 to 7.12.13.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.12.13/packages/babel-preset-env)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-07 08:48:42 +00:00
6c0804d4c3 chore(deps-dev): bump @babel/core from 7.12.10 to 7.12.13 in /src/packages/excalidraw (#2952)
Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.12.10 to 7.12.13.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.12.13/packages/babel-core)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-07 08:45:04 +00:00
ae8e7aca16 chore(deps-dev): bump ts-loader from 8.0.14 to 8.0.15 in /src/packages/excalidraw (#2969)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-07 08:41:10 +00:00
842b185aa6 chore(deps-dev): bump @babel/plugin-transform-runtime from 7.12.10 to 7.12.15 in /src/packages/utils (#2968)
Bumps [@babel/plugin-transform-runtime](https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-transform-runtime) from 7.12.10 to 7.12.15.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.12.15/packages/babel-plugin-transform-runtime)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-07 08:34:00 +00:00
f59387471e chore(deps): bump firebase from 8.2.5 to 8.2.6 (#2983)
Bumps [firebase](https://github.com/firebase/firebase-js-sdk) from 8.2.5 to 8.2.6.
- [Release notes](https://github.com/firebase/firebase-js-sdk/releases)
- [Changelog](https://github.com/firebase/firebase-js-sdk/blob/master/CHANGELOG.md)
- [Commits](https://github.com/firebase/firebase-js-sdk/compare/firebase@8.2.5...firebase@8.2.6)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-07 08:31:32 +00:00
60eb709eb3 chore(deps-dev): bump @babel/plugin-transform-runtime from 7.12.10 to 7.12.15 in /src/packages/excalidraw (#2967)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-07 08:27:00 +00:00
02539bbb89 chore(deps): bump @testing-library/react from 11.2.3 to 11.2.5 (#2975)
Bumps [@testing-library/react](https://github.com/testing-library/react-testing-library) from 11.2.3 to 11.2.5.
- [Release notes](https://github.com/testing-library/react-testing-library/releases)
- [Changelog](https://github.com/testing-library/react-testing-library/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/react-testing-library/compare/v11.2.3...v11.2.5)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-07 10:19:28 +02:00
77ae5d4605 chore(deps): bump @sentry/* from 6.0.3 to 6.1.0 (#2984) 2021-02-07 10:17:05 +02:00
bdd4f69bf6 chore(deps-dev): bump @babel/preset-react from 7.12.10 to 7.12.13 in /src/packages/excalidraw (#2963)
Bumps [@babel/preset-react](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-react) from 7.12.10 to 7.12.13.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.12.13/packages/babel-preset-react)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-07 10:16:47 +02:00
87ca829490 chore(deps-dev): bump webpack-cli from 4.4.0 to 4.5.0 in /src/packages/excalidraw (#2953)
Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 4.4.0 to 4.5.0.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-cli/compare/webpack-cli@4.4.0...webpack-cli@4.5.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-07 10:15:42 +02:00
a31a7fd766 chore(deps-dev): bump @babel/plugin-transform-typescript from 7.12.1 to 7.12.13 in /src/packages/utils (#2954)
Bumps [@babel/plugin-transform-typescript](https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-transform-typescript) from 7.12.1 to 7.12.13.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.12.13/packages/babel-plugin-transform-typescript)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-07 08:12:48 +00:00
e70f02063f chore(deps-dev): bump sass-loader from 10.1.1 to 11.0.0 in /src/packages/excalidraw (#2971)
Bumps [sass-loader](https://github.com/webpack-contrib/sass-loader) from 10.1.1 to 11.0.0.
- [Release notes](https://github.com/webpack-contrib/sass-loader/releases)
- [Changelog](https://github.com/webpack-contrib/sass-loader/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/sass-loader/compare/v10.1.1...v11.0.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-07 08:10:24 +00:00
769f727bd4 chore(deps-dev): bump @babel/plugin-transform-arrow-functions from 7.12.1 to 7.12.13 in /src/packages/utils (#2960)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-07 07:58:51 +00:00
bc994fcbe2 chore(deps-dev): bump @babel/core from 7.12.10 to 7.12.13 in /src/packages/utils (#2956)
Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.12.10 to 7.12.13.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.12.13/packages/babel-core)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-07 09:52:55 +02:00
ac5e058222 chore(deps-dev): bump webpack from 5.19.0 to 5.21.1 in /src/packages/utils (#2966)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-07 07:52:22 +00:00
d61970cdac chore(deps): bump browser-fs-access from 0.13.0 to 0.13.1 (#2980)
Bumps [browser-fs-access](https://github.com/GoogleChromeLabs/browser-fs-access) from 0.13.0 to 0.13.1.
- [Release notes](https://github.com/GoogleChromeLabs/browser-fs-access/releases)
- [Commits](https://github.com/GoogleChromeLabs/browser-fs-access/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-07 09:43:49 +02:00
489d4b7469 chore(deps-dev): bump webpack from 5.19.0 to 5.21.1 in /src/packages/excalidraw (#2965)
Bumps [webpack](https://github.com/webpack/webpack) from 5.19.0 to 5.21.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.19.0...v5.21.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-07 09:43:26 +02:00
d88de08872 chore(deps-dev): bump webpack-cli from 4.4.0 to 4.5.0 in /src/packages/utils (#2958)
Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 4.4.0 to 4.5.0.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-cli/compare/webpack-cli@4.4.0...webpack-cli@4.5.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-07 09:42:51 +02:00
42882e2a93 chore(deps-dev): bump @babel/plugin-transform-typescript (#2959)
Bumps [@babel/plugin-transform-typescript](https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-transform-typescript) from 7.12.1 to 7.12.13.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.12.13/packages/babel-plugin-transform-typescript)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-07 09:42:37 +02:00
f6374e5bde chore(deps-dev): bump ts-loader from 8.0.14 to 8.0.15 in /src/packages/utils (#2962)
Bumps [ts-loader](https://github.com/TypeStrong/ts-loader) from 8.0.14 to 8.0.15.
- [Release notes](https://github.com/TypeStrong/ts-loader/releases)
- [Changelog](https://github.com/TypeStrong/ts-loader/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TypeStrong/ts-loader/compare/v8.0.14...v8.0.15)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-07 09:42:20 +02:00
aac9d4e837 chore(deps): bump @types/react from 17.0.0 to 17.0.1 (#2978)
Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 17.0.0 to 17.0.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-07 09:42:12 +02:00
d9103b8b24 chore(deps-dev): bump firebase-tools from 9.2.2 to 9.3.0 (#2974)
Bumps [firebase-tools](https://github.com/firebase/firebase-tools) from 9.2.2 to 9.3.0.
- [Release notes](https://github.com/firebase/firebase-tools/releases)
- [Changelog](https://github.com/firebase/firebase-tools/blob/master/CHANGELOG.md)
- [Commits](https://github.com/firebase/firebase-tools/compare/v9.2.2...v9.3.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-07 09:42:02 +02:00
8b56346011 chore(deps-dev): bump lint-staged from 10.5.3 to 10.5.4 (#2976)
Bumps [lint-staged](https://github.com/okonet/lint-staged) from 10.5.3 to 10.5.4.
- [Release notes](https://github.com/okonet/lint-staged/releases)
- [Commits](https://github.com/okonet/lint-staged/compare/v10.5.3...v10.5.4)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-07 09:41:52 +02:00
e63a0ec5be feat: allow host to pass color for collaborators (#2943)
* feat: allow host to pass color for collaborators

* remove user prop as its not used anywhere

* update changelog and readme

* add pr link
2021-02-06 23:33:52 +05:30
86222662f2 docs: Add open collective in readme (#2948)
Co-authored-by: David Luzar <luzar.david@gmail.com>
2021-02-06 18:12:35 +02:00
066560311b feat: add props zenModeEnabled and gridModeEnabled so host can control completely (#2901)
* feat: add props zenModeEnabled and gridModeEnabled so host can control completely

* dnt show exit zenmode button when prop present

* fix

* update when props change

* Add tests

* Add tests

* update changelog and readme

* update

* Update src/tests/excalidrawPackage.test.tsx

* Update src/packages/excalidraw/README.md

Co-authored-by: Lipis <lipiridis@gmail.com>

* Update src/packages/excalidraw/README.md

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

* Apply suggestions from code review

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

* fix specs

Co-authored-by: Lipis <lipiridis@gmail.com>
Co-authored-by: David Luzar <luzar.david@gmail.com>
2021-02-06 21:22:28 +05:30
d6ca981f7a fix: Rename 'Grid mode' to 'Show grid' (#2944) 2021-02-05 23:50:53 +02:00
f7f98d9dda chore: Update translations from Crowdin (#2930) 2021-02-05 20:07:33 +02:00
1a67642fd1 chore: [Idle detection] Deal with users on systems that don't handle emoji (#2941)
* Deal with users on systems that don't handle emoji

* Leave no trailing space

* Move function to utils, and actually call it 🤣
Chapeau, TypeScript!

* Use grinning face instead of koala

* Tweak globalAlpha
2021-02-05 18:34:35 +01:00
6aa22bada8 fix: mobile toolbar tooltip regression (#2939) 2021-02-05 16:09:40 +01:00
00209ef9c3 fix: hide collaborator list on mobile if empty (#2938)
Co-authored-by: Lipis <lipiridis@gmail.com>
2021-02-05 15:45:44 +01:00
b79ef0d428 fix: don't prompt on empty scenes (#2937) 2021-02-05 12:04:33 +01:00
dc25fe06d0 chore: Update translations from Crowdin (#2906) 2021-02-04 20:18:57 +02:00
1e17c1967b fix: toolbar unnecessarily eats too much width (#2924) 2021-02-04 16:52:16 +01:00
23a8891e0e fix: mistakenly hardcoding scale (#2925) 2021-02-04 16:52:00 +01:00
6c81a32d62 fix: text editor not visible in dark mode (#2920) 2021-02-04 16:21:48 +01:00
f0f5430313 feat: support supplying custom scale when exporting canvas (#2904) 2021-02-04 14:54:08 +01:00
e18e945cd3 fix: incorrect z-index of text editor (#2914) 2021-02-04 14:54:00 +01:00
bd0c6e63ff feat: Show version in the stats dialog (#2908)
Co-authored-by: dwelle <luzar.david@gmail.com>
2021-02-04 13:47:46 +01:00
dbae33e4f8 fix: make scrollbars draggable when offsets are set (#2916)
Co-authored-by: dwelle <luzar.david@gmail.com>
2021-02-04 13:07:29 +01:00
0f4a053759 chore: Run actions on pull requests as well (#2917)
* chore: Run actions on pull requests as well

* Update cancel.yml

* Update lint.yml

* Update test.yml

* Update cancel.yml
2021-02-04 13:01:20 +01:00
1837147c55 feat: Add idle detection to collaboration feature (#2877)
* Start idle detection implementation

* First working version

* Add screen state

* Add type safety

* Better rendering, enum types, localization

* Add origin trial token

* Fix

* Refactor idle detection to no longer use IdleDetector API

* Cleanup some leftovers

* Fix

* Apply suggestions from code review

* Three state: active 🟢, idle 💤, away ️

* Address feedback from code review
Thanks, @lipis

* Deal with unmount

Co-authored-by: Panayiotis Lipiridis <lipiridis@gmail.com>
2021-02-04 11:55:43 +01:00
15f698dc21 fix: pointer-events being disabled on free-draw (#2912) 2021-02-03 20:43:16 +01:00
ce507b0a0b feat: don't store to LS during collab (#2909) 2021-02-03 19:14:26 +01:00
02598c6163 chore: Update translations from Crowdin (#2898) 2021-02-02 22:06:44 +00:00
3e2890bd21 fix: track zenmode and grid mode usage (#2900) 2021-02-02 20:57:22 +05:30
210649f383 refactor: Use the latest vercel configuration instead of now (#2893)
* refactor: Use the latest vercel configuration instead of now

* Remove redict
2021-02-02 14:38:33 +01:00
f8087e01c8 chore: Update translations from Crowdin (#2894) 2021-02-02 09:41:57 +00:00
e2522645f7 Update i18n.ts 2021-02-02 11:35:52 +02:00
d46a9166be Update locales-coverage-description.js 2021-02-02 11:35:00 +02:00
675da16ca4 feat: add view mode in Excalidraw (#2840)
Co-authored-by: Lipis <lipiridis@gmail.com>
2021-02-01 21:56:42 +01:00
2b1b62d8f2 chore(deps): bump @sentry/integrations from 6.0.1 to 6.0.3 (#2889)
* chore(deps): bump @sentry/integrations from 6.0.1 to 6.0.3

Bumps [@sentry/integrations](https://github.com/getsentry/sentry-javascript) from 6.0.1 to 6.0.3.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/6.0.1...6.0.3)

Signed-off-by: dependabot[bot] <support@github.com>

* Update both

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Panayiotis Lipiridis <lipiridis@gmail.com>
2021-02-01 12:59:03 +00:00
627c56ef1c fix: disable UI pointer-events on canvas drag (#2856) 2021-02-01 14:55:38 +02:00
0d0fe32485 chore: Update translations from Crowdin (#2875) 2021-02-01 13:23:08 +02:00
6576b9442e chore(deps): bump firebase from 8.2.4 to 8.2.5 (#2888)
Bumps [firebase](https://github.com/firebase/firebase-js-sdk) from 8.2.4 to 8.2.5.
- [Release notes](https://github.com/firebase/firebase-js-sdk/releases)
- [Changelog](https://github.com/firebase/firebase-js-sdk/blob/master/CHANGELOG.md)
- [Commits](https://github.com/firebase/firebase-js-sdk/compare/firebase@8.2.4...firebase@8.2.5)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-31 20:58:05 +02:00
ee4cb2d4a9 chore(deps-dev): bump webpack from 5.17.0 to 5.19.0 in /src/packages/utils (#2887)
Bumps [webpack](https://github.com/webpack/webpack) from 5.17.0 to 5.19.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.17.0...v5.19.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-31 20:57:53 +02:00
cdcc91faa5 chore(deps-dev): bump mini-css-extract-plugin from 1.3.4 to 1.3.5 in /src/packages/excalidraw (#2885)
Bumps [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin) from 1.3.4 to 1.3.5.
- [Release notes](https://github.com/webpack-contrib/mini-css-extract-plugin/releases)
- [Changelog](https://github.com/webpack-contrib/mini-css-extract-plugin/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/mini-css-extract-plugin/compare/v1.3.4...v1.3.5)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-31 20:57:36 +02:00
9093341dc1 chore(deps-dev): bump webpack from 5.17.0 to 5.19.0 in /src/packages/excalidraw (#2886)
Bumps [webpack](https://github.com/webpack/webpack) from 5.17.0 to 5.19.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.17.0...v5.19.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-31 20:57:19 +02:00
1973ae9444 fix: stop flooring scroll positions (#2883) 2021-01-31 10:47:43 +01:00
10cd6a24b0 feat: increase max zoom (#2881) 2021-01-30 18:03:23 +01:00
6abf4f52ff refactor: remove duplicate key handling (#2878) 2021-01-30 10:30:00 +01:00
4624ec2bd6 fix: apply initialData appState for zenmode and grid stats and refactor check param for actions (#2871)
* fix: pass default value for grid mode / zen mode so it sets the value from initialData appState

fixes #2870

* change checked from boolean to be a function which recieves appState and returns boolean

* fix

* use clsx

Co-authored-by: dwelle <luzar.david@gmail.com>
2021-01-29 23:38:37 +05:30
e8685c5236 feat: Remove copy & paste from context menu on desktop (#2872)
* Remove copy & paste from context menu on desktop

* fix build

* Make requested changes

* More changes

* make into function

* update changelog

* fix tests

Co-authored-by: dwelle <luzar.david@gmail.com>
2021-01-28 22:02:00 +01:00
6e9df2bae7 fix(app.tsx): show correct state of Nerd stats in context menu when nerd stats dialog closed (#2874)
fixes #2873
2021-01-29 02:21:10 +05:30
ed0bec41dc chore: Update workflows to use the latest Node (#2863) 2021-01-28 19:20:48 +05:30
d4e12a2962 reuse scss variables in js for SSOT (#2867) 2021-01-28 17:28:35 +05:30
978e85a33b feat: Add separators on context menu (#2659)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dwelle <luzar.david@gmail.com>
Co-authored-by: Lipis <lipiridis@gmail.com>
2021-01-27 20:11:17 +01:00
b5e26ba81f refactor: Rename browser-nativefs to browser-fs-access (#2862) 2021-01-27 20:47:55 +02:00
4392a4644a chore: Update translations from Crowdin (#2861) 2021-01-27 14:22:37 +02:00
b1c8c538ee fix: Change the timeout for reporting the version to 30s (#2858) 2021-01-26 22:22:41 +02:00
f6492895df chore: Update translations from Crowdin (#2839)
Co-authored-by: Excalidraw Bot <77840495+excalidrawbot@users.noreply.github.com>
2021-01-26 14:48:36 +02:00
e75f5f20e7 fix: remote pointers not accounting for offset (#2855) 2021-01-25 10:47:48 +01:00
0a0be839b9 refactor: rewrite collabWrapper to remove TDZs and simplify (#2834) 2021-01-25 10:47:35 +01:00
03f6d9c783 chore(deps-dev): bump webpack-cli from 4.3.1 to 4.4.0 in /src/packages/excalidraw (#2847)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-24 09:00:02 +00:00
df745c1098 chore(deps-dev): bump webpack from 5.15.0 to 5.17.0 in /src/packages/excalidraw (#2844)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-24 08:59:37 +00:00
b888f7e7ba chore(deps-dev): bump webpack-bundle-analyzer from 4.3.0 to 4.4.0 in /src/packages/utils (#2848)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-24 08:58:30 +00:00
3010253f72 chore(deps): bump @sentry/browser from 5.30.0 to 6.0.1 (#2852)
Bumps [@sentry/browser](https://github.com/getsentry/sentry-javascript) from 5.30.0 to 6.0.1.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.30.0...6.0.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-24 08:57:12 +00:00
0815f3282e chore(deps-dev): bump webpack-cli from 4.3.1 to 4.4.0 in /src/packages/utils (#2849)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-24 10:55:38 +02:00
9dd58288de chore(deps-dev): bump webpack-bundle-analyzer from 4.3.0 to 4.4.0 in /src/packages/excalidraw (#2845)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-24 10:54:48 +02:00
c2e2bb495c chore(deps-dev): bump webpack from 5.15.0 to 5.17.0 in /src/packages/utils (#2846)
Bumps [webpack](https://github.com/webpack/webpack) from 5.15.0 to 5.17.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.15.0...v5.17.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-24 10:54:36 +02:00
a31cfe1f07 chore(deps-dev): bump firebase-tools from 9.2.1 to 9.2.2 (#2850)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-24 10:53:35 +02:00
d3367bfe12 chore(deps-dev): bump eslint-config-prettier from 7.1.0 to 7.2.0 (#2851)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-24 10:53:23 +02:00
70791dfa7b chore(deps): bump firebase from 8.2.3 to 8.2.4 (#2853)
Bumps [firebase](https://github.com/firebase/firebase-js-sdk) from 8.2.3 to 8.2.4.
- [Release notes](https://github.com/firebase/firebase-js-sdk/releases)
- [Changelog](https://github.com/firebase/firebase-js-sdk/blob/master/CHANGELOG.md)
- [Commits](https://github.com/firebase/firebase-js-sdk/compare/firebase@8.2.3...firebase@8.2.4)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-24 10:52:52 +02:00
d63ec678db chore(deps): bump @sentry/integrations from 5.30.0 to 6.0.1 (#2854)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-24 10:52:41 +02:00
26acebcdb6 chore: Update translations from Crowdin (#2817) 2021-01-22 18:06:21 +02:00
9dc930b447 feat: add ctrl-y to redo (#2831) 2021-01-21 16:21:54 +01:00
6e767fc949 fix(actionmenu): toggle help dialog when "shift+?" is pressed (#2828) 2021-01-21 13:13:47 +02:00
49bd683401 fix(analytics.ts): add safe check for process so Excalidraw can be loaded via script (#2824)
* fix(analytics.ts): add safe check for process so Excalidraw can be loaded via script

* fix
2021-01-20 21:27:33 +05:30
3922ee8c11 docs: update changelog and readme and release 0.2.1 (#2821) 2021-01-19 17:38:04 +01:00
8c2bc94336 build(webpack): bundle css files with js (#2819) 2021-01-19 15:29:05 +01:00
fb4d97ef78 fix: Use VERCEL_GIT_COMMIT_SHA env variable (#2816) 2021-01-18 19:22:02 +02:00
a8e28afbad chore: Update translations from Crowdin (#2790)
Co-authored-by: Kostas Bariotis <konmpar@gmail.com>
2021-01-18 17:00:42 +02:00
68347ba476 docs(changelog): add about extra api's in changelog and separate package and library updates (#2813) 2021-01-17 18:48:19 +01:00
ce2c341910 feat: Change shortcuts menu to help menu (#2812)
Co-authored-by: Panayiotis Lipiridis <lipiridis@gmail.com>
2021-01-17 18:46:23 +02:00
07cc858926 chore(deps-dev): bump husky from 4.3.7 to 4.3.8 (#2804)
Bumps [husky](https://github.com/typicode/husky) from 4.3.7 to 4.3.8.
- [Release notes](https://github.com/typicode/husky/releases)
- [Commits](https://github.com/typicode/husky/compare/v4.3.7...v4.3.8)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-17 11:33:24 +02:00
a7a2936f7c chore(deps): bump @sentry/integrations from 5.29.2 to 5.30.0 (#2807)
Bumps [@sentry/integrations](https://github.com/getsentry/sentry-javascript) from 5.29.2 to 5.30.0.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.29.2...5.30.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-17 11:33:15 +02:00
e72ff6be66 chore(deps-dev): bump webpack from 5.12.3 to 5.15.0 in /src/packages/utils (#2803)
Bumps [webpack](https://github.com/webpack/webpack) from 5.12.3 to 5.15.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.12.3...v5.15.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-17 11:33:02 +02:00
0ea29675df chore(deps-dev): bump webpack from 5.12.3 to 5.15.0 in /src/packages/excalidraw (#2800)
Bumps [webpack](https://github.com/webpack/webpack) from 5.12.3 to 5.15.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.12.3...v5.15.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-17 11:31:59 +02:00
da2ad4f37c chore(deps-dev): bump sass-loader from 10.1.0 to 10.1.1 in /src/packages/excalidraw (#2801)
Bumps [sass-loader](https://github.com/webpack-contrib/sass-loader) from 10.1.0 to 10.1.1.
- [Release notes](https://github.com/webpack-contrib/sass-loader/releases)
- [Changelog](https://github.com/webpack-contrib/sass-loader/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/sass-loader/compare/v10.1.0...v10.1.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-17 11:31:45 +02:00
33a7cf0d3f chore(deps): bump firebase from 8.2.2 to 8.2.3 (#2810)
Bumps [firebase](https://github.com/firebase/firebase-js-sdk) from 8.2.2 to 8.2.3.
- [Release notes](https://github.com/firebase/firebase-js-sdk/releases)
- [Changelog](https://github.com/firebase/firebase-js-sdk/blob/master/CHANGELOG.md)
- [Commits](https://github.com/firebase/firebase-js-sdk/commits/firebase@8.2.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-17 11:31:17 +02:00
f8e890df7b chore(deps-dev): bump mini-css-extract-plugin from 1.3.3 to 1.3.4 in /src/packages/excalidraw (#2802)
Bumps [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin) from 1.3.3 to 1.3.4.
- [Release notes](https://github.com/webpack-contrib/mini-css-extract-plugin/releases)
- [Changelog](https://github.com/webpack-contrib/mini-css-extract-plugin/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/mini-css-extract-plugin/compare/v1.3.3...v1.3.4)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-17 11:28:23 +02:00
12337a54a3 chore(deps): bump @testing-library/jest-dom from 5.11.8 to 5.11.9 (#2805)
Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 5.11.8 to 5.11.9.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v5.11.8...v5.11.9)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-17 11:27:38 +02:00
7a9ed2cfa1 chore(deps-dev): bump firebase-tools from 9.1.2 to 9.2.1 (#2808)
Bumps [firebase-tools](https://github.com/firebase/firebase-tools) from 9.1.2 to 9.2.1.
- [Release notes](https://github.com/firebase/firebase-tools/releases)
- [Commits](https://github.com/firebase/firebase-tools/compare/v9.1.2...v9.2.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-17 11:27:12 +02:00
553bf2956f chore(deps): bump @sentry/browser from 5.29.2 to 5.30.0 (#2809)
Bumps [@sentry/browser](https://github.com/getsentry/sentry-javascript) from 5.29.2 to 5.30.0.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.29.2...5.30.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-17 11:27:01 +02:00
1e16a6e5bd chore(deps): bump @types/socket.io-client from 1.4.34 to 1.4.35 (#2811)
Bumps [@types/socket.io-client](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/socket.io-client) from 1.4.34 to 1.4.35.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/socket.io-client)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-17 11:26:44 +02:00
e26f374ca6 improvement: Enhance resize for non generic elements (#2720) 2021-01-16 19:49:13 +01:00
c799b28a0e fix: Count all versions (#2798) 2021-01-16 18:59:26 +01:00
ee703206b0 docs: update changelog and release 0.2.0 (#2725)
* docs(changelog): update changelog and release 0.2.0

* fix

* Add missing API's

* update

* fix

* fix

* Apply suggestions from code review

* remove

* fix

* fix
2021-01-16 22:20:46 +05:30
543c624405 feat: Add toast (#2772)
Co-authored-by: Lipis <lipiridis@gmail.com>
Co-authored-by: dwelle <luzar.david@gmail.com>
2021-01-15 16:02:46 +01:00
0bf6830373 docs: Update readme with documentation (#2788) 2021-01-14 18:31:52 +02:00
af79461f41 fix: allow text-selecting in dialogs & reset cursor (#2783)
Co-authored-by: dwelle <luzar.david@gmail.com>
2021-01-14 14:42:15 +01:00
fd699c0447 chore: Update translations from Crowdin (#2742)
Co-authored-by: Kostas Bariotis <konmpar@gmail.com>
2021-01-14 12:09:05 +02:00
6a16caf13c fix: broken Individuals link (#2782) 2021-01-14 09:24:50 +02:00
511eb62228 refactor: Converting span to kbd tag (#2774) 2021-01-14 09:24:32 +02:00
04c46fc01a fix: don't render due to zoom after unmount (#2779)
* fix: don't render due to zoom after unmount

* update changelog

* remove unnecessary flush
2021-01-13 17:42:42 +01:00
49e792649d fix: Track the chart type correctly (#2773) 2021-01-13 15:23:14 +02:00
4e1caf2417 chore(deps-dev): bump terser-webpack-plugin in /src/packages/excalidraw (#2750)
Bumps [terser-webpack-plugin](https://github.com/webpack-contrib/terser-webpack-plugin) from 5.0.3 to 5.1.1.
- [Release notes](https://github.com/webpack-contrib/terser-webpack-plugin/releases)
- [Changelog](https://github.com/webpack-contrib/terser-webpack-plugin/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/terser-webpack-plugin/compare/v5.0.3...v5.1.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-13 00:44:32 +05:30
034f2e470b chore(deps-dev): bump webpack in /src/packages/utils (#2768)
Bumps [webpack](https://github.com/webpack/webpack) from 5.11.1 to 5.12.3.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.11.1...v5.12.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-13 00:44:11 +05:30
adcd28f348 fix: delay version logging & prevent duplicates (#2770) 2021-01-12 18:47:31 +02:00
62f1ed74f1 chore(deps-dev): bump webpack in /src/packages/excalidraw (#2769)
Bumps [webpack](https://github.com/webpack/webpack) from 5.11.1 to 5.12.3.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.11.1...v5.12.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-12 02:03:31 +05:30
8fa4273969 chore(deps-dev): bump ts-loader in /src/packages/excalidraw (#2749)
Bumps [ts-loader](https://github.com/TypeStrong/ts-loader) from 8.0.13 to 8.0.14.
- [Release notes](https://github.com/TypeStrong/ts-loader/releases)
- [Changelog](https://github.com/TypeStrong/ts-loader/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TypeStrong/ts-loader/compare/v8.0.13...v8.0.14)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-12 01:43:13 +05:30
672068ce7e chore(deps-dev): bump ts-loader in /src/packages/utils (#2753)
Bumps [ts-loader](https://github.com/TypeStrong/ts-loader) from 8.0.13 to 8.0.14.
- [Release notes](https://github.com/TypeStrong/ts-loader/releases)
- [Changelog](https://github.com/TypeStrong/ts-loader/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TypeStrong/ts-loader/compare/v8.0.13...v8.0.14)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-12 01:42:42 +05:30
f1fc308a5d chore(deps): bump nanoid from 2.1.11 to 3.1.20 (#2581)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Panayiotis Lipiridis <lipiridis@gmail.com>
2021-01-11 12:47:10 +02:00
001880ba88 feat: Track current version (#2731) 2021-01-10 20:48:12 +02:00
3a130cb102 chore(actions): Use cancel workflow action (#2763) 2021-01-10 20:09:44 +02:00
e682cf9bf6 chore(deps): bump @testing-library/react from 11.2.2 to 11.2.3 (#2755)
Bumps [@testing-library/react](https://github.com/testing-library/react-testing-library) from 11.2.2 to 11.2.3.
- [Release notes](https://github.com/testing-library/react-testing-library/releases)
- [Changelog](https://github.com/testing-library/react-testing-library/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/react-testing-library/compare/v11.2.2...v11.2.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-10 12:39:44 +02:00
2a169924d0 chore(deps-dev): bump firebase-tools from 9.1.0 to 9.1.2 (#2761)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-10 12:39:29 +02:00
eb6e75b806 chore(deps-dev): bump eslint-plugin-prettier from 3.3.0 to 3.3.1 (#2754)
Bumps [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) from 3.3.0 to 3.3.1.
- [Release notes](https://github.com/prettier/eslint-plugin-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-plugin-prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-plugin-prettier/compare/v3.3.0...v3.3.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-10 12:34:37 +02:00
38857b9e9d chore(deps): bump firebase from 8.2.1 to 8.2.2 (#2758)
Bumps [firebase](https://github.com/firebase/firebase-js-sdk) from 8.2.1 to 8.2.2.
- [Release notes](https://github.com/firebase/firebase-js-sdk/releases)
- [Changelog](https://github.com/firebase/firebase-js-sdk/blob/master/CHANGELOG.md)
- [Commits](https://github.com/firebase/firebase-js-sdk/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-10 12:34:05 +02:00
342289f261 chore(deps-dev): bump husky from 4.3.6 to 4.3.7 (#2757)
Bumps [husky](https://github.com/typicode/husky) from 4.3.6 to 4.3.7.
- [Release notes](https://github.com/typicode/husky/releases)
- [Commits](https://github.com/typicode/husky/compare/v4.3.6...v4.3.7)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-10 12:33:47 +02:00
095d7de618 chore(deps): bump open-color from 1.7.0 to 1.8.0 (#2756)
Bumps [open-color](https://github.com/yeun/open-color) from 1.7.0 to 1.8.0.
- [Release notes](https://github.com/yeun/open-color/releases)
- [Changelog](https://github.com/yeun/open-color/blob/master/build_release)
- [Commits](https://github.com/yeun/open-color/compare/v1.7.0...v1.8.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-10 12:33:25 +02:00
f57d52028a chore(deps): bump @types/jest from 26.0.19 to 26.0.20 (#2759)
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 26.0.19 to 26.0.20.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-10 12:33:02 +02:00
60557df23a ci(semantic-pr-title.yml): update version to 3.0.0 so that action doesn't run twice (#2741)
* ci(semantic-pr-title.yml): don't run this action twice

* Update semantic-pr-title.yml

Co-authored-by: Lipis <lipiridis@gmail.com>
2021-01-08 20:12:48 +05:30
bafbe9bbc8 feat: Add language separator and list English twice (#2739) 2021-01-07 21:39:57 +02:00
eb71e571e0 improvement: Perform lossless compression on all PNG images (#2740) 2021-01-07 18:04:28 +02:00
b608ab74cc chore: New Crowdin updates (#2681)
Co-authored-by: Kostas Bariotis <konmpar@gmail.com>
Co-authored-by: dwelle <luzar.david@gmail.com>
2021-01-07 11:30:22 +02:00
a13c4f72f5 docs: adding PR guidelines for contributors (#2736) 2021-01-06 22:53:12 +02:00
629341da4d improvement: adding zen mode to context menu (#2734) 2021-01-06 17:23:05 +01:00
778e4b08af feat: Add cmd+o shortcut to load scene (#2732) 2021-01-06 13:36:55 +01:00
e16266ce5d Fix translation of Catalan to read Català 2021-01-06 00:46:42 +01:00
b6708fb73f improvement: Make arrowheads keybinds color accessible on dark mode (#2724) 2021-01-05 22:35:03 +02:00
cdffed285d fix(readme): fix typo for initialData and point all links to master (#2707)
* fix(readme): fix typo for initialData

* Update src/packages/excalidraw/README.md

* fix lint

* Update src/packages/excalidraw/README.md

* point all links to master

Co-authored-by: Lipis <lipiridis@gmail.com>
2021-01-06 00:00:18 +05:30
3aa01ad272 chore: Remove tracking (#2722)
* chore: Remove tracking

* process

* rename

* remove

* prod

* Update public/index.html

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

* Update public/index.html

* eol

* more

* stats

Co-authored-by: David Luzar <luzar.david@gmail.com>
2021-01-05 19:06:14 +01:00
4acdc47ef0 improvement: do not reset to selection for draw tool (#2721)
Co-authored-by: Lipis <lipiridis@gmail.com>
Co-authored-by: dwelle <luzar.david@gmail.com>
2021-01-05 14:04:06 +01:00
ade2565f49 feat: add langCode and renderFooter props (#2644)
Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
Co-authored-by: dwelle <luzar.david@gmail.com>
2021-01-03 21:51:52 +01:00
c35d983fef chore(deps): bump @testing-library/jest-dom from 5.11.6 to 5.11.8 (#2702)
Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 5.11.6 to 5.11.8.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v5.11.6...v5.11.8)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-03 10:52:02 +01:00
69878167c2 improvement: Make dialogs look more like dialogs (#2686)
Co-authored-by: Jed Fox <git@jedfox.com>
Co-authored-by: dwelle <luzar.david@gmail.com>
2021-01-03 10:50:41 +01:00
eb1f717d35 chore(deps-dev): bump ts-loader in /src/packages/utils (#2700)
Bumps [ts-loader](https://github.com/TypeStrong/ts-loader) from 8.0.12 to 8.0.13.
- [Release notes](https://github.com/TypeStrong/ts-loader/releases)
- [Changelog](https://github.com/TypeStrong/ts-loader/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TypeStrong/ts-loader/compare/v8.0.12...v8.0.13)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-03 15:20:28 +05:30
8e9af5c51b chore(deps-dev): bump webpack in /src/packages/excalidraw (#2698)
Bumps [webpack](https://github.com/webpack/webpack) from 5.11.0 to 5.11.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.11.0...v5.11.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-03 15:20:06 +05:30
afe0c760f6 chore(deps-dev): bump webpack-cli in /src/packages/utils (#2701)
Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 4.2.0 to 4.3.1.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-cli/compare/webpack-cli@4.2.0...webpack-cli@4.3.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-03 15:14:21 +05:30
a231cefac0 chore(deps-dev): bump webpack-cli in /src/packages/excalidraw (#2697)
Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 4.2.0 to 4.3.1.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-cli/compare/webpack-cli@4.2.0...webpack-cli@4.3.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-03 15:14:01 +05:30
cb4c9d16fc chore(deps-dev): bump webpack in /src/packages/utils (#2699)
Bumps [webpack](https://github.com/webpack/webpack) from 5.11.0 to 5.11.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.11.0...v5.11.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-03 15:02:27 +05:30
7366f089ba chore(packages/excalidraw): bump ts-loader from 8.0.12 to 8.0.13. (#2696)
Bumps [ts-loader](https://github.com/TypeStrong/ts-loader) from 8.0.12 to 8.0.13.
- [Release notes](https://github.com/TypeStrong/ts-loader/releases)
- [Changelog](https://github.com/TypeStrong/ts-loader/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TypeStrong/ts-loader/compare/v8.0.12...v8.0.13)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-03 15:01:57 +05:30
7c3513b9df feat: browse libraries styles fixed (#2694)
* feat: browse libraries styles fixed

* simplify jsx & css

* remove justify-content

* fix padding/margin

* Update src/components/LayerUI.scss

Co-authored-by: benjamin.kugler <benjamin.kugler@elliemae.com>
Co-authored-by: dwelle <luzar.david@gmail.com>
2021-01-02 17:13:48 +01:00
aef3644c93 fix: scene not initialized properly when tab not focused (#2677)
Co-authored-by: Lipis <lipiridis@gmail.com>
2020-12-29 21:03:34 +01:00
0cf58adb4c chore: Update portal URL (#2689) 2020-12-28 13:14:22 +01:00
3aab81bc35 docs: add tsdoc for certain element props (#2673)
Co-authored-by: Panayiotis Lipiridis <lipiridis@gmail.com>
2020-12-28 00:17:27 +02:00
3b0fb1562d feat: Require use of a preset dialog size; adjust dialog sizing (#2684) 2020-12-28 00:07:05 +02:00
0488b7b5c6 fix(css): Fix compile error (#2685) 2020-12-27 23:42:23 +02:00
b8d13c98b5 refactor: Media queries (#2680) 2020-12-27 23:27:25 +02:00
6f82a88b79 chore: Cleanup unused labels (#2682) 2020-12-27 18:51:47 +02:00
022f349dc6 feat: Add line chart and paste dialog selection (#2670)
Co-authored-by: dwelle <luzar.david@gmail.com>
Co-authored-by: Jed Fox <git@jedfox.com>
2020-12-27 18:26:30 +02:00
c1e2146d78 chore(deps-dev): bump firebase-tools from 9.0.1 to 9.1.0 (#2676)
Bumps [firebase-tools](https://github.com/firebase/firebase-tools) from 9.0.1 to 9.1.0.
- [Release notes](https://github.com/firebase/firebase-tools/releases)
- [Commits](https://github.com/firebase/firebase-tools/compare/v9.0.1...v9.1.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-27 13:51:54 +02:00
8091ac6c08 style: media query for hiding shortcuts for mobile view (#2667)
Co-authored-by: Lipis <lipiridis@gmail.com>
2020-12-26 21:23:51 +02:00
Luo
bc414ccaaf feat: tweak editing behavior (#2668)
* feat: tweak editing behavior

* fix tests

Co-authored-by: dwelle <luzar.david@gmail.com>
2020-12-25 19:34:47 +01:00
0cf5f1ac1f chore: update Sentry (#2669) 2020-12-25 20:02:12 +02:00
e9cb7ee77c chore: New Crowdin updates (#2620)
Co-authored-by: Kostas Bariotis <konmpar@gmail.com>
2020-12-25 12:15:34 +02:00
86c036505b chore: Remove unused cursorX, cursorY from AppState (#2665) 2020-12-24 22:05:22 +01:00
39e7b8cf4f chore(deps-dev): bump firebase-tools from 8.19.0 to 9.0.1 (#2629)
Bumps [firebase-tools](https://github.com/firebase/firebase-tools) from 8.19.0 to 9.0.1.
- [Release notes](https://github.com/firebase/firebase-tools/releases)
- [Changelog](https://github.com/firebase/firebase-tools/blob/master/CHANGELOG.md)
- [Commits](https://github.com/firebase/firebase-tools/compare/v8.19.0...v9.0.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-22 11:20:57 +01:00
e0ece680a6 chore(deps): bump firebase from 8.2.0 to 8.2.1 (#2631)
Bumps [firebase](https://github.com/firebase/firebase-js-sdk) from 8.2.0 to 8.2.1.
- [Release notes](https://github.com/firebase/firebase-js-sdk/releases)
- [Changelog](https://github.com/firebase/firebase-js-sdk/blob/master/CHANGELOG.md)
- [Commits](https://github.com/firebase/firebase-js-sdk/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-22 11:01:03 +01:00
8dfea49ec1 improvement: change hint for 2-point lines on resize (#2655) 2020-12-22 11:00:51 +01:00
d7f314cda8 refactor: Remove duplicate entry from en.json (#2654) 2020-12-22 11:42:01 +02:00
6adb45ef5a feat: Change title to Excalidraw after a timeout (#2656)
* feat: Change title to Excalidraw after a timeout

* clear timeout
2020-12-22 10:34:06 +01:00
b0eeb8e6e6 refactor: Remove the word toggle from labels (#2648) 2020-12-21 14:58:43 +01:00
c3c20b6087 chore(deps): bump browser-nativefs from 0.11.2 to 0.12.0 (#2634)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-21 12:35:22 +02:00
0faec7efb6 feat: Checkmark to toggle context-menu-items (#2645) 2020-12-21 00:20:03 +02:00
aff817c667 align items in context menu (#2640) 2020-12-20 12:15:40 -08:00
9a3a3ecb44 fix: Center zoom on iPhone and iPad (#2642)
My last attempt removed the gesture handler altogether but broke macbooks. This one keeps it working on macbook but makes sure it zooms properly on iPhone and iPad.
2020-12-20 12:13:15 -08:00
81f8039ec7 fix: Don't break zoom when zooming in on UI (#2638)
If you start the gesture on the chrome, gesture is not defined and the zoom will be set to NaN and you will have to refresh.

Typescript was actually right and we shouldn't have overridden the bang ;)

Repro:
- On iPhone touch down on a shape, touch down on the chrome, start moving around
- See that the selection is off, but the zoom is not being modified like crazy.

https://user-images.githubusercontent.com/197597/102722206-6c182400-42b4-11eb-9865-6ae1cd0af9be.MP4
2020-12-20 12:07:58 -08:00
14759d5b72 chore: Remove changelog check and graphql (#2639) 2020-12-20 21:52:21 +02:00
b997e69ebc improvement: Tweak error message on image import (#2619)
* improvement: tweak error message on image import

* tweak copy
2020-12-20 16:11:44 +01:00
4a89aba682 chore(deps-dev): bump webpack in /src/packages/excalidraw (#2625)
Bumps [webpack](https://github.com/webpack/webpack) from 5.10.1 to 5.11.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.10.1...v5.11.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-20 20:35:49 +05:30
34dcf998bd docs: excalidraw package usage example tweaks (#2608)
Co-authored-by: Aakansha Doshi <monstershome@gmail.com>
2020-12-20 16:04:12 +01:00
325d1bec91 feat: Add onExportToBackend prop so host can handle it (#2612)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-12-20 15:14:04 +01:00
b917e42694 fix: Consistent case for export locale strings (#2622) 2020-12-20 14:40:11 +02:00
eb9e67e36a improvement: Support numbers with commas in them (#2636) 2020-12-20 14:08:22 +02:00
f14ae52e94 chore(deps-dev): bump @babel/preset-env in /src/packages/excalidraw (#2624)
Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.12.10 to 7.12.11.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.12.11/packages/babel-preset-env)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-20 16:49:20 +05:30
f93eb658d6 chore(deps-dev): bump webpack-bundle-analyzer (#2623)
Bumps [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer) from 4.2.0 to 4.3.0.
- [Release notes](https://github.com/webpack-contrib/webpack-bundle-analyzer/releases)
- [Changelog](https://github.com/webpack-contrib/webpack-bundle-analyzer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/webpack-bundle-analyzer/compare/v4.2.0...v4.3.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-20 16:46:37 +05:30
9bac44ee75 fix(appstate.ts): Remove unnecessary console.error as it was polluting Sentry (#2637) 2020-12-20 16:28:46 +05:30
91b4109f67 chore(deps-dev): bump webpack-bundle-analyzer in /src/packages/utils (#2626)
Bumps [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer) from 4.2.0 to 4.3.0.
- [Release notes](https://github.com/webpack-contrib/webpack-bundle-analyzer/releases)
- [Changelog](https://github.com/webpack-contrib/webpack-bundle-analyzer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/webpack-bundle-analyzer/compare/v4.2.0...v4.3.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-20 16:21:17 +05:30
6e45cb95db chore(deps-dev): bump webpack in /src/packages/utils (#2627)
Bumps [webpack](https://github.com/webpack/webpack) from 5.10.1 to 5.11.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.10.1...v5.11.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-20 15:20:35 +05:30
5edf82898b chore(deps-dev): bump @babel/preset-env in /src/packages/utils (#2628)
Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.12.10 to 7.12.11.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.12.11/packages/babel-preset-env)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-20 15:19:20 +05:30
60b82e3055 chore(deps-dev): bump eslint-config-prettier from 7.0.0 to 7.1.0 (#2632)
Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 7.0.0 to 7.1.0.
- [Release notes](https://github.com/prettier/eslint-config-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-config-prettier/compare/v7.0.0...v7.1.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-20 03:16:05 +02:00
5d6590c200 ci: Update the coverage report for i18n PRs (#2592)
Co-authored-by: Kostas Bariotis <konmpar@gmail.com>
2020-12-19 22:44:01 +02:00
d3bebbc68d ci: Better locale coverage comment (#2616)
Co-authored-by: kbariotis <konmpar@gmail.com>
2020-12-19 20:35:03 +02:00
4ff8f3b006 add commenting on translations PRs, resolves #2587 (#2615) 2020-12-19 13:52:50 +00:00
abbc756887 ci: Add semantic pr title action (#2610) 2020-12-18 21:32:37 +05:30
10e07e434c chore: Remove support for deprecated Excalidraw for Desktop (#2465) 2020-12-18 14:02:29 +02:00
fb582b45db fix: Fix centering element on init (#2445)
Co-authored-by: Andrés Rivera <andres@MBP.local>
Co-authored-by: Lipis <lipiridis@gmail.com>
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-12-16 18:17:39 +01:00
23f21434ff Fix changelog workflow (#2604)
Fix the workflow to make sure it runs on pull requests against forked branches and also don't run on l10_master and dependabot branches
2020-12-16 20:19:05 +05:30
7e9fdf85a0 fix: Dropdown for Arrowheads overflow (#2596)
Co-authored-by: Lipis <lipiridis@gmail.com>
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-12-16 13:06:55 +01:00
98c26642d0 fix: hide collab button when onCollabButtonClick not supplied (#2598) 2020-12-15 16:21:14 +01:00
2b434db062 chore: Don't run docker build on PRs (#2601) 2020-12-15 14:24:00 +01:00
f919907855 Enhance delete button in context menu (#2591) 2020-12-15 00:59:00 +02:00
bfeb3c7dfd fix(changelog-check.yml): ignore l10n_master and dependabot branches in changelog workflow (#2594) 2020-12-15 02:25:45 +05:30
8729ab3c54 chore(package/utils): update deps (#2593) 2020-12-15 02:13:19 +05:30
37f53bccbf Revert the changelog check of excluding the branches (#2590)
* temp commit

* fix

* fix

* Update actionAlign.tsx
2020-12-14 22:41:00 +02:00
c783763307 chore(package/excalidraw): update deps (#2589) 2020-12-14 19:21:22 +01:00
f151f45df8 Bump webpack from 4.42.0 to 4.44.2 in /src/packages/utils (#2554)
Bumps [webpack](https://github.com/webpack/webpack) from 4.42.0 to 4.44.2.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v4.42.0...v4.44.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-14 21:08:06 +05:30
f33880e005 Bump @babel/plugin-transform-arrow-functions in /src/packages/utils (#2558)
Bumps [@babel/plugin-transform-arrow-functions](https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-transform-arrow-functions) from 7.8.3 to 7.12.1.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.12.1/packages/babel-plugin-transform-arrow-functions)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-14 21:02:52 +05:30
29ed50f6ea Bump webpack-cli from 3.3.11 to 4.2.0 in /src/packages/excalidraw (#2571)
Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 3.3.11 to 4.2.0.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-cli/compare/v3.3.11...webpack-cli@4.2.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
2020-12-14 21:00:06 +05:30
ce52c18382 fix: Add width/height for the lines in charts (#2586)
Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-12-14 16:29:39 +01:00
7c3e1d8d1b Add declarative link capturing
See https://github.com/WICG/sw-launch/blob/master/declarative_link_capturing.md#user-content-proposal:~:text=new_client,-%E2%80%9D%20%E2%80%94 for context.
2020-12-14 16:25:48 +01:00
0d15934a96 Bump firebase-tools from 8.17.0 to 8.19.0 (#2574)
Bumps [firebase-tools](https://github.com/firebase/firebase-tools) from 8.17.0 to 8.19.0.
- [Release notes](https://github.com/firebase/firebase-tools/releases)
- [Commits](https://github.com/firebase/firebase-tools/compare/v8.17.0...v8.19.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-14 17:15:38 +02:00
a0069d04f0 Bump firebase from 8.1.2 to 8.2.0 (#2580)
Bumps [firebase](https://github.com/firebase/firebase-js-sdk) from 8.1.2 to 8.2.0.
- [Release notes](https://github.com/firebase/firebase-js-sdk/releases)
- [Changelog](https://github.com/firebase/firebase-js-sdk/blob/master/CHANGELOG.md)
- [Commits](https://github.com/firebase/firebase-js-sdk/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-14 17:15:16 +02:00
3b86944365 chore: New Crowdin updates (#2480) 2020-12-14 16:49:01 +02:00
4c7b1a2269 fix: Visibility and zooming when canvas offset is not zero (#2534) 2020-12-14 15:14:56 +01:00
60864ace54 feat: Add tooltip with icon for embedding scenes (#2532)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-12-14 14:24:54 +01:00
4b32c03994 feat: export exportToCanvas in utils (#2583) 2020-12-14 14:11:48 +01:00
222dbdcc00 Bump @types/jest from 26.0.16 to 26.0.19 (#2578)
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 26.0.16 to 26.0.19.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-14 07:59:56 +02:00
1346227d30 Bump @sentry/browser from 5.28.0 to 5.29.0 (#2561)
Bumps [@sentry/browser](https://github.com/getsentry/sentry-javascript) from 5.28.0 to 5.29.0.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.28.0...5.29.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-14 07:59:48 +02:00
ecbddd214c Bump pepjs from 0.5.2 to 0.5.3 (#2550)
Bumps [pepjs](https://github.com/jquery/PEP) from 0.5.2 to 0.5.3.
- [Release notes](https://github.com/jquery/PEP/releases)
- [Commits](https://github.com/jquery/PEP/commits/0.5.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-14 05:29:51 +02:00
4999ca5c82 Bump husky from 4.3.0 to 4.3.6 (#2575)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-14 05:29:16 +02:00
174638889d Bump typescript from 4.0.5 to 4.1.3 (#2569)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.0.5 to 4.1.3.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-14 05:28:55 +02:00
480998582e Bump eslint-plugin-prettier from 3.1.4 to 3.3.0 (#2573)
Bumps [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) from 3.1.4 to 3.3.0.
- [Release notes](https://github.com/prettier/eslint-plugin-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-plugin-prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-plugin-prettier/compare/v3.1.4...v3.3.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-14 05:28:40 +02:00
94544e458c Bump browser-nativefs from 0.11.1 to 0.11.2 (#2577)
Bumps [browser-nativefs](https://github.com/GoogleChromeLabs/browser-nativefs) from 0.11.1 to 0.11.2.
- [Release notes](https://github.com/GoogleChromeLabs/browser-nativefs/releases)
- [Commits](https://github.com/GoogleChromeLabs/browser-nativefs/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-14 05:28:16 +02:00
f664ba9e1e Bump @sentry/integrations from 5.28.0 to 5.29.0 (#2579)
Bumps [@sentry/integrations](https://github.com/getsentry/sentry-javascript) from 5.28.0 to 5.29.0.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.28.0...5.29.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-14 05:27:54 +02:00
015a60638e chore: Update user for packages 2020-12-14 03:49:43 +02:00
7abb80530f chore: Add dependabot configuration (#2535) 2020-12-14 03:47:13 +02:00
5abe9b93e8 feat: Add zoom to fit for selected elements (#2522) 2020-12-13 22:54:35 +02:00
59cff0f219 ci: Add github action to make sure changelog for @excalidraw/excalidraw is updated (#2518)
Add guidelines for changelog and group the commits
update the changelog with the latest commits since the last release
Co-authored-by: Lipis <lipiridis@gmail.com>
2020-12-13 18:53:14 +05:30
81c17a56fb RTL support for the stats dialog (#2530) 2020-12-13 13:39:45 +01:00
802b8c50d5 Insert Library items in the middle of the screen (#2527)
Co-authored-by: Zen Tang <zen@wayve.ai>
2020-12-13 13:46:42 +02:00
94fe1ff6e6 Show shortcut context menu (#2501)
Co-authored-by: rene_mbp <harryloveslearning@googlemail.com>
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-12-12 23:03:58 +01:00
9cfe7b45e5 Aligns arrowhead schemas (#2517) 2020-12-12 17:42:30 +01:00
9cf54041dc Expand canvas padding based on zoom. (#2515) 2020-12-12 16:34:36 +01:00
8f269eb840 Fix Library Menu Layout (#2502) 2020-12-12 15:23:59 +02:00
1a134a88bd Add Cut to menus (#2511)
Co-authored-by: Zen Tang <zen@wayve.ai>
2020-12-12 12:54:34 +01:00
ae15380a9f hide stats and scrollToContent-button when mobile menus open (#2509) 2020-12-11 23:12:36 +02:00
0efa62cf7c Hide shortcuts on pickers for mobile (#2508) 2020-12-11 20:41:54 +01:00
c742225f43 More Arrowheads: dot, bar (#2486)
Co-authored-by: Jed Fox <git@jedfox.com>
Co-authored-by: Lipis <lipiridis@gmail.com>
2020-12-11 18:17:28 +01:00
7c7fb4903b Don't throw error when localStorage is null (#2505) 2020-12-11 18:13:13 +02:00
a4e1f2c5c1 Bump ini from 1.3.5 to 1.3.7 in /src/packages/utils (#2499)
Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.7.
- [Release notes](https://github.com/isaacs/ini/releases)
- [Commits](https://github.com/isaacs/ini/compare/v1.3.5...v1.3.7)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-11 15:02:42 +02:00
068c9b4876 Bump ini from 1.3.5 to 1.3.7 in /src/packages/excalidraw (#2500)
Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.7.
- [Release notes](https://github.com/isaacs/ini/releases)
- [Commits](https://github.com/isaacs/ini/compare/v1.3.5...v1.3.7)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-11 15:02:32 +02:00
b2d442abce Support CSV graphs and improve the look and feel (#2495)
Co-authored-by: David Luzar <luzar.david@gmail.com>
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-12-11 12:13:23 +01:00
7bfe7a1924 docs(readme.md): Update the homepage URL so it redirects to correct readme (#2498)
Co-authored-by: Lipis <lipiridis@gmail.com>
2020-12-11 02:41:19 +05:30
48e27f327f Final steps before the release of @excalidraw/excalidraw (#2464)
* docs(packages/excalidraw): add read me
* Add changelog and update version
2020-12-10 22:09:45 +05:30
182a3e39e1 Add "Safari" to PWACompat loading condition
They froze the UA string on iPad.
2020-12-09 16:49:12 +01:00
4672a2a135 fix misaligning on grid paste (#2494)
* fix misaligning on grid paste

* tweak naming
2020-12-09 15:45:03 +02:00
c7b5cdb71e Reduce the maximum size of the binding gap (#2450) 2020-12-09 14:03:25 +01:00
4d71078f48 Bump firebase-tools from 8.16.2 to 8.17.0 (#2473)
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-12-08 22:25:50 +02:00
38e1a0fd05 Bump @sentry/integrations from 5.27.6 to 5.28.0 (#2471)
Bumps [@sentry/integrations](https://github.com/getsentry/sentry-javascript) from 5.27.6 to 5.28.0.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.27.6...5.28.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-12-08 22:25:32 +02:00
8f8fd023f8 fix(app.tsx): add safe check for readyPromise (#2489)
* fix(app.tsx): add safe check for readyPromise

* make type-safe

Co-authored-by: dwelle <luzar.david@gmail.com>
2020-12-09 01:35:08 +05:30
fba37e422d Add https://libraries.excalidraw.com/ to README.md (#2478)
Co-authored-by: Lipis <lipiridis@gmail.com>
2020-12-08 20:13:43 +02:00
88fc961559 add separate entry point for fonts as its messing up the js bundle (#2485) 2020-12-08 18:11:44 +01:00
c291edfc44 Add Arrowheads to Arrows (#2452)
Co-authored-by: dwelle <luzar.david@gmail.com>
Co-authored-by: Lipis <lipiridis@gmail.com>
2020-12-08 16:02:55 +01:00
bd8e860d7f move all chunks inside excalidraw-assets folder when bundling (#2484) 2020-12-08 15:52:56 +01:00
3be5038c14 Revert "Remove native gesture "support" from iOS (#2457)" (#2483)
This reverts commit 2b6d1470f9.
2020-12-07 19:22:20 +01:00
5e57f408c5 Add link to the public libraries (#2469) 2020-12-07 19:24:55 +02:00
dd993adc5c Add stats for nerds (#2453)
Co-authored-by: David Luzar <luzar.david@gmail.com>
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-12-07 18:35:16 +02:00
5cdb9bd2ed Bump firebase from 8.1.1 to 8.1.2 (#2477)
Bumps [firebase](https://github.com/firebase/firebase-js-sdk) from 8.1.1 to 8.1.2.
- [Release notes](https://github.com/firebase/firebase-js-sdk/releases)
- [Changelog](https://github.com/firebase/firebase-js-sdk/blob/master/CHANGELOG.md)
- [Commits](https://github.com/firebase/firebase-js-sdk/compare/firebase@8.1.1...firebase@8.1.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-12-07 09:58:25 +02:00
d055fc0334 Bump @types/jest from 26.0.15 to 26.0.16 (#2475)
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 26.0.15 to 26.0.16.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-12-07 09:57:50 +02:00
fbdf796c9f Bump lint-staged from 10.5.2 to 10.5.3 (#2476)
Bumps [lint-staged](https://github.com/okonet/lint-staged) from 10.5.2 to 10.5.3.
- [Release notes](https://github.com/okonet/lint-staged/releases)
- [Commits](https://github.com/okonet/lint-staged/compare/v10.5.2...v10.5.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-12-07 09:57:19 +02:00
90867ed9c1 Bump @sentry/browser from 5.27.6 to 5.28.0 (#2474)
Bumps [@sentry/browser](https://github.com/getsentry/sentry-javascript) from 5.27.6 to 5.28.0.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.27.6...5.28.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-12-07 09:57:06 +02:00
6d6bf52f88 Bump eslint-config-prettier from 6.15.0 to 7.0.0 (#2472)
Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 6.15.0 to 7.0.0.
- [Release notes](https://github.com/prettier/eslint-config-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-config-prettier/compare/v6.15.0...v7.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-12-07 09:56:51 +02:00
aa221837fc Enhance aspect ratio tools | Rectangle, Diamond, Ellipses (#2439)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-12-07 00:39:31 +02:00
4c90ea5667 chore(package.json): set public access for npm packages (#2463) 2020-12-06 13:49:35 +01:00
5071cffb02 Fix scrollbars when no elements (#2460)
I already fixed this but a special case for no elements was added in getCommonBounds to return 0 and reintroduce this bug. I'm not exactly sure where to put this check tbh. Fixing it here so that I'm not annoyed anymore at least.

I checked some of the callsites, some of them related to selection will never pass an empty array, some to export will break if we remove the 0, 0, 0, 0 fix.
2020-12-06 12:42:04 +01:00
fb02329c11 show lockicon on a second row on mobile (#2462)
* show lockicon on a second row

* fix darkMode toggle acting as a lock icon

Co-authored-by: dwelle <luzar.david@gmail.com>
2020-12-06 12:40:11 +01:00
6081bb5941 Do not override cmd/ctrl-f for search (#2461)
F is full screen but we shouldn't override cmd/ctrl-f for search. It's useful for searching in the list of keywords
2020-12-06 10:41:13 +01:00
533815c081 Fix middle handles on mobile (#2459)
For rendering we always use mouse in order to check which handles to display but when doing the hit test, we used pointer which has a different size. So we couldn't use the middle handles for small shapes. This is now fixed.

cc @j-f1 as you added it in #790
2020-12-05 16:35:44 -08:00
2b6d1470f9 Remove native gesture "support" from iOS (#2457)
We were processing both the touch move and gesture on iOS which was first firing twice as many set state, but also caused issues:
- The gesture implementation didn't support zooming on the center
- Touching down on a circle and then on the bottom chrome would freak out because initialScale was null

Touching down on the menu still isn't perfect as it shifts the shape around but doesn't completly break the zoom
2020-12-06 00:47:03 +01:00
545b214558 Don't open context menu when multi-touch (#2455)
This was very annoying when you would zoom on mobile and the context menu would appear.

The problem was the following:
- You put a finger in, it creates a timeout
- You put a second finger in, it creates another timeout
- 300ms elapsed, which is not that much
- The context menu opens
- Now you move your fingers, which works, but the context menu is still open

The fix is to invalidate the context menu if a second finger is added even if the first one hasn't moved.
2020-12-06 00:06:50 +01:00
e617ccc252 Factor out collaboration code (#2313)
Co-authored-by: Lipis <lipiridis@gmail.com>
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-12-05 15:30:53 +01:00
d8a0dc3b4d Add events on load (#2451) 2020-12-05 01:18:21 +02:00
e392bebc40 Add library events (#2448) 2020-12-04 19:18:20 +02:00
a2132c9bb7 New Crowdin weekly updates (#2420)
Co-authored-by: Kostas Bariotis <konmpar@gmail.com>
2020-12-03 19:33:57 +02:00
66e5b18e4e Add more events for sharing and refactor I/O, dialogs (#2443) 2020-12-03 17:03:02 +02:00
c43109a230 Don't count first load 2020-12-03 15:26:16 +02:00
668150a667 More events for layers, align, colors and swap name <=> category (#2442) 2020-12-03 15:10:04 +02:00
0ef60dce2d More export events (#2441) 2020-12-03 12:03:29 +02:00
abde1daba4 Add basic event actions to analytics (#2375)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-12-02 23:57:51 +02:00
014097a97e refactor: Stop using the deprecated keyCode (#2426)
Co-authored-by: Lipis <lipiridis@gmail.com>
Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-12-01 22:36:06 +01:00
58fcb44de0 Bump @sentry/browser from 5.27.4 to 5.27.6 (#2431)
Bumps [@sentry/browser](https://github.com/getsentry/sentry-javascript) from 5.27.4 to 5.27.6.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.27.4...5.27.6)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-12-01 17:53:52 +02:00
102169581c Bump @sentry/integrations from 5.27.4 to 5.27.6 (#2430)
Bumps [@sentry/integrations](https://github.com/getsentry/sentry-javascript) from 5.27.4 to 5.27.6.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.27.4...5.27.6)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-12-01 15:38:02 +02:00
eb75dc55cb Bump browser-nativefs from 0.11.0 to 0.11.1 (#2433)
Bumps [browser-nativefs](https://github.com/GoogleChromeLabs/browser-nativefs) from 0.11.0 to 0.11.1.
- [Release notes](https://github.com/GoogleChromeLabs/browser-nativefs/releases)
- [Commits](https://github.com/GoogleChromeLabs/browser-nativefs/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-12-01 15:37:50 +02:00
df33ab23f8 Bump lint-staged from 10.5.1 to 10.5.2 (#2432)
Bumps [lint-staged](https://github.com/okonet/lint-staged) from 10.5.1 to 10.5.2.
- [Release notes](https://github.com/okonet/lint-staged/releases)
- [Commits](https://github.com/okonet/lint-staged/compare/v10.5.1...v10.5.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-12-01 15:37:27 +02:00
e8421bc5ab Bump prettier from 2.2.0 to 2.2.1 (#2434)
Bumps [prettier](https://github.com/prettier/prettier) from 2.2.0 to 2.2.1.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.2.0...2.2.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-12-01 15:33:38 +02:00
36980160ae Revert "Remove unused project name from export dialog (#2427)" (#2436) 2020-12-01 14:00:13 +01:00
084aff2bf3 fix(app.tsx): use cursorx, cursory in onGestureChange as pointers are empty (#2424) 2020-11-30 02:30:13 +02:00
bdb1fb2dae Add border to the Avatars (#2428) 2020-11-29 20:19:06 +02:00
b21fd49412 chore: Minor refactoring for consistency (#2425) 2020-11-29 17:32:51 +01:00
204c8370a0 Remove unused project name from export dialog (#2427)
* Remove unused project name from export dialog

* snaps
2020-11-29 15:42:44 +02:00
ca60244aa3 hide fill icons when fill color transparent (#2414)
Co-authored-by: Panayiotis Lipiridis <lipiridis@gmail.com>
2020-11-26 21:43:38 +01:00
Luo
6c0296c434 click on library icon should toggle the LibraryMenu (#2421)
Co-authored-by: David Luzar <luzar.david@gmail.com>
Co-authored-by: Lipis <lipiridis@gmail.com>
2020-11-26 20:02:40 +01:00
1269b9ab17 New Crowdin updates (Persian) (#2418) 2020-11-26 13:30:08 +02:00
2f9a849170 New Crowdin updates (Removed languages that were less than 30% in Crowdin) (#2417) 2020-11-26 12:42:33 +02:00
8d479ab238 RTL updates (#2416)
* Update a bunch of icons to be mirrored in RTL

* Fix RTL layout issues in in zen mode and collaboration

* Small change to the shortcuts dialog to make isRTL unnecessary

* Tweaks to alignment in RTL
2020-11-26 01:21:33 +02:00
fec48060f7 Improves distribute algorithm (#2415)
* Update disitrubte.ts

* Update disitrubte.ts

* Simplifies operations

* Combines algorithms
2020-11-26 01:20:56 +02:00
2de7f73a71 New Crowdin updates (#2407)
* New translations en.json (Arabic)

* New translations en.json (Slovak)

* New translations en.json (Norwegian Bokmal)

* New translations en.json (Burmese)

* New translations en.json (Hindi)

* New translations en.json (Norwegian Nynorsk)

* New translations en.json (Tamil)

* New translations en.json (Persian)

* New translations en.json (Indonesian)

* New translations en.json (Galician)

* New translations en.json (Chinese Traditional)

* New translations en.json (Chinese Simplified)

* New translations en.json (Ukrainian)

* New translations en.json (Turkish)

* New translations en.json (Swedish)

* New translations en.json (Albanian)

* New translations en.json (Portuguese)

* New translations en.json (Korean)

* New translations en.json (German)

* New translations en.json (Russian)

* New translations en.json (Romanian)

* New translations en.json (French)

* New translations en.json (Spanish)

* New translations en.json (Bulgarian)

* New translations en.json (Catalan)

* New translations en.json (Greek)

* New translations en.json (Polish)

* 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 (Dutch)

* New translations en.json (Hausa)

* Auto commit: Calculate translation coverage

* New translations en.json (Romanian)

* Auto commit: Calculate translation coverage

* New translations en.json (German)

* New translations en.json (Swedish)

* Auto commit: Calculate translation coverage

* New translations en.json (Finnish)

* New translations en.json (Norwegian Bokmal)

* Auto commit: Calculate translation coverage

* New translations en.json (Indonesian)

* Auto commit: Calculate translation coverage

* New translations en.json (Chinese Traditional)

* Auto commit: Calculate translation coverage

* New translations en.json (Ukrainian)

* Auto commit: Calculate translation coverage

* New translations en.json (Italian)

* Auto commit: Calculate translation coverage

Co-authored-by: Kostas Bariotis <konmpar@gmail.com>
2020-11-24 13:34:41 +02:00
198106e297 Add distribute actions. (#2395) 2020-11-23 19:16:23 +01:00
Luo
d3c3894108 Fix "Copy | Look Up" popup issue on mobile device (#2406) 2020-11-23 16:18:44 +01:00
6718902645 Bump prettier from 2.1.2 to 2.2.0 (#2401)
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-11-23 11:09:31 +01:00
38aa6da7a3 Bump @types/react from 16.9.56 to 17.0.0 (#2399)
Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 16.9.56 to 17.0.0.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-11-23 10:48:20 +01:00
2c008c8adf Bump @testing-library/react from 11.1.2 to 11.2.2 (#2397)
Bumps [@testing-library/react](https://github.com/testing-library/react-testing-library) from 11.1.2 to 11.2.2.
- [Release notes](https://github.com/testing-library/react-testing-library/releases)
- [Changelog](https://github.com/testing-library/react-testing-library/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/react-testing-library/compare/v11.1.2...v11.2.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-11-23 10:43:36 +01:00
a6292a789e Bump @types/react-dom from 16.9.9 to 17.0.0 (#2400)
Bumps [@types/react-dom](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react-dom) from 16.9.9 to 17.0.0.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react-dom)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-11-23 10:42:40 +01:00
5f7d48e551 Bump firebase from 8.0.2 to 8.1.1 (#2396)
Bumps [firebase](https://github.com/firebase/firebase-js-sdk) from 8.0.2 to 8.1.1.
- [Release notes](https://github.com/firebase/firebase-js-sdk/releases)
- [Changelog](https://github.com/firebase/firebase-js-sdk/blob/master/CHANGELOG.md)
- [Commits](https://github.com/firebase/firebase-js-sdk/compare/firebase@8.0.2...firebase@8.1.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-11-23 10:41:45 +01:00
c7831e854d Bump react-scripts from 4.0.0 to 4.0.1 (#2402)
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-11-23 10:32:24 +01:00
7aa58561c8 New Crowdin updates (#2394)
* New translations en.json (French)

* New translations en.json (Japanese)

* Auto commit: Calculate translation coverage

* New translations en.json (Japanese)

* Auto commit: Calculate translation coverage

* New translations en.json (Japanese)

* Auto commit: Calculate translation coverage

Co-authored-by: Kostas Bariotis <konmpar@gmail.com>
2020-11-22 18:33:54 +02:00
db5acff860 Fix docker-compose (#2388)
* deps target is not used anymore

* use nginx instead of npm run start
2020-11-22 15:59:17 +00:00
a267fc85b4 Bump @sentry/integrations from 5.27.3 to 5.27.4 (#2382)
Bumps [@sentry/integrations](https://github.com/getsentry/sentry-javascript) from 5.27.3 to 5.27.4.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.27.3...5.27.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-11-18 18:39:49 +02:00
7d2ce4e52f Bump @testing-library/react from 11.1.1 to 11.1.2 (#2384)
Bumps [@testing-library/react](https://github.com/testing-library/react-testing-library) from 11.1.1 to 11.1.2.
- [Release notes](https://github.com/testing-library/react-testing-library/releases)
- [Changelog](https://github.com/testing-library/react-testing-library/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/react-testing-library/compare/v11.1.1...v11.1.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-11-18 15:01:50 +02:00
5e6ec19ce1 Bump @sentry/browser from 5.27.3 to 5.27.4 (#2385)
Bumps [@sentry/browser](https://github.com/getsentry/sentry-javascript) from 5.27.3 to 5.27.4.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.27.3...5.27.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-11-18 14:49:14 +02:00
9a38f87147 Bump firebase from 8.0.1 to 8.0.2 (#2381)
Bumps [firebase](https://github.com/firebase/firebase-js-sdk) from 8.0.1 to 8.0.2.
- [Release notes](https://github.com/firebase/firebase-js-sdk/releases)
- [Changelog](https://github.com/firebase/firebase-js-sdk/blob/master/CHANGELOG.md)
- [Commits](https://github.com/firebase/firebase-js-sdk/compare/firebase@8.0.1...firebase@8.0.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-11-18 14:49:03 +02:00
5e7d09d723 Bump firebase-tools from 8.15.1 to 8.16.2 (#2386)
Bumps [firebase-tools](https://github.com/firebase/firebase-tools) from 8.15.1 to 8.16.2.
- [Release notes](https://github.com/firebase/firebase-tools/releases)
- [Commits](https://github.com/firebase/firebase-tools/compare/v8.15.1...v8.16.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-11-18 14:48:19 +02:00
5db77a4e7d Bump @testing-library/jest-dom from 5.11.5 to 5.11.6 (#2387)
Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 5.11.5 to 5.11.6.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v5.11.5...v5.11.6)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-11-18 14:47:56 +02:00
ca3cf6971d New Crowdin updates (#2364)
* New translations en.json (Arabic)

* Auto commit: Calculate translation coverage

* New translations en.json (Korean)

* Auto commit: Calculate translation coverage

Co-authored-by: Kostas Bariotis <konmpar@gmail.com>
2020-11-13 21:16:29 +01:00
a1fbec1030 Remove last committed point json (#2371)
Co-authored-by: rene_mbp <harryloveslearning@googlemail.com>
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-11-11 15:55:22 +01:00
4371c29f0c Update to Analytics 4 (#2374) 2020-11-11 04:23:15 +02:00
bf143ed0b8 ignore CapsLock when handling keyDown event (#2373)
* ignore CapsLock when handling keyDown event

* fix `this`
2020-11-10 19:42:13 +02:00
68aafe31f9 fix portal teardown (#2370) 2020-11-09 15:34:26 +01:00
b06cf86811 revert socketIO to 2.3.1 (#2363) 2020-11-08 23:21:34 +01:00
5b829772d9 Fix library import (#2360) 2020-11-08 17:08:22 +01:00
dad9ad9bf4 don't reset specific appState props on canvas clear (#2359)
Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-11-08 16:10:20 +01:00
f90cbeb089 add .env.local to .gitignore (#2357) 2020-11-08 14:27:19 +01:00
d2a730837e New Crowdin updates (#2332) 2020-11-08 14:00:17 +02:00
5b63371c14 Fix docker build (#2348)
* .eslintrc.json is required to build using react-scripts

* Remove the extra "deps" step

This step can be done as part of the build (faster and more reliable).

* Add a GitHub Actions to build the Docker image

Make sure that "docker build" is working on every pull request before landing on master.

* Update package-lock.json

* Add .prettierrc in the Docker image to avoid warnings in the build step

* Revert "Update package-lock.json"

This reverts commit 7ef2eaadfa.

* Make sure that the 'node_modules' layer can be cached

if package and package-lock.json didn't changed
2020-11-07 22:22:19 +00:00
a05679b3c5 Bump @sentry/integrations from 5.27.2 to 5.27.3 (#2352)
Bumps [@sentry/integrations](https://github.com/getsentry/sentry-javascript) from 5.27.2 to 5.27.3.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.27.2...5.27.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-11-07 22:03:40 +02:00
396c49c7d8 Bump @testing-library/react from 11.1.0 to 11.1.1 (#2353)
Bumps [@testing-library/react](https://github.com/testing-library/react-testing-library) from 11.1.0 to 11.1.1.
- [Release notes](https://github.com/testing-library/react-testing-library/releases)
- [Changelog](https://github.com/testing-library/react-testing-library/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/react-testing-library/compare/v11.1.0...v11.1.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-11-07 21:58:26 +02:00
0d01738029 Bump @sentry/browser from 5.27.2 to 5.27.3 (#2354)
Bumps [@sentry/browser](https://github.com/getsentry/sentry-javascript) from 5.27.2 to 5.27.3.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.27.2...5.27.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-11-07 21:58:15 +02:00
c5c375dd2e Bump socket.io-client from 2.3.1 to 3.0.0 (#2350)
Bumps [socket.io-client](https://github.com/socketio/socket.io-client) from 2.3.1 to 3.0.0.
- [Release notes](https://github.com/socketio/socket.io-client/releases)
- [Changelog](https://github.com/socketio/socket.io-client/blob/master/CHANGELOG.md)
- [Commits](https://github.com/socketio/socket.io-client/compare/2.3.1...3.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-11-07 21:58:04 +02:00
b09d96ad14 Bump @types/react from 16.9.55 to 16.9.56 (#2351)
Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 16.9.55 to 16.9.56.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-11-07 18:15:08 +02:00
a58873af13 Bump firebase-tools from 8.14.1 to 8.15.1 (#2355)
Bumps [firebase-tools](https://github.com/firebase/firebase-tools) from 8.14.1 to 8.15.1.
- [Release notes](https://github.com/firebase/firebase-tools/releases)
- [Commits](https://github.com/firebase/firebase-tools/compare/v8.14.1...v8.15.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-11-07 18:13:14 +02:00
08031d3f85 Bump firebase from 8.0.0 to 8.0.1 (#2349)
Bumps [firebase](https://github.com/firebase/firebase-js-sdk) from 8.0.0 to 8.0.1.
- [Release notes](https://github.com/firebase/firebase-js-sdk/releases)
- [Changelog](https://github.com/firebase/firebase-js-sdk/blob/master/CHANGELOG.md)
- [Commits](https://github.com/firebase/firebase-js-sdk/compare/firebase@8.0.0...firebase@8.0.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-11-07 18:13:00 +02:00
a20f3240fd Prefer arrow functions (#2344) 2020-11-06 21:06:39 +01:00
e05acd6fd9 Update ESLint rules (#2342) 2020-11-06 21:06:30 +01:00
56938cf874 fix modal island ref init (#2341)
* fix modal island ref init

* remove unnecessary sIP

* naming
2020-11-05 22:05:58 +02:00
5d295415db Keep errors, elements and comments consistent (#2340)
Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-11-05 18:06:18 +01:00
2a20c44338 fix: fonts not cached by service worker (#2338) 2020-11-04 22:09:28 +02:00
dcedd17f57 Add bundle analyzer to webpack behind env variable (#2330) 2020-11-04 20:38:16 +01:00
455badb23e fix export preview flicker (#2335) 2020-11-04 18:50:53 +01:00
566e6a5ede Zoom on cursor | Issue #940 (#2319) 2020-11-04 19:49:15 +02:00
facde7ace0 Fix padding in the library loading buttons (#2331)
* Fix padding in the library loading buttons

* Update src/components/Stack.tsx

Co-authored-by: Dominic Lee <34794189+dominictwlee@users.noreply.github.com>

* extend CSSProperties TS definition

Co-authored-by: Dominic Lee <34794189+dominictwlee@users.noreply.github.com>
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-11-04 11:05:12 +01:00
eca2bdabcc New Crowdin updates (#2311) 2020-11-03 18:45:13 +02:00
a7da8901d8 Excalidraw export (#2246) 2020-11-02 20:14:20 +01:00
58861e87e5 Bump @types/react from 16.9.54 to 16.9.55 (#2325)
Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 16.9.54 to 16.9.55.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-11-02 11:48:26 +02:00
a646a12758 Bump @sentry/integrations from 5.27.1 to 5.27.2 (#2327)
Bumps [@sentry/integrations](https://github.com/getsentry/sentry-javascript) from 5.27.1 to 5.27.2.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.27.1...5.27.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-11-02 11:48:14 +02:00
1be4a2d649 Bump lint-staged from 10.5.0 to 10.5.1 (#2326)
Bumps [lint-staged](https://github.com/okonet/lint-staged) from 10.5.0 to 10.5.1.
- [Release notes](https://github.com/okonet/lint-staged/releases)
- [Commits](https://github.com/okonet/lint-staged/compare/v10.5.0...v10.5.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-11-02 11:35:53 +02:00
25feaefe9e Bump @sentry/browser from 5.27.1 to 5.27.2 (#2324)
Bumps [@sentry/browser](https://github.com/getsentry/sentry-javascript) from 5.27.1 to 5.27.2.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.27.1...5.27.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-11-02 11:35:42 +02:00
7491fcc3f3 use icons for toggle labels (#2315) 2020-11-01 20:08:48 +01:00
856ab50090 Feature: Align elements (#2267)
Co-authored-by: Maximilian Massing <maximilian.massing@googlemail.com>
Co-authored-by: Sven Kube <github@sven-kube.de>
Co-authored-by: Maximilian Massing <massing@sipgate.de>
2020-10-31 11:40:06 +01:00
411bc2aa0a SW fix (#2320) 2020-10-31 11:31:02 +01:00
ba3f548b91 Fix library dnd (#2314) 2020-10-30 21:01:41 +01:00
8a50916ef2 Bump firebase from 7.24.0 to 8.0.0 (#2294)
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-10-29 16:10:46 +01:00
471a8b7676 Create codeql-analysis.yml (#2308) 2020-10-29 00:52:49 +02:00
56215c6c2b remove eslint two disabled rules & fix (#2309) 2020-10-28 20:53:27 +01:00
fc58e51ab3 Show error message when canvas to export is too big (#1256) (#2210)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-10-28 20:52:53 +01:00
5c26bd19d7 SVG export: add image size (#2292) 2020-10-28 19:10:22 +02:00
9de6c947ef Update react-scripts, TS and remove ESlint as it exist in CRA (#2302)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-10-28 17:28:07 +01:00
44af6b4a78 Bump react and react-dom (#2300)
* Bump react and react-dom

Bumps [react](https://github.com/facebook/react/tree/HEAD/packages/react) and [react-dom](https://github.com/facebook/react/tree/HEAD/packages/react-dom). These dependencies needed to be updated together.

Updates `react` from 16.14.0 to 17.0.1
- [Release notes](https://github.com/facebook/react/releases)
- [Changelog](https://github.com/facebook/react/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/react/commits/v17.0.1/packages/react)

Updates `react-dom` from 16.14.0 to 17.0.1
- [Release notes](https://github.com/facebook/react/releases)
- [Changelog](https://github.com/facebook/react/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/react/commits/v17.0.1/packages/react-dom)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Fix

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Panayiotis Lipiridis <lipiridis@gmail.com>
2020-10-28 04:01:53 +02:00
a47d372a90 Bump @types/react-dom from 16.9.8 to 16.9.9 (#2295)
Bumps [@types/react-dom](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react-dom) from 16.9.8 to 16.9.9.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react-dom)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-28 03:21:05 +02:00
f4da7f38d2 Bump @types/react from 16.9.53 to 16.9.54 (#2296)
Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 16.9.53 to 16.9.54.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-28 02:50:17 +02:00
2098db901c Bump eslint-config-prettier from 6.14.0 to 6.15.0 (#2299)
Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 6.14.0 to 6.15.0.
- [Release notes](https://github.com/prettier/eslint-config-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-config-prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-config-prettier/compare/v6.14.0...v6.15.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-28 02:49:36 +02:00
8621eb0d0c Bump firebase-tools from 8.14.0 to 8.14.1 (#2298)
Bumps [firebase-tools](https://github.com/firebase/firebase-tools) from 8.14.0 to 8.14.1.
- [Release notes](https://github.com/firebase/firebase-tools/releases)
- [Commits](https://github.com/firebase/firebase-tools/compare/v8.14.0...v8.14.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-28 02:49:19 +02:00
fb8be3ba0f Bump lint-staged from 10.4.2 to 10.5.0 (#2297)
Bumps [lint-staged](https://github.com/okonet/lint-staged) from 10.4.2 to 10.5.0.
- [Release notes](https://github.com/okonet/lint-staged/releases)
- [Commits](https://github.com/okonet/lint-staged/compare/v10.4.2...v10.5.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-28 02:49:06 +02:00
348976aa59 Bump @sentry/browser from 5.26.0 to 5.27.1 (#2280)
* Bump @sentry/browser from 5.26.0 to 5.27.1

Bumps [@sentry/browser](https://github.com/getsentry/sentry-javascript) from 5.26.0 to 5.27.1.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.26.0...5.27.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Updated and fix vulnrel

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Panayiotis Lipiridis <lipiridis@gmail.com>
2020-10-28 02:16:58 +02:00
2d6a231634 Bump react-dom from 16.13.1 to 16.14.0 (#2278)
Bumps [react-dom](https://github.com/facebook/react/tree/HEAD/packages/react-dom) from 16.13.1 to 16.14.0.
- [Release notes](https://github.com/facebook/react/releases)
- [Changelog](https://github.com/facebook/react/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/react/commits/v16.14.0/packages/react-dom)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-27 18:28:40 +02:00
41d4bb1491 Bump firebase-tools from 8.13.1 to 8.14.0 (#2290)
Bumps [firebase-tools](https://github.com/firebase/firebase-tools) from 8.13.1 to 8.14.0.
- [Release notes](https://github.com/firebase/firebase-tools/releases)
- [Commits](https://github.com/firebase/firebase-tools/compare/v8.13.1...v8.14.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-27 18:28:28 +02:00
7b53d29066 Bump firebase-tools from 8.12.1 to 8.13.1 (#2285)
Bumps [firebase-tools](https://github.com/firebase/firebase-tools) from 8.12.1 to 8.13.1.
- [Release notes](https://github.com/firebase/firebase-tools/releases)
- [Commits](https://github.com/firebase/firebase-tools/compare/v8.12.1...v8.13.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-27 18:21:42 +02:00
6f5a285266 Bump eslint-config-prettier from 6.13.0 to 6.14.0 (#2281)
Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 6.13.0 to 6.14.0.
- [Release notes](https://github.com/prettier/eslint-config-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-config-prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-config-prettier/compare/v6.13.0...v6.14.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-27 18:21:20 +02:00
9e40dcdcdc New Crowdin updates (#2286)
* New translations en.json (Chinese Simplified)

* Auto commit: Calculate translation coverage

Co-authored-by: Kostas Bariotis <konmpar@gmail.com>
2020-10-27 18:21:08 +02:00
5e55e77f54 enable ColorPicker keyboard shortcuts if using custom color (#2288) 2020-10-27 11:01:57 +01:00
f404ab6f50 clear deleted elements on room create (#2270) 2020-10-26 15:53:55 +01:00
915bda9fd8 restore elements on load from firebase (#2269) 2020-10-26 15:45:51 +01:00
46c421ee26 Bump @types/jest from 26.0.14 to 26.0.15 (#2282)
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 26.0.14 to 26.0.15.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-26 13:46:45 +01:00
5168a03373 Bump @testing-library/jest-dom from 5.11.4 to 5.11.5 (#2284)
Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 5.11.4 to 5.11.5.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v5.11.4...v5.11.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-26 13:45:17 +01:00
36700b9376 New Crowdin updates (#2248)
Co-authored-by: Kostas Bariotis <konmpar@gmail.com>
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-10-25 15:50:35 +01:00
900e0f27ad expose resetHistory & factor out from updateScene (#2277) 2020-10-25 15:48:16 +01:00
e916d7f6f6 expose resetScene and getSceneElementsIncludingDeleted && move excalidrawApp to excalidraw-app folder (#2272)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-10-25 15:09:57 +01:00
1845b5e32c build(webpack): apply optimization to async chunks so module is exported correctly (#2273) 2020-10-25 14:26:09 +01:00
72a3450c99 allow to supply canvas offsets from upstream (#2271) 2020-10-23 19:06:16 +02:00
499a60309f factor reconcilation out of updateScene & remove replaceAll (#2266)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-10-22 23:47:34 +02:00
1034ec91b8 fix(fonts): move fonts to public folder so that its served as static assets via cra & works in export (#2264) 2020-10-21 22:50:57 +02:00
6db5647048 move broadcastScene and broadcastMouseLocation to portal (#2262) 2020-10-21 15:41:20 +02:00
cc5e27af42 Bump react from 16.13.1 to 16.14.0 (#2260)
Bumps [react](https://github.com/facebook/react/tree/HEAD/packages/react) from 16.13.1 to 16.14.0.
- [Release notes](https://github.com/facebook/react/releases)
- [Changelog](https://github.com/facebook/react/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/react/commits/v16.14.0/packages/react)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-19 20:38:58 +03:00
f7f27bba17 Bump @sentry/browser from 5.25.0 to 5.26.0 (#2253)
Bumps [@sentry/browser](https://github.com/getsentry/sentry-javascript) from 5.25.0 to 5.26.0.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.25.0...5.26.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-19 20:38:48 +03:00
adef15862c Bump @types/react from 16.9.52 to 16.9.53 (#2254)
Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 16.9.52 to 16.9.53.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-19 20:38:41 +03:00
62b69c3dd7 Bump firebase from 7.23.0 to 7.24.0 (#2255)
Bumps [firebase](https://github.com/firebase/firebase-js-sdk) from 7.23.0 to 7.24.0.
- [Release notes](https://github.com/firebase/firebase-js-sdk/releases)
- [Commits](https://github.com/firebase/firebase-js-sdk/compare/firebase@7.23.0...firebase@7.24.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-19 20:38:21 +03:00
7c1d0175bf Bump eslint-config-prettier from 6.12.0 to 6.13.0 (#2257)
Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 6.12.0 to 6.13.0.
- [Release notes](https://github.com/prettier/eslint-config-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-config-prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-config-prettier/compare/v6.12.0...v6.13.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-19 20:37:33 +03:00
fdae50cece Bump @testing-library/react from 11.0.4 to 11.1.0 (#2256)
Bumps [@testing-library/react](https://github.com/testing-library/react-testing-library) from 11.0.4 to 11.1.0.
- [Release notes](https://github.com/testing-library/react-testing-library/releases)
- [Changelog](https://github.com/testing-library/react-testing-library/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/react-testing-library/compare/v11.0.4...v11.1.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-19 20:37:19 +03:00
31aab2d202 Bump lint-staged from 10.4.0 to 10.4.2 (#2259)
Bumps [lint-staged](https://github.com/okonet/lint-staged) from 10.4.0 to 10.4.2.
- [Release notes](https://github.com/okonet/lint-staged/releases)
- [Commits](https://github.com/okonet/lint-staged/compare/v10.4.0...v10.4.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-19 20:37:02 +03:00
12b73aaac6 fix(app.scss): Move fonts from public to fonts directory so that it can be included in bundle as well (#2251) 2020-10-19 20:36:44 +03:00
b50c54f855 Add and use clsx (classnames alternative) (#2249)
Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-10-19 16:14:28 +02:00
1484c5a63b fileHandle refactor & fixes (#2252) 2020-10-19 10:53:37 +02:00
4a26845395 enable code splitting and add chunk names to dynamic import and create separate chunk vendor for all node modules (#2245)
* build: increase Limit chunk to enable code splitting add chunk names to dynamic import

* Remove limitchunkcount and have separate chunk for each node module so we dnt have any unnamed id.js chunks

* fix

* create one chunk for all node modules

* Add caret to peer deps

* extra space
2020-10-18 19:36:25 +02:00
41ccd47791 feat: add a proper error message when file is too big (#2247) 2020-10-18 10:39:55 +02:00
8f5c5f80d3 New Crowdin updates (#2242) 2020-10-16 15:05:27 +03:00
538f2be097 add export error handling (#2243) 2020-10-16 11:53:40 +02:00
25d460be96 don't touch DOM outside useEffect (#2215) 2020-10-15 21:39:24 +02:00
b3263c2a69 fix encoding of embed data & compress (#2240) 2020-10-15 21:31:21 +02:00
e8a39b5f84 New Crowdin updates (#2233)
Bunch of updates
2020-10-15 19:27:44 +03:00
f40a2230ec Fix embedding scene to PNG on Safari (#2235) 2020-10-13 16:55:08 +02:00
5950fa9a40 support embedding scene data to PNG/SVG (#2219)
Co-authored-by: Lipis <lipiridis@gmail.com>
2020-10-13 14:47:07 +02:00
7618ca48d7 retain local appState props on restore (#2224)
Co-authored-by: Lipis <lipiridis@gmail.com>
2020-10-13 13:46:52 +02:00
b91f929503 Bump @types/react from 16.9.50 to 16.9.52 (#2226)
Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 16.9.50 to 16.9.52.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-13 12:34:32 +03:00
d20cdbd736 Bump firebase from 7.22.0 to 7.23.0 (#2227)
Bumps [firebase](https://github.com/firebase/firebase-js-sdk) from 7.22.0 to 7.23.0.
- [Release notes](https://github.com/firebase/firebase-js-sdk/releases)
- [Commits](https://github.com/firebase/firebase-js-sdk/compare/firebase@7.22.0...firebase@7.23.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-13 12:34:26 +03:00
dab9659590 Bump firebase-tools from 8.11.2 to 8.12.1 (#2229)
Bumps [firebase-tools](https://github.com/firebase/firebase-tools) from 8.11.2 to 8.12.1.
- [Release notes](https://github.com/firebase/firebase-tools/releases)
- [Commits](https://github.com/firebase/firebase-tools/compare/v8.11.2...v8.12.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-13 12:34:19 +03:00
a0a8397fb4 Bump @sentry/integrations from 5.24.2 to 5.26.0 (#2230)
Bumps [@sentry/integrations](https://github.com/getsentry/sentry-javascript) from 5.24.2 to 5.26.0.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.24.2...5.26.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-13 12:27:16 +03:00
8b1e0275cf Bump @sentry/browser from 5.24.2 to 5.25.0 (#2225)
Bumps [@sentry/browser](https://github.com/getsentry/sentry-javascript) from 5.24.2 to 5.25.0.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.24.2...5.25.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-12 20:23:16 +02:00
d012fda59d New Crowdin updates (#2214)
* New translations en.json (Indonesian)

* New translations en.json (Polish)

* New translations en.json (Norwegian Bokmal)

* New translations en.json (Hindi)

* New translations en.json (Norwegian Nynorsk)

* New translations en.json (Tamil)

* New translations en.json (Galician)

* New translations en.json (Vietnamese)

* New translations en.json (Chinese Traditional)

* New translations en.json (Chinese Simplified)

* New translations en.json (Ukrainian)

* New translations en.json (Turkish)

* New translations en.json (Swedish)

* New translations en.json (Albanian)

* New translations en.json (Russian)

* New translations en.json (Portuguese)

* New translations en.json (Dutch)

* New translations en.json (Persian)

* New translations en.json (Korean)

* New translations en.json (Japanese)

* New translations en.json (Italian)

* New translations en.json (Hungarian)

* New translations en.json (Hebrew)

* New translations en.json (Finnish)

* New translations en.json (Greek)

* New translations en.json (German)

* New translations en.json (Catalan)

* New translations en.json (Bulgarian)

* New translations en.json (Arabic)

* New translations en.json (Spanish)

* New translations en.json (French)

* New translations en.json (Romanian)

* New translations en.json (Nepali)

* Auto commit: Calculate translation coverage

* New translations en.json (French)

* New translations en.json (Portuguese)

* New translations en.json (Chinese Traditional)

* New translations en.json (Norwegian Bokmal)

* Auto commit: Calculate translation coverage

* New translations en.json (Swedish)

* Auto commit: Calculate translation coverage

* New translations en.json (Dutch)

* Auto commit: Calculate translation coverage

* New translations en.json (Romanian)

* Auto commit: Calculate translation coverage

* New translations en.json (Catalan)

* Auto commit: Calculate translation coverage

* New translations en.json (Spanish)

* New translations en.json (Catalan)

* New translations en.json (Italian)

* Auto commit: Calculate translation coverage

* New translations en.json (Italian)

* New translations en.json (Portuguese)

* Auto commit: Calculate translation coverage

* New translations en.json (Finnish)

* Auto commit: Calculate translation coverage

* New translations en.json (Indonesian)

* Auto commit: Calculate translation coverage

* New translations en.json (German)

* Auto commit: Calculate translation coverage

Co-authored-by: Kostas Bariotis <konmpar@gmail.com>
2020-10-12 15:34:47 +03:00
63566ecb92 Expose update scene via refs (#2217)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-10-11 18:11:26 +02:00
8a10f2a0b8 Fix collision check for rectangles and rendering of binding area (#2221) 2020-10-11 09:46:13 +03:00
3835fa60e4 pass named function to react.memo so in dev tools it doesn't show as anonymous (#2216)
This makes debugging easier as well
2020-10-07 23:37:19 +02:00
215128ffdf add titles with width/height to scale buttons in ExportDialog (#2193) 2020-10-07 15:37:38 +02:00
d18a72c879 save room to firebase on unload or portal close (#2207)
* save on unload or portal close

* align naming
2020-10-05 22:34:40 -04:00
ae1ab1ab37 clear scene when joining a room (#2208)
* clear scene when joining a room

* code shuffle

* remove noop code path
2020-10-05 22:31:34 -04:00
e424ca53c6 fix inconsistent text element color on dark mode while editing. (#2196)
On dark mode, while text element is being edited, it was changing color to the light mode variant (white turns back to black, etc...).

This is caused by the --appearance-filter not being applied to the floating textarea. The css var --appearance-filter is only applied to the .excalidraw class while the floating textarea is being appended to the body which put it outside of .excalidraw.

This change adds excalidraw class to the floating textarea and also adds Appearance_dark to it while dark mode is on.
2020-10-05 17:41:57 +03:00
556f9123f8 Bump @types/socket.io-client from 1.4.33 to 1.4.34 (#2202)
Bumps [@types/socket.io-client](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/socket.io-client) from 1.4.33 to 1.4.34.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/socket.io-client)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-05 17:37:14 +03:00
1963afe289 Bump jest-canvas-mock from 2.2.0 to 2.3.0 (#2203)
Bumps [jest-canvas-mock](https://github.com/hustcc/jest-canvas-mock) from 2.2.0 to 2.3.0.
- [Release notes](https://github.com/hustcc/jest-canvas-mock/releases)
- [Changelog](https://github.com/hustcc/jest-canvas-mock/blob/master/CHANGELOG.md)
- [Commits](https://github.com/hustcc/jest-canvas-mock/compare/v2.2.0...v2.3.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-05 17:37:10 +03:00
6382b82acf Bump firebase from 7.21.1 to 7.22.0 (#2204)
Bumps [firebase](https://github.com/firebase/firebase-js-sdk) from 7.21.1 to 7.22.0.
- [Release notes](https://github.com/firebase/firebase-js-sdk/releases)
- [Commits](https://github.com/firebase/firebase-js-sdk/compare/firebase@7.21.1...firebase@7.22.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-05 17:37:02 +03:00
823a5697c0 Bump @types/react from 16.9.49 to 16.9.50 (#2205)
Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 16.9.49 to 16.9.50.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-05 17:36:57 +03:00
04f2564947 Bump socket.io-client from 2.3.0 to 2.3.1 (#2206)
Bumps [socket.io-client](https://github.com/Automattic/socket.io-client) from 2.3.0 to 2.3.1.
- [Release notes](https://github.com/Automattic/socket.io-client/releases)
- [Changelog](https://github.com/socketio/socket.io-client/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Automattic/socket.io-client/compare/2.3.0...2.3.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-05 17:36:51 +03:00
16d3d2fb54 New Crowdin updates (#2195) 2020-10-05 17:36:25 +03:00
6ca7420252 Remove warning about rooms not being persisted (#2199) 2020-10-04 13:02:06 -07:00
d0985fe67a Persistent rooms via Firebase (#2188)
* Periodically back up collaborative rooms in firebase

* Responses to code review

* comments from code review, new firebase credentials
2020-10-04 11:12:47 -07:00
f2135ab739 New Crowdin updates (#2187) 2020-10-01 20:23:38 +03:00
8ab9ffbe28 One-click installable libraries (#2179)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-10-01 19:12:43 +02:00
6b7516bc3c Bump eslint-config-prettier from 6.11.0 to 6.12.0 (#2190)
Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 6.11.0 to 6.12.0.
- [Release notes](https://github.com/prettier/eslint-config-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-config-prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-config-prettier/compare/v6.11.0...v6.12.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-09-28 15:32:51 +03:00
a61b212220 scope css under name space excalidraw (#1983) 2020-09-25 23:18:45 +02:00
403576861c Bump @sentry/browser from 5.23.0 to 5.24.2 (#2173)
Bumps [@sentry/browser](https://github.com/getsentry/sentry-javascript) from 5.23.0 to 5.24.2.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.23.0...5.24.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-09-23 20:23:47 +03:00
66c345b732 Bump lint-staged from 10.3.0 to 10.4.0 (#2176)
Bumps [lint-staged](https://github.com/okonet/lint-staged) from 10.3.0 to 10.4.0.
- [Release notes](https://github.com/okonet/lint-staged/releases)
- [Commits](https://github.com/okonet/lint-staged/compare/v10.3.0...v10.4.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-09-23 20:19:46 +03:00
65d9352648 Bump @sentry/integrations from 5.23.0 to 5.24.2 (#2174)
Bumps [@sentry/integrations](https://github.com/getsentry/sentry-javascript) from 5.23.0 to 5.24.2.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.23.0...5.24.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-09-23 20:19:24 +03:00
1404b4b958 Bump prettier from 2.1.1 to 2.1.2 (#2175)
Bumps [prettier](https://github.com/prettier/prettier) from 2.1.1 to 2.1.2.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.1.1...2.1.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-09-23 20:19:17 +03:00
22f12352c6 Bump @types/jest from 26.0.13 to 26.0.14 (#2178)
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 26.0.13 to 26.0.14.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-09-23 20:19:08 +03:00
adb1ac5788 fix restoring appState (#2182) 2020-09-22 21:51:49 +02:00
b2822f3538 Make File Handling actually work (#2181)
Follow-up from #1736
2020-09-22 15:21:22 +02:00
68bdfaefbe Fix pinch-to-zoom performance (#2171) 2020-09-21 21:16:34 +02:00
2a2630082f New Crowdin updates (#2166) 2020-09-21 17:19:31 +03:00
e3f3427b31 Fix middle mouse panning on windows (#2172) 2020-09-21 10:15:40 +02:00
c814917927 Add gitattributes (#2164) 2020-09-15 21:59:00 +02:00
8b8adb146f fix: fix package-lock.json typo in volumes (#2162) 2020-09-14 18:23:24 +01:00
3e404d33fd Bump @sentry/integrations from 5.22.3 to 5.23.0 (#2161)
Bumps [@sentry/integrations](https://github.com/getsentry/sentry-javascript) from 5.22.3 to 5.23.0.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.22.3...5.23.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-09-14 12:05:54 +02:00
3d3af88a41 Bump husky from 4.2.5 to 4.3.0 (#2159)
Bumps [husky](https://github.com/typicode/husky) from 4.2.5 to 4.3.0.
- [Release notes](https://github.com/typicode/husky/releases)
- [Changelog](https://github.com/typicode/husky/blob/master/CHANGELOG.md)
- [Commits](https://github.com/typicode/husky/compare/v4.2.5...v4.3.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-09-14 12:01:35 +02:00
d6adfe88bd Bump @testing-library/react from 11.0.2 to 11.0.4 (#2160)
Bumps [@testing-library/react](https://github.com/testing-library/react-testing-library) from 11.0.2 to 11.0.4.
- [Release notes](https://github.com/testing-library/react-testing-library/releases)
- [Changelog](https://github.com/testing-library/react-testing-library/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/react-testing-library/compare/v11.0.2...v11.0.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-09-14 12:01:09 +02:00
786d1bba94 Bump @sentry/browser from 5.22.3 to 5.23.0 (#2158)
Bumps [@sentry/browser](https://github.com/getsentry/sentry-javascript) from 5.22.3 to 5.23.0.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.22.3...5.23.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-09-14 12:00:44 +02:00
31f7e2b8b2 Remove Native File System OT token for good (#2157) 2020-09-14 11:01:07 +02:00
55ecbdcca9 Bump @testing-library/react from 10.4.9 to 11.0.2 (#2140)
Bumps [@testing-library/react](https://github.com/testing-library/react-testing-library) from 10.4.9 to 11.0.2.
- [Release notes](https://github.com/testing-library/react-testing-library/releases)
- [Changelog](https://github.com/testing-library/react-testing-library/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/react-testing-library/compare/v10.4.9...v11.0.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-09-13 23:30:30 +03:00
7d7ce04e9b Add Swedish to the picker 2020-09-13 20:30:28 +03:00
fbc4c70ed8 New Crowdin updates (#2130)
* New translations en.json (Japanese)

* Auto commit: Calculate translation coverage

* New translations en.json (Japanese)

* Auto commit: Calculate translation coverage

* New translations en.json (Japanese)

* Auto commit: Calculate translation coverage

* New translations en.json (Japanese)

* Auto commit: Calculate translation coverage

* New translations en.json (Turkish)

* New translations en.json (Japanese)

* Auto commit: Calculate translation coverage

* New translations en.json (Japanese)

* New translations en.json (French)

* Auto commit: Calculate translation coverage

* New translations en.json (Polish)

* Auto commit: Calculate translation coverage

* New translations en.json (Italian)

* Auto commit: Calculate translation coverage

* New translations en.json (French)

* New translations en.json (Arabic)

* New translations en.json (Arabic)

* New translations en.json (Romanian)

* Auto commit: Calculate translation coverage

* New translations en.json (Indonesian)

* Auto commit: Calculate translation coverage

* New translations en.json (Chinese Simplified)

* New translations en.json (French)

* New translations en.json (French)

* New translations en.json (Nepali)

* Auto commit: Calculate translation coverage

* New translations en.json (Norwegian Nynorsk)

* Auto commit: Calculate translation coverage

* New translations en.json (Norwegian Nynorsk)

* Auto commit: Calculate translation coverage

* New translations en.json (Polish)

* Auto commit: Calculate translation coverage

* New translations en.json (Polish)

* Auto commit: Calculate translation coverage

* New translations en.json (Hindi)

* Auto commit: Calculate translation coverage

* New translations en.json (Hindi)

* Auto commit: Calculate translation coverage

* add nepali to language picker

* New translations en.json (Swedish)

* Auto commit: Calculate translation coverage

* New translations en.json (Swedish)

* Auto commit: Calculate translation coverage

* New translations en.json (Swedish)

* Auto commit: Calculate translation coverage

* New translations en.json (Swedish)

* Auto commit: Calculate translation coverage

* New translations en.json (Japanese)

* New translations en.json (Swedish)

* Auto commit: Calculate translation coverage

* New translations en.json (Swedish)

* Auto commit: Calculate translation coverage

* New translations en.json (Swedish)

* Auto commit: Calculate translation coverage

* New translations en.json (Swedish)

* Auto commit: Calculate translation coverage

* New translations en.json (Japanese)

* Auto commit: Calculate translation coverage

Co-authored-by: Kostas Bariotis <konmpar@gmail.com>
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-09-13 20:27:49 +03:00
242ccac290 Arrows binds/unbinds to bindable elements when moved with arrow keys (Issue #2103) (#2150) 2020-09-13 19:17:16 +02:00
b9d584714a Temporarily disable OT (#2155) 2020-09-11 22:35:08 +02:00
c6736fa14e Lock drag direction using Shift (#1858)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-09-11 17:22:40 +02:00
d07099aadd fix zindex to account for group boundaries (#2065) 2020-09-11 17:06:07 +02:00
ea020f2c50 Update Native File System API Origin Trial token (#2152) 2020-09-11 10:57:19 +02:00
48c2a13c7a Pass file extensions with leading dot after API change (#2149) 2020-09-10 12:00:18 +02:00
aaddde5dd9 Fix history initialization (#2115) 2020-09-09 21:08:06 +02:00
9cac7816cc Fix textbox element bindings on size changes (#2145)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-09-08 18:03:49 +02:00
f2401c9163 Bump @types/jest from 26.0.10 to 26.0.13 (#2142)
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 26.0.10 to 26.0.13.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-09-07 21:01:29 +03:00
18759ec133 Bump lint-staged from 10.2.13 to 10.3.0 (#2141)
Bumps [lint-staged](https://github.com/okonet/lint-staged) from 10.2.13 to 10.3.0.
- [Release notes](https://github.com/okonet/lint-staged/releases)
- [Commits](https://github.com/okonet/lint-staged/compare/v10.2.13...v10.3.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-09-07 21:01:24 +03:00
6319f9b156 Bump @types/react from 16.9.48 to 16.9.49 (#2139)
Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 16.9.48 to 16.9.49.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-09-07 21:01:14 +03:00
47dba05c91 System clipboard (#2117) 2020-09-04 14:58:32 +02:00
950ec66907 Update README.md (#2135) 2020-09-04 14:03:04 +02:00
640dcc90c2 A silly one :) 2020-09-03 22:46:42 +03:00
15e4b51bb1 Fix binding disabling when taking screenshots on macOS (#2129)
* Fix binding disabling when taking screenshots on macOS
* Update snapshot for cmd+click test
2020-09-03 16:12:01 +02:00
924292dc9a New Crowdin updates (#2128)
* New translations en.json (Romanian)

* New translations en.json (Romanian)

* New translations en.json (Romanian)

* New translations en.json (Romanian)

* New translations en.json (Chinese Simplified)

* Auto commit: Calculate translation coverage

* New translations en.json (Chinese Simplified)

* New translations en.json (Chinese Simplified)

Co-authored-by: Kostas Bariotis <konmpar@gmail.com>
2020-09-02 11:31:51 +03:00
a693b36d37 New Crowdin updates (#2127)
* New translations en.json (Russian)

* Auto commit: Calculate translation coverage

Co-authored-by: Kostas Bariotis <konmpar@gmail.com>
2020-09-01 13:16:21 +02:00
dd0c44864d Bump prettier from 2.0.5 to 2.1.1 (#2119)
* Bump prettier from 2.0.5 to 2.1.1

Bumps [prettier](https://github.com/prettier/prettier) from 2.0.5 to 2.1.1.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.0.5...2.1.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* fix

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Panayiotis Lipiridis <lipiridis@gmail.com>
2020-08-31 19:34:46 +03:00
6824572d21 Bump @sentry/browser from 5.21.3 to 5.22.3 (#2118)
Bumps [@sentry/browser](https://github.com/getsentry/sentry-javascript) from 5.21.3 to 5.22.3.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.21.3...5.22.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-31 18:40:34 +03:00
7ca9452d80 Bump lint-staged from 10.2.11 to 10.2.13 (#2123)
Bumps [lint-staged](https://github.com/okonet/lint-staged) from 10.2.11 to 10.2.13.
- [Release notes](https://github.com/okonet/lint-staged/releases)
- [Commits](https://github.com/okonet/lint-staged/compare/v10.2.11...v10.2.13)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-31 18:13:10 +03:00
825aa86016 Bump pwacompat from 2.0.16 to 2.0.17 (#2122)
Bumps [pwacompat](https://github.com/GoogleChrome/pwacompat) from 2.0.16 to 2.0.17.
- [Release notes](https://github.com/GoogleChrome/pwacompat/releases)
- [Commits](https://github.com/GoogleChrome/pwacompat/compare/v2.0.16...2.0.17)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-31 18:13:01 +03:00
2d59689436 Bump @types/react from 16.9.46 to 16.9.48 (#2121)
Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 16.9.46 to 16.9.48.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-31 18:12:52 +03:00
b7e3d98c0f Bump @sentry/integrations from 5.21.4 to 5.22.3 (#2120)
Bumps [@sentry/integrations](https://github.com/getsentry/sentry-javascript) from 5.21.4 to 5.22.3.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.21.4...5.22.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-31 18:12:40 +03:00
98a4d0a595 New Crowdin updates (#2116) 2020-08-31 14:15:33 +03:00
b215e165d2 Fix HintViewer positioning (#2124) 2020-08-31 13:13:34 +02:00
730a11e0a5 Assign file handle to dropped files (#2125)
Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-08-31 13:11:14 +02:00
0ab58b38e0 Fix bug of issue #2062 (#2108)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-08-30 13:10:07 +02:00
46bff3dace New Crowdin updates (#2078)
* New translations en.json (Korean)

* New translations en.json (Korean)

* Auto commit: Calculate translation coverage

* New translations en.json (Romanian)

* Auto commit: Calculate translation coverage

* New translations en.json (Romanian)

* Auto commit: Calculate translation coverage

* New translations en.json (Romanian)

* Auto commit: Calculate translation coverage

* New translations en.json (Romanian)

* Auto commit: Calculate translation coverage

* New translations en.json (Romanian)

* Auto commit: Calculate translation coverage

* New translations en.json (Romanian)

* Auto commit: Calculate translation coverage

* New translations en.json (Romanian)

* Auto commit: Calculate translation coverage

* New translations en.json (Romanian)

* Auto commit: Calculate translation coverage

* New translations en.json (Romanian)

* Auto commit: Calculate translation coverage

* add ro-Ro to language picker

* New translations en.json (Romanian)

* Auto commit: Calculate translation coverage

* New translations en.json (Romanian)

* Auto commit: Calculate translation coverage

Co-authored-by: Kostas Bariotis <konmpar@gmail.com>
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-08-30 10:33:59 +03:00
d15444e232 allowed for sticking to grid when pasting an element (#2107) 2020-08-29 20:01:36 +02:00
7ebeae2d38 Fix arrow rebinding on rotation (take 2) (#2104)
* Clear up test, fix simple rotation
* Fix eligibility rules
2020-08-29 17:56:03 +02:00
26ef235019 rebind arrow on rotation (#2096) 2020-08-29 14:16:40 +02:00
0e28177ccc fix collab MOUSE_LOCATION payload naming for legacy versions (#2098) 2020-08-29 14:12:58 +02:00
1828a93ba7 Fix keypress rebinding (#2102)
Co-authored-by: Anton <anton.matrenin@introduct.tech>
2020-08-29 14:12:28 +02:00
84c49ebaa1 Support rotating two-point lines (angle can be non-zero) (#2090)
Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-08-28 10:20:06 +02:00
8b9e2a540d factor out test helpers (#2093) 2020-08-28 10:15:29 +02:00
4c2d34ffd7 select single element on cmd-click (#2087) 2020-08-27 20:59:46 +02:00
b8f8bc2e32 fix group selection (#2092) 2020-08-27 20:32:10 +02:00
546e13571d reintroduce index CSS as interim solution to SW caching issues (#2085) 2020-08-26 23:26:06 +02:00
e7d186b439 Fix drag multiple elements bug (#2023)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-08-26 18:37:44 +02:00
4718c31da5 Pass Additional props remove localstorage related code for storing data and username from App.tsx to index.tsx (#2057)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-08-26 12:45:54 +02:00
0e0a695e81 Fix multiline hint text cropping (#2079)
Co-authored-by: Lipis <lipiridis@gmail.com>
2020-08-25 17:09:39 +02:00
86d9bee3f4 Bump @testing-library/react from 10.4.8 to 10.4.9 (#2072)
Bumps [@testing-library/react](https://github.com/testing-library/react-testing-library) from 10.4.8 to 10.4.9.
- [Release notes](https://github.com/testing-library/react-testing-library/releases)
- [Changelog](https://github.com/testing-library/react-testing-library/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/react-testing-library/compare/v10.4.8...v10.4.9)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-25 17:48:23 +03:00
d58e71d566 Bump @sentry/integrations from 5.21.1 to 5.21.4 (#2077)
Bumps [@sentry/integrations](https://github.com/getsentry/sentry-javascript) from 5.21.1 to 5.21.4.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.21.1...5.21.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-25 17:48:15 +03:00
37b4883629 New Crowdin updates (#2054) 2020-08-25 13:40:58 +03:00
3c66335ec1 Bump @testing-library/jest-dom from 5.11.3 to 5.11.4 (#2066)
Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 5.11.3 to 5.11.4.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v5.11.3...v5.11.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-25 13:38:38 +03:00
0470e85da7 Bump i18next-browser-languagedetector from 6.0.0 to 6.0.1 (#2070)
Bumps [i18next-browser-languagedetector](https://github.com/i18next/i18next-browser-languageDetector) from 6.0.0 to 6.0.1.
- [Release notes](https://github.com/i18next/i18next-browser-languageDetector/releases)
- [Changelog](https://github.com/i18next/i18next-browser-languageDetector/blob/master/CHANGELOG.md)
- [Commits](https://github.com/i18next/i18next-browser-languageDetector/compare/v6.0.0...v6.0.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-25 13:38:26 +03:00
b39e282ca2 Bump @sentry/browser from 5.21.1 to 5.21.3 (#2068)
Bumps [@sentry/browser](https://github.com/getsentry/sentry-javascript) from 5.21.1 to 5.21.3.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.21.1...5.21.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-25 13:38:08 +03:00
94555287d4 Bump pwacompat from 2.0.15 to 2.0.16 (#2067)
Bumps [pwacompat](https://github.com/GoogleChrome/pwacompat) from 2.0.15 to 2.0.16.
- [Release notes](https://github.com/GoogleChrome/pwacompat/releases)
- [Commits](https://github.com/GoogleChrome/pwacompat/compare/v2.0.15...v2.0.16)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-25 13:38:01 +03:00
e34cf3aee3 Fix #2075 - Pinch zooming while typing text breaks the UI on Chrome Mac OS X (#2076) 2020-08-25 11:38:03 +02:00
960b640e89 Update README.md 2020-08-21 02:55:10 +03:00
eda8333c05 Add link to docker hub in README.md (#2059) 2020-08-21 02:36:18 +03:00
c3de4cd4c5 Reduce the padding of the left 'Islands' (#2050) 2020-08-21 01:24:46 +03:00
643e6bd08d feat: Add hint for double click to insert text (#2056) 2020-08-20 22:55:44 +03:00
ab7073abdb add excalidraw_embed into base repo (#2040)
Co-authored-by: Lipis <lipiridis@gmail.com>
2020-08-20 16:45:20 +02:00
80cbe13167 Make iOS "safe area" respect dark mode (#2053) 2020-08-20 13:20:13 +02:00
aac83325c5 Bump @testing-library/jest-dom from 5.11.2 to 5.11.3 (#2048)
Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 5.11.2 to 5.11.3.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v5.11.2...v5.11.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-19 02:29:14 +03:00
460ec83ca5 Bump @sentry/browser from 5.20.1 to 5.21.1 (#2049)
Bumps [@sentry/browser](https://github.com/getsentry/sentry-javascript) from 5.20.1 to 5.21.1.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.20.1...5.21.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-19 02:29:01 +03:00
7e1b919fba Bump @types/jest from 26.0.9 to 26.0.10 (#2044)
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 26.0.9 to 26.0.10.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-18 19:42:03 +03:00
abfc265f01 Bump i18next-browser-languagedetector from 5.0.1 to 6.0.0 (#2047)
Bumps [i18next-browser-languagedetector](https://github.com/i18next/i18next-browser-languageDetector) from 5.0.1 to 6.0.0.
- [Release notes](https://github.com/i18next/i18next-browser-languageDetector/releases)
- [Changelog](https://github.com/i18next/i18next-browser-languageDetector/blob/master/CHANGELOG.md)
- [Commits](https://github.com/i18next/i18next-browser-languageDetector/compare/v5.0.1...v6.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-18 19:40:49 +03:00
01a1504cb3 Bump react-scripts from 3.4.1 to 3.4.3 (#2046)
Bumps [react-scripts](https://github.com/facebook/create-react-app/tree/HEAD/packages/react-scripts) from 3.4.1 to 3.4.3.
- [Release notes](https://github.com/facebook/create-react-app/releases)
- [Changelog](https://github.com/facebook/create-react-app/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/create-react-app/commits/HEAD/packages/react-scripts)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-18 19:40:32 +03:00
7edffd8e7b Bump @sentry/integrations from 5.20.1 to 5.21.1 (#2045)
Bumps [@sentry/integrations](https://github.com/getsentry/sentry-javascript) from 5.20.1 to 5.21.1.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.20.1...5.21.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-18 19:40:27 +03:00
036bdcfa3f Bump @types/react from 16.9.45 to 16.9.46 (#2043)
Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 16.9.45 to 16.9.46.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-18 19:40:20 +03:00
c6e2877418 New Crowdin updates (#2042)
* New translations en.json (Vietnamese)

* Auto commit: Calculate translation coverage

* add vi-VN to i18n

Co-authored-by: Kostas Bariotis <konmpar@gmail.com>
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-08-18 19:39:40 +03:00
415bf7bb5b New Crowdin updates (#2022) 2020-08-17 00:13:58 +03:00
4644ca1778 🎨 Use consistent naming (#2029) 2020-08-14 20:14:22 +02:00
009eba6315 feat: Zoom controls are pushed to the right edge for Right-To-Left languages (#2021) (#2037) 2020-08-14 21:08:27 +03:00
14317c2232 🐛 Remove unnecessary class name props (#2027)
It's unused and serialized to `undefined`.
2020-08-14 20:05:29 +02:00
41cb1fbeba feat: sharpness (#1931)
* feat: sharpness

* feat: fill sharp lines, et al.

* fix: rotated positioning

* chore: simplify path with Q

* fix: hit test inside sharp elements

* make sharp / round buttons work properly

* fix tsc tests

* update snapshots

* update snapshots

* fix: sharp arrow creation error

* fix merge and test

* avoid type assertion

* remove duplicate helper

Co-authored-by: dwelle <luzar.david@gmail.com>
2020-08-14 17:59:43 +02:00
930813387b make loading message account for dark mode & add i18n (#2033)
* make loading message account for dark mode & add i18n

* use app color scheme
2020-08-14 13:27:41 +02:00
3f2b0fdd0a don't reset dark mode on canvas clear (#2032) 2020-08-13 17:22:39 +02:00
2cb8ba6521 add explanation for why we mutate collaborators state (#2028)
* 🔒 Avoid mutating state

* revert to mutation and add explaining comment

Co-authored-by: dwelle <luzar.david@gmail.com>
2020-08-13 17:20:38 +02:00
5670c47789 🐛 Fix emoji rendering (#2030)
Thanks.
2020-08-13 16:29:33 +02:00
c0dd870c6e Dark mode (#2006)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-08-13 13:35:31 +02:00
c9d5ec9277 Bump @types/jest from 26.0.8 to 26.0.9 (#2017)
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 26.0.8 to 26.0.9.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-11 17:18:58 +03:00
6e5b1a1c2a New Crowdin updates (#1987) 2020-08-11 17:12:33 +03:00
296e3677cf Fix single element bounding box bug (#2008)
Co-authored-by: Michal Srb <xixixao@seznam.cz>
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-08-11 12:42:08 +02:00
a96406f505 Bump i18next-browser-languagedetector from 5.0.0 to 5.0.1 (#2015)
Bumps [i18next-browser-languagedetector](https://github.com/i18next/i18next-browser-languageDetector) from 5.0.0 to 5.0.1.
- [Release notes](https://github.com/i18next/i18next-browser-languageDetector/releases)
- [Changelog](https://github.com/i18next/i18next-browser-languageDetector/blob/master/CHANGELOG.md)
- [Commits](https://github.com/i18next/i18next-browser-languageDetector/compare/v5.0.0...v5.0.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-10 18:10:42 +03:00
36c01eb982 Bump @testing-library/react from 10.4.7 to 10.4.8 (#2016)
Bumps [@testing-library/react](https://github.com/testing-library/react-testing-library) from 10.4.7 to 10.4.8.
- [Release notes](https://github.com/testing-library/react-testing-library/releases)
- [Changelog](https://github.com/testing-library/react-testing-library/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/react-testing-library/compare/v10.4.7...v10.4.8)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-10 18:10:24 +03:00
bd1a1c966e Bump @types/react from 16.9.44 to 16.9.45 (#2014)
Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 16.9.44 to 16.9.45.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-10 18:10:13 +03:00
964746e569 fix transform handles regression (#2018) 2020-08-10 15:00:21 +02:00
950bcd0b72 Refactor resize handle naming (#2013) 2020-08-10 14:16:39 +02:00
85d000ccda Add prevent binding keyboard shortcut to shortcuts dialog (#2010)
Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-08-09 13:46:20 +02:00
8bbeb32e87 Fix text selection broken by PR1899 (#2011) 2020-08-09 00:51:41 -07:00
26f67d27ec Allow binding linear elements to other elements (#1899)
* Refactor: simplify linear element type

* Refactor: dedupe scrollbar handling

* First step towards binding - establish relationship and basic test for dragged lines

* Refactor: use zoom from appstate

* Refactor: generalize getElementAtPosition

* Only consider bindable elements in hit test

* Refactor: pull out pieces of hit test for reuse later

* Refactor: pull out diamond from hit test for reuse later

* Refactor: pull out text from hit test for reuse later

* Suggest binding when hovering

* Give shapes in regression test real size

* Give shapes in undo/redo test real size

* Keep bound element highlighted

* Show binding suggestion for multi-point elements

* Move binding to its on module with functions so that I can use it from actions, add support for binding end of multi-point elements

* Use Id instead of ID

* Improve boundary offset for non-squarish elements

* Fix localStorage for binding on linear elements

* Simplify dragging code and fix elements bound twice to the same shape

* Fix binding for rectangles

* Bind both ends at the end of the linear element creation, needed for focus points

* wip

* Refactor: Renames and reshapes for next commit

* Calculate and store focus points and gaps, but dont use them yet

* Focus points for rectangles

* Dont blow up when canceling linear element

* Stop suggesting binding when a non-compatible tool is selected

* Clean up collision code

* Using Geometric Algebra for hit tests

* Correct binding for all shapes

* Constant gap around polygon corners

* Fix rotation handling

* Generalize update and fix hit test for rotated elements

* Handle rotation realtime

* Handle scaling

* Remove vibration when moving bound and binding element together

* Handle simultenous scaling

* Allow binding and unbinding when editing linear elements

* Dont delete binding when the end point wasnt touched

* Bind on enter/escape when editing

* Support multiple suggested bindable elements in preparation for supporting linear elements dragging

* Update binding when moving linear elements

* Update binding when resizing linear elements

* Dont re-render UI on binding hints

* Update both ends when one is moved

* Use distance instead of focus point for binding

* Complicated approach for posterity, ignore this commit

* Revert the complicated approach

* Better focus point strategy, working for all shapes

* Update snapshots

* Dont break binding gap when mirroring shape

* Dont break binding gap when grid mode pushes it inside

* Dont bind draw elements

* Support alt duplication

* Fix alt duplication to

* Support cmd+D duplication

* All copy mechanisms are supported

* Allow binding shapes to arrows, having arrows created first

* Prevent arrows from disappearing for ellipses

* Better binding suggestion highlight for shapes

* Dont suggest second binding for simple elements when editing or moving them

* Dont steal already bound linear elements when moving shapes

* Fix highlighting diamonds and more precisely highlight other shapes

* Highlight linear element edges for binding

* Highlight text binding too

* Handle deletion

* Dont suggest second binding for simple linear elements when creating them

* Dont highlight bound element during creation

* Fix binding for rotated linear elements

* Fix collision check for ellipses

* Dont show suggested bindings for selected pairs

* Bind multi-point linear elements when the tool is switched - important for mobile

* Handle unbinding one of two bound edges correctly

* Rename boundElement in state to startBoundElement

* Dont double account for zoom when rendering binding highlight

* Fix rendering of edited linear element point handles

* Suggest binding when adding new point to a linear element

* Bind when adding a new point to a linear element and dont unbind when moving middle elements

* Handle deleting points

* Add cmd modifier key to disable binding

* Use state for enabling binding, fix not binding for linear elements during creation

* Drop support for binding lines, only arrows are bindable

* Reset binding mode on blur

* Fix not binding lines
2020-08-08 21:04:15 -07:00
5f195694ee update simplifier distance to reflect zoom (#2004)
* update simplifier distance to reflect zoom

The distance used in the iterative end-point fit algorithm to
determine if points can be removed no longer ignores the
zoom. As the zoom gets larger this distance will get smaller
and fewer points will be removed, thus making for finer grain
control over the drawing. As the zoom gets smaller the drawing
will get more coarse as more points are removed.

* remove the comment

Co-authored-by: John Dupuis <wasp7@Johns-MacBook-Pro.local>
Co-authored-by: Michal Srb <xixixao@seznam.cz>
2020-08-08 18:50:16 -07:00
403e8bd307 clear selection from copied/duplicatated group (#1973)
Co-authored-by: rene_mbp <harryloveslearning@googlemail.com>
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-08-08 22:35:34 +02:00
c06988a202 do not prevent UI scrolling on mobile (#2007) 2020-08-06 18:56:51 +02:00
0eff9d525d Update origin trial token (#2005) 2020-08-06 09:11:33 +02:00
e4f429f1c1 Bump @types/react from 16.9.43 to 16.9.44 (#1997)
Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 16.9.43 to 16.9.44.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-03 18:34:33 +03:00
32d5507d41 Bump @types/jest from 26.0.7 to 26.0.8 (#1995)
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 26.0.7 to 26.0.8.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-03 18:32:11 +03:00
7f4e50d6de Bump @testing-library/jest-dom from 5.11.1 to 5.11.2 (#1996)
Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 5.11.1 to 5.11.2.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v5.11.1...v5.11.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-03 18:32:06 +03:00
4dfb043331 Bump browser-nativefs from 0.10.1 to 0.10.2 (#1998)
Bumps [browser-nativefs](https://github.com/GoogleChromeLabs/browser-nativefs) from 0.10.1 to 0.10.2.
- [Release notes](https://github.com/GoogleChromeLabs/browser-nativefs/releases)
- [Commits](https://github.com/GoogleChromeLabs/browser-nativefs/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-03 18:31:58 +03:00
c7b45da85f [Security] Bump elliptic from 6.5.2 to 6.5.3 (#1979)
Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.2 to 6.5.3. **This update includes a security fix.**
- [Release notes](https://github.com/indutny/elliptic/releases)
- [Commits](https://github.com/indutny/elliptic/compare/v6.5.2...v6.5.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-31 18:13:09 +03:00
fea257765d regenerate seed on change of sloppiness (#1986) 2020-07-30 20:14:38 +02:00
818821c293 feat: grid mode for line editing (#1984) 2020-07-30 17:09:51 +02:00
c171fb4c7f simplify by replacing draggingElementPointIndex with isDragging (#1982)
* simplify by replacing draggingElementPointIndex with isDragging

* add tsdoc
2020-07-30 12:58:06 +02:00
20500b7822 remove shared global scene and attach it to every instance (#1706)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-07-30 11:20:59 +02:00
54f8d8f820 New Crowdin updates (#1949) 2020-07-29 18:56:41 +03:00
ab980b252c make restore migration types required (#1977) 2020-07-28 23:40:06 +02:00
925db9dcca Only insert text on double click when selection is enabled (#1937)
This was an oversight to enable it for all the shapes. I don't believe that we want to be able to insert text on double click when drawing a rectangle for example. And it's definitely a broken experience when doing so for free draw.

Fixes part of #1935
2020-07-27 23:05:52 +02:00
c0ca6bae37 Bump @sentry/integrations from 5.19.2 to 5.20.1 (#1968)
Bumps [@sentry/integrations](https://github.com/getsentry/sentry-javascript) from 5.19.2 to 5.20.1.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.19.2...5.20.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-27 16:27:56 +03:00
ee8fa6aaad Import and export library from/to a file (#1940)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-07-27 14:29:19 +02:00
7eff6893c5 calculate coords based on container viewport position (#1955)
* feat: calculate coords based on parent left and top so it renders correctly in host App

* fix text

* move offsets to state & fix bugs

* fix text jumping

* account for zoom in textWysiwyg & undo incorrect offsetting

Co-authored-by: dwelle <luzar.david@gmail.com>
2020-07-27 13:48:49 +02:00
63edbb9517 Bump browser-nativefs from 0.10.0 to 0.10.1 (#1971)
Bumps [browser-nativefs](https://github.com/GoogleChromeLabs/browser-nativefs) from 0.10.0 to 0.10.1.
- [Release notes](https://github.com/GoogleChromeLabs/browser-nativefs/releases)
- [Commits](https://github.com/GoogleChromeLabs/browser-nativefs/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-27 12:49:34 +03:00
a4ad22bc4d Bump @types/jest from 26.0.5 to 26.0.7 (#1970)
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 26.0.5 to 26.0.7.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-27 12:49:27 +03:00
a945e16274 Bump @sentry/browser from 5.20.0 to 5.20.1 (#1969)
Bumps [@sentry/browser](https://github.com/getsentry/sentry-javascript) from 5.20.0 to 5.20.1.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.20.0...5.20.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-27 12:49:11 +03:00
f0ac606ed7 Add robots.txt (#1965) 2020-07-26 21:04:38 +02:00
f295550940 ensure editingLinearElement handles are rendered on top (#1967) 2020-07-26 20:52:25 +02:00
df4e903bd6 Add regression tests for context-menu actions (#1959) 2020-07-26 13:29:44 +02:00
a2e7d8d560 feat: rotating multiple elements (#1960) 2020-07-26 12:21:38 +02:00
ebf2923c5e Issues/1827 group-ungroup icons (#1956)
* show group and ungroup action-icon

* change group-icon visiblilty

don't show group if selected is only a single element or a single group of elements

Co-authored-by: rene_mbp <harryloveslearning@googlemail.com>
2020-07-26 01:42:06 +03:00
880cac2359 Update browser-nativefs (#1963)
Incorporates the latest changes in the Native File System API
2020-07-25 15:34:51 +02:00
d3a38202e3 Make sure extension gets set correctly for exports (#1962) 2020-07-25 13:00:55 +02:00
dc1f6c4d4c change selection/line/draw shortcut defaults (#1953) 2020-07-24 15:47:46 +02:00
c5d37a07c8 fix resize hints not showing due to LayerUI bailing on updates (#1952) 2020-07-24 13:29:36 +02:00
2d8430593d Bump @sentry/browser from 5.19.1 to 5.20.0 (#1948)
Bumps [@sentry/browser](https://github.com/getsentry/sentry-javascript) from 5.19.1 to 5.20.0.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.19.1...5.20.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-22 18:09:22 +03:00
3c52c5bfc2 Bump @testing-library/jest-dom from 5.11.0 to 5.11.1 (#1944)
Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 5.11.0 to 5.11.1.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v5.11.0...v5.11.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-22 18:03:49 +03:00
5a7595cf4e Bump @types/jest from 26.0.4 to 26.0.5 (#1945)
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 26.0.4 to 26.0.5.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-22 18:03:41 +03:00
76c36397bc Bump @sentry/browser from 5.19.1 to 5.19.2 (#1942)
Bumps [@sentry/browser](https://github.com/getsentry/sentry-javascript) from 5.19.1 to 5.19.2.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.19.1...5.19.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-22 17:48:17 +03:00
46574713eb Bump typescript from 3.9.6 to 3.9.7 (#1943)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 3.9.6 to 3.9.7.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v3.9.6...v3.9.7)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-22 17:47:55 +03:00
365a03e930 Bump @testing-library/react from 10.4.6 to 10.4.7 (#1946)
Bumps [@testing-library/react](https://github.com/testing-library/react-testing-library) from 10.4.6 to 10.4.7.
- [Release notes](https://github.com/testing-library/react-testing-library/releases)
- [Changelog](https://github.com/testing-library/react-testing-library/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/react-testing-library/compare/v10.4.6...v10.4.7)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-22 17:47:46 +03:00
f9524c79b0 [Security] Bump lodash from 4.17.15 to 4.17.19 (#1941)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19. **This update includes a security fix.**
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-22 17:47:33 +03:00
f15d62aa44 New Crowdin updates (#1926)
* New translations en.json (French)

* New translations en.json (French)

* New translations en.json (Turkish)

* Auto commit: Calculate translation coverage

* New translations en.json (Arabic)

* New translations en.json (Turkish)

* Auto commit: Calculate translation coverage

Co-authored-by: Kostas Bariotis <konmpar@gmail.com>
2020-07-21 11:02:10 +03:00
b07aa6e205 delay scene init until document active (#1920)
* delay scene init until document active

* use opts.once for the listener
2020-07-20 12:53:53 +02:00
cf36cb394b Library improvements (#1925)
Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-07-19 23:12:56 +02:00
29f803e25d Fix display of some emoji on Windows (#1933) 2020-07-19 21:14:45 +02:00
e2640edb79 add name field to package.json (#1934) 2020-07-18 15:44:45 +03:00
c1488fa353 try/catch localStorage access (#1932) 2020-07-17 18:39:23 +02:00
494b7d08c5 mute FS abort errors (#1929) 2020-07-17 11:34:21 +02:00
4cfc8bd4b3 fix accessing nonexisting config property during appState clearing (#1928) 2020-07-16 21:20:55 +02:00
f9793835e6 Restore missing env vars in Docker image (#1922) 2020-07-15 13:25:42 +02:00
bac20fa641 Choosing color before entering text does not update the swatch (Fixes #1897) (#1915)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-07-14 13:56:45 +02:00
e2cc961c76 Bump @testing-library/react from 10.4.4 to 10.4.6 (#1917)
Bumps [@testing-library/react](https://github.com/testing-library/react-testing-library) from 10.4.4 to 10.4.6.
- [Release notes](https://github.com/testing-library/react-testing-library/releases)
- [Changelog](https://github.com/testing-library/react-testing-library/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/react-testing-library/compare/v10.4.4...v10.4.6)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-14 14:03:43 +03:00
eb3455fc03 Bump @sentry/integrations from 5.19.0 to 5.19.2 (#1918)
Bumps [@sentry/integrations](https://github.com/getsentry/sentry-javascript) from 5.19.0 to 5.19.2.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.19.0...5.19.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-14 14:03:37 +03:00
8ab7921796 New Crowdin updates (#1883)
* New translations en.json (Norwegian Bokmal)

* Auto commit: Calculate translation coverage

* New translations en.json (Hindi)

* Auto commit: Calculate translation coverage

* New translations en.json (Hindi)

* Auto commit: Calculate translation coverage

* New translations en.json (French)

* New translations en.json (Russian)

* New translations en.json (Norwegian Bokmal)

* New translations en.json (Ukrainian)

* New translations en.json (Persian)

* New translations en.json (Albanian)

* New translations en.json (Catalan)

* New translations en.json (Hebrew)

* New translations en.json (Hindi)

* New translations en.json (Indonesian)

* New translations en.json (Chinese Traditional)

* New translations en.json (Chinese Simplified)

* New translations en.json (Turkish)

* New translations en.json (Portuguese)

* New translations en.json (Spanish)

* New translations en.json (Polish)

* New translations en.json (Dutch)

* New translations en.json (Korean)

* New translations en.json (Japanese)

* New translations en.json (Italian)

* New translations en.json (Hungarian)

* New translations en.json (Finnish)

* New translations en.json (Greek)

* New translations en.json (German)

* New translations en.json (Bulgarian)

* New translations en.json (Arabic)

* New translations en.json (Norwegian Nynorsk)

* Auto commit: Calculate translation coverage

* New translations en.json (Norwegian Bokmal)

* Auto commit: Calculate translation coverage

* New translations en.json (Portuguese)

* Auto commit: Calculate translation coverage

* New translations en.json (Persian)

* Auto commit: Calculate translation coverage

* New translations en.json (Chinese Traditional)

* Auto commit: Calculate translation coverage

* New translations en.json (Finnish)

* Auto commit: Calculate translation coverage

* New translations en.json (Hindi)

* Auto commit: Calculate translation coverage

* New translations en.json (German)

* New translations en.json (German)

* Auto commit: Calculate translation coverage

* New translations en.json (French)

* New translations en.json (Russian)

* New translations en.json (Norwegian Bokmal)

* New translations en.json (Ukrainian)

* New translations en.json (Persian)

* New translations en.json (Albanian)

* New translations en.json (Catalan)

* New translations en.json (Hebrew)

* New translations en.json (Hindi)

* New translations en.json (Indonesian)

* New translations en.json (Chinese Traditional)

* New translations en.json (Chinese Simplified)

* New translations en.json (Turkish)

* New translations en.json (Portuguese)

* New translations en.json (Spanish)

* New translations en.json (Polish)

* New translations en.json (Dutch)

* New translations en.json (Korean)

* New translations en.json (Japanese)

* New translations en.json (Italian)

* New translations en.json (Hungarian)

* New translations en.json (Finnish)

* New translations en.json (Greek)

* New translations en.json (German)

* New translations en.json (Bulgarian)

* New translations en.json (Arabic)

* New translations en.json (Norwegian Nynorsk)

* Auto commit: Calculate translation coverage

* New translations en.json (Chinese Traditional)

* Auto commit: Calculate translation coverage

* New translations en.json (Norwegian Bokmal)

* Auto commit: Calculate translation coverage

* New translations en.json (Ukrainian)

* Auto commit: Calculate translation coverage

* New translations en.json (Finnish)

* Auto commit: Calculate translation coverage

* New translations en.json (German)

* Auto commit: Calculate translation coverage

* New translations en.json (Catalan)

* Auto commit: Calculate translation coverage

* New translations en.json (Catalan)

* Auto commit: Calculate translation coverage

* New translations en.json (Spanish)

* New translations en.json (Catalan)

* Auto commit: Calculate translation coverage

* New translations en.json (French)

* New translations en.json (Spanish)

* New translations en.json (Italian)

* New translations en.json (Portuguese)

* Auto commit: Calculate translation coverage

* New translations en.json (Italian)

* Auto commit: Calculate translation coverage

* New translations en.json (Russian)

* New translations en.json (Russian)

* Auto commit: Calculate translation coverage

Co-authored-by: Kostas Bariotis <konmpar@gmail.com>
2020-07-14 11:41:37 +03:00
8f3ccac54c Bump @types/react from 16.9.41 to 16.9.43 (#1913)
Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 16.9.41 to 16.9.43.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-14 11:39:51 +03:00
77254aa2f7 Bump @types/jest from 26.0.3 to 26.0.4 (#1910)
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 26.0.3 to 26.0.4.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-14 11:39:31 +03:00
c4a308e4e6 Bump @sentry/browser from 5.19.0 to 5.19.1 (#1914)
Bumps [@sentry/browser](https://github.com/getsentry/sentry-javascript) from 5.19.0 to 5.19.1.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/5.19.0...5.19.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-14 11:39:20 +03:00
953cd5563c move the excalidraw props to correct file and typo fix (#1907) 2020-07-11 15:13:20 +02:00
0ee2c15929 make clearing state for storage more type-safe (#1884) 2020-07-11 13:09:40 +02:00
6428b59ccb Library MVP (#1787)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-07-10 11:20:23 +02:00
7ab0c1aba8 reload scene on hashchange (#1893)
* reload scene on hashchange

* tweak isLoading
2020-07-09 22:16:28 -07:00
4ab4fce998 Refactoring in pointer down event handler, step 3 (#1888)
* Refactor: use pointer down state for alt duplication flag

* Refactor: use pointer down state for drag state

* Refactor: simplify over scrollbars check

* Refactor: move pointer move handler out of pointer down handler

* Refactor: move pointer up handler out of pointer down handler

* Refactor: further simplify scrollbar check state in pointer down event

* Refactor: pull out initial pointer down state creation
2020-07-09 14:15:42 -07:00
6e357c0291 fix deleting multi-point elem during edit (#1892) 2020-07-09 22:33:27 +02:00
51a8ab65f3 Group / ungroup should not always be present in the context menu (#1890)
Co-authored-by: rene_mbp <harryloveslearning@googlemail.com>
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-07-09 22:32:27 +02:00
5664de0459 Refactoring in pointer down event handler, step 2 (#1887)
* Refactor: introduce pointer down state to replace implicit closure state with an explicit object

* Refactor: use pointer down state for resize handle

* Refactor: use pointer down state for isResizing

* Refactor: use pointer down state for resizing offset

* Refactor: use pointer down state for hit element

* Refactor: move selection handling out of pointer down event handler

* Refactor: move text handling out of pointer down event handler

* Refactor: move linear tools handling out of pointer down event handler

* Refactor: move element creation out of pointer down handler
2020-07-09 09:30:38 -07:00
6cc6e13892 adjust font baseline on resize (#1820)
* adjust font baseline on resize

* simplify font scaling on resize

* fix: resizing text to avoid glitchy behavior

* make text resizing deterministic

* no TEXT_WIDTH_PADDING hack

Co-authored-by: dwelle <luzar.david@gmail.com>
2020-07-09 22:22:10 +09:00
5d7020cce6 Refactoring in pointer down event handler (#1880)
* Refactor: Move context menu touch device handling

* Refactor: Move more stuff out of pointer down

* Refactor: Move last coords into an object

* Refactor: Move scrollbar handling out of pointer down

* Refactor: simplify resizing in pointer down

* Refactor: further simplify resizing in pointer down

* Refactor: clarify clearing selection code

* Refactor: move out clearing selection from pointer down

* Refactor: further simplify deselection in pointer down
2020-07-08 22:07:51 -07:00
d5e7d08586 prompt when loading external scene before overriding local one (#1862) 2020-07-08 22:55:26 +02:00
1b9b824c70 [Security] Bump npm from 6.14.4 to 6.14.6 (#1885)
Bumps [npm](https://github.com/npm/cli) from 6.14.4 to 6.14.6. **This update includes a security fix.**
- [Release notes](https://github.com/npm/cli/releases)
- [Changelog](https://github.com/npm/cli/blob/latest/CHANGELOG.md)
- [Commits](https://github.com/npm/cli/compare/v6.14.4...v6.14.6)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-08 15:54:49 +03:00
6f13b5ac75 Fix status when do selectAll while editing lines (#1828) 2020-07-08 10:29:47 +02:00
df5eb3f0d9 change copy/paste styles shortcuts (#1881)
* change copy/paste styles shortcuts

* use keyCode
2020-07-07 20:22:23 +02:00
6f1cff101a Bump @testing-library/react from 10.4.3 to 10.4.4 (#1872)
Bumps [@testing-library/react](https://github.com/testing-library/react-testing-library) from 10.4.3 to 10.4.4.
- [Release notes](https://github.com/testing-library/react-testing-library/releases)
- [Changelog](https://github.com/testing-library/react-testing-library/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/react-testing-library/compare/v10.4.3...v10.4.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-07 20:02:57 +03:00
eb9a9b628a Bump browser-nativefs from 0.9.0 to 0.9.1 (#1873)
Bumps [browser-nativefs](https://github.com/GoogleChromeLabs/browser-nativefs) from 0.9.0 to 0.9.1.
- [Release notes](https://github.com/GoogleChromeLabs/browser-nativefs/releases)
- [Commits](https://github.com/GoogleChromeLabs/browser-nativefs/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-07 20:02:50 +03:00
3a4bc68025 Bump typescript from 3.9.5 to 3.9.6 (#1874)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 3.9.5 to 3.9.6.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-07 20:02:44 +03:00
01e546c230 use width,height from current appstate when initializing scene (#1882)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-07-07 18:37:53 +02:00
ead58bf2d9 New Crowdin updates (#1856) 2020-07-07 18:30:58 +03:00
9351b2821c feat: add width, height as props to App.tsx (#1871) 2020-07-07 17:10:39 +02:00
b1261eea70 duplicate point on cmd+d (#1831) 2020-07-07 13:53:44 +02:00
84abda82d5 docs: add multiple selection docs (#1875) 2020-07-07 11:24:07 +02:00
93137c0bb2 Parameterise socket preconnect (#1867) 2020-07-03 16:35:02 +02:00
30cbe21a47 Update to browser-nativefs v0.9.0 (#1864) 2020-07-03 11:24:41 +02:00
cc52ea4ac2 Add support for long press to context menu on iOS (#1769)
* Initial support for touch context menu

* Only deal with touch if it's available

* Fix touch checking

* Remove touch checking

* Added comments

* Combine onTouch with onPointer for mobile context menu support
2020-07-03 00:12:56 +03:00
8621ddb6a2 Extract backend URLs into environment variables (#1772) (#1848) 2020-07-02 17:52:58 +02:00
b21f723eee use absolute positioning instead of fixed (#1860) 2020-07-02 15:27:47 +02:00
d9e84b90ce strip fragment (#1859) 2020-07-02 12:02:16 +02:00
79c3b846d7 Added Language support for Hindi in language selection dropdown (#1753)
* Added Language support for Hindi in language selection dropdown

* Update src/locales/hi-IN.json

* Update src/i18n.ts

Co-authored-by: Lipis <lipiridis@gmail.com>
2020-07-01 20:20:27 +03:00
d39d8e3cb1 New Crowdin updates (#1846) 2020-07-01 19:49:53 +03:00
24fe05f023 Bump @sentry/* to the latest (#1855)
* Bump @sentry/* to the latest

* lock
2020-07-01 19:49:16 +03:00
53d2c67b52 Bump @types/jest from 26.0.0 to 26.0.3 (#1835)
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 26.0.0 to 26.0.3.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-01 19:36:34 +03:00
2ee8bb9846 Bump @testing-library/react from 10.4.1 to 10.4.3 (#1837)
Bumps [@testing-library/react](https://github.com/testing-library/react-testing-library) from 10.4.1 to 10.4.3.
- [Release notes](https://github.com/testing-library/react-testing-library/releases)
- [Changelog](https://github.com/testing-library/react-testing-library/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/react-testing-library/compare/v10.4.1...v10.4.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-01 19:27:14 +03:00
19038d0d7e Bump @testing-library/jest-dom from 5.10.1 to 5.11.0 (#1838)
Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 5.10.1 to 5.11.0.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v5.10.1...v5.11.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-01 19:15:45 +03:00
bcf9cc2a5b Bump @types/react from 16.9.38 to 16.9.41 (#1840)
Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 16.9.38 to 16.9.41.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-01 19:15:30 +03:00
ecc3a72583 Native File System API OT refresh (#1852) 2020-07-01 17:26:32 +02:00
89cf826555 Change target branch of coverage and pretty print (#1850) 2020-07-01 12:05:21 +03:00
2a25480272 Expose Git SHA to window (#1847)
* expose git sha

* move to global.d.ts

* fix vercel domain
2020-06-30 22:03:13 +01:00
9a5ae05bbf Auto commit: Calculate translation coverage 2020-06-30 18:34:33 +00:00
54a72b821a New translations en.json (Greek) (#1845) 2020-06-30 19:34:15 +01:00
8c3549f336 Add script to calculate percentage of translation (#1826)
* add script to calculate percentage of translation

* test translation change

* change translation

* test

* change translation

* Calculate percentages of each translation file

* test

* Calculate percentages of each translation file

* change translation

* test

* test

* Calculate percentages of each translation file

* test

* Calculate percentages of each translation file

* fix workflow

* test

* test again

* Calculate percentages of each translation file

* Calculate percentages of each translation file

* test

* refactor

* change build logic

* fix types, move English first

* docs added

* test translation file

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* Calculate percentages of each translation file

* let this be the final test please

* Calculate percentages of each translation file

* test

* test

* Test

* Calculate percentages of each translation file

* test

* Calculate percentages of each translation file

* test

* Calculate percentages of each translation file

* test

* Auto commit: Calculate translation coverage

* test

* test

* test

* test

* Auto commit: Calculate translation coverage

* test

* only on master

* test

* test

* Auto commit: Calculate translation coverage

* switch to master branch

Co-authored-by: i18n automation <runner@fv-az76.2iswp1o5zimezclxzdlwqia2gf.cx.internal.cloudapp.net>
Co-authored-by: i18n automation <runner@fv-az129.idlktykl4ure3gqe2lnji05orb.cx.internal.cloudapp.net>
Co-authored-by: i18n automation <runner@fv-az76.pjgcdo5npjpenpqz2nk0ztqvxd.cx.internal.cloudapp.net>
Co-authored-by: i18n automation <runner@fv-az33.senarqq4ucbulg04aytwntvgah.cx.internal.cloudapp.net>
Co-authored-by: i18n automation <runner@fv-az51.icvemaqob4xunfekbtdiz2tu2c.cx.internal.cloudapp.net>
Co-authored-by: i18n automation <runner@fv-az78.gikxu4m3dpiulftj3bftpuu3ee.cx.internal.cloudapp.net>
Co-authored-by: i18n automation <runner@fv-az121.cqdewbghluceforu5pkvpnveec.cx.internal.cloudapp.net>
Co-authored-by: i18n automation <runner@fv-az139.jsbds1i2htye3fh1bzwbe4ugmf.cx.internal.cloudapp.net>
Co-authored-by: i18n automation <runner@fv-az50.0bg2cysi0dkefjvuua0a0kbd1h.cx.internal.cloudapp.net>
Co-authored-by: i18n automation <runner@fv-az51.nhi3in4tbx4ehjtltcwuwbwsua.cx.internal.cloudapp.net>
2020-06-30 19:28:19 +01:00
e23f7d37b6 Update Norwegian languages in list (#1843) 2020-06-30 15:51:25 +03:00
483796f6ff New Crowdin updates (#1813) 2020-06-30 15:50:48 +03:00
a679ef7876 Refactor CJS require to ESM (#1841)
Resolves https://github.com/excalidraw/excalidraw/pull/1793#discussion_r447067827
2020-06-29 20:22:27 +02:00
0a3fb70ec7 Dynamicaly import locales (#1793)
* dynamicly import locales

* fix tests

* reformat languages
2020-06-27 12:02:54 +01:00
5970bb7ee9 Remove duplicate string for toggle grid mode (#1821) 2020-06-26 22:28:01 +02:00
1991511ef7 Fix flickering outline on the dialogs while clicking (#1747) 2020-06-26 22:27:16 +02:00
cd87bd6901 do not center text when not applicable (#1783) 2020-06-25 21:21:27 +02:00
9c89504b6f fix: start dragging grouped elements (#1818)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-06-24 13:38:42 +02:00
159890860a Bump @testing-library/react from 10.3.0 to 10.4.1 (#1817)
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-06-24 12:49:30 +03:00
caa9b54893 do not render grid on export (#1814) 2020-06-24 10:16:03 +02:00
e7ef02cc0f New Crowdin updates and change code for Norwegian Bokmal (#1776)
* New translations en.json (Turkish)

* New translations en.json (French)

* New translations en.json (Turkish)

* New translations en.json (Turkish)

* New translations en.json (Turkish)

* New translations en.json (Turkish)

* New translations en.json (Turkish)

* New translations en.json (Turkish)

* New translations en.json (Norwegian Bokmal)

* Update i18n.ts

* Remove no-NO

* Update i18n.ts

* Update i18n.ts

* New translations en.json (Hindi)

* New translations en.json (Hindi)

* New translations en.json (Hindi)

* New translations en.json (Hindi)

* New translations en.json (French)

* New translations en.json (Russian)

* New translations en.json (Ukrainian)

* New translations en.json (Persian)

* New translations en.json (Albanian)

* New translations en.json (Catalan)

* New translations en.json (Hebrew)

* New translations en.json (Hindi)

* New translations en.json (Indonesian)

* New translations en.json (Chinese Traditional)

* New translations en.json (Chinese Simplified)

* New translations en.json (Turkish)

* New translations en.json (Portuguese)

* New translations en.json (Spanish)

* New translations en.json (Polish)

* New translations en.json (Dutch)

* New translations en.json (Korean)

* New translations en.json (Japanese)

* New translations en.json (Italian)

* New translations en.json (Hungarian)

* New translations en.json (Finnish)

* New translations en.json (Greek)

* New translations en.json (German)

* New translations en.json (Bulgarian)

* New translations en.json (Arabic)

* New translations en.json (Norwegian Bokmal)

* New translations en.json (Chinese Traditional)

* New translations en.json (Norwegian Bokmal)

* New translations en.json (Finnish)

* New translations en.json (Persian)

* New translations en.json (Portuguese)

* New translations en.json (Turkish)

* New translations en.json (Turkish)

* New translations en.json (Turkish)

* New translations en.json (German)

* New translations en.json (French)

* New translations en.json (Russian)

* New translations en.json (Ukrainian)

* New translations en.json (Persian)

* New translations en.json (Albanian)

* New translations en.json (Catalan)

* New translations en.json (Hebrew)

* New translations en.json (Hindi)

* New translations en.json (Indonesian)

* New translations en.json (Chinese Traditional)

* New translations en.json (Chinese Simplified)

* New translations en.json (Turkish)

* New translations en.json (Portuguese)

* New translations en.json (Spanish)

* New translations en.json (Polish)

* New translations en.json (Dutch)

* New translations en.json (Korean)

* New translations en.json (Japanese)

* New translations en.json (Italian)

* New translations en.json (Hungarian)

* New translations en.json (Finnish)

* New translations en.json (Greek)

* New translations en.json (German)

* New translations en.json (Bulgarian)

* New translations en.json (Arabic)

* New translations en.json (Norwegian Bokmal)

* New translations en.json (Polish)

* New translations en.json (Polish)

* New translations en.json (Norwegian Bokmal)

* New translations en.json (Portuguese)

* New translations en.json (Persian)

* New translations en.json (Finnish)

* New translations en.json (Hindi)

* New translations en.json (Ukrainian)

* New translations en.json (German)

* New translations en.json (Chinese Simplified)

* New translations en.json (Chinese Simplified)

* New translations en.json (Turkish)

* New translations en.json (French)

* New translations en.json (French)

* New translations en.json (French)

* New translations en.json (Russian)

* New translations en.json (Ukrainian)

* New translations en.json (Persian)

* New translations en.json (Albanian)

* New translations en.json (Catalan)

* New translations en.json (Hebrew)

* New translations en.json (Hindi)

* New translations en.json (Indonesian)

* New translations en.json (Chinese Traditional)

* New translations en.json (Chinese Simplified)

* New translations en.json (Turkish)

* New translations en.json (Portuguese)

* New translations en.json (Spanish)

* New translations en.json (Polish)

* New translations en.json (Dutch)

* New translations en.json (Korean)

* New translations en.json (Japanese)

* New translations en.json (Italian)

* New translations en.json (Hungarian)

* New translations en.json (Finnish)

* New translations en.json (Greek)

* New translations en.json (German)

* New translations en.json (Bulgarian)

* New translations en.json (Arabic)

* New translations en.json (Norwegian Bokmal)

* New translations en.json (Finnish)

* New translations en.json (Portuguese)

* New translations en.json (Chinese Traditional)
2020-06-23 20:12:13 +03:00
24a385ff73 Bump i18next-browser-languagedetector from 4.3.0 to 5.0.0 (#1803)
Bumps [i18next-browser-languagedetector](https://github.com/i18next/i18next-browser-languageDetector) from 4.3.0 to 5.0.0.
- [Release notes](https://github.com/i18next/i18next-browser-languageDetector/releases)
- [Changelog](https://github.com/i18next/i18next-browser-languageDetector/blob/master/CHANGELOG.md)
- [Commits](https://github.com/i18next/i18next-browser-languageDetector/compare/v4.3.0...v5.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-06-23 20:10:06 +03:00
cb13cc36cf Bump @testing-library/react from 10.2.1 to 10.3.0 (#1801)
Bumps [@testing-library/react](https://github.com/testing-library/react-testing-library) from 10.2.1 to 10.3.0.
- [Release notes](https://github.com/testing-library/react-testing-library/releases)
- [Changelog](https://github.com/testing-library/react-testing-library/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/react-testing-library/compare/v10.2.1...v10.3.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-06-23 20:09:55 +03:00
5444abc822 Bump @types/react from 16.9.36 to 16.9.38 (#1802)
Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 16.9.36 to 16.9.38.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-06-23 20:09:32 +03:00
76cbefb4ce Bump lint-staged from 10.2.10 to 10.2.11 (#1804)
Bumps [lint-staged](https://github.com/okonet/lint-staged) from 10.2.10 to 10.2.11.
- [Release notes](https://github.com/okonet/lint-staged/releases)
- [Commits](https://github.com/okonet/lint-staged/compare/v10.2.10...v10.2.11)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-06-23 20:09:17 +03:00
baa8fb6c14 grid support (1st iteration) (#1788)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-06-23 17:24:52 +02:00
b6bf011d0d Inline the dropdown icon (#1782) 2020-06-22 10:10:18 -07:00
482fa2d90f fix visibility check on rotated elements (#1799) 2020-06-22 10:00:09 +02:00
a357d00bbe Hint for shortcut for moving the visible area (#1784) 2020-06-19 22:28:13 +02:00
bda8415714 Include stroke style when copy/paste styles (#1785) 2020-06-19 21:33:37 +02:00
ca87ca6fe9 Add user list component + snap to user functionality (#1749) 2020-06-19 12:36:49 +02:00
8f65e37dac Disable Sentry inside Docker (#1781) 2020-06-18 13:18:57 +02:00
f1ceeab8d9 Prepare for Docker publishing (#1771)
* prepare for docker publishing

* fix links

* remove that

* update README

* test publish worklofw

* build and push on master

* include gtag by default
2020-06-18 10:46:24 +01:00
046c0818c5 upgrade Sentry (#1777) 2020-06-16 20:33:31 +03:00
6baa091762 Bump @testing-library/jest-dom from 5.9.0 to 5.10.1 (#1761)
Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 5.9.0 to 5.10.1.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v5.9.0...v5.10.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-06-16 19:16:12 +03:00
2bab4d2c24 Bump i18next-browser-languagedetector from 4.2.0 to 4.3.0 (#1758)
Bumps [i18next-browser-languagedetector](https://github.com/i18next/i18next-browser-languageDetector) from 4.2.0 to 4.3.0.
- [Release notes](https://github.com/i18next/i18next-browser-languageDetector/releases)
- [Changelog](https://github.com/i18next/i18next-browser-languageDetector/blob/master/CHANGELOG.md)
- [Commits](https://github.com/i18next/i18next-browser-languageDetector/compare/v4.2.0...v4.3.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-06-16 19:16:03 +03:00
3a4e48e5af Bump @types/jest from 25.2.3 to 26.0.0 (#1757)
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 25.2.3 to 26.0.0.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-06-16 19:15:55 +03:00
ed89cfc62c Bump lint-staged from 10.2.9 to 10.2.10 (#1759)
Bumps [lint-staged](https://github.com/okonet/lint-staged) from 10.2.9 to 10.2.10.
- [Release notes](https://github.com/okonet/lint-staged/releases)
- [Commits](https://github.com/okonet/lint-staged/compare/v10.2.9...v10.2.10)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-06-16 17:29:42 +03:00
ed0d707851 Bump eslint-plugin-prettier from 3.1.3 to 3.1.4 (#1760)
Bumps [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) from 3.1.3 to 3.1.4.
- [Release notes](https://github.com/prettier/eslint-plugin-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-plugin-prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-plugin-prettier/compare/v3.1.3...v3.1.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-06-16 17:29:31 +03:00
0f15608ad5 Bump @types/react from 16.9.35 to 16.9.36 (#1762)
Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 16.9.35 to 16.9.36.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-06-16 17:29:21 +03:00
2eb58da4c3 New Crowdin translations (#1748)
* New translations en.json (Finnish)

* New translations en.json (French)

* New translations en.json (Portuguese)

* New translations en.json (Persian)

* New translations en.json (Albanian)

* New translations en.json (Catalan)

* New translations en.json (Hebrew)

* New translations en.json (Hindi)

* New translations en.json (Indonesian)

* New translations en.json (Chinese Traditional)

* New translations en.json (Chinese Simplified)

* New translations en.json (Turkish)

* New translations en.json (Russian)

* New translations en.json (Polish)

* New translations en.json (Spanish)

* New translations en.json (Norwegian)

* New translations en.json (Dutch)

* New translations en.json (Korean)

* New translations en.json (Japanese)

* New translations en.json (Italian)

* New translations en.json (Hungarian)

* New translations en.json (Finnish)

* New translations en.json (Greek)

* New translations en.json (German)

* New translations en.json (Bulgarian)

* New translations en.json (Arabic)

* New translations en.json (Ukrainian)

* New translations en.json (Italian)

* New translations en.json (Italian)

* New translations en.json (Persian)

* New translations en.json (Persian)

* New translations en.json (Persian)

* New translations en.json (German)

* New translations en.json (Portuguese)

* New translations en.json (Persian)

* New translations en.json (Persian)

* New translations en.json (Persian)

* New translations en.json (Persian)

* New translations en.json (Finnish)

* New translations en.json (Hindi)

* New translations en.json (Hindi)

* New translations en.json (Hindi)

* New translations en.json (French)

* New translations en.json (Greek)

* New translations en.json (Greek)

* New translations en.json (Chinese Traditional)

* New translations en.json (Chinese Traditional)

* New translations en.json (Chinese Traditional)

* New translations en.json (Chinese Traditional)
2020-06-16 17:27:30 +03:00
f0463fadc3 Remove docker info (#1766) 2020-06-15 17:40:29 +02:00
3cee0768cc Null file handle doesn’t need to be passed (#1752)
* Bump browser-nativefs version to v0.2.0

In reply to https://github.com/tomayac/browser-nativefs/issues/2.

* Update package-lock.json

* Null file handle doesn’t need to be passed
2020-06-15 12:23:23 +02:00
5d3867d8ac Implement Save without re-prompt and Save as (#1709)
* Implement Save without re-prompt and Save as
Fixes #1668

* Add save-as icon

* Make .excalidraw the default extension

* Only show save as button on supporting browsers
2020-06-12 18:35:04 +02:00
0ed6a96b6a New Crowdin translations (#1724) 2020-06-10 18:24:36 +03:00
dadf054ea2 fix not always generating shape on render (#1741) 2020-06-09 17:36:25 +02:00
6b87278a0f Add file handling (#1736)
* Add file handling
https://github.com/WICG/file-handling/blob/master/explainer.md#example

* Only trigger on `.excalidraw` for now
2020-06-08 13:02:06 +02:00
998f0ae458 remove z-index for color-picker-hash div (#1711) 2020-06-08 06:52:54 -04:00
60973f6dc5 rename container class to excalidraw and move css from index.html to app.css (#1729)
Moved the css from index.html to app.css so it can be included in upstream app as well
2020-06-08 13:36:35 +03:00
53ab46126d support resizing multiple elements including texts (#1726)
Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-06-08 11:25:20 +02:00
ebb1341bbd Bump @testing-library/react from 10.0.4 to 10.2.1 (#1732)
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-06-08 12:19:55 +03:00
5a5f9aed0d Bump typescript from 3.9.3 to 3.9.5 (#1733)
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-06-08 12:19:47 +03:00
bec8e55c42 Bump browser-nativefs from 0.7.3 to 0.8.1 (#1734)
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-06-08 12:19:39 +03:00
1df43d0f9f Bump lint-staged from 10.2.7 to 10.2.9 (#1735)
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-06-08 12:19:29 +03:00
d171e9705d Fix RTL text direction rendering (reopened) (#1722)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-06-07 11:55:08 +02:00
f7c4efbd35 Excalicharts MVP (#1723)
Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-06-06 22:09:04 +02:00
d1be2a5481 fix text constructor groupIds & improve type safety (#1715) 2020-06-06 13:32:43 +02:00
4eb6c3e8a4 [Security] Bump websocket-extensions from 0.1.3 to 0.1.4 (#1719)
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-06-05 19:46:27 +03:00
476c0e9f8a Fix undo with line editing (#1717) 2020-06-05 17:11:24 +02:00
c6e73c56fd New Crowdin translations (#1703) 2020-06-05 14:07:00 +03:00
669e84b5d7 Add regression tests for context-menu (#1683) (#1697)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-06-04 22:09:16 +02:00
ff93d95998 Revert "Fix RTL text direction rendering (#1687)" (#1705)
This reverts commit a118bed82f.
2020-06-03 12:12:43 +02:00
1f375522d6 rename docker repo (#1702) 2020-06-02 20:26:16 +01:00
5ed4614a8c Adding publish-docker workflow (#1654) 2020-06-02 20:22:40 +01:00
a118bed82f Fix RTL text direction rendering (#1687)
Co-authored-by: Lipis <lipiridis@gmail.com>
2020-06-02 21:31:34 +03:00
fd75b88bd3 Double finger zoom should not select things (#1333) 2020-06-02 19:41:40 +03:00
1e9adf0a80 New Crowdin translations (#1700) 2020-06-02 15:13:30 +03:00
0190af2d76 Bump @testing-library/jest-dom from 5.8.0 to 5.9.0 (#1694)
Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 5.8.0 to 5.9.0.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v5.8.0...v5.9.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-06-02 03:23:34 +03:00
b0d3f18824 Bump pwacompat from 2.0.12 to 2.0.15 (#1693)
Bumps [pwacompat](https://github.com/GoogleChrome/pwacompat) from 2.0.12 to 2.0.15.
- [Release notes](https://github.com/GoogleChrome/pwacompat/releases)
- [Commits](https://github.com/GoogleChrome/pwacompat/compare/v2.0.12...v2.0.15)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-06-02 03:23:21 +03:00
b74fa0dcf0 Bump lint-staged from 10.2.6 to 10.2.7 (#1695)
Bumps [lint-staged](https://github.com/okonet/lint-staged) from 10.2.6 to 10.2.7.
- [Release notes](https://github.com/okonet/lint-staged/releases)
- [Commits](https://github.com/okonet/lint-staged/compare/v10.2.6...v10.2.7)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-06-02 03:22:56 +03:00
3f31a6ce89 New Crowdin translations (#1696) 2020-06-02 02:42:37 +03:00
d3d9994c74 New Crowdin translations (#1690)
* New translations en.json (Persian)

* New translations en.json (Persian)

* New translations en.json (Persian)

* New translations en.json (French)

* New translations en.json (Portuguese)

* New translations en.json (Persian)

* New translations en.json (Albanian)

* New translations en.json (Catalan)

* New translations en.json (Hebrew)

* New translations en.json (Hindi)

* New translations en.json (Indonesian)

* New translations en.json (Chinese Traditional)

* New translations en.json (Chinese Simplified)

* New translations en.json (Turkish)

* New translations en.json (Russian)

* New translations en.json (Polish)

* New translations en.json (Spanish)

* New translations en.json (Norwegian)

* New translations en.json (Dutch)

* New translations en.json (Korean)

* New translations en.json (Japanese)

* New translations en.json (Italian)

* New translations en.json (Hungarian)

* New translations en.json (Finnish)

* New translations en.json (Greek)

* New translations en.json (German)

* New translations en.json (Bulgarian)

* New translations en.json (Arabic)

* New translations en.json (Ukrainian)

* New translations en.json (French)
2020-06-01 07:00:35 -04:00
14a66956d7 Implement line editing (#1616)
* implement line editing

* line editing with rotation

* ensure adding new points is disabled on point dragging

* fix hotkey replacement

* don't paint bounding box when creating new multipoint

* tweak points style, account for zoom and z-index

* don't persist editingLinearElement to localStorage

* don't mutate on noop points updates

* account for rotation when adding new point

* ensure clicking on points doesn't deselect element

* tweak history handling around editingline element

* update snapshots

* refactor pointerMove handling

* factor out point dragging

* factor out pointerDown

* improve positioning with rotation

* revert to use roughjs for calculating points bounds

* migrate from storing editingLinearElement.element to id

* make GlobalScene.getElement into O(1)

* use Alt for adding new points

* fix adding and deleting a point with rotation

* disable resize handlers & bounding box on line edit

Co-authored-by: daishi <daishi@axlight.com>
2020-06-01 11:35:44 +02:00
db316f32e0 New Crowdin translations (#1659) 2020-05-31 17:35:34 +03:00
9151da772c feat: hide the UI elements when printing the page (#1680) 2020-05-30 13:51:28 -07:00
f413bab3de Fix group element removing (#1676) 2020-05-30 13:48:57 -07:00
17e9cc4506 Some cleanup in App.tsx (#1681) 2020-05-30 15:26:17 +02:00
fa359034c5 scroll the closest element to center (#1670)
Co-authored-by: Sanghyeon Lee <yongdamsh@gmail.com>
2020-05-30 14:02:32 +02:00
0db7ac78c4 fix fontFamily state updating (#1679) 2020-05-29 21:59:39 +02:00
44a88d2d58 Rewrite restore to guard against missing migrations (#1664) 2020-05-28 02:41:34 -07:00
56f8bc092d Tests for groups, more test utils (#1669) 2020-05-28 10:56:18 +02:00
4f3bf79708 skip element mutation on noop updates (#1667) 2020-05-28 00:50:56 -07:00
7edcea9a93 feat: resize text element (#1650)
* feat: resize text element

* ignore small font size change that leads jankiness

Co-authored-by: dwelle <luzar.david@gmail.com>
2020-05-28 07:17:15 +09:00
5327e8a3dc fix language change not rerendering ui (#1638) 2020-05-27 16:46:11 +02:00
5b75925928 Bump i18next-browser-languagedetector from 4.1.1 to 4.2.0 (#1646)
Bumps [i18next-browser-languagedetector](https://github.com/i18next/i18next-browser-languageDetector) from 4.1.1 to 4.2.0.
- [Release notes](https://github.com/i18next/i18next-browser-languageDetector/releases)
- [Changelog](https://github.com/i18next/i18next-browser-languageDetector/blob/master/CHANGELOG.md)
- [Commits](https://github.com/i18next/i18next-browser-languageDetector/compare/v4.1.1...v4.2.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-27 16:34:33 +03:00
ce8d88a486 Bump @testing-library/jest-dom from 5.7.0 to 5.8.0 (#1647)
Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 5.7.0 to 5.8.0.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v5.7.0...v5.8.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-27 16:34:19 +03:00
63c10743fb split font into fontSize and fontFamily (#1635) 2020-05-27 15:14:50 +02:00
46b574283f Fix zindex in groups (#1660) 2020-05-26 22:56:22 +02:00
61e5b66dac Group/ungroup (#1648)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-05-26 13:07:46 -07:00
5252726307 dynamically import socket.io-client when needed (#1631) 2020-05-26 20:51:03 +02:00
5a64447adc Bump @types/jest from 25.2.2 to 25.2.3 (#1644)
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-26 17:24:35 +03:00
f1afeda62c Bump lint-staged from 10.2.2 to 10.2.6 (#1645)
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-26 17:24:22 +03:00
1a1cbb345b New Crowdin translations (#1617) 2020-05-26 17:24:01 +03:00
2867af6528 Update OT trial token (#1649) 2020-05-25 16:10:08 +02:00
35049e3de7 History tweaks (#1641)
Co-authored-by: Pete Hunt <phunt@twitter.com>
2020-05-24 15:17:14 -07:00
d315e3dc4d Update TypeScript to 3.9.3 (#1640)
Co-authored-by: tk338g <tkhazamov@wayfair.com>
2020-05-24 21:17:25 +02:00
6512ede9ca Optimize undo history (#1632)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-05-23 12:07:11 -07:00
51608c07b0 15-degree rotation locking (#1627) 2020-05-23 10:45:05 +02:00
d2ae18995c add history.shouldCreateEntry resolver (#1622) 2020-05-22 22:26:59 -07:00
22f7945c70 fix typescript link (#1630) 2020-05-22 21:58:44 +02:00
ce6f2ff88c cache nonDeleted elements (#1626) 2020-05-22 10:15:16 -07:00
fb897c75a7 docker build : install devDependencies so the build succeed (#1625) 2020-05-22 10:37:17 +02:00
584e4182a7 Ensure arrows are not draggable from inside (#1620) 2020-05-21 21:57:54 +02:00
c427aa3cce Prefer arrow functions and callbacks (#1210) 2020-05-20 15:21:37 +02:00
33fe223b5d Typo fix in desc_exitSession en.json (#1619) 2020-05-19 19:33:37 +02:00
8de47ed36b Bump @types/socket.io-client from 1.4.32 to 1.4.33 (#1612)
Bumps [@types/socket.io-client](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/socket.io-client) from 1.4.32 to 1.4.33.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/socket.io-client)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-19 18:09:20 +03:00
cc3abfc6ff Bump @types/jest from 25.2.1 to 25.2.2 (#1613)
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 25.2.1 to 25.2.2.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-19 18:09:10 +03:00
4d2e8f9ad1 feat: resize multiple elements including two-point lines (#1607) 2020-05-18 10:36:30 +02:00
6b628bb1a6 fix: resize non solid lines/arrows/draws (#1608) 2020-05-17 16:01:35 +02:00
7f35b805d1 Add Catalan translation (#1566) 2020-05-16 18:45:56 +03:00
755cd9c320 New Crowdin translations (#1567)
* New translations en.json (Greek)

* New translations en.json (Norwegian)

* New translations en.json (Russian)

* New translations en.json (Russian)

* New translations en.json (Russian)

* New translations en.json (Catalan)

* New translations en.json (French)

* New translations en.json (French)

* New translations en.json (French)

* New translations en.json (Norwegian)

* New translations en.json (Hebrew)

* New translations en.json (Hindi)

* New translations en.json (Indonesian)

* New translations en.json (Chinese Traditional)

* New translations en.json (Chinese Simplified)

* New translations en.json (Turkish)

* New translations en.json (Russian)

* New translations en.json (Portuguese)

* New translations en.json (Polish)

* New translations en.json (Dutch)

* New translations en.json (Spanish)

* New translations en.json (Korean)

* New translations en.json (Japanese)

* New translations en.json (Italian)

* New translations en.json (Hungarian)

* New translations en.json (Finnish)

* New translations en.json (Greek)

* New translations en.json (German)

* New translations en.json (Bulgarian)

* New translations en.json (Arabic)

* New translations en.json (Catalan)

* New translations en.json (Spanish)

* New translations en.json (Portuguese)

* New translations en.json (Norwegian)

* New translations en.json (Finnish)

* New translations en.json (German)

* New translations en.json (German)

* New translations en.json (German)

* New translations en.json (French)

* New translations en.json (French)

* New translations en.json (French)

* New translations en.json (Norwegian)

* New translations en.json (Hebrew)

* New translations en.json (Hindi)

* New translations en.json (Indonesian)

* New translations en.json (Chinese Traditional)

* New translations en.json (Chinese Simplified)

* New translations en.json (Turkish)

* New translations en.json (Russian)

* New translations en.json (Portuguese)

* New translations en.json (Polish)

* New translations en.json (Dutch)

* New translations en.json (Spanish)

* New translations en.json (Korean)

* New translations en.json (Japanese)

* New translations en.json (Italian)

* New translations en.json (Hungarian)

* New translations en.json (Finnish)

* New translations en.json (Greek)

* New translations en.json (German)

* New translations en.json (Bulgarian)

* New translations en.json (Arabic)

* New translations en.json (Catalan)

* New translations en.json (French)

* New translations en.json (Spanish)

* New translations en.json (Greek)

* New translations en.json (French)

* New translations en.json (Norwegian)

* New translations en.json (Hebrew)

* New translations en.json (Chinese Traditional)

* New translations en.json (Chinese Simplified)

* New translations en.json (Turkish)

* New translations en.json (Russian)

* New translations en.json (Portuguese)

* New translations en.json (Polish)

* New translations en.json (Dutch)

* New translations en.json (Spanish)

* New translations en.json (Korean)

* New translations en.json (Japanese)

* New translations en.json (Italian)

* New translations en.json (Hungarian)

* New translations en.json (Finnish)

* New translations en.json (Greek)

* New translations en.json (German)

* New translations en.json (Bulgarian)

* New translations en.json (Arabic)

* New translations en.json (Spanish)

* New translations en.json (Finnish)

* New translations en.json (German)

* New translations en.json (German)

* New translations en.json (Catalan)

* New translations en.json (Catalan)

* New translations en.json (Spanish)

* New translations en.json (Catalan)

* New translations en.json (Catalan)

* New translations en.json (Catalan)

* New translations en.json (Catalan)

* New translations en.json (French)

* New translations en.json (Italian)

* New translations en.json (Portuguese)

* New translations en.json (Italian)
2020-05-16 18:45:09 +03:00
afbfe2b8b1 Alt should be labeled as Option on Mac (#1602) 2020-05-14 16:51:52 -07:00
9bd72f91fc fixed typo: loose ==> lose (#1601) 2020-05-14 21:16:39 +02:00
876170ee27 fix snapshots (#1598) 2020-05-14 17:21:37 +02:00
39c56a4c01 implement stroke style (#1571) 2020-05-14 17:04:33 +02:00
f6be200388 feat: resize multiple curved lines (#1596) 2020-05-14 16:56:14 +02:00
828c9c4d65 use commitToHistory prop for handling draw history (#1595) 2020-05-14 14:51:33 +02:00
d9b8dcfbb4 Remove no longer needed Native File System API v1 origin trial token (#1592) 2020-05-14 14:44:23 +02:00
c32640d174 Fix free draw to allow undo (#1594) 2020-05-14 13:32:10 +01:00
331 changed files with 72060 additions and 29855 deletions

View File

@ -2,6 +2,9 @@
!public/
!src/
!.npmrc
!.eslintrc.json
!.prettierrc
!package-lock.json
!package.json
!tsconfig.json
!.env

5
.env Normal file
View File

@ -0,0 +1,5 @@
REACT_APP_BACKEND_V1_GET_URL=https://json.excalidraw.com/api/v1/
REACT_APP_BACKEND_V2_GET_URL=https://json.excalidraw.com/api/v2/
REACT_APP_BACKEND_V2_POST_URL=https://json.excalidraw.com/api/v2/post/
REACT_APP_SOCKET_SERVER_URL=https://portal.excalidraw.com
REACT_APP_FIREBASE_CONFIG='{"apiKey":"AIzaSyAd15pYlMci_xIp9ko6wkEsDzAAA0Dn0RU","authDomain":"excalidraw-room-persistence.firebaseapp.com","databaseURL":"https://excalidraw-room-persistence.firebaseio.com","projectId":"excalidraw-room-persistence","storageBucket":"excalidraw-room-persistence.appspot.com","messagingSenderId":"654800341332","appId":"1:654800341332:web:4a692de832b55bd57ce0c1"}'

1
.env.production Normal file
View File

@ -0,0 +1 @@
REACT_APP_GOOGLE_ANALYTICS_ID=UA-387204-13

View File

@ -3,3 +3,4 @@ build/
package-lock.json
.vscode/
firebase/
dist/

View File

@ -2,7 +2,10 @@
"extends": ["prettier", "react-app"],
"plugins": ["prettier"],
"rules": {
"@typescript-eslint/no-unused-vars": "warn",
"curly": "warn",
"dot-notation": "warn",
"import/no-anonymous-default-export": "off",
"no-console": [
"warn",
{
@ -10,7 +13,21 @@
}
],
"no-else-return": "warn",
"no-lonely-if": "warn",
"no-restricted-syntax": [
"warn",
{
"message": "Use 't(...)' instead of literal text in JSX",
"selector": "JSXText[value=/\\w/]"
}
],
"no-unneeded-ternary": "warn",
"no-unused-expressions": "warn",
"no-useless-return": "warn",
"no-var": "warn",
"object-shorthand": "warn",
"one-var": ["warn", "never"],
"prefer-arrow-callback": "warn",
"prefer-const": [
"warn",
{
@ -18,13 +35,6 @@
}
],
"prefer-template": "warn",
"prettier/prettier": "warn",
"no-restricted-syntax": [
"warn",
{
"selector": "JSXText[value=/\\w/]",
"message": "Use 't(...)' instead of literal text in JSX"
}
]
"prettier/prettier": "warn"
}
}

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
* text=auto eol=lf

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 20 KiB

37
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,37 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: weekly
day: sunday
time: "01:00"
open-pull-requests-limit: 99
reviewers:
- lipis
assignees:
- lipis
- package-ecosystem: npm
directory: "/src/packages/excalidraw/"
schedule:
interval: weekly
day: sunday
time: "01:00"
open-pull-requests-limit: 99
reviewers:
- ad1992
assignees:
- ad1992
- package-ecosystem: npm
directory: "/src/packages/utils/"
schedule:
interval: weekly
day: sunday
time: "01:00"
open-pull-requests-limit: 99
reviewers:
- ad1992
assignees:
- ad1992

14
.github/workflows/build-docker.yml vendored Normal file
View File

@ -0,0 +1,14 @@
name: Build Docker image
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: docker build -t excalidraw .

33
.github/workflows/build-packages.yml vendored Normal file
View File

@ -0,0 +1,33 @@
name: Build packages
on:
push:
branches:
- master
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Install dependencies
run: |
npm ci
npm ci --prefix src/packages/excalidraw
npm ci --prefix src/packages/utils
- name: Build @excalidraw/excalidraw
run: |
npm run pack --prefix src/packages/excalidraw
- name: Build @excalidraw/utils
run: |
npm run pack --prefix src/packages/utils

18
.github/workflows/cancel.yml vendored Normal file
View File

@ -0,0 +1,18 @@
name: Cancel previous runs
on:
push:
branches:
- master
pull_request:
jobs:
cancel:
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- uses: styfle/cancel-workflow-action@0.6.0
with:
workflow_id: 400555, 400556, 905313, 1451724, 1710116, 3185001, 3438604
access_token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,10 +1,6 @@
name: Lint
on:
push:
branches:
- master
pull_request:
on: pull_request
jobs:
lint:
@ -13,10 +9,10 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: Setup Node.js 12.x
- name: Setup Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 14.x
- name: Install and lint
run: |
@ -24,5 +20,3 @@ jobs:
npm run test:other
npm run test:code
npm run test:typecheck
env:
CI: true

47
.github/workflows/locales-coverage.yml vendored Normal file
View File

@ -0,0 +1,47 @@
name: Build locales coverage
on:
push:
branches:
- "l10n_master"
jobs:
locales:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.PUSH_TRANSLATIONS_COVERAGE_PAT }}
- name: Setup Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Create report file
run: |
npm run locales-coverage
FILE_CHANGED=$(git diff src/locales/percentages.json)
if [ ! -z "${FILE_CHANGED}" ]; then
git config --global user.name 'Excalidraw Bot'
git config --global user.email 'bot@excalidraw.com'
git add src/locales/percentages.json
git commit -am "Auto commit: Calculate translation coverage"
git push
fi
- name: Construct comment body
id: getCommentBody
run: |
body=$(npm run locales-coverage:description | grep '^[^>]')
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo ::set-output name=body::$body
- name: Update description with coverage
uses: kt3k/update-pr-description@v1.0.1
with:
pr_body: ${{ steps.getCommentBody.outputs.body }}
pr_title: "chore: Update translations from Crowdin"
github_token: ${{ secrets.PUSH_TRANSLATIONS_COVERAGE_PAT }}

20
.github/workflows/publish-docker.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: Publish Docker
on:
push:
branches:
- master
jobs:
publish-docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: excalidraw/excalidraw
tag_with_ref: true
tag_with_sha: true

17
.github/workflows/semantic-pr-title.yml vendored Normal file
View File

@ -0,0 +1,17 @@
name: "Semantic PR title"
on:
pull_request_target:
types:
- opened
- edited
- synchronize
jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v3.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -8,13 +8,14 @@ on:
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1.0.0
- name: Setup Node.js 12.x
- name: Setup Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 14.x
- name: Install and build
run: |

View File

@ -1,10 +1,6 @@
name: Tests
on:
push:
branches:
- master
pull_request:
on: pull_request
jobs:
test:
@ -13,14 +9,12 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: Setup Node.js 12.x
- name: Setup Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 14.x
- name: Install and test
run: |
npm ci
npm run test:app
env:
CI: true

15
.gitignore vendored
View File

@ -1,10 +1,18 @@
*.log
.DS_Store
.env.development.local
.env.local
.env.production.local
.env.test.local
.envrc
.now
.eslintcache
.idea
.vercel
.vscode
*.log
*.tgz
build
firebase/
dist
firebase
logs
node_modules
npm-debug.log*
@ -12,4 +20,3 @@ static
yarn-debug.log*
yarn-error.log*
yarn.lock
.idea

View File

@ -1,7 +1,7 @@
const { CLIEngine } = require("eslint");
// see https://github.com/okonet/lint-staged#how-can-i-ignore-files-from-eslintignore-
// for explanation
// for explanation
const cli = new CLIEngine({});
module.exports = {

0
.prettierignore Normal file
View File

View File

@ -1,3 +1,4 @@
{
"proseWrap": "never",
"trailingComma": "all"
}

3
CHANGELOG.md Normal file
View File

@ -0,0 +1,3 @@
## 2020-10-13
- Added ability to embed scene source into exported PNG/SVG files so you can import the scene from them (open via `Load` button or drag & drop). #2219

View File

@ -8,8 +8,7 @@
1. Run `npm install` to install dependencies
1. Create a branch for your PR with `git checkout -b your-branch-name`
> To keep `master` branch pointing to remote repository and make
> pull requests from branches on your fork. To do this, run:
> To keep `master` branch pointing to remote repository and make pull requests from branches on your fork. To do this, run:
>
> ```sh
> git remote add upstream https://github.com/excalidraw/excalidraw.git
@ -20,8 +19,45 @@
### Option 2 - CodeSandbox
1. Go to https://codesandbox.io/s/github/excalidraw/excalidraw
1. Connect your Github account
1. Connect your GitHub account
1. Go to Git tab on left side
1. Tap on `Fork Sandbox`
1. Write your code
1. Commit and PR automatically
## Pull Request Guidelines
Don't worry if you get any of the below wrong, or if you don't know how. We'll gladly help out.
### Title
Make sure the title starts with a semantic prefix:
- **feat**: A new feature
- **fix**: A bug fix
- **docs**: Documentation only changes
- **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
- **refactor**: A code change that neither fixes a bug nor adds a feature
- **perf**: A code change that improves performance
- **test**: Adding missing tests or correcting existing tests
- **build**: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
- **ci**: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
- **chore**: Other changes that don't modify src or test files
- **revert**: Reverts a previous commit
### Changelog
Add a brief description of your pull request to the changelog located here: [`src/packages/excalidraw/CHANGELOG.md`](src/packages/excalidraw/CHANGELOG.md)
Notes:
- Make sure to prepend to the section corresponding with the semantic prefix you selected in the title
- Link to your pull request - this will require updating the CHANGELOG _after_ creating the pull request
### Testing
Once you submit your pull request it will automatically be tested. Be sure to check the results of the test and fix any issues that arise.
It's also a good idea to consider if your change should include additional tests. This is highly recommended for new features or bug-fixes. For example, it's good practice to create a test for each bug you fix which ensures that we don't regress the code in the future.
Finally - always manually test your changes using the convenient staging environment deployed for each pull request. As much as local development attempts to replicate production, there can still be subtle differences in behavior. For larger features consider testing your change in multiple browsers as well.

View File

@ -1,16 +1,17 @@
FROM node:14-alpine AS build
ENV NODE_ENV=production
WORKDIR /usr/src/app
WORKDIR /opt/node_app
COPY package.json package-lock.json ./
RUN npm install
RUN npm i --no-optional
ARG NODE_ENV=production
COPY . .
RUN npm run build:app
RUN npm run build:app:docker
FROM nginx:1.17-alpine
COPY --from=build /usr/src/app/build /usr/share/nginx/html
COPY --from=build /opt/node_app/build /usr/share/nginx/html
HEALTHCHECK CMD wget -q -O /dev/null http://localhost || exit 1

135
README.md
View File

@ -1,30 +1,85 @@
<div align="center" style="display:flex;flex-direction:column;">
<a href="https://excalidraw.com">
<img src="./public/og-image.png" alt="Excalidraw logo: Sketch handrawn like diagrams." />
<img width="540" src="./public/og-image-sm.png" alt="Excalidraw logo: Sketch handrawn like diagrams." />
</a>
<h3>Excalidraw is a whiteboard tool that lets you easily sketch diagrams with a hand-drawn feel.</h3>
<h3>Virtual whiteboard for sketching hand-drawn like diagrams.<br>Collaborative and end-to-end encrypted.</h3>
<p>
<a href="https://twitter.com/Excalidraw">
<img alt="Follow Excalidraw on Twitter" src="https://img.shields.io/twitter/follow/excalidraw.svg?label=follow+excalidraw&style=social&logo=twitter">
</a>
<a title="Crowdin" target="_blank" href="https://crowdin.com/project/excalidraw">
<a target="_blank" href="https://crowdin.com/project/excalidraw">
<img src="https://badges.crowdin.net/excalidraw/localized.svg">
</a>
</p>
<p>Ask questions or hang out on our <a target="_blank" href="https://discord.gg/UexuTaE">discord.gg/UexuTaE</a>.</p>
</div>
## Try it now
Go to https://excalidraw.com to start sketching.
Go to [excalidraw.com](https://excalidraw.com) to start sketching.
Read our [blog](https://blog.excalidraw.com) and follow the [guides](https://howto.excalidraw.com) to learn more about Excalidraw and how to use it effectively.
Read the latest news and updates on our [blog](https://blog.excalidraw.com). A good start is to see all the updates of [One Year of Excalidraw](https://blog.excalidraw.com/one-year-of-excalidraw/).
## Run the code
## Supporting Excalidraw
If you like the project, you can become a sponsor at [Open Collective](https://opencollective.com/excalidraw).
[<img src="https://opencollective.com/excalidraw/tiers/sponsors/0/avatar.svg?avatarHeight=120">](https://opencollective.com/excalidraw/tiers/sponsors/0/website) [<img src="https://opencollective.com/excalidraw/tiers/sponsors/1/avatar.svg?avatarHeight=120">](https://opencollective.com/excalidraw/tiers/sponsors/1/website) [<img src="https://opencollective.com/excalidraw/tiers/sponsors/2/avatar.svg?avatarHeight=120">](https://opencollective.com/excalidraw/tiers/sponsors/2/website) [<img src="https://opencollective.com/excalidraw/tiers/sponsors/3/avatar.svg?avatarHeight=120">](https://opencollective.com/excalidraw/tiers/sponsors/3/website) [<img src="https://opencollective.com/excalidraw/tiers/sponsors/4/avatar.svg?avatarHeight=120">](https://opencollective.com/excalidraw/tiers/sponsors/4/website) [<img src="https://opencollective.com/excalidraw/tiers/sponsors/5/avatar.svg?avatarHeight=120">](https://opencollective.com/excalidraw/tiers/sponsors/5/website) [<img src="https://opencollective.com/excalidraw/tiers/sponsors/6/avatar.svg?avatarHeight=120">](https://opencollective.com/excalidraw/tiers/sponsors/6/website) [<img src="https://opencollective.com/excalidraw/tiers/sponsors/7/avatar.svg?avatarHeight=120">](https://opencollective.com/excalidraw/tiers/sponsors/7/website) [<img src="https://opencollective.com/excalidraw/tiers/sponsors/8/avatar.svg?avatarHeight=120">](https://opencollective.com/excalidraw/tiers/sponsors/8/website) [<img src="https://opencollective.com/excalidraw/tiers/sponsors/9/avatar.svg?avatarHeight=120">](https://opencollective.com/excalidraw/tiers/sponsors/9/website) [<img src="https://opencollective.com/excalidraw/tiers/sponsors/10/avatar.svg?avatarHeight=120">](https://opencollective.com/excalidraw/tiers/sponsors/10/website)
<a href="https://opencollective.com/excalidraw#category-CONTRIBUTE" target="_blank"><img src="https://opencollective.com/excalidraw/tiers/backers.svg?avatarHeight=32"/></a>
## Documentation
### Shortcuts
You can almost do anything with shortcuts. Click on the help icon on the bottom right corner to see them all.
### Curved lines and arrows
Choose line or arrow and click click click instead of drag.
### Charts
You can easily create charts by copy pasting data from Excel or just plain comma separated text.
### Translating
To translate Excalidraw into other languages, please visit [our Crowdin page](https://crowdin.com/project/excalidraw). To add a new language, [open an issue](https://github.com/excalidraw/excalidraw/issues/new) so we can get things set up on our end first.
Translations will be available on the app if they exceed a certain threshold of completion (currently 85%).
### Create a collaboration session manually
In order to create a session manually, you just need to generate a link of this form:
```
https://excalidraw.com/#room=[0-9a-f]{20},[a-zA-Z0-9_-]{22}
```
#### Example
```
https://excalidraw.com/#room=91bd46ae3aa84dff9d20,pfLqgEoY1c2ioq8LmGwsFA
```
The first set of digits is the room. This is visible from the server thats going to dispatch messages to everyone that knows this number.
The second set of digits is the encryption key. The Excalidraw server doesnt know about it. This is what all the participants use to encrypt/decrypt the messages.
## Shape libraries
Find a growing list of libraries containing assets for your drawings at [libraries.excalidraw.com](https://libraries.excalidraw.com).
## Embedding Excalidraw in your App?
Try out [`@excalidraw/excalidraw`](https://www.npmjs.com/package/@excalidraw/excalidraw). This package allows you to easily embed Excalidraw as a React component into your apps.
## Development
### Code Sandbox
- Go to https://codesandbox.io/s/github/excalidraw/excalidraw
- You may need to sign in with Github and reload the page
- You may need to sign in with GitHub and reload the page
- You can start coding instantly, and even send PRs from there!
### Local Installation
@ -48,78 +103,38 @@ git clone https://github.com/excalidraw/excalidraw.git
| `npm run test:update` | Update test snapshots |
| `npm run test:code` | Test for formatting with Prettier |
### Docker Installation
A production-ready version for deploying to e.g. Kubernetes or OpenShift can be built using Docker.
#### Docker Compose
You can use docker-compose to work on Excalidraw locally if you don't want to setup a Node.js env.
```sh
docker-compose up --build -d
```
#### Native Docker
### Self-hosting
We publish a Docker image with the Excalidraw client at [excalidraw/excalidraw](https://hub.docker.com/r/excalidraw/excalidraw). You can use it to self-host your own client under your own domain, on Kubernetes, AWS ECS, etc.
```sh
docker build -t excalidraw/excalidraw .
docker run --rm -dit --name excalidraw -p 5000:80 excalidraw/excalidraw:latest
```
After building the image and running the container, open <http://localhost:5000> to see the application.
The Docker image is free of analytics and other tracking libraries.
**At the moment, self-hosting your own instance doesn't support sharing or collaboration features.**
We are working towards providing a full-fledged solution for self-hosting your own Excalidraw.
## Contributing
Pull requests are welcome. For major changes, please [open an issue](https://github.com/excalidraw/excalidraw/issues/new) first to discuss what you would like to change.
## Translating
## Notable used tools
To translate Excalidraw into other languages, please visit [our Crowdin page](https://crowdin.com/project/excalidraw). To add a new language, [open an issue](https://github.com/excalidraw/excalidraw/issues/new) so we can get things set up on our end first.
## Excalidraw is built using these awesome tools
- [React](https://reactjs.org)
- [Create React App](https://github.com/facebook/create-react-app)
- [Rough.js](https://roughjs.com)
- [TypeScript](https://typescriptlang.org)
- [TypeScript](https://www.typescriptlang.org)
- [Vercel](https://vercel.com)
And the main source of inspiration for starting the project is the awesome [Zwibbler](https://zwibbler.com/demo/) app.
## Testimonials
<a href="https://twitter.com/Lissy_Sykes/status/1213813117177729026"><img width="398" src="https://user-images.githubusercontent.com/197597/71783813-dbf8a600-2fa0-11ea-9c0d-bb3cc45969e6.png"></a>
<a href="https://twitter.com/dan_abramov/status/1213762494428262400"><img width="398" src="https://user-images.githubusercontent.com/197597/71783990-4d395880-2fa3-11ea-9ad7-186138db5003.png"></a>
<a href="https://twitter.com/kyehohenberger/status/1214288572037025792"><img width="423" src="https://user-images.githubusercontent.com/197597/71851802-34f13880-308c-11ea-9416-191099e6349c.png"></a>
<a href="https://twitter.com/lucasazzola/status/1215126440330416128"><img width="429" src="https://user-images.githubusercontent.com/197597/72039003-48e99580-3258-11ea-8daa-85dd055f2a82.png">
<a href="https://twitter.com/jordwalke/status/1214858186789806080"><img width="434" src="https://user-images.githubusercontent.com/197597/72036874-07a1b780-3251-11ea-99e8-6bafd93483a0.png"></a>
## Contributors
### Code Contributors
This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
<a href="https://github.com/excalidraw/excalidraw/graphs/contributors"><img src="https://opencollective.com/excalidraw/contributors.svg?width=890&button=false" /></a>
### Financial Contributors
Become a financial contributor and help us sustain our community. [[Contribute](https://opencollective.com/excalidraw/contribute)]
#### Individuals
<a href="https://opencollective.com/excalidraw"><img src="https://opencollective.com/excalidraw/individuals.svg?width=890"></a>
#### Organizations
Support this project with your organization. Your logo will show up here with a link to your website. [[Contribute](https://opencollective.com/excalidraw/contribute)]
<a href="https://opencollective.com/excalidraw/organization/0/website"><img src="https://opencollective.com/excalidraw/organization/0/avatar.svg"></a>
<a href="https://opencollective.com/excalidraw/organization/1/website"><img src="https://opencollective.com/excalidraw/organization/1/avatar.svg"></a>
<a href="https://opencollective.com/excalidraw/organization/2/website"><img src="https://opencollective.com/excalidraw/organization/2/avatar.svg"></a>
<a href="https://opencollective.com/excalidraw/organization/3/website"><img src="https://opencollective.com/excalidraw/organization/3/avatar.svg"></a>
<a href="https://opencollective.com/excalidraw/organization/4/website"><img src="https://opencollective.com/excalidraw/organization/4/avatar.svg"></a>
<a href="https://opencollective.com/excalidraw/organization/5/website"><img src="https://opencollective.com/excalidraw/organization/5/avatar.svg"></a>
<a href="https://opencollective.com/excalidraw/organization/6/website"><img src="https://opencollective.com/excalidraw/organization/6/avatar.svg"></a>
<a href="https://opencollective.com/excalidraw/organization/7/website"><img src="https://opencollective.com/excalidraw/organization/7/avatar.svg"></a>
<a href="https://opencollective.com/excalidraw/organization/8/website"><img src="https://opencollective.com/excalidraw/organization/8/avatar.svg"></a>
<a href="https://opencollective.com/excalidraw/organization/9/website"><img src="https://opencollective.com/excalidraw/organization/9/avatar.svg"></a>

View File

@ -1,9 +1,25 @@
version: "3"
version: "3.8"
services:
excalidraw:
build: .
build:
context: .
args:
- NODE_ENV=development
container_name: excalidraw
ports:
- "5000:80"
- "3000:80"
restart: on-failure
stdin_open: true
healthcheck:
disable: true
environment:
- NODE_ENV=development
volumes:
- ./:/opt/node_app/app:delegated
- ./package.json:/opt/node_app/package.json
- ./package-lock.json:/opt/node_app/package-lock.json
- notused:/opt/node_app/app/node_modules
volumes:
notused:

View File

@ -0,0 +1,5 @@
{
"projects": {
"default": "excalidraw-room-persistence"
}
}

66
firebase-project/.gitignore vendored Normal file
View File

@ -0,0 +1,66 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
firebase-debug.log*
firebase-debug.*.log*
# Firebase cache
.firebase/
# Firebase config
# Uncomment this if you'd like others to create their own Firebase project.
# For a team working on the same Firebase project(s), it is recommended to leave
# it commented so all members can deploy to the same project(s) in .firebaserc.
# .firebaserc
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env

View File

@ -0,0 +1,6 @@
{
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
}
}

View File

@ -0,0 +1,4 @@
{
"indexes": [],
"fieldOverrides": []
}

View File

@ -0,0 +1,10 @@
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow get, write: if true;
// never set this to true, otherwise anyone can delete anyone else's drawing.
allow list: if false;
}
}
}

View File

@ -1,32 +0,0 @@
{
"headers": [
{
"source": "/(.*)",
"headers": [
{
"key": "Access-Control-Allow-Origin",
"value": "*"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "Feature-Policy",
"value": "*"
},
{
"key": "Referrer-Policy",
"value": "origin"
}
]
}
],
"redirects": [
{
"source": "/([^.]+)",
"destination": "/",
"statusCode": 301
}
]
}

21656
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -19,41 +19,47 @@
]
},
"dependencies": {
"@sentry/browser": "5.15.5",
"@sentry/integrations": "5.15.5",
"@testing-library/jest-dom": "5.7.0",
"@testing-library/react": "10.0.4",
"@types/jest": "25.2.1",
"@types/nanoid": "2.1.0",
"@types/react": "16.9.35",
"@types/react-dom": "16.9.8",
"@types/socket.io-client": "1.4.32",
"browser-nativefs": "0.7.3",
"i18next-browser-languagedetector": "4.1.1",
"@sentry/browser": "6.1.0",
"@sentry/integrations": "6.1.0",
"@testing-library/jest-dom": "5.11.9",
"@testing-library/react": "11.2.5",
"@types/jest": "26.0.20",
"@types/react": "17.0.2",
"@types/react-dom": "17.0.1",
"@types/socket.io-client": "1.4.35",
"browser-fs-access": "0.13.1",
"clsx": "1.1.1",
"firebase": "8.2.7",
"i18next-browser-languagedetector": "6.0.1",
"lodash.throttle": "4.1.1",
"nanoid": "2.1.11",
"nanoid": "3.1.20",
"node-sass": "4.14.1",
"open-color": "1.7.0",
"open-color": "1.8.0",
"pako": "1.0.11",
"png-chunk-text": "1.0.0",
"png-chunks-encode": "1.0.0",
"png-chunks-extract": "1.0.0",
"points-on-curve": "0.2.0",
"pwacompat": "2.0.12",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-scripts": "3.4.1",
"pwacompat": "2.0.17",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-scripts": "4.0.2",
"roughjs": "4.3.1",
"socket.io-client": "2.3.0",
"typescript": "3.8.3"
"socket.io-client": "2.3.1",
"typescript": "4.1.5"
},
"devDependencies": {
"@types/lodash.throttle": "4.1.6",
"asar": "3.0.3",
"eslint": "6.8.0",
"eslint-config-prettier": "6.11.0",
"eslint-plugin-prettier": "3.1.3",
"husky": "4.2.5",
"jest-canvas-mock": "2.2.0",
"lint-staged": "10.2.2",
"pepjs": "0.5.2",
"prettier": "2.0.5",
"@types/pako": "1.0.1",
"@types/resize-observer-browser": "0.1.5",
"eslint-config-prettier": "7.2.0",
"eslint-plugin-prettier": "3.3.1",
"firebase-tools": "9.3.0",
"husky": "4.3.8",
"jest-canvas-mock": "2.3.1",
"lint-staged": "10.5.4",
"pepjs": "0.5.3",
"prettier": "2.2.1",
"rewire": "5.0.0"
},
"engines": {
@ -67,28 +73,33 @@
},
"jest": {
"transformIgnorePatterns": [
"node_modules/(?!(roughjs|points-on-curve|path-data-parser|points-on-path|browser-nativefs)/)"
]
"node_modules/(?!(roughjs|points-on-curve|path-data-parser|points-on-path|browser-fs-access)/)"
],
"resetMocks": false
},
"name": "excalidraw",
"private": true,
"scripts": {
"build": "npm run build:app && npm run build:zip",
"build-node": "node ./scripts/build-node.js",
"build:app": "REACT_APP_GIT_SHA=$NOW_GITHUB_COMMIT_SHA react-scripts build",
"build:zip": "node ./scripts/build-version.js",
"build:app:docker": "REACT_APP_DISABLE_SENTRY=true react-scripts build",
"build:app": "REACT_APP_GIT_SHA=$VERCEL_GIT_COMMIT_SHA react-scripts build",
"build:version": "node ./scripts/build-version.js",
"build": "npm run build:app && npm run build:version",
"eject": "react-scripts eject",
"fix": "npm run fix:other && npm run fix:code",
"fix:code": "npm run test:code -- --fix",
"fix:other": "npm run prettier -- --write",
"fix": "npm run fix:other && npm run fix:code",
"locales-coverage": "node scripts/build-locales-coverage.js",
"locales-coverage:description": "node scripts/locales-coverage-description.js",
"prettier": "prettier \"**/*.{css,scss,json,md,html,yml}\" --ignore-path=.eslintignore",
"start": "react-scripts start",
"test": "npm run test:app",
"test:all": "npm run test:typecheck && npm run test:code && npm run test:other && npm run test:app -- --watchAll=false",
"test:update": "npm run test:app -- --updateSnapshot --watchAll=false",
"test:app": "react-scripts test --env=jsdom --passWithNoTests",
"test:app": "react-scripts test --passWithNoTests",
"test:code": "eslint --max-warnings=0 --ignore-path .gitignore --ext .js,.ts,.tsx .",
"test:debug": "react-scripts --inspect-brk test --runInBand --no-cache",
"test:other": "npm run prettier -- --list-different",
"test:typecheck": "tsc"
"test:typecheck": "tsc",
"test:update": "npm run test:app -- --updateSnapshot --watchAll=false",
"test": "npm run test:app"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -13,18 +13,6 @@
<meta name="theme-color" content="#000" />
<!-- Origin Trial token for the Native File System API v1 https://developers.chrome.com/origintrials/#/view_trial/3868592079911256065 (Chrome 7881) -->
<meta
http-equiv="origin-trial"
content="AoGjY+6r8OQZ5c0AXpK+bbca0pJdCTSHWFqSFNulxiW4OwFBB63kHdDHNo433GeuEOir8IvSovR0LOZLfPnEDAUAAABceyJvcmlnaW4iOiJodHRwczovL3d3dy5leGNhbGlkcmF3LmNvbTo0NDMiLCJmZWF0dXJlIjoiTmF0aXZlRmlsZVN5c3RlbSIsImV4cGlyeSI6MTU4OTMyNzk5OX0="
/>
<!-- Origin Trial token for the Native File System API v2 https://developers.chrome.com/origintrials/#/view_trial/4019462667428167681 (Chrome 8385) -->
<meta
http-equiv="origin-trial"
content="AgMee3sqSZkE0QaZP8f/F9OJj5iSLdnNMRGttIDlOQy552MI4GoL41jyCAHOYsQ8UWM1kPdrb6PVmbSllX/JqwEAAABZeyJvcmlnaW4iOiJodHRwczovL2V4Y2FsaWRyYXcuY29tOjQ0MyIsImZlYXR1cmUiOiJOYXRpdmVGaWxlU3lzdGVtMiIsImV4cGlyeSI6MTU5MDU3MzM5MX0="
/>
<!-- General tags -->
<meta
name="description"
@ -66,7 +54,10 @@
<!-- OG tags require absolute url for images -->
<meta name="twitter:image" content="https://excalidraw.com/og-image.png" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="fonts.css" type="text/css" />
<!-- Excalidraw version -->
<meta name="version" content="{version}" />
<link
rel="preload"
href="FG_Virgil.woff2"
@ -83,7 +74,7 @@
/>
<link
href="https://excalidraw-socket.herokuapp.com/socket.io"
href="%REACT_APP_SOCKET_SERVER_URL%/socket.io"
rel="preconnect"
crossorigin="anonymous"
/>
@ -91,12 +82,51 @@
<link
rel="manifest"
href="manifest.json"
style="--pwacompat-splash-font: 24px Virgil;"
style="--pwacompat-splash-font: 24px Virgil"
/>
<link rel="stylesheet" href="fonts.css" type="text/css" />
<% if (process.env.REACT_APP_GOOGLE_ANALYTICS_ID) { %>
<script
async
src="https://www.googletagmanager.com/gtag/js?id=%REACT_APP_GOOGLE_ANALYTICS_ID%"
></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag("js", new Date());
gtag("config", "%REACT_APP_GOOGLE_ANALYTICS_ID%");
</script>
<% } %>
<!-- FIXME: remove this when we update CRA (fix SW caching) -->
<style>
body {
margin: 0;
--ui-font: system-ui, BlinkMacSystemFont, -apple-system, Segoe UI,
Roboto, Helvetica, Arial, sans-serif;
font-family: var(--ui-font);
-webkit-text-size-adjust: 100%;
-webkit-user-select: none;
user-select: none;
width: 100vw;
height: 100vh;
}
.visually-hidden {
position: absolute !important;
height: 1px;
width: 1px;
overflow: hidden;
clip: rect(1px, 1px, 1px, 1px);
white-space: nowrap; /* added line */
}
.LoadingMessage {
position: fixed;
position: absolute;
top: 0;
right: 0;
bottom: 0;
@ -107,40 +137,19 @@
justify-content: center;
pointer-events: none;
}
.LoadingMessage span {
background-color: rgba(255, 255, 255, 0.8);
background-color: var(--button-gray-1);
border-radius: 5px;
padding: 0.8em 1.2em;
color: var(--popup-text-color);
font-size: 1.3em;
}
.visually-hidden {
position: absolute !important;
height: 1px;
width: 1px;
overflow: hidden;
clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
clip: rect(1px, 1px, 1px, 1px);
white-space: nowrap; /* added line */
}
</style>
<script
async
src="https://www.googletagmanager.com/gtag/js?id=UA-387204-13"
></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag("js", new Date());
gtag("config", "UA-387204-13");
</script>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<noscript> You need to enable JavaScript to run this app. </noscript>
<header>
<h1 class="visually-hidden">Excalidraw</h1>
</header>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -14,8 +14,17 @@
"sizes": "256x256"
}
],
"start_url": ".",
"start_url": "/",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
"background_color": "#ffffff",
"file_handlers": [
{
"action": "/",
"accept": {
"application/vnd.excalidraw+json": [".excalidraw"]
}
}
],
"capture_links": "new_client"
}

BIN
public/og-image-sm.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 70 KiB

3
public/robots.txt Normal file
View File

@ -0,0 +1,3 @@
user-agent: *
Allow: /$
Disallow: /

View File

@ -0,0 +1,32 @@
const { readdirSync, writeFileSync } = require("fs");
const files = readdirSync(`${__dirname}/../src/locales`);
const flatten = (object) =>
Object.keys(object).reduce(
(initial, current) => ({ ...initial, ...object[current] }),
{},
);
const locales = files.filter(
(file) => file !== "README.md" && file !== "percentages.json",
);
const percentages = {};
for (let index = 0; index < locales.length; index++) {
const currentLocale = locales[index];
const data = flatten(require(`${__dirname}/../src/locales/${currentLocale}`));
const allKeys = Object.keys(data);
const translatedKeys = allKeys.filter((item) => data[item] !== "");
const percentage = (100 * translatedKeys.length) / allKeys.length;
percentages[currentLocale.replace(".json", "")] = parseInt(percentage);
}
writeFileSync(
`${__dirname}/../src/locales/percentages.json`,
`${JSON.stringify(percentages, null, 2)}\n`,
"utf8",
);

View File

@ -9,9 +9,9 @@
// node build/static/js/build-node.js
// open test.png
var rewire = require("rewire");
var defaults = rewire("react-scripts/scripts/build.js");
var config = defaults.__get__("config");
const rewire = require("rewire");
const defaults = rewire("react-scripts/scripts/build.js");
const config = defaults.__get__("config");
// Disable multiple chunks
config.optimization.runtimeChunk = false;
@ -29,7 +29,7 @@ config.entry = "./src/index-node";
// By default, webpack is going to replace the require of the canvas.node file
// to just a string with the path of the canvas.node file. We need to tell
// webpack to avoid rewriting that dependency.
config.externals = function (context, request, callback) {
config.externals = (context, request, callback) => {
if (/\.node$/.test(request)) {
return callback(
null,

View File

@ -2,36 +2,60 @@
const fs = require("fs");
const path = require("path");
const asar = require("asar");
const versionFile = path.join("build", "version.json");
const indexFile = path.join("build", "index.html");
const zero = (digit) => `0${digit}`.slice(-2);
const versionDate = (date) => date.toISOString().replace(".000", "");
const versionDate = (date) => {
const date_ = `${date.getFullYear()}-${zero(date.getMonth() + 1)}-${zero(
date.getDate(),
)}`;
const time = `${zero(date.getHours())}-${zero(date.getMinutes())}-${zero(
date.getSeconds(),
)}`;
return `${date_}-${time}`;
const commitHash = () => {
try {
return require("child_process")
.execSync("git rev-parse --short HEAD")
.toString()
.trim();
} catch {
return "none";
}
};
const now = new Date();
const commitDate = (hash) => {
try {
const unix = require("child_process")
.execSync(`git show -s --format=%ct ${hash}`)
.toString()
.trim();
const date = new Date(parseInt(unix) * 1000);
return versionDate(date);
} catch {
return versionDate(new Date());
}
};
const getFullVersion = () => {
const hash = commitHash();
return `${commitDate(hash)}-${hash}`;
};
const data = JSON.stringify(
{
asar: `excalidraw.asar`,
version: versionDate(now),
version: getFullVersion(),
},
undefined,
2,
);
fs.writeFileSync(path.join("build", "version.json"), data);
fs.writeFileSync(versionFile, data);
(async () => {
const src = "build/";
const dest = path.join("build", `excalidraw.asar`);
// https://stackoverflow.com/a/14181136/8418
fs.readFile(indexFile, "utf8", (error, data) => {
if (error) {
return console.error(error);
}
const result = data.replace(/{version}/g, getFullVersion());
await asar.createPackage(src, dest);
})();
fs.writeFile(indexFile, result, "utf8", (error) => {
if (error) {
return console.error(error);
}
});
});

View File

@ -0,0 +1,161 @@
const fs = require("fs");
const THRESSHOLD = 85;
const crowdinMap = {
"ar-SA": "en-ar",
"bg-BG": "en-bg",
"ca-ES": "en-ca",
"de-DE": "en-de",
"el-GR": "en-el",
"es-ES": "en-es",
"fa-IR": "en-fa",
"fi-FI": "en-fi",
"fr-FR": "en-fr",
"he-IL": "en-he",
"hi-IN": "en-hi",
"hu-HU": "en-hu",
"id-ID": "en-id",
"it-IT": "en-it",
"ja-JP": "en-ja",
"kab-KAB": "en-kab",
"ko-KR": "en-ko",
"my-MM": "en-my",
"nb-NO": "en-nb",
"nl-NL": "en-nl",
"nn-NO": "en-nnno",
"pa-IN": "en-pain",
"pl-PL": "en-pl",
"pt-BR": "en-ptbr",
"pt-PT": "en-pt",
"ro-RO": "en-ro",
"ru-RU": "en-ru",
"sk-SK": "en-sk",
"sv-SE": "en-sv",
"tr-TR": "en-tr",
"uk-UA": "en-uk",
"zh-CN": "en-zhcn",
"zh-TW": "en-zhtw",
};
const flags = {
"ar-SA": "🇸🇦",
"bg-BG": "🇧🇬",
"ca-ES": "🏳",
"de-DE": "🇩🇪",
"el-GR": "🇬🇷",
"es-ES": "🇪🇸",
"fa-IR": "🇮🇷",
"fi-FI": "🇫🇮",
"fr-FR": "🇫🇷",
"he-IL": "🇮🇱",
"hi-IN": "🇮🇳",
"hu-HU": "🇭🇺",
"id-ID": "🇮🇩",
"it-IT": "🇮🇹",
"ja-JP": "🇯🇵",
"kab-KAB": "🏳",
"ko-KR": "🇰🇷",
"my-MM": "🇲🇲",
"nb-NO": "🇳🇴",
"nl-NL": "🇳🇱",
"nn-NO": "🇳🇴",
"pa-IN": "🇮🇳",
"pl-PL": "🇵🇱",
"pt-BR": "🇧🇷",
"pt-PT": "🇵🇹",
"ro-RO": "🇷🇴",
"ru-RU": "🇷🇺",
"sk-SK": "🇸🇰",
"sv-SE": "🇸🇪",
"tr-TR": "🇹🇷",
"uk-UA": "🇺🇦",
"zh-CN": "🇨🇳",
"zh-TW": "🇹🇼",
};
const languages = {
"ar-SA": "العربية",
"bg-BG": "Български",
"ca-ES": "Català",
"de-DE": "Deutsch",
"el-GR": "Ελληνικά",
"es-ES": "Español",
"fa-IR": "فارسی",
"fi-FI": "Suomi",
"fr-FR": "Français",
"he-IL": "עברית",
"hi-IN": "हिन्दी",
"hu-HU": "Magyar",
"id-ID": "Bahasa Indonesia",
"it-IT": "Italiano",
"ja-JP": "日本語",
"kab-KAB": "Taqbaylit",
"ko-KR": "한국어",
"my-MM": "Burmese",
"nb-NO": "Norsk bokmål",
"nl-NL": "Nederlands",
"nn-NO": "Norsk nynorsk",
"pa-IN": "ਪੰਜਾਬੀ",
"pl-PL": "Polski",
"pt-BR": "Português Brasileiro",
"pt-PT": "Português",
"ro-RO": "Română",
"ru-RU": "Русский",
"sk-SK": "Slovenčina",
"sv-SE": "Svenska",
"tr-TR": "Türkçe",
"uk-UA": "Українська",
"zh-CN": "简体中文",
"zh-TW": "繁體中文",
};
const percentages = fs.readFileSync(
`${__dirname}/../src/locales/percentages.json`,
);
const rowData = JSON.parse(percentages);
const coverages = Object.entries(rowData)
.sort(([, a], [, b]) => b - a)
.reduce((r, [k, v]) => ({ ...r, [k]: v }), {});
const boldIf = (text, condition) => (condition ? `**${text}**` : text);
const printHeader = () => {
let result = "| | Flag | Locale | % |\n";
result += "| :--: | :--: | -- | :--: |";
return result;
};
const printRow = (id, locale, coverage) => {
const isOver = coverage >= THRESSHOLD;
let result = `| ${isOver ? id : "..."} | `;
result += `${locale in flags ? flags[locale] : ""} | `;
const language = locale in languages ? languages[locale] : locale;
if (locale in crowdinMap && crowdinMap[locale]) {
result += `[${boldIf(
language,
isOver,
)}](https://crowdin.com/translate/excalidraw/10/${crowdinMap[locale]}) | `;
} else {
result += `${boldIf(language, isOver)} | `;
}
result += `${coverage === 100 ? "💯" : boldIf(coverage, isOver)} |`;
return result;
};
console.info(
`Each language must be at least **${THRESSHOLD}%** translated in order to appear on Excalidraw. Join us on [Crowdin](https://crowdin.com/project/excalidraw) and help us translate your own language. **Can't find yours yet?** Open an [issue](https://github.com/excalidraw/excalidraw/issues/new) and we'll add it to the list.`,
);
console.info("\n\r");
console.info(printHeader());
let index = 1;
for (const coverage in coverages) {
if (coverage === "en") {
continue;
}
console.info(printRow(index, coverage, coverages[coverage]));
index++;
}
console.info("\n\r");
console.info("\\* Languages in **bold** are going to appear on production.");

View File

@ -0,0 +1,21 @@
import { register } from "./register";
import { getSelectedElements } from "../scene";
import { getNonDeletedElements } from "../element";
import { deepCopyElement } from "../element/newElement";
import { Library } from "../data/library";
export const actionAddToLibrary = register({
name: "addToLibrary",
perform: (elements, appState) => {
const selectedElements = getSelectedElements(
getNonDeletedElements(elements),
appState,
);
Library.loadLibrary().then((items) => {
Library.saveLibrary([...items, selectedElements.map(deepCopyElement)]);
});
return false;
},
contextItemLabel: "labels.addToLibrary",
});

207
src/actions/actionAlign.tsx Normal file
View File

@ -0,0 +1,207 @@
import React from "react";
import { alignElements, Alignment } from "../align";
import {
AlignBottomIcon,
AlignLeftIcon,
AlignRightIcon,
AlignTopIcon,
CenterHorizontallyIcon,
CenterVerticallyIcon,
} from "../components/icons";
import { ToolButton } from "../components/ToolButton";
import { getElementMap, getNonDeletedElements } from "../element";
import { ExcalidrawElement } from "../element/types";
import { t } from "../i18n";
import { KEYS } from "../keys";
import { getSelectedElements, isSomeElementSelected } from "../scene";
import { AppState } from "../types";
import { getShortcutKey } from "../utils";
import { register } from "./register";
const enableActionGroup = (
elements: readonly ExcalidrawElement[],
appState: AppState,
) => getSelectedElements(getNonDeletedElements(elements), appState).length > 1;
const alignSelectedElements = (
elements: readonly ExcalidrawElement[],
appState: Readonly<AppState>,
alignment: Alignment,
) => {
const selectedElements = getSelectedElements(
getNonDeletedElements(elements),
appState,
);
const updatedElements = alignElements(selectedElements, alignment);
const updatedElementsMap = getElementMap(updatedElements);
return elements.map((element) => updatedElementsMap[element.id] || element);
};
export const actionAlignTop = register({
name: "alignTop",
perform: (elements, appState) => {
return {
appState,
elements: alignSelectedElements(elements, appState, {
position: "start",
axis: "y",
}),
commitToHistory: true,
};
},
keyTest: (event) =>
event[KEYS.CTRL_OR_CMD] && event.shiftKey && event.key === KEYS.ARROW_UP,
PanelComponent: ({ elements, appState, updateData }) => (
<ToolButton
hidden={!enableActionGroup(elements, appState)}
type="button"
icon={<AlignTopIcon appearance={appState.appearance} />}
onClick={() => updateData(null)}
title={`${t("labels.alignTop")}${getShortcutKey(
"CtrlOrCmd+Shift+Up",
)}`}
aria-label={t("labels.alignTop")}
visible={isSomeElementSelected(getNonDeletedElements(elements), appState)}
/>
),
});
export const actionAlignBottom = register({
name: "alignBottom",
perform: (elements, appState) => {
return {
appState,
elements: alignSelectedElements(elements, appState, {
position: "end",
axis: "y",
}),
commitToHistory: true,
};
},
keyTest: (event) =>
event[KEYS.CTRL_OR_CMD] && event.shiftKey && event.key === KEYS.ARROW_DOWN,
PanelComponent: ({ elements, appState, updateData }) => (
<ToolButton
hidden={!enableActionGroup(elements, appState)}
type="button"
icon={<AlignBottomIcon appearance={appState.appearance} />}
onClick={() => updateData(null)}
title={`${t("labels.alignBottom")}${getShortcutKey(
"CtrlOrCmd+Shift+Down",
)}`}
aria-label={t("labels.alignBottom")}
visible={isSomeElementSelected(getNonDeletedElements(elements), appState)}
/>
),
});
export const actionAlignLeft = register({
name: "alignLeft",
perform: (elements, appState) => {
return {
appState,
elements: alignSelectedElements(elements, appState, {
position: "start",
axis: "x",
}),
commitToHistory: true,
};
},
keyTest: (event) =>
event[KEYS.CTRL_OR_CMD] && event.shiftKey && event.key === KEYS.ARROW_LEFT,
PanelComponent: ({ elements, appState, updateData }) => (
<ToolButton
hidden={!enableActionGroup(elements, appState)}
type="button"
icon={<AlignLeftIcon appearance={appState.appearance} />}
onClick={() => updateData(null)}
title={`${t("labels.alignLeft")}${getShortcutKey(
"CtrlOrCmd+Shift+Left",
)}`}
aria-label={t("labels.alignLeft")}
visible={isSomeElementSelected(getNonDeletedElements(elements), appState)}
/>
),
});
export const actionAlignRight = register({
name: "alignRight",
perform: (elements, appState) => {
return {
appState,
elements: alignSelectedElements(elements, appState, {
position: "end",
axis: "x",
}),
commitToHistory: true,
};
},
keyTest: (event) =>
event[KEYS.CTRL_OR_CMD] && event.shiftKey && event.key === KEYS.ARROW_RIGHT,
PanelComponent: ({ elements, appState, updateData }) => (
<ToolButton
hidden={!enableActionGroup(elements, appState)}
type="button"
icon={<AlignRightIcon appearance={appState.appearance} />}
onClick={() => updateData(null)}
title={`${t("labels.alignRight")}${getShortcutKey(
"CtrlOrCmd+Shift+Right",
)}`}
aria-label={t("labels.alignRight")}
visible={isSomeElementSelected(getNonDeletedElements(elements), appState)}
/>
),
});
export const actionAlignVerticallyCentered = register({
name: "alignVerticallyCentered",
perform: (elements, appState) => {
return {
appState,
elements: alignSelectedElements(elements, appState, {
position: "center",
axis: "y",
}),
commitToHistory: true,
};
},
PanelComponent: ({ elements, appState, updateData }) => (
<ToolButton
hidden={!enableActionGroup(elements, appState)}
type="button"
icon={<CenterVerticallyIcon appearance={appState.appearance} />}
onClick={() => updateData(null)}
title={t("labels.centerVertically")}
aria-label={t("labels.centerVertically")}
visible={isSomeElementSelected(getNonDeletedElements(elements), appState)}
/>
),
});
export const actionAlignHorizontallyCentered = register({
name: "alignHorizontallyCentered",
perform: (elements, appState) => {
return {
appState,
elements: alignSelectedElements(elements, appState, {
position: "center",
axis: "x",
}),
commitToHistory: true,
};
},
PanelComponent: ({ elements, appState, updateData }) => (
<ToolButton
hidden={!enableActionGroup(elements, appState)}
type="button"
icon={<CenterHorizontallyIcon appearance={appState.appearance} />}
onClick={() => updateData(null)}
title={t("labels.centerHorizontally")}
aria-label={t("labels.centerHorizontally")}
visible={isSomeElementSelected(getNonDeletedElements(elements), appState)}
/>
),
});

View File

@ -1,17 +1,21 @@
import React from "react";
import { ColorPicker } from "../components/ColorPicker";
import { getDefaultAppState } from "../appState";
import { trash, zoomIn, zoomOut, resetZoom } from "../components/icons";
import { ColorPicker } from "../components/ColorPicker";
import { resetZoom, trash, zoomIn, zoomOut } from "../components/icons";
import { ToolButton } from "../components/ToolButton";
import { t } from "../i18n";
import { getNormalizedZoom, calculateScrollCenter } from "../scene";
import { KEYS } from "../keys";
import { getShortcutKey } from "../utils";
import useIsMobile from "../is-mobile";
import { register } from "./register";
import { ZOOM_STEP } from "../constants";
import { getCommonBounds, getNonDeletedElements } from "../element";
import { newElementWith } from "../element/mutateElement";
import { AppState, FlooredNumber } from "../types";
import { getCommonBounds } from "../element";
import { ExcalidrawElement } from "../element/types";
import { t } from "../i18n";
import useIsMobile from "../is-mobile";
import { CODES, KEYS } from "../keys";
import { getNormalizedZoom, getSelectedElements } from "../scene";
import { centerScrollOn } from "../scene/scroll";
import { getNewZoom } from "../scene/zoom";
import { AppState, NormalizedZoomValue } from "../types";
import { getShortcutKey } from "../utils";
import { register } from "./register";
export const actionChangeViewBackgroundColor = register({
name: "changeViewBackgroundColor",
@ -44,7 +48,14 @@ export const actionClearCanvas = register({
),
appState: {
...getDefaultAppState(),
username: appState.username,
appearance: appState.appearance,
elementLocked: appState.elementLocked,
exportBackground: appState.exportBackground,
exportEmbedScene: appState.exportEmbedScene,
gridSize: appState.gridSize,
shouldAddWatermark: appState.shouldAddWatermark,
showStats: appState.showStats,
pasteDialog: appState.pasteDialog,
},
commitToHistory: true,
};
@ -58,10 +69,6 @@ export const actionClearCanvas = register({
showAriaLabel={useIsMobile()}
onClick={() => {
if (window.confirm(t("alerts.clearReset"))) {
// TODO: Defined globally, since file handles aren't yet serializable.
// Once `FileSystemFileHandle` can be serialized, make this
// part of `AppState`.
(window as any).handle = null;
updateData(null);
}
}}
@ -69,25 +76,19 @@ export const actionClearCanvas = register({
),
});
const ZOOM_STEP = 0.1;
const KEY_CODES = {
MINUS: "Minus",
EQUAL: "Equal",
ONE: "Digit1",
ZERO: "Digit0",
NUM_SUBTRACT: "NumpadSubtract",
NUM_ADD: "NumpadAdd",
NUM_ZERO: "Numpad0",
};
export const actionZoomIn = register({
name: "zoomIn",
perform: (_elements, appState) => {
const zoom = getNewZoom(
getNormalizedZoom(appState.zoom.value + ZOOM_STEP),
appState.zoom,
{ left: appState.offsetLeft, top: appState.offsetTop },
{ x: appState.width / 2, y: appState.height / 2 },
);
return {
appState: {
...appState,
zoom: getNormalizedZoom(appState.zoom + ZOOM_STEP),
zoom,
},
commitToHistory: false,
};
@ -104,17 +105,24 @@ export const actionZoomIn = register({
/>
),
keyTest: (event) =>
(event.code === KEY_CODES.EQUAL || event.code === KEY_CODES.NUM_ADD) &&
(event.code === CODES.EQUAL || event.code === CODES.NUM_ADD) &&
(event[KEYS.CTRL_OR_CMD] || event.shiftKey),
});
export const actionZoomOut = register({
name: "zoomOut",
perform: (_elements, appState) => {
const zoom = getNewZoom(
getNormalizedZoom(appState.zoom.value - ZOOM_STEP),
appState.zoom,
{ left: appState.offsetLeft, top: appState.offsetTop },
{ x: appState.width / 2, y: appState.height / 2 },
);
return {
appState: {
...appState,
zoom: getNormalizedZoom(appState.zoom - ZOOM_STEP),
zoom,
},
commitToHistory: false,
};
@ -131,7 +139,7 @@ export const actionZoomOut = register({
/>
),
keyTest: (event) =>
(event.code === KEY_CODES.MINUS || event.code === KEY_CODES.NUM_SUBTRACT) &&
(event.code === CODES.MINUS || event.code === CODES.NUM_SUBTRACT) &&
(event[KEYS.CTRL_OR_CMD] || event.shiftKey),
});
@ -141,7 +149,15 @@ export const actionResetZoom = register({
return {
appState: {
...appState,
zoom: 1,
zoom: getNewZoom(
1 as NormalizedZoomValue,
appState.zoom,
{ left: appState.offsetLeft, top: appState.offsetTop },
{
x: appState.width / 2,
y: appState.height / 2,
},
),
},
commitToHistory: false,
};
@ -158,66 +174,86 @@ export const actionResetZoom = register({
/>
),
keyTest: (event) =>
(event.code === KEY_CODES.ZERO || event.code === KEY_CODES.NUM_ZERO) &&
(event.code === CODES.ZERO || event.code === CODES.NUM_ZERO) &&
(event[KEYS.CTRL_OR_CMD] || event.shiftKey),
});
const calculateZoom = (
commonBounds: number[],
currentZoom: number,
{
scrollX,
scrollY,
}: {
scrollX: FlooredNumber;
scrollY: FlooredNumber;
},
): number => {
const { innerWidth, innerHeight } = window;
const [x, y] = commonBounds;
const zoomX = -innerWidth / (2 * scrollX + 2 * x - innerWidth);
const zoomY = -innerHeight / (2 * scrollY + 2 * y - innerHeight);
const margin = 0.01;
let newZoom;
if (zoomX < zoomY) {
newZoom = zoomX - margin;
} else if (zoomY <= zoomX) {
newZoom = zoomY - margin;
} else {
newZoom = currentZoom;
}
if (newZoom <= 0.1) {
return 0.1;
}
if (newZoom >= 1) {
return 1;
}
return newZoom;
const zoomValueToFitBoundsOnViewport = (
bounds: [number, number, number, number],
viewportDimensions: { width: number; height: number },
) => {
const [x1, y1, x2, y2] = bounds;
const commonBoundsWidth = x2 - x1;
const zoomValueForWidth = viewportDimensions.width / commonBoundsWidth;
const commonBoundsHeight = y2 - y1;
const zoomValueForHeight = viewportDimensions.height / commonBoundsHeight;
const smallestZoomValue = Math.min(zoomValueForWidth, zoomValueForHeight);
const zoomAdjustedToSteps =
Math.floor(smallestZoomValue / ZOOM_STEP) * ZOOM_STEP;
const clampedZoomValueToFitElements = Math.min(
Math.max(zoomAdjustedToSteps, ZOOM_STEP),
1,
);
return clampedZoomValueToFitElements as NormalizedZoomValue;
};
export const actionZoomToFit = register({
name: "zoomToFit",
perform: (elements, appState) => {
const nonDeletedElements = elements.filter((element) => !element.isDeleted);
const scrollCenter = calculateScrollCenter(nonDeletedElements);
const commonBounds = getCommonBounds(nonDeletedElements);
const zoom = calculateZoom(commonBounds, appState.zoom, scrollCenter);
const zoomToFitElements = (
elements: readonly ExcalidrawElement[],
appState: Readonly<AppState>,
zoomToSelection: boolean,
) => {
const nonDeletedElements = getNonDeletedElements(elements);
const selectedElements = getSelectedElements(nonDeletedElements, appState);
return {
appState: {
...appState,
scrollX: scrollCenter.scrollX,
scrollY: scrollCenter.scrollY,
zoom,
},
commitToHistory: false,
};
},
const commonBounds =
zoomToSelection && selectedElements.length > 0
? getCommonBounds(selectedElements)
: getCommonBounds(nonDeletedElements);
const zoomValue = zoomValueToFitBoundsOnViewport(commonBounds, {
width: appState.width,
height: appState.height,
});
const newZoom = getNewZoom(zoomValue, appState.zoom, {
left: appState.offsetLeft,
top: appState.offsetTop,
});
const [x1, y1, x2, y2] = commonBounds;
const centerX = (x1 + x2) / 2;
const centerY = (y1 + y2) / 2;
return {
appState: {
...appState,
...centerScrollOn({
scenePoint: { x: centerX, y: centerY },
viewportDimensions: {
width: appState.width,
height: appState.height,
},
zoom: newZoom,
}),
zoom: newZoom,
},
commitToHistory: false,
};
};
export const actionZoomToSelected = register({
name: "zoomToSelection",
perform: (elements, appState) => zoomToFitElements(elements, appState, true),
keyTest: (event) =>
event.code === KEY_CODES.ONE &&
event.code === CODES.TWO &&
event.shiftKey &&
!event.altKey &&
!event[KEYS.CTRL_OR_CMD],
});
export const actionZoomToFit = register({
name: "zoomToFit",
perform: (elements, appState) => zoomToFitElements(elements, appState, false),
keyTest: (event) =>
event.code === CODES.ONE &&
event.shiftKey &&
!event.altKey &&
!event[KEYS.CTRL_OR_CMD],

View File

@ -0,0 +1,114 @@
import { CODES, KEYS } from "../keys";
import { register } from "./register";
import { copyToClipboard } from "../clipboard";
import { actionDeleteSelected } from "./actionDeleteSelected";
import { getSelectedElements } from "../scene/selection";
import { exportCanvas } from "../data/index";
import { getNonDeletedElements } from "../element";
import { t } from "../i18n";
export const actionCopy = register({
name: "copy",
perform: (elements, appState) => {
copyToClipboard(getNonDeletedElements(elements), appState);
return {
commitToHistory: false,
};
},
contextItemLabel: "labels.copy",
keyTest: (event) => event[KEYS.CTRL_OR_CMD] && event.code === CODES.C,
});
export const actionCut = register({
name: "cut",
perform: (elements, appState, data, app) => {
actionCopy.perform(elements, appState, data, app);
return actionDeleteSelected.perform(elements, appState, data, app);
},
contextItemLabel: "labels.cut",
keyTest: (event) => event[KEYS.CTRL_OR_CMD] && event.code === CODES.X,
});
export const actionCopyAsSvg = register({
name: "copyAsSvg",
perform: async (elements, appState, _data, app) => {
if (!app.canvas) {
return {
commitToHistory: false,
};
}
const selectedElements = getSelectedElements(
getNonDeletedElements(elements),
appState,
);
try {
await exportCanvas(
"clipboard-svg",
selectedElements.length
? selectedElements
: getNonDeletedElements(elements),
appState,
app.canvas,
appState,
);
return {
commitToHistory: false,
};
} catch (error) {
console.error(error);
return {
appState: {
...appState,
errorMessage: error.message,
},
commitToHistory: false,
};
}
},
contextItemLabel: "labels.copyAsSvg",
});
export const actionCopyAsPng = register({
name: "copyAsPng",
perform: async (elements, appState, _data, app) => {
if (!app.canvas) {
return {
commitToHistory: false,
};
}
const selectedElements = getSelectedElements(
getNonDeletedElements(elements),
appState,
);
try {
await exportCanvas(
"clipboard",
selectedElements.length
? selectedElements
: getNonDeletedElements(elements),
appState,
app.canvas,
appState,
);
return {
appState: {
...appState,
toastMessage: t("toast.copyToClipboardAsPng"),
},
commitToHistory: false,
};
} catch (error) {
console.error(error);
return {
appState: {
...appState,
errorMessage: error.message,
},
commitToHistory: false,
};
}
},
contextItemLabel: "labels.copyAsPng",
keyTest: (event) => event.code === CODES.C && event.altKey && event.shiftKey,
});

View File

@ -1,4 +1,4 @@
import { deleteSelectedElements, isSomeElementSelected } from "../scene";
import { isSomeElementSelected } from "../scene";
import { KEYS } from "../keys";
import { ToolButton } from "../components/ToolButton";
import React from "react";
@ -6,14 +6,122 @@ import { trash } from "../components/icons";
import { t } from "../i18n";
import { register } from "./register";
import { getNonDeletedElements } from "../element";
import { ExcalidrawElement } from "../element/types";
import { AppState } from "../types";
import { newElementWith } from "../element/mutateElement";
import { getElementsInGroup } from "../groups";
import { LinearElementEditor } from "../element/linearElementEditor";
import { fixBindingsAfterDeletion } from "../element/binding";
const deleteSelectedElements = (
elements: readonly ExcalidrawElement[],
appState: AppState,
) => {
return {
elements: elements.map((el) => {
if (appState.selectedElementIds[el.id]) {
return newElementWith(el, { isDeleted: true });
}
return el;
}),
appState: {
...appState,
selectedElementIds: {},
},
};
};
const handleGroupEditingState = (
appState: AppState,
elements: readonly ExcalidrawElement[],
): AppState => {
if (appState.editingGroupId) {
const siblingElements = getElementsInGroup(
getNonDeletedElements(elements),
appState.editingGroupId!,
);
if (siblingElements.length) {
return {
...appState,
selectedElementIds: { [siblingElements[0].id]: true },
};
}
}
return appState;
};
export const actionDeleteSelected = register({
name: "deleteSelectedElements",
perform: (elements, appState) => {
const {
if (appState.editingLinearElement) {
const {
elementId,
activePointIndex,
startBindingElement,
endBindingElement,
} = appState.editingLinearElement;
const element = LinearElementEditor.getElement(elementId);
if (!element) {
return false;
}
if (
// case: no point selected → delete whole element
activePointIndex == null ||
activePointIndex === -1 ||
// case: deleting last remaining point
element.points.length < 2
) {
const nextElements = elements.filter((el) => el.id !== element.id);
const nextAppState = handleGroupEditingState(appState, nextElements);
return {
elements: nextElements,
appState: {
...nextAppState,
editingLinearElement: null,
},
commitToHistory: false,
};
}
// We cannot do this inside `movePoint` because it is also called
// when deleting the uncommitted point (which hasn't caused any binding)
const binding = {
startBindingElement:
activePointIndex === 0 ? null : startBindingElement,
endBindingElement:
activePointIndex === element.points.length - 1
? null
: endBindingElement,
};
LinearElementEditor.movePoint(element, activePointIndex, "delete");
return {
elements,
appState: {
...appState,
editingLinearElement: {
...appState.editingLinearElement,
...binding,
activePointIndex: activePointIndex > 0 ? activePointIndex - 1 : 0,
},
},
commitToHistory: true,
};
}
let {
elements: nextElements,
appState: nextAppState,
} = deleteSelectedElements(elements, appState);
fixBindingsAfterDeletion(
nextElements,
elements.filter(({ id }) => appState.selectedElementIds[id]),
);
nextAppState = handleGroupEditingState(nextAppState, nextElements);
return {
elements: nextElements,
appState: {
@ -28,7 +136,6 @@ export const actionDeleteSelected = register({
};
},
contextItemLabel: "labels.delete",
contextMenuOrder: 3,
keyTest: (event) => event.key === KEYS.BACKSPACE || event.key === KEYS.DELETE,
PanelComponent: ({ elements, appState, updateData }) => (
<ToolButton

View File

@ -0,0 +1,91 @@
import React from "react";
import {
DistributeHorizontallyIcon,
DistributeVerticallyIcon,
} from "../components/icons";
import { ToolButton } from "../components/ToolButton";
import { distributeElements, Distribution } from "../disitrubte";
import { getElementMap, getNonDeletedElements } from "../element";
import { ExcalidrawElement } from "../element/types";
import { t } from "../i18n";
import { CODES } from "../keys";
import { getSelectedElements, isSomeElementSelected } from "../scene";
import { AppState } from "../types";
import { getShortcutKey } from "../utils";
import { register } from "./register";
const enableActionGroup = (
elements: readonly ExcalidrawElement[],
appState: AppState,
) => getSelectedElements(getNonDeletedElements(elements), appState).length > 1;
const distributeSelectedElements = (
elements: readonly ExcalidrawElement[],
appState: Readonly<AppState>,
distribution: Distribution,
) => {
const selectedElements = getSelectedElements(
getNonDeletedElements(elements),
appState,
);
const updatedElements = distributeElements(selectedElements, distribution);
const updatedElementsMap = getElementMap(updatedElements);
return elements.map((element) => updatedElementsMap[element.id] || element);
};
export const distributeHorizontally = register({
name: "distributeHorizontally",
perform: (elements, appState) => {
return {
appState,
elements: distributeSelectedElements(elements, appState, {
space: "between",
axis: "x",
}),
commitToHistory: true,
};
},
keyTest: (event) => event.altKey && event.code === CODES.H,
PanelComponent: ({ elements, appState, updateData }) => (
<ToolButton
hidden={!enableActionGroup(elements, appState)}
type="button"
icon={<DistributeHorizontallyIcon appearance={appState.appearance} />}
onClick={() => updateData(null)}
title={`${t("labels.distributeHorizontally")}${getShortcutKey(
"Alt+H",
)}`}
aria-label={t("labels.distributeHorizontally")}
visible={isSomeElementSelected(getNonDeletedElements(elements), appState)}
/>
),
});
export const distributeVertically = register({
name: "distributeVertically",
perform: (elements, appState) => {
return {
appState,
elements: distributeSelectedElements(elements, appState, {
space: "between",
axis: "y",
}),
commitToHistory: true,
};
},
keyTest: (event) => event.altKey && event.code === CODES.V,
PanelComponent: ({ elements, appState, updateData }) => (
<ToolButton
hidden={!enableActionGroup(elements, appState)}
type="button"
icon={<DistributeVerticallyIcon appearance={appState.appearance} />}
onClick={() => updateData(null)}
title={`${t("labels.distributeVertically")}${getShortcutKey("Alt+V")}`}
aria-label={t("labels.distributeVertically")}
visible={isSomeElementSelected(getNonDeletedElements(elements), appState)}
/>
),
});

View File

@ -8,32 +8,63 @@ import { ToolButton } from "../components/ToolButton";
import { clone } from "../components/icons";
import { t } from "../i18n";
import { getShortcutKey } from "../utils";
import { LinearElementEditor } from "../element/linearElementEditor";
import { mutateElement } from "../element/mutateElement";
import {
selectGroupsForSelectedElements,
getSelectedGroupForElement,
getElementsInGroup,
} from "../groups";
import { AppState } from "../types";
import { fixBindingsAfterDuplication } from "../element/binding";
import { ActionResult } from "./types";
import { GRID_SIZE } from "../constants";
export const actionDuplicateSelection = register({
name: "duplicateSelection",
perform: (elements, appState) => {
return {
appState,
elements: elements.reduce(
(acc: Array<ExcalidrawElement>, element: ExcalidrawElement) => {
if (appState.selectedElementIds[element.id]) {
const newElement = duplicateElement(element, {
x: element.x + 10,
y: element.y + 10,
});
appState.selectedElementIds[newElement.id] = true;
delete appState.selectedElementIds[element.id];
return acc.concat([element, newElement]);
}
return acc.concat(element);
// duplicate point if selected while editing multi-point element
if (appState.editingLinearElement) {
const { activePointIndex, elementId } = appState.editingLinearElement;
const element = LinearElementEditor.getElement(elementId);
if (!element || activePointIndex === null) {
return false;
}
const { points } = element;
const selectedPoint = points[activePointIndex];
const nextPoint = points[activePointIndex + 1];
mutateElement(element, {
points: [
...points.slice(0, activePointIndex + 1),
nextPoint
? [
(selectedPoint[0] + nextPoint[0]) / 2,
(selectedPoint[1] + nextPoint[1]) / 2,
]
: [selectedPoint[0] + 30, selectedPoint[1] + 30],
...points.slice(activePointIndex + 1),
],
});
return {
appState: {
...appState,
editingLinearElement: {
...appState.editingLinearElement,
activePointIndex: activePointIndex + 1,
},
},
[],
),
elements,
commitToHistory: true,
};
}
return {
...duplicateElements(elements, appState),
commitToHistory: true,
};
},
contextItemLabel: "labels.duplicateSelection",
keyTest: (event) => event[KEYS.CTRL_OR_CMD] && event.key === "d",
keyTest: (event) => event[KEYS.CTRL_OR_CMD] && event.key === KEYS.D,
PanelComponent: ({ elements, appState, updateData }) => (
<ToolButton
type="button"
@ -47,3 +78,74 @@ export const actionDuplicateSelection = register({
/>
),
});
const duplicateElements = (
elements: readonly ExcalidrawElement[],
appState: AppState,
): Partial<ActionResult> => {
const groupIdMap = new Map();
const newElements: ExcalidrawElement[] = [];
const oldElements: ExcalidrawElement[] = [];
const oldIdToDuplicatedId = new Map();
const duplicateAndOffsetElement = (element: ExcalidrawElement) => {
const newElement = duplicateElement(
appState.editingGroupId,
groupIdMap,
element,
{
x: element.x + GRID_SIZE / 2,
y: element.y + GRID_SIZE / 2,
},
);
oldIdToDuplicatedId.set(element.id, newElement.id);
oldElements.push(element);
newElements.push(newElement);
return newElement;
};
const finalElements: ExcalidrawElement[] = [];
let index = 0;
while (index < elements.length) {
const element = elements[index];
if (appState.selectedElementIds[element.id]) {
if (element.groupIds.length) {
const groupId = getSelectedGroupForElement(appState, element);
// if group selected, duplicate it atomically
if (groupId) {
const groupElements = getElementsInGroup(elements, groupId);
finalElements.push(
...groupElements,
...groupElements.map((element) =>
duplicateAndOffsetElement(element),
),
);
index = index + groupElements.length;
continue;
}
}
finalElements.push(element, duplicateAndOffsetElement(element));
} else {
finalElements.push(element);
}
index++;
}
fixBindingsAfterDuplication(finalElements, oldElements, oldIdToDuplicatedId);
return {
elements: finalElements,
appState: selectGroupsForSelectedElements(
{
...appState,
selectedGroupIds: {},
selectedElementIds: newElements.reduce((acc, element) => {
acc[element.id] = true;
return acc;
}, {} as any),
},
getNonDeletedElements(finalElements),
),
};
};

View File

@ -1,16 +1,20 @@
import React from "react";
import { trackEvent } from "../analytics";
import { load, questionCircle, save, saveAs } from "../components/icons";
import { ProjectName } from "../components/ProjectName";
import { saveAsJSON, loadFromJSON } from "../data";
import { load, save } from "../components/icons";
import { ToolButton } from "../components/ToolButton";
import "../components/ToolIcon.scss";
import { Tooltip } from "../components/Tooltip";
import { loadFromJSON, saveAsJSON } from "../data";
import { t } from "../i18n";
import useIsMobile from "../is-mobile";
import { register } from "./register";
import { KEYS } from "../keys";
import { register } from "./register";
export const actionChangeProjectName = register({
name: "changeProjectName",
perform: (_elements, appState, value) => {
trackEvent("change", "title");
return { appState: { ...appState, name: value }, commitToHistory: false };
},
PanelComponent: ({ appState, updateData }) => (
@ -42,6 +46,33 @@ export const actionChangeExportBackground = register({
),
});
export const actionChangeExportEmbedScene = register({
name: "changeExportEmbedScene",
perform: (_elements, appState, value) => {
return {
appState: { ...appState, exportEmbedScene: value },
commitToHistory: false,
};
},
PanelComponent: ({ appState, updateData }) => (
<label style={{ display: "flex" }}>
<input
type="checkbox"
checked={appState.exportEmbedScene}
onChange={(event) => updateData(event.target.checked)}
/>{" "}
{t("labels.exportEmbedScene")}
<Tooltip
label={t("labels.exportEmbedScene_details")}
position="above"
long={true}
>
<div className="TooltipIcon">{questionCircle}</div>
</Tooltip>
</label>
),
});
export const actionChangeShouldAddWatermark = register({
name: "changeShouldAddWatermark",
perform: (_elements, appState, value) => {
@ -64,13 +95,34 @@ export const actionChangeShouldAddWatermark = register({
export const actionSaveScene = register({
name: "saveScene",
perform: (elements, appState, value) => {
saveAsJSON(elements, appState).catch((error) => console.error(error));
return { commitToHistory: false };
},
keyTest: (event) => {
return event.key === "s" && event[KEYS.CTRL_OR_CMD];
perform: async (elements, appState, value) => {
const fileHandleExists = !!appState.fileHandle;
try {
const { fileHandle } = await saveAsJSON(elements, appState);
return {
commitToHistory: false,
appState: {
...appState,
fileHandle,
toastMessage: fileHandleExists
? fileHandle.name
? t("toast.fileSavedToFilename").replace(
"{filename}",
`"${fileHandle.name}"`,
)
: t("toast.fileSaved")
: null,
},
};
} catch (error) {
if (error?.name !== "AbortError") {
console.error(error);
}
return { commitToHistory: false };
}
},
keyTest: (event) =>
event.key === KEYS.S && event[KEYS.CTRL_OR_CMD] && !event.shiftKey,
PanelComponent: ({ updateData }) => (
<ToolButton
type="button"
@ -83,42 +135,72 @@ export const actionSaveScene = register({
),
});
export const actionSaveAsScene = register({
name: "saveAsScene",
perform: async (elements, appState, value) => {
try {
const { fileHandle } = await saveAsJSON(elements, {
...appState,
fileHandle: null,
});
return { commitToHistory: false, appState: { ...appState, fileHandle } };
} catch (error) {
if (error?.name !== "AbortError") {
console.error(error);
}
return { commitToHistory: false };
}
},
keyTest: (event) =>
event.key === KEYS.S && event.shiftKey && event[KEYS.CTRL_OR_CMD],
PanelComponent: ({ updateData }) => (
<ToolButton
type="button"
icon={saveAs}
title={t("buttons.saveAs")}
aria-label={t("buttons.saveAs")}
showAriaLabel={useIsMobile()}
hidden={
!("chooseFileSystemEntries" in window || "showOpenFilePicker" in window)
}
onClick={() => updateData(null)}
/>
),
});
export const actionLoadScene = register({
name: "loadScene",
perform: (
elements,
appState,
{ elements: loadedElements, appState: loadedAppState, error },
) => {
return {
elements: loadedElements,
appState: {
...loadedAppState,
errorMessage: error,
},
commitToHistory: false,
};
perform: async (elements, appState) => {
try {
const {
elements: loadedElements,
appState: loadedAppState,
} = await loadFromJSON(appState);
return {
elements: loadedElements,
appState: loadedAppState,
commitToHistory: true,
};
} catch (error) {
if (error?.name === "AbortError") {
return false;
}
return {
elements,
appState: { ...appState, errorMessage: error.message },
commitToHistory: false,
};
}
},
PanelComponent: ({ updateData }) => (
keyTest: (event) => event[KEYS.CTRL_OR_CMD] && event.key === KEYS.O,
PanelComponent: ({ updateData, appState }) => (
<ToolButton
type="button"
icon={load}
title={t("buttons.load")}
aria-label={t("buttons.load")}
showAriaLabel={useIsMobile()}
onClick={() => {
loadFromJSON()
.then(({ elements, appState }) => {
updateData({ elements: elements, appState: appState });
})
.catch((error) => {
// if user cancels, ignore the error
if (error.name === "AbortError") {
return;
}
updateData({ error: error.message });
});
}}
onClick={updateData}
/>
),
});

View File

@ -8,10 +8,47 @@ import { t } from "../i18n";
import { register } from "./register";
import { mutateElement } from "../element/mutateElement";
import { isPathALoop } from "../math";
import { LinearElementEditor } from "../element/linearElementEditor";
import Scene from "../scene/Scene";
import {
maybeBindLinearElement,
bindOrUnbindLinearElement,
} from "../element/binding";
import { isBindingElement } from "../element/typeChecks";
export const actionFinalize = register({
name: "finalize",
perform: (elements, appState) => {
if (appState.editingLinearElement) {
const {
elementId,
startBindingElement,
endBindingElement,
} = appState.editingLinearElement;
const element = LinearElementEditor.getElement(elementId);
if (element) {
if (isBindingElement(element)) {
bindOrUnbindLinearElement(
element,
startBindingElement,
endBindingElement,
);
}
return {
elements:
element.points.length < 2 || isInvisiblySmallElement(element)
? elements.filter((el) => el.id !== element.id)
: undefined,
appState: {
...appState,
editingLinearElement: null,
},
commitToHistory: true,
};
}
}
let newElements = elements;
if (window.document.activeElement instanceof HTMLElement) {
window.document.activeElement.blur();
@ -46,16 +83,17 @@ export const actionFinalize = register({
// If the multi point line closes the loop,
// set the last point to first point.
// This ensures that loop remains closed at different scales.
const isLoop = isPathALoop(multiPointElement.points, appState.zoom.value);
if (
multiPointElement.type === "line" ||
multiPointElement.type === "draw"
) {
if (isPathALoop(multiPointElement.points)) {
if (isLoop) {
const linePoints = multiPointElement.points;
const firstPoint = linePoints[0];
mutateElement(multiPointElement, {
points: linePoints.map((point, i) =>
i === linePoints.length - 1
points: linePoints.map((point, index) =>
index === linePoints.length - 1
? ([firstPoint[0], firstPoint[1]] as const)
: point,
),
@ -63,11 +101,31 @@ export const actionFinalize = register({
}
}
if (!appState.elementLocked) {
if (
isBindingElement(multiPointElement) &&
!isLoop &&
multiPointElement.points.length > 1
) {
const [x, y] = LinearElementEditor.getPointAtIndexGlobalCoordinates(
multiPointElement,
-1,
);
maybeBindLinearElement(
multiPointElement,
appState,
Scene.getScene(multiPointElement)!,
{ x, y },
);
}
if (!appState.elementLocked && appState.elementType !== "draw") {
appState.selectedElementIds[multiPointElement.id] = true;
}
}
if (!appState.elementLocked || !multiPointElement) {
if (
(!appState.elementLocked && appState.elementType !== "draw") ||
!multiPointElement
) {
resetCursor();
}
return {
@ -75,27 +133,32 @@ export const actionFinalize = register({
appState: {
...appState,
elementType:
appState.elementLocked && multiPointElement
(appState.elementLocked || appState.elementType === "draw") &&
multiPointElement
? appState.elementType
: "selection",
draggingElement: null,
multiElement: null,
editingElement: null,
startBoundElement: null,
suggestedBindings: [],
selectedElementIds:
multiPointElement && !appState.elementLocked
multiPointElement &&
!appState.elementLocked &&
appState.elementType !== "draw"
? {
...appState.selectedElementIds,
[multiPointElement.id]: true,
}
: appState.selectedElementIds,
},
commitToHistory: false,
commitToHistory: appState.elementType === "draw",
};
},
keyTest: (event, appState) =>
(event.key === KEYS.ESCAPE &&
!appState.draggingElement &&
appState.multiElement === null) ||
(appState.editingLinearElement !== null ||
(!appState.draggingElement && appState.multiElement === null))) ||
((event.key === KEYS.ESCAPE || event.key === KEYS.ENTER) &&
appState.multiElement !== null),
PanelComponent: ({ appState, updateData }) => (

191
src/actions/actionGroup.tsx Normal file
View File

@ -0,0 +1,191 @@
import React from "react";
import { CODES, KEYS } from "../keys";
import { t } from "../i18n";
import { getShortcutKey } from "../utils";
import { register } from "./register";
import { UngroupIcon, GroupIcon } from "../components/icons";
import { newElementWith } from "../element/mutateElement";
import { getSelectedElements, isSomeElementSelected } from "../scene";
import {
getSelectedGroupIds,
selectGroup,
selectGroupsForSelectedElements,
getElementsInGroup,
addToGroup,
removeFromSelectedGroups,
isElementInGroup,
} from "../groups";
import { getNonDeletedElements } from "../element";
import { randomId } from "../random";
import { ToolButton } from "../components/ToolButton";
import { ExcalidrawElement } from "../element/types";
import { AppState } from "../types";
const allElementsInSameGroup = (elements: readonly ExcalidrawElement[]) => {
if (elements.length >= 2) {
const groupIds = elements[0].groupIds;
for (const groupId of groupIds) {
if (
elements.reduce(
(acc, element) => acc && isElementInGroup(element, groupId),
true,
)
) {
return true;
}
}
}
return false;
};
const enableActionGroup = (
elements: readonly ExcalidrawElement[],
appState: AppState,
) => {
const selectedElements = getSelectedElements(
getNonDeletedElements(elements),
appState,
);
return (
selectedElements.length >= 2 && !allElementsInSameGroup(selectedElements)
);
};
export const actionGroup = register({
name: "group",
perform: (elements, appState) => {
const selectedElements = getSelectedElements(
getNonDeletedElements(elements),
appState,
);
if (selectedElements.length < 2) {
// nothing to group
return { appState, elements, commitToHistory: false };
}
// if everything is already grouped into 1 group, there is nothing to do
const selectedGroupIds = getSelectedGroupIds(appState);
if (selectedGroupIds.length === 1) {
const selectedGroupId = selectedGroupIds[0];
const elementIdsInGroup = new Set(
getElementsInGroup(elements, selectedGroupId).map(
(element) => element.id,
),
);
const selectedElementIds = new Set(
selectedElements.map((element) => element.id),
);
const combinedSet = new Set([
...Array.from(elementIdsInGroup),
...Array.from(selectedElementIds),
]);
if (combinedSet.size === elementIdsInGroup.size) {
// no incremental ids in the selected ids
return { appState, elements, commitToHistory: false };
}
}
const newGroupId = randomId();
const updatedElements = elements.map((element) => {
if (!appState.selectedElementIds[element.id]) {
return element;
}
return newElementWith(element, {
groupIds: addToGroup(
element.groupIds,
newGroupId,
appState.editingGroupId,
),
});
});
// keep the z order within the group the same, but move them
// to the z order of the highest element in the layer stack
const elementsInGroup = getElementsInGroup(updatedElements, newGroupId);
const lastElementInGroup = elementsInGroup[elementsInGroup.length - 1];
const lastGroupElementIndex = updatedElements.lastIndexOf(
lastElementInGroup,
);
const elementsAfterGroup = updatedElements.slice(lastGroupElementIndex + 1);
const elementsBeforeGroup = updatedElements
.slice(0, lastGroupElementIndex)
.filter(
(updatedElement) => !isElementInGroup(updatedElement, newGroupId),
);
const updatedElementsInOrder = [
...elementsBeforeGroup,
...elementsInGroup,
...elementsAfterGroup,
];
return {
appState: selectGroup(
newGroupId,
{ ...appState, selectedGroupIds: {} },
getNonDeletedElements(updatedElementsInOrder),
),
elements: updatedElementsInOrder,
commitToHistory: true,
};
},
contextItemLabel: "labels.group",
contextItemPredicate: (elements, appState) =>
enableActionGroup(elements, appState),
keyTest: (event) =>
!event.shiftKey && event[KEYS.CTRL_OR_CMD] && event.code === CODES.G,
PanelComponent: ({ elements, appState, updateData }) => (
<ToolButton
hidden={!enableActionGroup(elements, appState)}
type="button"
icon={<GroupIcon appearance={appState.appearance} />}
onClick={() => updateData(null)}
title={`${t("labels.group")}${getShortcutKey("CtrlOrCmd+G")}`}
aria-label={t("labels.group")}
visible={isSomeElementSelected(getNonDeletedElements(elements), appState)}
></ToolButton>
),
});
export const actionUngroup = register({
name: "ungroup",
perform: (elements, appState) => {
const groupIds = getSelectedGroupIds(appState);
if (groupIds.length === 0) {
return { appState, elements, commitToHistory: false };
}
const nextElements = elements.map((element) => {
const nextGroupIds = removeFromSelectedGroups(
element.groupIds,
appState.selectedGroupIds,
);
if (nextGroupIds.length === element.groupIds.length) {
return element;
}
return newElementWith(element, {
groupIds: nextGroupIds,
});
});
return {
appState: selectGroupsForSelectedElements(
{ ...appState, selectedGroupIds: {} },
getNonDeletedElements(nextElements),
),
elements: nextElements,
commitToHistory: true,
};
},
keyTest: (event) =>
event.shiftKey && event[KEYS.CTRL_OR_CMD] && event.code === CODES.G,
contextItemLabel: "labels.ungroup",
contextItemPredicate: (elements, appState) =>
getSelectedGroupIds(appState).length > 0,
PanelComponent: ({ elements, appState, updateData }) => (
<ToolButton
type="button"
hidden={getSelectedGroupIds(appState).length === 0}
icon={<UngroupIcon appearance={appState.appearance} />}
onClick={() => updateData(null)}
title={`${t("labels.ungroup")}${getShortcutKey("CtrlOrCmd+Shift+G")}`}
aria-label={t("labels.ungroup")}
visible={isSomeElementSelected(getNonDeletedElements(elements), appState)}
></ToolButton>
),
});

View File

@ -3,20 +3,18 @@ import React from "react";
import { undo, redo } from "../components/icons";
import { ToolButton } from "../components/ToolButton";
import { t } from "../i18n";
import { SceneHistory } from "../history";
import { SceneHistory, HistoryEntry } from "../history";
import { ExcalidrawElement } from "../element/types";
import { AppState } from "../types";
import { KEYS } from "../keys";
import { isWindows, KEYS } from "../keys";
import { getElementMap } from "../element";
import { newElementWith } from "../element/mutateElement";
import { fixBindingsAfterDeletion } from "../element/binding";
const writeData = (
prevElements: readonly ExcalidrawElement[],
appState: AppState,
updater: () => {
elements: ExcalidrawElement[];
appState: AppState;
} | null,
updater: () => HistoryEntry | null,
): ActionResult => {
const commitToHistory = false;
if (
@ -33,40 +31,44 @@ const writeData = (
const prevElementMap = getElementMap(prevElements);
const nextElements = data.elements;
const nextElementMap = getElementMap(nextElements);
return {
elements: nextElements
.map((nextElement) =>
newElementWith(
prevElementMap[nextElement.id] || nextElement,
nextElement,
),
)
.concat(
prevElements
.filter(
(prevElement) => !nextElementMap.hasOwnProperty(prevElement.id),
)
.map((prevElement) =>
newElementWith(prevElement, { isDeleted: true }),
),
const deletedElements = prevElements.filter(
(prevElement) => !nextElementMap.hasOwnProperty(prevElement.id),
);
const elements = nextElements
.map((nextElement) =>
newElementWith(
prevElementMap[nextElement.id] || nextElement,
nextElement,
),
)
.concat(
deletedElements.map((prevElement) =>
newElementWith(prevElement, { isDeleted: true }),
),
);
fixBindingsAfterDeletion(elements, deletedElements);
return {
elements,
appState: { ...appState, ...data.appState },
commitToHistory,
syncHistory: true,
};
}
return { commitToHistory };
};
const testUndo = (shift: boolean) => (event: KeyboardEvent) =>
event[KEYS.CTRL_OR_CMD] && /z/i.test(event.key) && event.shiftKey === shift;
type ActionCreator = (history: SceneHistory) => Action;
export const createUndoAction: ActionCreator = (history) => ({
name: "undo",
perform: (elements, appState) =>
writeData(elements, appState, () => history.undoOnce()),
keyTest: testUndo(false),
keyTest: (event) =>
event[KEYS.CTRL_OR_CMD] &&
event.key.toLowerCase() === KEYS.Z &&
!event.shiftKey,
PanelComponent: ({ updateData }) => (
<ToolButton
type="button"
@ -82,7 +84,11 @@ export const createRedoAction: ActionCreator = (history) => ({
name: "redo",
perform: (elements, appState) =>
writeData(elements, appState, () => history.redoOnce()),
keyTest: testUndo(true),
keyTest: (event) =>
(event[KEYS.CTRL_OR_CMD] &&
event.shiftKey &&
event.key.toLowerCase() === KEYS.Z) ||
(isWindows && event.ctrlKey && !event.shiftKey && event.key === KEYS.Y),
PanelComponent: ({ updateData }) => (
<ToolButton
type="button"

View File

@ -5,7 +5,7 @@ import { t } from "../i18n";
import { showSelectedShapeActions, getNonDeletedElements } from "../element";
import { register } from "./register";
import { allowFullScreen, exitFullScreen, isFullScreen } from "../utils";
import { KEYS } from "../keys";
import { CODES, KEYS } from "../keys";
import { HelpIcon } from "../components/HelpIcon";
export const actionToggleCanvasMenu = register({
@ -65,7 +65,7 @@ export const actionFullScreen = register({
commitToHistory: false,
};
},
keyTest: (event) => event.keyCode === KEYS.F_KEY_CODE,
keyTest: (event) => event.code === CODES.F && !event[KEYS.CTRL_OR_CMD],
});
export const actionShortcuts = register({
@ -74,13 +74,13 @@ export const actionShortcuts = register({
return {
appState: {
...appState,
showShortcutsDialog: true,
showHelpDialog: !appState.showHelpDialog,
},
commitToHistory: false,
};
},
PanelComponent: ({ updateData }) => (
<HelpIcon title={t("shortcutsDialog.title")} onClick={updateData} />
<HelpIcon title={t("helpDialog.title")} onClick={updateData} />
),
keyTest: (event) => event.key === KEYS.QUESTION_MARK,
});

View File

@ -0,0 +1,58 @@
import React from "react";
import { getClientColors, getClientInitials } from "../clients";
import { Avatar } from "../components/Avatar";
import { centerScrollOn } from "../scene/scroll";
import { Collaborator } from "../types";
import { register } from "./register";
export const actionGoToCollaborator = register({
name: "goToCollaborator",
perform: (_elements, appState, value) => {
const point = value as Collaborator["pointer"];
if (!point) {
return { appState, commitToHistory: false };
}
return {
appState: {
...appState,
...centerScrollOn({
scenePoint: point,
viewportDimensions: {
width: appState.width,
height: appState.height,
},
zoom: appState.zoom,
}),
// Close mobile menu
openMenu: appState.openMenu === "canvas" ? null : appState.openMenu,
},
commitToHistory: false,
};
},
PanelComponent: ({ appState, updateData, id }) => {
const clientId = id;
if (!clientId) {
return null;
}
const collaborator = appState.collaborators.get(clientId);
if (!collaborator) {
return null;
}
const { background, stroke } = getClientColors(clientId, appState);
const shortName = getClientInitials(collaborator.username);
return (
<Avatar
color={background}
border={stroke}
onClick={() => updateData(collaborator.pointer)}
>
{shortName}
</Avatar>
);
},
});

View File

@ -1,25 +1,53 @@
import React from "react";
import {
ExcalidrawElement,
ExcalidrawTextElement,
TextAlign,
} from "../element/types";
import {
getCommonAttributeOfSelectedElements,
isSomeElementSelected,
} from "../scene";
import { AppState } from "../../src/types";
import { ButtonIconSelect } from "../components/ButtonIconSelect";
import { ButtonSelect } from "../components/ButtonSelect";
import { ColorPicker } from "../components/ColorPicker";
import { IconPicker } from "../components/IconPicker";
import {
ArrowheadArrowIcon,
ArrowheadBarIcon,
ArrowheadDotIcon,
ArrowheadNoneIcon,
EdgeRoundIcon,
EdgeSharpIcon,
FillCrossHatchIcon,
FillHachureIcon,
FillSolidIcon,
SloppinessArchitectIcon,
SloppinessArtistIcon,
SloppinessCartoonistIcon,
StrokeStyleDashedIcon,
StrokeStyleDottedIcon,
StrokeStyleSolidIcon,
StrokeWidthIcon,
} from "../components/icons";
import { DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE } from "../constants";
import {
getNonDeletedElements,
isTextElement,
redrawTextBoundingBox,
getNonDeletedElements,
} from "../element";
import { ColorPicker } from "../components/ColorPicker";
import { AppState } from "../../src/types";
import { t } from "../i18n";
import { DEFAULT_FONT } from "../appState";
import { register } from "./register";
import { newElementWith } from "../element/mutateElement";
import { isLinearElement, isLinearElementType } from "../element/typeChecks";
import {
Arrowhead,
ExcalidrawElement,
ExcalidrawLinearElement,
ExcalidrawTextElement,
FontFamily,
TextAlign,
} from "../element/types";
import { getLanguage, t } from "../i18n";
import { randomInteger } from "../random";
import {
canChangeSharpness,
canHaveArrowheads,
getCommonAttributeOfSelectedElements,
getTargetElements,
isSomeElementSelected,
} from "../scene";
import { register } from "./register";
const changeProperty = (
elements: readonly ExcalidrawElement[],
@ -136,11 +164,23 @@ export const actionChangeFillStyle = register({
PanelComponent: ({ elements, appState, updateData }) => (
<fieldset>
<legend>{t("labels.fill")}</legend>
<ButtonSelect
<ButtonIconSelect
options={[
{ value: "hachure", text: t("labels.hachure") },
{ value: "cross-hatch", text: t("labels.crossHatch") },
{ value: "solid", text: t("labels.solid") },
{
value: "hachure",
text: t("labels.hachure"),
icon: <FillHachureIcon appearance={appState.appearance} />,
},
{
value: "cross-hatch",
text: t("labels.crossHatch"),
icon: <FillCrossHatchIcon appearance={appState.appearance} />,
},
{
value: "solid",
text: t("labels.solid"),
icon: <FillSolidIcon appearance={appState.appearance} />,
},
]}
group="fill"
value={getFormValue(
@ -173,12 +213,39 @@ export const actionChangeStrokeWidth = register({
PanelComponent: ({ elements, appState, updateData }) => (
<fieldset>
<legend>{t("labels.strokeWidth")}</legend>
<ButtonSelect
<ButtonIconSelect
group="stroke-width"
options={[
{ value: 1, text: t("labels.thin") },
{ value: 2, text: t("labels.bold") },
{ value: 4, text: t("labels.extraBold") },
{
value: 1,
text: t("labels.thin"),
icon: (
<StrokeWidthIcon
appearance={appState.appearance}
strokeWidth={2}
/>
),
},
{
value: 2,
text: t("labels.bold"),
icon: (
<StrokeWidthIcon
appearance={appState.appearance}
strokeWidth={6}
/>
),
},
{
value: 4,
text: t("labels.extraBold"),
icon: (
<StrokeWidthIcon
appearance={appState.appearance}
strokeWidth={10}
/>
),
},
]}
value={getFormValue(
elements,
@ -198,6 +265,7 @@ export const actionChangeSloppiness = register({
return {
elements: changeProperty(elements, appState, (el) =>
newElementWith(el, {
seed: randomInteger(),
roughness: value,
}),
),
@ -208,12 +276,24 @@ export const actionChangeSloppiness = register({
PanelComponent: ({ elements, appState, updateData }) => (
<fieldset>
<legend>{t("labels.sloppiness")}</legend>
<ButtonSelect
<ButtonIconSelect
group="sloppiness"
options={[
{ value: 0, text: t("labels.architect") },
{ value: 1, text: t("labels.artist") },
{ value: 2, text: t("labels.cartoonist") },
{
value: 0,
text: t("labels.architect"),
icon: <SloppinessArchitectIcon appearance={appState.appearance} />,
},
{
value: 1,
text: t("labels.artist"),
icon: <SloppinessArtistIcon appearance={appState.appearance} />,
},
{
value: 2,
text: t("labels.cartoonist"),
icon: <SloppinessCartoonistIcon appearance={appState.appearance} />,
},
]}
value={getFormValue(
elements,
@ -227,6 +307,53 @@ export const actionChangeSloppiness = register({
),
});
export const actionChangeStrokeStyle = register({
name: "changeStrokeStyle",
perform: (elements, appState, value) => {
return {
elements: changeProperty(elements, appState, (el) =>
newElementWith(el, {
strokeStyle: value,
}),
),
appState: { ...appState, currentItemStrokeStyle: value },
commitToHistory: true,
};
},
PanelComponent: ({ elements, appState, updateData }) => (
<fieldset>
<legend>{t("labels.strokeStyle")}</legend>
<ButtonIconSelect
group="strokeStyle"
options={[
{
value: "solid",
text: t("labels.strokeStyle_solid"),
icon: <StrokeStyleSolidIcon appearance={appState.appearance} />,
},
{
value: "dashed",
text: t("labels.strokeStyle_dashed"),
icon: <StrokeStyleDashedIcon appearance={appState.appearance} />,
},
{
value: "dotted",
text: t("labels.strokeStyle_dotted"),
icon: <StrokeStyleDottedIcon appearance={appState.appearance} />,
},
]}
value={getFormValue(
elements,
appState,
(element) => element.strokeStyle,
appState.currentItemStrokeStyle,
)}
onChange={(value) => updateData(value)}
/>
</fieldset>
),
});
export const actionChangeOpacity = register({
name: "changeOpacity",
perform: (elements, appState, value) => {
@ -283,7 +410,7 @@ export const actionChangeFontSize = register({
elements: changeProperty(elements, appState, (el) => {
if (isTextElement(el)) {
const element: ExcalidrawTextElement = newElementWith(el, {
font: `${value}px ${el.font.split("px ")[1]}`,
fontSize: value,
});
redrawTextBoundingBox(element);
return element;
@ -293,9 +420,7 @@ export const actionChangeFontSize = register({
}),
appState: {
...appState,
currentItemFont: `${value}px ${
appState.currentItemFont.split("px ")[1]
}`,
currentItemFontSize: value,
},
commitToHistory: true,
};
@ -314,8 +439,8 @@ export const actionChangeFontSize = register({
value={getFormValue(
elements,
appState,
(element) => isTextElement(element) && +element.font.split("px ")[0],
+(appState.currentItemFont || DEFAULT_FONT).split("px ")[0],
(element) => isTextElement(element) && element.fontSize,
appState.currentItemFontSize || DEFAULT_FONT_SIZE,
)}
onChange={(value) => updateData(value)}
/>
@ -330,7 +455,7 @@ export const actionChangeFontFamily = register({
elements: changeProperty(elements, appState, (el) => {
if (isTextElement(el)) {
const element: ExcalidrawTextElement = newElementWith(el, {
font: `${el.font.split("px ")[0]}px ${value}`,
fontFamily: value,
});
redrawTextBoundingBox(element);
return element;
@ -340,33 +465,35 @@ export const actionChangeFontFamily = register({
}),
appState: {
...appState,
currentItemFont: `${
appState.currentItemFont.split("px ")[0]
}px ${value}`,
currentItemFontFamily: value,
},
commitToHistory: true,
};
},
PanelComponent: ({ elements, appState, updateData }) => (
<fieldset>
<legend>{t("labels.fontFamily")}</legend>
<ButtonSelect
group="font-family"
options={[
{ value: "Virgil", text: t("labels.handDrawn") },
{ value: "Helvetica", text: t("labels.normal") },
{ value: "Cascadia", text: t("labels.code") },
]}
value={getFormValue(
elements,
appState,
(element) => isTextElement(element) && element.font.split("px ")[1],
(appState.currentItemFont || DEFAULT_FONT).split("px ")[1],
)}
onChange={(value) => updateData(value)}
/>
</fieldset>
),
PanelComponent: ({ elements, appState, updateData }) => {
const options: { value: FontFamily; text: string }[] = [
{ value: 1, text: t("labels.handDrawn") },
{ value: 2, text: t("labels.normal") },
{ value: 3, text: t("labels.code") },
];
return (
<fieldset>
<legend>{t("labels.fontFamily")}</legend>
<ButtonSelect<FontFamily | false>
group="font-family"
options={options}
value={getFormValue(
elements,
appState,
(element) => isTextElement(element) && element.fontFamily,
appState.currentItemFontFamily || DEFAULT_FONT_FAMILY,
)}
onChange={(value) => updateData(value)}
/>
</fieldset>
);
},
});
export const actionChangeTextAlign = register({
@ -412,3 +539,225 @@ export const actionChangeTextAlign = register({
</fieldset>
),
});
export const actionChangeSharpness = register({
name: "changeSharpness",
perform: (elements, appState, value) => {
const targetElements = getTargetElements(
getNonDeletedElements(elements),
appState,
);
const shouldUpdateForNonLinearElements = targetElements.length
? targetElements.every((el) => !isLinearElement(el))
: !isLinearElementType(appState.elementType);
const shouldUpdateForLinearElements = targetElements.length
? targetElements.every(isLinearElement)
: isLinearElementType(appState.elementType);
return {
elements: changeProperty(elements, appState, (el) =>
newElementWith(el, {
strokeSharpness: value,
}),
),
appState: {
...appState,
currentItemStrokeSharpness: shouldUpdateForNonLinearElements
? value
: appState.currentItemStrokeSharpness,
currentItemLinearStrokeSharpness: shouldUpdateForLinearElements
? value
: appState.currentItemLinearStrokeSharpness,
},
commitToHistory: true,
};
},
PanelComponent: ({ elements, appState, updateData }) => (
<fieldset>
<legend>{t("labels.edges")}</legend>
<ButtonIconSelect
group="edges"
options={[
{
value: "sharp",
text: t("labels.sharp"),
icon: <EdgeSharpIcon appearance={appState.appearance} />,
},
{
value: "round",
text: t("labels.round"),
icon: <EdgeRoundIcon appearance={appState.appearance} />,
},
]}
value={getFormValue(
elements,
appState,
(element) => element.strokeSharpness,
(canChangeSharpness(appState.elementType) &&
(isLinearElementType(appState.elementType)
? appState.currentItemLinearStrokeSharpness
: appState.currentItemStrokeSharpness)) ||
null,
)}
onChange={(value) => updateData(value)}
/>
</fieldset>
),
});
export const actionChangeArrowhead = register({
name: "changeArrowhead",
perform: (
elements,
appState,
value: { position: "start" | "end"; type: Arrowhead },
) => {
return {
elements: changeProperty(elements, appState, (el) => {
if (isLinearElement(el)) {
const { position, type } = value;
if (position === "start") {
const element: ExcalidrawLinearElement = newElementWith(el, {
startArrowhead: type,
});
return element;
} else if (position === "end") {
const element: ExcalidrawLinearElement = newElementWith(el, {
endArrowhead: type,
});
return element;
}
}
return el;
}),
appState: {
...appState,
[value.position === "start"
? "currentItemStartArrowhead"
: "currentItemEndArrowhead"]: value.type,
},
commitToHistory: true,
};
},
PanelComponent: ({ elements, appState, updateData }) => {
const isRTL = getLanguage().rtl;
return (
<fieldset>
<legend>{t("labels.arrowheads")}</legend>
<div className="iconSelectList">
<IconPicker
label="arrowhead_start"
options={[
{
value: null,
text: t("labels.arrowhead_none"),
icon: <ArrowheadNoneIcon appearance={appState.appearance} />,
keyBinding: "q",
},
{
value: "arrow",
text: t("labels.arrowhead_arrow"),
icon: (
<ArrowheadArrowIcon
appearance={appState.appearance}
flip={!isRTL}
/>
),
keyBinding: "w",
},
{
value: "bar",
text: t("labels.arrowhead_bar"),
icon: (
<ArrowheadBarIcon
appearance={appState.appearance}
flip={!isRTL}
/>
),
keyBinding: "e",
},
{
value: "dot",
text: t("labels.arrowhead_dot"),
icon: (
<ArrowheadDotIcon
appearance={appState.appearance}
flip={!isRTL}
/>
),
keyBinding: "r",
},
]}
value={getFormValue<Arrowhead | null>(
elements,
appState,
(element) =>
isLinearElement(element) && canHaveArrowheads(element.type)
? element.startArrowhead
: appState.currentItemStartArrowhead,
appState.currentItemStartArrowhead,
)}
onChange={(value) => updateData({ position: "start", type: value })}
/>
<IconPicker
label="arrowhead_end"
group="arrowheads"
options={[
{
value: null,
text: t("labels.arrowhead_none"),
keyBinding: "q",
icon: <ArrowheadNoneIcon appearance={appState.appearance} />,
},
{
value: "arrow",
text: t("labels.arrowhead_arrow"),
keyBinding: "w",
icon: (
<ArrowheadArrowIcon
appearance={appState.appearance}
flip={isRTL}
/>
),
},
{
value: "bar",
text: t("labels.arrowhead_bar"),
keyBinding: "e",
icon: (
<ArrowheadBarIcon
appearance={appState.appearance}
flip={isRTL}
/>
),
},
{
value: "dot",
text: t("labels.arrowhead_dot"),
keyBinding: "r",
icon: (
<ArrowheadDotIcon
appearance={appState.appearance}
flip={isRTL}
/>
),
},
]}
value={getFormValue<Arrowhead | null>(
elements,
appState,
(element) =>
isLinearElement(element) && canHaveArrowheads(element.type)
? element.endArrowhead
: appState.currentItemEndArrowhead,
appState.currentItemEndArrowhead,
)}
onChange={(value) => updateData({ position: "end", type: value })}
/>
</div>
</fieldset>
);
},
});

View File

@ -1,22 +1,31 @@
import { KEYS } from "../keys";
import { register } from "./register";
import { selectGroupsForSelectedElements } from "../groups";
import { getNonDeletedElements } from "../element";
export const actionSelectAll = register({
name: "selectAll",
perform: (elements, appState) => {
if (appState.editingLinearElement) {
return false;
}
return {
appState: {
...appState,
selectedElementIds: elements.reduce((map, element) => {
if (!element.isDeleted) {
map[element.id] = true;
}
return map;
}, {} as any),
},
appState: selectGroupsForSelectedElements(
{
...appState,
editingGroupId: null,
selectedElementIds: elements.reduce((map, element) => {
if (!element.isDeleted) {
map[element.id] = true;
}
return map;
}, {} as any),
},
getNonDeletedElements(elements),
),
commitToHistory: true,
};
},
contextItemLabel: "labels.selectAll",
keyTest: (event) => event[KEYS.CTRL_OR_CMD] && event.key === "a",
keyTest: (event) => event[KEYS.CTRL_OR_CMD] && event.key === KEYS.A,
});

View File

@ -3,12 +3,18 @@ import {
isExcalidrawElement,
redrawTextBoundingBox,
} from "../element";
import { KEYS } from "../keys";
import { DEFAULT_FONT, DEFAULT_TEXT_ALIGN } from "../appState";
import { CODES, KEYS } from "../keys";
import { t } from "../i18n";
import { register } from "./register";
import { mutateElement, newElementWith } from "../element/mutateElement";
import {
DEFAULT_FONT_SIZE,
DEFAULT_FONT_FAMILY,
DEFAULT_TEXT_ALIGN,
} from "../constants";
let copiedStyles: string = "{}";
// `copiedStyles` is exported only for tests.
export let copiedStyles: string = "{}";
export const actionCopyStyles = register({
name: "copyStyles",
@ -18,13 +24,16 @@ export const actionCopyStyles = register({
copiedStyles = JSON.stringify(element);
}
return {
appState: {
...appState,
toastMessage: t("toast.copyStyles"),
},
commitToHistory: false,
};
},
contextItemLabel: "labels.copyStyles",
keyTest: (event) =>
event[KEYS.CTRL_OR_CMD] && event.shiftKey && event.key === "C",
contextMenuOrder: 0,
event[KEYS.CTRL_OR_CMD] && event.altKey && event.code === CODES.C,
});
export const actionPasteStyles = register({
@ -41,13 +50,15 @@ export const actionPasteStyles = register({
backgroundColor: pastedElement?.backgroundColor,
strokeWidth: pastedElement?.strokeWidth,
strokeColor: pastedElement?.strokeColor,
strokeStyle: pastedElement?.strokeStyle,
fillStyle: pastedElement?.fillStyle,
opacity: pastedElement?.opacity,
roughness: pastedElement?.roughness,
});
if (isTextElement(newElement)) {
mutateElement(newElement, {
font: pastedElement?.font || DEFAULT_FONT,
fontSize: pastedElement?.fontSize || DEFAULT_FONT_SIZE,
fontFamily: pastedElement?.fontFamily || DEFAULT_FONT_FAMILY,
textAlign: pastedElement?.textAlign || DEFAULT_TEXT_ALIGN,
});
redrawTextBoundingBox(newElement);
@ -61,6 +72,5 @@ export const actionPasteStyles = register({
},
contextItemLabel: "labels.pasteStyles",
keyTest: (event) =>
event[KEYS.CTRL_OR_CMD] && event.shiftKey && event.key === "V",
contextMenuOrder: 1,
event[KEYS.CTRL_OR_CMD] && event.altKey && event.code === CODES.V,
});

View File

@ -0,0 +1,22 @@
import { CODES, KEYS } from "../keys";
import { register } from "./register";
import { GRID_SIZE } from "../constants";
import { AppState } from "../types";
import { trackEvent } from "../analytics";
export const actionToggleGridMode = register({
name: "gridMode",
perform(elements, appState) {
trackEvent("view", "mode", "grid");
return {
appState: {
...appState,
gridSize: this.checked!(appState) ? null : GRID_SIZE,
},
commitToHistory: false,
};
},
checked: (appState: AppState) => appState.gridSize !== null,
contextItemLabel: "labels.showGrid",
keyTest: (event) => event[KEYS.CTRL_OR_CMD] && event.code === CODES.QUOTE,
});

View File

@ -0,0 +1,16 @@
import { register } from "./register";
export const actionToggleStats = register({
name: "stats",
perform(elements, appState) {
return {
appState: {
...appState,
showStats: !this.checked!(appState),
},
commitToHistory: false,
};
},
checked: (appState) => appState.showStats,
contextItemLabel: "stats.title",
});

View File

@ -0,0 +1,22 @@
import { CODES, KEYS } from "../keys";
import { register } from "./register";
import { trackEvent } from "../analytics";
export const actionToggleViewMode = register({
name: "viewMode",
perform(elements, appState) {
trackEvent("view", "mode", "view");
return {
appState: {
...appState,
viewModeEnabled: !this.checked!(appState),
selectedElementIds: {},
},
commitToHistory: false,
};
},
checked: (appState) => appState.viewModeEnabled,
contextItemLabel: "labels.viewMode",
keyTest: (event) =>
!event[KEYS.CTRL_OR_CMD] && event.altKey && event.code === CODES.R,
});

View File

@ -0,0 +1,22 @@
import { CODES, KEYS } from "../keys";
import { register } from "./register";
import { trackEvent } from "../analytics";
export const actionToggleZenMode = register({
name: "zenMode",
perform(elements, appState) {
trackEvent("view", "mode", "zen");
return {
appState: {
...appState,
zenModeEnabled: !this.checked!(appState),
},
commitToHistory: false,
};
},
checked: (appState) => appState.zenModeEnabled,
contextItemLabel: "buttons.zenMode",
keyTest: (event) =>
!event[KEYS.CTRL_OR_CMD] && event.altKey && event.code === CODES.Z,
});

View File

@ -5,79 +5,22 @@ import {
moveAllLeft,
moveAllRight,
} from "../zindex";
import { KEYS, isDarwin } from "../keys";
import { KEYS, isDarwin, CODES } from "../keys";
import { t } from "../i18n";
import { getShortcutKey } from "../utils";
import { register } from "./register";
import {
sendBackward,
bringToFront,
sendToBack,
bringForward,
SendBackwardIcon,
BringToFrontIcon,
SendToBackIcon,
BringForwardIcon,
} from "../components/icons";
import { ExcalidrawElement } from "../element/types";
import { AppState } from "../types";
function getElementIndices(
direction: "left" | "right",
elements: readonly ExcalidrawElement[],
appState: AppState,
) {
const selectedIndices: number[] = [];
let deletedIndicesCache: number[] = [];
function cb(element: ExcalidrawElement, index: number) {
if (element.isDeleted) {
// we want to build an array of deleted elements that are preceeding
// a selected element so that we move them together
deletedIndicesCache.push(index);
} else {
if (appState.selectedElementIds[element.id]) {
selectedIndices.push(...deletedIndicesCache, index);
}
// always empty cache of deleted elements after either pushing a group
// of selected/deleted elements, of after encountering non-deleted elem
deletedIndicesCache = [];
}
}
// sending back → select contiguous deleted elements that are to the left of
// selected element(s)
if (direction === "left") {
let i = -1;
const len = elements.length;
while (++i < len) {
cb(elements[i], i);
}
// moving to front → loop from right to left so that we don't need to
// backtrack when gathering deleted elements
} else {
let i = elements.length;
while (--i > -1) {
cb(elements[i], i);
}
}
// sort in case we were gathering indexes from right to left
return selectedIndices.sort();
}
function moveElements(
func: typeof moveOneLeft,
elements: readonly ExcalidrawElement[],
appState: AppState,
) {
const _elements = elements.slice();
const direction =
func === moveOneLeft || func === moveAllLeft ? "left" : "right";
const indices = getElementIndices(direction, _elements, appState);
return func(_elements, indices);
}
export const actionSendBackward = register({
name: "sendBackward",
perform: (elements, appState) => {
return {
elements: moveElements(moveOneLeft, elements, appState),
elements: moveOneLeft(elements, appState),
appState,
commitToHistory: true,
};
@ -85,15 +28,17 @@ export const actionSendBackward = register({
contextItemLabel: "labels.sendBackward",
keyPriority: 40,
keyTest: (event) =>
event[KEYS.CTRL_OR_CMD] && !event.shiftKey && event.code === "BracketLeft",
PanelComponent: ({ updateData }) => (
event[KEYS.CTRL_OR_CMD] &&
!event.shiftKey &&
event.code === CODES.BRACKET_LEFT,
PanelComponent: ({ updateData, appState }) => (
<button
type="button"
className="zIndexButton"
onClick={() => updateData(null)}
title={`${t("labels.sendBackward")}${getShortcutKey("CtrlOrCmd+[")}`}
>
{sendBackward}
<SendBackwardIcon appearance={appState.appearance} />
</button>
),
});
@ -102,7 +47,7 @@ export const actionBringForward = register({
name: "bringForward",
perform: (elements, appState) => {
return {
elements: moveElements(moveOneRight, elements, appState),
elements: moveOneRight(elements, appState),
appState,
commitToHistory: true,
};
@ -110,15 +55,17 @@ export const actionBringForward = register({
contextItemLabel: "labels.bringForward",
keyPriority: 40,
keyTest: (event) =>
event[KEYS.CTRL_OR_CMD] && !event.shiftKey && event.code === "BracketRight",
PanelComponent: ({ updateData }) => (
event[KEYS.CTRL_OR_CMD] &&
!event.shiftKey &&
event.code === CODES.BRACKET_RIGHT,
PanelComponent: ({ updateData, appState }) => (
<button
type="button"
className="zIndexButton"
onClick={() => updateData(null)}
title={`${t("labels.bringForward")}${getShortcutKey("CtrlOrCmd+]")}`}
>
{bringForward}
<BringForwardIcon appearance={appState.appearance} />
</button>
),
});
@ -127,20 +74,21 @@ export const actionSendToBack = register({
name: "sendToBack",
perform: (elements, appState) => {
return {
elements: moveElements(moveAllLeft, elements, appState),
elements: moveAllLeft(elements, appState),
appState,
commitToHistory: true,
};
},
contextItemLabel: "labels.sendToBack",
keyTest: (event) => {
return isDarwin
? event[KEYS.CTRL_OR_CMD] && event.altKey && event.code === "BracketLeft"
keyTest: (event) =>
isDarwin
? event[KEYS.CTRL_OR_CMD] &&
event.altKey &&
event.code === CODES.BRACKET_LEFT
: event[KEYS.CTRL_OR_CMD] &&
event.shiftKey &&
event.code === "BracketLeft";
},
PanelComponent: ({ updateData }) => (
event.shiftKey &&
event.code === CODES.BRACKET_LEFT,
PanelComponent: ({ updateData, appState }) => (
<button
type="button"
className="zIndexButton"
@ -151,7 +99,7 @@ export const actionSendToBack = register({
: getShortcutKey("CtrlOrCmd+Shift+[")
}`}
>
{sendToBack}
<SendToBackIcon appearance={appState.appearance} />
</button>
),
});
@ -160,20 +108,21 @@ export const actionBringToFront = register({
name: "bringToFront",
perform: (elements, appState) => {
return {
elements: moveElements(moveAllRight, elements, appState),
elements: moveAllRight(elements, appState),
appState,
commitToHistory: true,
};
},
contextItemLabel: "labels.bringToFront",
keyTest: (event) => {
return isDarwin
? event[KEYS.CTRL_OR_CMD] && event.altKey && event.code === "BracketRight"
keyTest: (event) =>
isDarwin
? event[KEYS.CTRL_OR_CMD] &&
event.altKey &&
event.code === CODES.BRACKET_RIGHT
: event[KEYS.CTRL_OR_CMD] &&
event.shiftKey &&
event.code === "BracketRight";
},
PanelComponent: ({ updateData }) => (
event.shiftKey &&
event.code === CODES.BRACKET_RIGHT,
PanelComponent: ({ updateData, appState }) => (
<button
type="button"
className="zIndexButton"
@ -184,7 +133,7 @@ export const actionBringToFront = register({
: getShortcutKey("CtrlOrCmd+Shift+]")
}`}
>
{bringToFront}
<BringToFrontIcon appearance={appState.appearance} />
</button>
),
});

View File

@ -34,6 +34,7 @@ export {
actionChangeProjectName,
actionChangeExportBackground,
actionSaveScene,
actionSaveAsScene,
actionLoadScene,
} from "./actionExport";
@ -44,3 +45,35 @@ export {
actionFullScreen,
actionShortcuts,
} from "./actionMenu";
export { actionGroup, actionUngroup } from "./actionGroup";
export { actionGoToCollaborator } from "./actionNavigate";
export { actionAddToLibrary } from "./actionAddToLibrary";
export {
actionAlignTop,
actionAlignBottom,
actionAlignLeft,
actionAlignRight,
actionAlignVerticallyCentered,
actionAlignHorizontallyCentered,
} from "./actionAlign";
export {
distributeHorizontally,
distributeVertically,
} from "./actionDistribute";
export {
actionCopy,
actionCut,
actionCopyAsPng,
actionCopyAsSvg,
} from "./actionClipboard";
export { actionToggleGridMode } from "./actionToggleGridMode";
export { actionToggleZenMode } from "./actionToggleZenMode";
export { actionToggleStats } from "./actionToggleStats";

View File

@ -3,33 +3,44 @@ import {
Action,
ActionsManagerInterface,
UpdaterFn,
ActionFilterFn,
ActionName,
ActionResult,
} from "./types";
import { ExcalidrawElement } from "../element/types";
import { AppState } from "../types";
import { t } from "../i18n";
import { globalSceneState } from "../scene";
import { AppState, ExcalidrawProps } from "../types";
import { MODES } from "../constants";
// This is the <App> component, but for now we don't care about anything but its
// `canvas` state.
type App = { canvas: HTMLCanvasElement | null; props: ExcalidrawProps };
export class ActionManager implements ActionsManagerInterface {
actions = {} as ActionsManagerInterface["actions"];
updater: UpdaterFn;
getAppState: () => AppState;
updater: (actionResult: ActionResult | Promise<ActionResult>) => void;
getAppState: () => Readonly<AppState>;
getElementsIncludingDeleted: () => readonly ExcalidrawElement[];
app: App;
constructor(
updater: UpdaterFn,
getAppState: () => AppState,
getElementsIncludingDeleted: () => ReturnType<
typeof globalSceneState["getElementsIncludingDeleted"]
>,
getElementsIncludingDeleted: () => readonly ExcalidrawElement[],
app: App,
) {
this.updater = updater;
this.updater = (actionResult) => {
if (actionResult && "then" in actionResult) {
actionResult.then((actionResult) => {
return updater(actionResult);
});
} else {
return updater(actionResult);
}
};
this.getAppState = getAppState;
this.getElementsIncludingDeleted = getElementsIncludingDeleted;
this.app = app;
}
registerAction(action: Action) {
@ -56,6 +67,12 @@ export class ActionManager implements ActionsManagerInterface {
if (data.length === 0) {
return false;
}
const { viewModeEnabled } = this.getAppState();
if (viewModeEnabled) {
if (!Object.values(MODES).includes(data[0].name)) {
return false;
}
}
event.preventDefault();
this.updater(
@ -63,6 +80,7 @@ export class ActionManager implements ActionsManagerInterface {
this.getElementsIncludingDeleted(),
this.getAppState(),
null,
this.app,
),
);
return true;
@ -74,34 +92,16 @@ export class ActionManager implements ActionsManagerInterface {
this.getElementsIncludingDeleted(),
this.getAppState(),
null,
this.app,
),
);
}
getContextMenuItems(actionFilter: ActionFilterFn = (action) => action) {
return Object.values(this.actions)
.filter(actionFilter)
.filter((action) => "contextItemLabel" in action)
.sort(
(a, b) =>
(a.contextMenuOrder !== undefined ? a.contextMenuOrder : 999) -
(b.contextMenuOrder !== undefined ? b.contextMenuOrder : 999),
)
.map((action) => ({
label: action.contextItemLabel ? t(action.contextItemLabel) : "",
action: () => {
this.updater(
action.perform(
this.getElementsIncludingDeleted(),
this.getAppState(),
null,
),
);
},
}));
}
renderAction = (name: ActionName) => {
// Id is an attribute that we can use to pass in data like keys.
// This is needed for dynamically generated action components
// like the user list. We can use this key to extract more
// data from app state. This is an alternative to generic prop hell!
renderAction = (name: ActionName, id?: string) => {
if (this.actions[name] && "PanelComponent" in this.actions[name]) {
const action = this.actions[name];
const PanelComponent = action.PanelComponent!;
@ -111,6 +111,7 @@ export class ActionManager implements ActionsManagerInterface {
this.getElementsIncludingDeleted(),
this.getAppState(),
formState,
this.app,
),
);
};
@ -120,6 +121,7 @@ export class ActionManager implements ActionsManagerInterface {
elements={this.getElementsIncludingDeleted()}
appState={this.getAppState()}
updateData={updateData}
id={id}
/>
);
}

View File

@ -2,7 +2,7 @@ import { Action } from "./types";
export let actions: readonly Action[] = [];
export function register(action: Action): Action {
export const register = (action: Action): Action => {
actions = actions.concat(action);
return action;
}
};

67
src/actions/shortcuts.ts Normal file
View File

@ -0,0 +1,67 @@
import { t } from "../i18n";
import { isDarwin } from "../keys";
import { getShortcutKey } from "../utils";
export type ShortcutName =
| "cut"
| "copy"
| "paste"
| "copyStyles"
| "pasteStyles"
| "selectAll"
| "deleteSelectedElements"
| "duplicateSelection"
| "sendBackward"
| "bringForward"
| "sendToBack"
| "bringToFront"
| "copyAsPng"
| "copyAsSvg"
| "group"
| "ungroup"
| "gridMode"
| "zenMode"
| "stats"
| "addToLibrary"
| "viewMode";
const shortcutMap: Record<ShortcutName, string[]> = {
cut: [getShortcutKey("CtrlOrCmd+X")],
copy: [getShortcutKey("CtrlOrCmd+C")],
paste: [getShortcutKey("CtrlOrCmd+V")],
copyStyles: [getShortcutKey("CtrlOrCmd+Alt+C")],
pasteStyles: [getShortcutKey("CtrlOrCmd+Alt+V")],
selectAll: [getShortcutKey("CtrlOrCmd+A")],
deleteSelectedElements: [getShortcutKey("Del")],
duplicateSelection: [
getShortcutKey("CtrlOrCmd+D"),
getShortcutKey(`Alt+${t("helpDialog.drag")}`),
],
sendBackward: [getShortcutKey("CtrlOrCmd+[")],
bringForward: [getShortcutKey("CtrlOrCmd+]")],
sendToBack: [
isDarwin
? getShortcutKey("CtrlOrCmd+Alt+[")
: getShortcutKey("CtrlOrCmd+Shift+["),
],
bringToFront: [
isDarwin
? getShortcutKey("CtrlOrCmd+Alt+]")
: getShortcutKey("CtrlOrCmd+Shift+]"),
],
copyAsPng: [getShortcutKey("Shift+Alt+C")],
copyAsSvg: [],
group: [getShortcutKey("CtrlOrCmd+G")],
ungroup: [getShortcutKey("CtrlOrCmd+Shift+G")],
gridMode: [getShortcutKey("CtrlOrCmd+'")],
zenMode: [getShortcutKey("Alt+Z")],
stats: [],
addToLibrary: [],
viewMode: [getShortcutKey("Alt+R")],
};
export const getShortcutFromShortcutName = (name: ShortcutName) => {
const shortcuts = shortcutMap[name];
// if multiple shortcuts availiable, take the first one
return shortcuts && shortcuts.length > 0 ? shortcuts[0] : "";
};

View File

@ -2,22 +2,32 @@ import React from "react";
import { ExcalidrawElement } from "../element/types";
import { AppState } from "../types";
export type ActionResult = {
elements?: readonly ExcalidrawElement[] | null;
appState?: AppState | null;
commitToHistory: boolean;
};
/** if false, the action should be prevented */
export type ActionResult =
| {
elements?: readonly ExcalidrawElement[] | null;
appState?: MarkOptional<AppState, "offsetTop" | "offsetLeft"> | null;
commitToHistory: boolean;
syncHistory?: boolean;
}
| false;
type ActionFn = (
elements: readonly ExcalidrawElement[],
appState: AppState,
appState: Readonly<AppState>,
formData: any,
) => ActionResult;
app: { canvas: HTMLCanvasElement | null },
) => ActionResult | Promise<ActionResult>;
export type UpdaterFn = (res: ActionResult, commitToHistory?: boolean) => void;
export type UpdaterFn = (res: ActionResult) => void;
export type ActionFilterFn = (action: Action) => void;
export type ActionName =
| "copy"
| "cut"
| "paste"
| "copyAsPng"
| "copyAsSvg"
| "sendBackward"
| "bringForward"
| "sendToBack"
@ -25,11 +35,16 @@ export type ActionName =
| "copyStyles"
| "selectAll"
| "pasteStyles"
| "gridMode"
| "zenMode"
| "stats"
| "changeStrokeColor"
| "changeBackgroundColor"
| "changeFillStyle"
| "changeStrokeWidth"
| "changeSloppiness"
| "changeStrokeStyle"
| "changeArrowhead"
| "changeOpacity"
| "changeFontSize"
| "toggleCanvasMenu"
@ -39,8 +54,10 @@ export type ActionName =
| "finalize"
| "changeProjectName"
| "changeExportBackground"
| "changeExportEmbedScene"
| "changeShouldAddWatermark"
| "saveScene"
| "saveAsScene"
| "loadScene"
| "duplicateSelection"
| "deleteSelectedElements"
@ -50,10 +67,25 @@ export type ActionName =
| "zoomOut"
| "resetZoom"
| "zoomToFit"
| "zoomToSelection"
| "changeFontFamily"
| "changeTextAlign"
| "toggleFullScreen"
| "toggleShortcuts";
| "toggleShortcuts"
| "group"
| "ungroup"
| "goToCollaborator"
| "addToLibrary"
| "changeSharpness"
| "alignTop"
| "alignBottom"
| "alignLeft"
| "alignRight"
| "alignVerticallyCentered"
| "alignHorizontallyCentered"
| "distributeHorizontally"
| "distributeVertically"
| "viewMode";
export interface Action {
name: ActionName;
@ -61,6 +93,7 @@ export interface Action {
elements: readonly ExcalidrawElement[];
appState: AppState;
updateData: (formData?: any) => void;
id?: string;
}>;
perform: ActionFn;
keyPriority?: number;
@ -70,17 +103,16 @@ export interface Action {
elements: readonly ExcalidrawElement[],
) => boolean;
contextItemLabel?: string;
contextMenuOrder?: number;
contextItemPredicate?: (
elements: readonly ExcalidrawElement[],
appState: AppState,
) => boolean;
checked?: (appState: Readonly<AppState>) => boolean;
}
export interface ActionsManagerInterface {
actions: {
[actionName in ActionName]: Action;
};
actions: Record<ActionName, Action>;
registerAction: (action: Action) => void;
handleKeyDown: (event: KeyboardEvent) => boolean;
getContextMenuItems: (
actionFilter: ActionFilterFn,
) => { label: string; action: () => void }[];
renderAction: (name: ActionName) => React.ReactElement | null;
}

95
src/align.ts Normal file
View File

@ -0,0 +1,95 @@
import { ExcalidrawElement } from "./element/types";
import { newElementWith } from "./element/mutateElement";
import { getCommonBounds } from "./element";
interface Box {
minX: number;
minY: number;
maxX: number;
maxY: number;
}
export interface Alignment {
position: "start" | "center" | "end";
axis: "x" | "y";
}
export const alignElements = (
selectedElements: ExcalidrawElement[],
alignment: Alignment,
): ExcalidrawElement[] => {
const groups: ExcalidrawElement[][] = getMaximumGroups(selectedElements);
const selectionBoundingBox = getCommonBoundingBox(selectedElements);
return groups.flatMap((group) => {
const translation = calculateTranslation(
group,
selectionBoundingBox,
alignment,
);
return group.map((element) =>
newElementWith(element, {
x: element.x + translation.x,
y: element.y + translation.y,
}),
);
});
};
export const getMaximumGroups = (
elements: ExcalidrawElement[],
): ExcalidrawElement[][] => {
const groups: Map<String, ExcalidrawElement[]> = new Map<
String,
ExcalidrawElement[]
>();
elements.forEach((element: ExcalidrawElement) => {
const groupId =
element.groupIds.length === 0
? element.id
: element.groupIds[element.groupIds.length - 1];
const currentGroupMembers = groups.get(groupId) || [];
groups.set(groupId, [...currentGroupMembers, element]);
});
return Array.from(groups.values());
};
const calculateTranslation = (
group: ExcalidrawElement[],
selectionBoundingBox: Box,
{ axis, position }: Alignment,
): { x: number; y: number } => {
const groupBoundingBox = getCommonBoundingBox(group);
const [min, max]: ["minX" | "minY", "maxX" | "maxY"] =
axis === "x" ? ["minX", "maxX"] : ["minY", "maxY"];
const noTranslation = { x: 0, y: 0 };
if (position === "start") {
return {
...noTranslation,
[axis]: selectionBoundingBox[min] - groupBoundingBox[min],
};
} else if (position === "end") {
return {
...noTranslation,
[axis]: selectionBoundingBox[max] - groupBoundingBox[max],
};
} // else if (position === "center") {
return {
...noTranslation,
[axis]:
(selectionBoundingBox[min] + selectionBoundingBox[max]) / 2 -
(groupBoundingBox[min] + groupBoundingBox[max]) / 2,
};
};
const getCommonBoundingBox = (elements: ExcalidrawElement[]): Box => {
const [minX, minY, maxX, maxY] = getCommonBounds(elements);
return { minX, minY, maxX, maxY };
};

18
src/analytics.ts Normal file
View File

@ -0,0 +1,18 @@
export const trackEvent =
typeof process !== "undefined" &&
process.env?.REACT_APP_GOOGLE_ANALYTICS_ID &&
typeof window !== "undefined" &&
window.gtag
? (category: string, name: string, label?: string, value?: number) => {
window.gtag("event", name, {
event_category: category,
event_label: label,
value,
});
}
: typeof process !== "undefined" && process.env?.JEST_WORKER_ID
? (category: string, name: string, label?: string, value?: number) => {}
: (category: string, name: string, label?: string, value?: number) => {
// Uncomment the next line to track locally
// console.info("Track Event", category, name, label, value);
};

View File

@ -1,96 +1,184 @@
import oc from "open-color";
import { AppState, FlooredNumber } from "./types";
import { getDateTime } from "./utils";
import {
DEFAULT_FONT_FAMILY,
DEFAULT_FONT_SIZE,
DEFAULT_TEXT_ALIGN,
} from "./constants";
import { t } from "./i18n";
import { AppState, NormalizedZoomValue } from "./types";
import { getDateTime } from "./utils";
export const DEFAULT_FONT = "20px Virgil";
export const DEFAULT_TEXT_ALIGN = "left";
export function getDefaultAppState(): AppState {
export const getDefaultAppState = (): Omit<
AppState,
"offsetTop" | "offsetLeft"
> => {
return {
isLoading: false,
errorMessage: null,
draggingElement: null,
resizingElement: null,
multiElement: null,
editingElement: null,
elementType: "selection",
elementLocked: false,
exportBackground: true,
shouldAddWatermark: false,
currentItemStrokeColor: oc.black,
appearance: "light",
collaborators: new Map(),
currentChartType: "bar",
currentItemBackgroundColor: "transparent",
currentItemEndArrowhead: "arrow",
currentItemFillStyle: "hachure",
currentItemStrokeWidth: 1,
currentItemRoughness: 1,
currentItemFontFamily: DEFAULT_FONT_FAMILY,
currentItemFontSize: DEFAULT_FONT_SIZE,
currentItemLinearStrokeSharpness: "round",
currentItemOpacity: 100,
currentItemFont: DEFAULT_FONT,
currentItemRoughness: 1,
currentItemStartArrowhead: null,
currentItemStrokeColor: oc.black,
currentItemStrokeSharpness: "sharp",
currentItemStrokeStyle: "solid",
currentItemStrokeWidth: 1,
currentItemTextAlign: DEFAULT_TEXT_ALIGN,
viewBackgroundColor: oc.white,
scrollX: 0 as FlooredNumber,
scrollY: 0 as FlooredNumber,
cursorX: 0,
cursorY: 0,
cursorButton: "up",
scrolledOutside: false,
name: `${t("labels.untitled")}-${getDateTime()}`,
username: "",
isCollaborating: false,
draggingElement: null,
editingElement: null,
editingGroupId: null,
editingLinearElement: null,
elementLocked: false,
elementType: "selection",
errorMessage: null,
exportBackground: true,
exportEmbedScene: false,
fileHandle: null,
gridSize: null,
height: window.innerHeight,
isBindingEnabled: true,
isLibraryOpen: false,
isLoading: false,
isResizing: false,
isRotating: false,
selectionElement: null,
zoom: 1,
openMenu: null,
lastPointerDownWith: "mouse",
multiElement: null,
name: `${t("labels.untitled")}-${getDateTime()}`,
openMenu: null,
pasteDialog: { shown: false, data: null },
previousSelectedElementIds: {},
resizingElement: null,
scrolledOutside: false,
scrollX: 0,
scrollY: 0,
selectedElementIds: {},
collaborators: new Map(),
selectedGroupIds: {},
selectionElement: null,
shouldAddWatermark: false,
shouldCacheIgnoreZoom: false,
showShortcutsDialog: false,
showHelpDialog: false,
showStats: false,
startBoundElement: null,
suggestedBindings: [],
toastMessage: null,
viewBackgroundColor: oc.white,
width: window.innerWidth,
zenModeEnabled: false,
zoom: { value: 1 as NormalizedZoomValue, translation: { x: 0, y: 0 } },
viewModeEnabled: false,
};
}
};
export function clearAppStateForLocalStorage(appState: AppState) {
const {
draggingElement,
resizingElement,
multiElement,
editingElement,
selectionElement,
isResizing,
isRotating,
collaborators,
isCollaborating,
isLoading,
errorMessage,
showShortcutsDialog,
...exportedState
} = appState;
return exportedState;
}
/**
* Config containing all AppState keys. Used to determine whether given state
* prop should be stripped when exporting to given storage type.
*/
const APP_STATE_STORAGE_CONF = (<
Values extends {
/** whether to keep when storing to browser storage (localStorage/IDB) */
browser: boolean;
/** whether to keep when exporting to file/database */
export: boolean;
},
T extends Record<keyof AppState, Values>
>(
config: { [K in keyof T]: K extends keyof AppState ? T[K] : never },
) => config)({
appearance: { browser: true, export: false },
collaborators: { browser: false, export: false },
currentChartType: { browser: true, export: false },
currentItemBackgroundColor: { browser: true, export: false },
currentItemEndArrowhead: { browser: true, export: false },
currentItemFillStyle: { browser: true, export: false },
currentItemFontFamily: { browser: true, export: false },
currentItemFontSize: { browser: true, export: false },
currentItemLinearStrokeSharpness: { browser: true, export: false },
currentItemOpacity: { browser: true, export: false },
currentItemRoughness: { browser: true, export: false },
currentItemStartArrowhead: { browser: true, export: false },
currentItemStrokeColor: { browser: true, export: false },
currentItemStrokeSharpness: { browser: true, export: false },
currentItemStrokeStyle: { browser: true, export: false },
currentItemStrokeWidth: { browser: true, export: false },
currentItemTextAlign: { browser: true, export: false },
cursorButton: { browser: true, export: false },
draggingElement: { browser: false, export: false },
editingElement: { browser: false, export: false },
editingGroupId: { browser: true, export: false },
editingLinearElement: { browser: false, export: false },
elementLocked: { browser: true, export: false },
elementType: { browser: true, export: false },
errorMessage: { browser: false, export: false },
exportBackground: { browser: true, export: false },
exportEmbedScene: { browser: true, export: false },
fileHandle: { browser: false, export: false },
gridSize: { browser: true, export: true },
height: { browser: false, export: false },
isBindingEnabled: { browser: false, export: false },
isLibraryOpen: { browser: false, export: false },
isLoading: { browser: false, export: false },
isResizing: { browser: false, export: false },
isRotating: { browser: false, export: false },
lastPointerDownWith: { browser: true, export: false },
multiElement: { browser: false, export: false },
name: { browser: true, export: false },
offsetLeft: { browser: false, export: false },
offsetTop: { browser: false, export: false },
openMenu: { browser: true, export: false },
pasteDialog: { browser: false, export: false },
previousSelectedElementIds: { browser: true, export: false },
resizingElement: { browser: false, export: false },
scrolledOutside: { browser: true, export: false },
scrollX: { browser: true, export: false },
scrollY: { browser: true, export: false },
selectedElementIds: { browser: true, export: false },
selectedGroupIds: { browser: true, export: false },
selectionElement: { browser: false, export: false },
shouldAddWatermark: { browser: true, export: false },
shouldCacheIgnoreZoom: { browser: true, export: false },
showHelpDialog: { browser: false, export: false },
showStats: { browser: true, export: false },
startBoundElement: { browser: false, export: false },
suggestedBindings: { browser: false, export: false },
toastMessage: { browser: false, export: false },
viewBackgroundColor: { browser: true, export: true },
width: { browser: false, export: false },
zenModeEnabled: { browser: true, export: false },
zoom: { browser: true, export: false },
viewModeEnabled: { browser: false, export: false },
});
export function clearAppStatePropertiesForHistory(
appState: AppState,
): Partial<AppState> {
return {
selectedElementIds: appState.selectedElementIds,
exportBackground: appState.exportBackground,
shouldAddWatermark: appState.shouldAddWatermark,
currentItemStrokeColor: appState.currentItemStrokeColor,
currentItemBackgroundColor: appState.currentItemBackgroundColor,
currentItemFillStyle: appState.currentItemFillStyle,
currentItemStrokeWidth: appState.currentItemStrokeWidth,
currentItemRoughness: appState.currentItemRoughness,
currentItemOpacity: appState.currentItemOpacity,
currentItemFont: appState.currentItemFont,
currentItemTextAlign: appState.currentItemTextAlign,
viewBackgroundColor: appState.viewBackgroundColor,
name: appState.name,
};
}
const _clearAppStateForStorage = <ExportType extends "export" | "browser">(
appState: Partial<AppState>,
exportType: ExportType,
) => {
type ExportableKeys = {
[K in keyof typeof APP_STATE_STORAGE_CONF]: typeof APP_STATE_STORAGE_CONF[K][ExportType] extends true
? K
: never;
}[keyof typeof APP_STATE_STORAGE_CONF];
const stateForExport = {} as { [K in ExportableKeys]?: typeof appState[K] };
for (const key of Object.keys(appState) as (keyof typeof appState)[]) {
const propConfig = APP_STATE_STORAGE_CONF[key];
if (propConfig?.[exportType]) {
// @ts-ignore see https://github.com/microsoft/TypeScript/issues/31445
stateForExport[key] = appState[key];
}
}
return stateForExport;
};
export function cleanAppStateForExport(appState: AppState) {
return {
viewBackgroundColor: appState.viewBackgroundColor,
};
}
export const clearAppStateForLocalStorage = (appState: Partial<AppState>) => {
return _clearAppStateForStorage(appState, "browser");
};
export const cleanAppStateForExport = (appState: Partial<AppState>) => {
return _clearAppStateForStorage(appState, "export");
};

479
src/charts.ts Normal file
View File

@ -0,0 +1,479 @@
import colors from "./colors";
import { DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE, ENV } from "./constants";
import { newElement, newLinearElement, newTextElement } from "./element";
import { NonDeletedExcalidrawElement } from "./element/types";
import { randomId } from "./random";
export type ChartElements = readonly NonDeletedExcalidrawElement[];
const BAR_WIDTH = 32;
const BAR_GAP = 12;
const BAR_HEIGHT = 256;
const GRID_OPACITY = 50;
export interface Spreadsheet {
title: string | null;
labels: string[] | null;
values: number[];
}
export const NOT_SPREADSHEET = "NOT_SPREADSHEET";
export const VALID_SPREADSHEET = "VALID_SPREADSHEET";
type ParseSpreadsheetResult =
| { type: typeof NOT_SPREADSHEET; reason: string }
| { type: typeof VALID_SPREADSHEET; spreadsheet: Spreadsheet };
const tryParseNumber = (s: string): number | null => {
const match = /^[$€£¥₩]?([0-9,]+(\.[0-9]+)?)$/.exec(s);
if (!match) {
return null;
}
return parseFloat(match[1].replace(/,/g, ""));
};
const isNumericColumn = (lines: string[][], columnIndex: number) =>
lines.slice(1).every((line) => tryParseNumber(line[columnIndex]) !== null);
const tryParseCells = (cells: string[][]): ParseSpreadsheetResult => {
const numCols = cells[0].length;
if (numCols > 2) {
return { type: NOT_SPREADSHEET, reason: "More than 2 columns" };
}
if (numCols === 1) {
if (!isNumericColumn(cells, 0)) {
return { type: NOT_SPREADSHEET, reason: "Value is not numeric" };
}
const hasHeader = tryParseNumber(cells[0][0]) === null;
const values = (hasHeader ? cells.slice(1) : cells).map((line) =>
tryParseNumber(line[0]),
);
if (values.length < 2) {
return { type: NOT_SPREADSHEET, reason: "Less than two rows" };
}
return {
type: VALID_SPREADSHEET,
spreadsheet: {
title: hasHeader ? cells[0][0] : null,
labels: null,
values: values as number[],
},
};
}
const valueColumnIndex = isNumericColumn(cells, 0) ? 0 : 1;
if (!isNumericColumn(cells, valueColumnIndex)) {
return { type: NOT_SPREADSHEET, reason: "Value is not numeric" };
}
const labelColumnIndex = (valueColumnIndex + 1) % 2;
const hasHeader = tryParseNumber(cells[0][valueColumnIndex]) === null;
const rows = hasHeader ? cells.slice(1) : cells;
if (rows.length < 2) {
return { type: NOT_SPREADSHEET, reason: "Less than 2 rows" };
}
return {
type: VALID_SPREADSHEET,
spreadsheet: {
title: hasHeader ? cells[0][valueColumnIndex] : null,
labels: rows.map((row) => row[labelColumnIndex]),
values: rows.map((row) => tryParseNumber(row[valueColumnIndex])!),
},
};
};
const transposeCells = (cells: string[][]) => {
const nextCells: string[][] = [];
for (let col = 0; col < cells[0].length; col++) {
const nextCellRow: string[] = [];
for (let row = 0; row < cells.length; row++) {
nextCellRow.push(cells[row][col]);
}
nextCells.push(nextCellRow);
}
return nextCells;
};
export const tryParseSpreadsheet = (text: string): ParseSpreadsheetResult => {
// Copy/paste from excel, spreadhseets, tsv, csv.
// For now we only accept 2 columns with an optional header
// Check for tab separated values
let lines = text
.trim()
.split("\n")
.map((line) => line.trim().split("\t"));
// Check for comma separated files
if (lines.length && lines[0].length !== 2) {
lines = text
.trim()
.split("\n")
.map((line) => line.trim().split(","));
}
if (lines.length === 0) {
return { type: NOT_SPREADSHEET, reason: "No values" };
}
const numColsFirstLine = lines[0].length;
const isSpreadsheet = lines.every((line) => line.length === numColsFirstLine);
if (!isSpreadsheet) {
return {
type: NOT_SPREADSHEET,
reason: "All rows don't have same number of columns",
};
}
const result = tryParseCells(lines);
if (result.type !== VALID_SPREADSHEET) {
const transposedResults = tryParseCells(transposeCells(lines));
if (transposedResults.type === VALID_SPREADSHEET) {
return transposedResults;
}
}
return result;
};
const bgColors = colors.elementBackground.slice(
2,
colors.elementBackground.length,
);
// Put all the common properties here so when the whole chart is selected
// the properties dialog shows the correct selected values
const commonProps = {
fillStyle: "hachure",
fontFamily: DEFAULT_FONT_FAMILY,
fontSize: DEFAULT_FONT_SIZE,
opacity: 100,
roughness: 1,
strokeColor: colors.elementStroke[0],
strokeSharpness: "sharp",
strokeStyle: "solid",
strokeWidth: 1,
verticalAlign: "middle",
} as const;
const getChartDimentions = (spreadsheet: Spreadsheet) => {
const chartWidth =
(BAR_WIDTH + BAR_GAP) * spreadsheet.values.length + BAR_GAP;
const chartHeight = BAR_HEIGHT + BAR_GAP * 2;
return { chartWidth, chartHeight };
};
const chartXLabels = (
spreadsheet: Spreadsheet,
x: number,
y: number,
groupId: string,
backgroundColor: string,
): ChartElements => {
return (
spreadsheet.labels?.map((label, index) => {
return newTextElement({
groupIds: [groupId],
backgroundColor,
...commonProps,
text: label.length > 8 ? `${label.slice(0, 5)}...` : label,
x: x + index * (BAR_WIDTH + BAR_GAP) + BAR_GAP * 2,
y: y + BAR_GAP / 2,
width: BAR_WIDTH,
angle: 5.87,
fontSize: 16,
textAlign: "center",
verticalAlign: "top",
});
}) || []
);
};
const chartYLabels = (
spreadsheet: Spreadsheet,
x: number,
y: number,
groupId: string,
backgroundColor: string,
): ChartElements => {
const minYLabel = newTextElement({
groupIds: [groupId],
backgroundColor,
...commonProps,
x: x - BAR_GAP,
y: y - BAR_GAP,
text: "0",
textAlign: "right",
});
const maxYLabel = newTextElement({
groupIds: [groupId],
backgroundColor,
...commonProps,
x: x - BAR_GAP,
y: y - BAR_HEIGHT - minYLabel.height / 2,
text: Math.max(...spreadsheet.values).toLocaleString(),
textAlign: "right",
});
return [minYLabel, maxYLabel];
};
const chartLines = (
spreadsheet: Spreadsheet,
x: number,
y: number,
groupId: string,
backgroundColor: string,
): ChartElements => {
const { chartWidth, chartHeight } = getChartDimentions(spreadsheet);
const xLine = newLinearElement({
backgroundColor,
groupIds: [groupId],
...commonProps,
type: "line",
x,
y,
startArrowhead: null,
endArrowhead: null,
width: chartWidth,
points: [
[0, 0],
[chartWidth, 0],
],
});
const yLine = newLinearElement({
backgroundColor,
groupIds: [groupId],
...commonProps,
type: "line",
x,
y,
startArrowhead: null,
endArrowhead: null,
height: chartHeight,
points: [
[0, 0],
[0, -chartHeight],
],
});
const maxLine = newLinearElement({
backgroundColor,
groupIds: [groupId],
...commonProps,
type: "line",
x,
y: y - BAR_HEIGHT - BAR_GAP,
startArrowhead: null,
endArrowhead: null,
strokeStyle: "dotted",
width: chartWidth,
opacity: GRID_OPACITY,
points: [
[0, 0],
[chartWidth, 0],
],
});
return [xLine, yLine, maxLine];
};
// For the maths behind it https://excalidraw.com/#json=6320864370884608,O_5xfD-Agh32tytHpRJx1g
const chartBaseElements = (
spreadsheet: Spreadsheet,
x: number,
y: number,
groupId: string,
backgroundColor: string,
debug?: boolean,
): ChartElements => {
const { chartWidth, chartHeight } = getChartDimentions(spreadsheet);
const title = spreadsheet.title
? newTextElement({
backgroundColor,
groupIds: [groupId],
...commonProps,
text: spreadsheet.title,
x: x + chartWidth / 2,
y: y - BAR_HEIGHT - BAR_GAP * 2 - DEFAULT_FONT_SIZE,
strokeSharpness: "sharp",
strokeStyle: "solid",
textAlign: "center",
})
: null;
const debugRect = debug
? newElement({
backgroundColor,
groupIds: [groupId],
...commonProps,
type: "rectangle",
x,
y: y - chartHeight,
width: chartWidth,
height: chartHeight,
strokeColor: colors.elementStroke[0],
fillStyle: "solid",
opacity: 6,
})
: null;
return [
...(debugRect ? [debugRect] : []),
...(title ? [title] : []),
...chartXLabels(spreadsheet, x, y, groupId, backgroundColor),
...chartYLabels(spreadsheet, x, y, groupId, backgroundColor),
...chartLines(spreadsheet, x, y, groupId, backgroundColor),
];
};
const chartTypeBar = (
spreadsheet: Spreadsheet,
x: number,
y: number,
): ChartElements => {
const max = Math.max(...spreadsheet.values);
const groupId = randomId();
const backgroundColor = bgColors[Math.floor(Math.random() * bgColors.length)];
const bars = spreadsheet.values.map((value, index) => {
const barHeight = (value / max) * BAR_HEIGHT;
return newElement({
backgroundColor,
groupIds: [groupId],
...commonProps,
type: "rectangle",
x: x + index * (BAR_WIDTH + BAR_GAP) + BAR_GAP,
y: y - barHeight - BAR_GAP,
width: BAR_WIDTH,
height: barHeight,
});
});
return [
...bars,
...chartBaseElements(
spreadsheet,
x,
y,
groupId,
backgroundColor,
process.env.NODE_ENV === ENV.DEVELOPMENT,
),
];
};
const chartTypeLine = (
spreadsheet: Spreadsheet,
x: number,
y: number,
): ChartElements => {
const max = Math.max(...spreadsheet.values);
const groupId = randomId();
const backgroundColor = bgColors[Math.floor(Math.random() * bgColors.length)];
let index = 0;
const points = [];
for (const value of spreadsheet.values) {
const cx = index * (BAR_WIDTH + BAR_GAP);
const cy = -(value / max) * BAR_HEIGHT;
points.push([cx, cy]);
index++;
}
const maxX = Math.max(...points.map((element) => element[0]));
const maxY = Math.max(...points.map((element) => element[1]));
const minX = Math.min(...points.map((element) => element[0]));
const minY = Math.min(...points.map((element) => element[1]));
const line = newLinearElement({
backgroundColor,
groupIds: [groupId],
...commonProps,
type: "line",
x: x + BAR_GAP + BAR_WIDTH / 2,
y: y - BAR_GAP,
startArrowhead: null,
endArrowhead: null,
height: maxY - minY,
width: maxX - minX,
strokeWidth: 2,
points: points as any,
});
const dots = spreadsheet.values.map((value, index) => {
const cx = index * (BAR_WIDTH + BAR_GAP) + BAR_GAP / 2;
const cy = -(value / max) * BAR_HEIGHT + BAR_GAP / 2;
return newElement({
backgroundColor,
groupIds: [groupId],
...commonProps,
fillStyle: "solid",
strokeWidth: 2,
type: "ellipse",
x: x + cx + BAR_WIDTH / 2,
y: y + cy - BAR_GAP * 2,
width: BAR_GAP,
height: BAR_GAP,
});
});
const lines = spreadsheet.values.map((value, index) => {
const cx = index * (BAR_WIDTH + BAR_GAP) + BAR_GAP / 2;
const cy = (value / max) * BAR_HEIGHT + BAR_GAP / 2 + BAR_GAP;
return newLinearElement({
backgroundColor,
groupIds: [groupId],
...commonProps,
type: "line",
x: x + cx + BAR_WIDTH / 2 + BAR_GAP / 2,
y: y - cy,
startArrowhead: null,
endArrowhead: null,
height: cy,
strokeStyle: "dotted",
opacity: GRID_OPACITY,
points: [
[0, 0],
[0, cy],
],
});
});
return [
...chartBaseElements(
spreadsheet,
x,
y,
groupId,
backgroundColor,
process.env.NODE_ENV === ENV.DEVELOPMENT,
),
line,
...lines,
...dots,
];
};
export const renderSpreadsheet = (
chartType: string,
spreadsheet: Spreadsheet,
x: number,
y: number,
): ChartElements => {
if (chartType === "line") {
return chartTypeLine(spreadsheet, x, y);
}
return chartTypeBar(spreadsheet, x, y);
};

37
src/clients.ts Normal file
View File

@ -0,0 +1,37 @@
import colors from "./colors";
import { AppState } from "./types";
export const getClientColors = (clientId: string, appState: AppState) => {
if (appState?.collaborators) {
const currentUser = appState.collaborators.get(clientId);
if (currentUser?.color) {
return currentUser.color;
}
}
// Naive way of getting an integer out of the clientId
const sum = clientId.split("").reduce((a, str) => a + str.charCodeAt(0), 0);
// Skip transparent background.
const backgrounds = colors.elementBackground.slice(1);
const strokes = colors.elementStroke.slice(1);
return {
background: backgrounds[sum % backgrounds.length],
stroke: strokes[sum % strokes.length],
};
};
export const getClientInitials = (username?: string | null) => {
if (!username) {
return "?";
}
const names = username.trim().split(" ");
if (names.length < 2) {
return names[0].substring(0, 2).toUpperCase();
}
const firstName = names[0];
const lastName = names[names.length - 1];
return (firstName[0] + lastName[0]).toUpperCase();
};

View File

@ -5,6 +5,16 @@ import {
import { getSelectedElements } from "./scene";
import { AppState } from "./types";
import { SVG_EXPORT_TAG } from "./scene/export";
import { tryParseSpreadsheet, Spreadsheet, VALID_SPREADSHEET } from "./charts";
import { canvasToBlob } from "./data/blob";
const TYPE_ELEMENTS = "excalidraw/elements";
type ElementsClipboard = {
type: typeof TYPE_ELEMENTS;
created: number;
elements: ExcalidrawElement[];
};
let CLIPBOARD = "";
let PREFER_APP_CLIPBOARD = false;
@ -21,104 +31,139 @@ export const probablySupportsClipboardBlob =
"ClipboardItem" in window &&
"toBlob" in HTMLCanvasElement.prototype;
export async function copyToAppClipboard(
const isElementsClipboard = (contents: any): contents is ElementsClipboard => {
if (contents?.type === TYPE_ELEMENTS) {
return true;
}
return false;
};
export const copyToClipboard = async (
elements: readonly NonDeletedExcalidrawElement[],
appState: AppState,
) {
CLIPBOARD = JSON.stringify(getSelectedElements(elements, appState));
) => {
const contents: ElementsClipboard = {
type: TYPE_ELEMENTS,
created: Date.now(),
elements: getSelectedElements(elements, appState),
};
const json = JSON.stringify(contents);
CLIPBOARD = json;
try {
// when copying to in-app clipboard, clear system clipboard so that if
// system clip contains text on paste we know it was copied *after* user
// copied elements, and thus we should prefer the text content.
await copyTextToSystemClipboard(null);
PREFER_APP_CLIPBOARD = false;
} catch {
// if clearing system clipboard didn't work, we should prefer in-app
// clipboard even if there's text in system clipboard on paste, because
// we can't be sure of the order of copy operations
await copyTextToSystemClipboard(json);
} catch (error) {
PREFER_APP_CLIPBOARD = true;
console.error(error);
}
}
};
export function getAppClipboard(): {
elements?: readonly ExcalidrawElement[];
} {
const getAppClipboard = (): Partial<ElementsClipboard> => {
if (!CLIPBOARD) {
return {};
}
try {
const clipboardElements = JSON.parse(CLIPBOARD);
if (
Array.isArray(clipboardElements) &&
clipboardElements.length > 0 &&
clipboardElements[0].type // need to implement a better check here...
) {
return { elements: clipboardElements };
}
return JSON.parse(CLIPBOARD);
} catch (error) {
console.error(error);
return {};
}
};
return {};
}
const parsePotentialSpreadsheet = (
text: string,
): { spreadsheet: Spreadsheet } | { errorMessage: string } | null => {
const result = tryParseSpreadsheet(text);
if (result.type === VALID_SPREADSHEET) {
return { spreadsheet: result.spreadsheet };
}
return null;
};
export async function getClipboardContent(
/**
* Retrieves content from system clipboard (either from ClipboardEvent or
* via async clipboard API if supported)
*/
const getSystemClipboard = async (
event: ClipboardEvent | null,
): Promise<{
text?: string;
elements?: readonly ExcalidrawElement[];
}> {
): Promise<string> => {
try {
const text = event
? event.clipboardData?.getData("text/plain").trim()
: probablySupportsClipboardReadText &&
(await navigator.clipboard.readText());
if (text && !PREFER_APP_CLIPBOARD && !text.includes(SVG_EXPORT_TAG)) {
return { text };
}
} catch (error) {
console.error(error);
return text || "";
} catch {
return "";
}
};
/**
* Attemps to parse clipboard. Prefers system clipboard.
*/
export const parseClipboard = async (
event: ClipboardEvent | null,
): Promise<{
spreadsheet?: Spreadsheet;
elements?: readonly ExcalidrawElement[];
text?: string;
errorMessage?: string;
}> => {
const systemClipboard = await getSystemClipboard(event);
// if system clipboard empty, couldn't be resolved, or contains previously
// copied excalidraw scene as SVG, fall back to previously copied excalidraw
// elements
if (!systemClipboard || systemClipboard.includes(SVG_EXPORT_TAG)) {
return getAppClipboard();
}
return getAppClipboard();
}
// if system clipboard contains spreadsheet, use it even though it's
// technically possible it's staler than in-app clipboard
const spreadsheetResult = parsePotentialSpreadsheet(systemClipboard);
if (spreadsheetResult) {
return spreadsheetResult;
}
export async function copyCanvasToClipboardAsPng(canvas: HTMLCanvasElement) {
return new Promise((resolve, reject) => {
try {
canvas.toBlob(async function (blob: any) {
try {
await navigator.clipboard.write([
new window.ClipboardItem({ "image/png": blob }),
]);
resolve();
} catch (error) {
reject(error);
}
});
} catch (error) {
reject(error);
}
});
}
const appClipboardData = getAppClipboard();
export async function copyCanvasToClipboardAsSvg(svgroot: SVGSVGElement) {
try {
await navigator.clipboard.writeText(svgroot.outerHTML);
} catch (error) {
console.error(error);
const systemClipboardData = JSON.parse(systemClipboard);
// system clipboard elements are newer than in-app clipboard
if (
isElementsClipboard(systemClipboardData) &&
(!appClipboardData?.created ||
appClipboardData.created < systemClipboardData.created)
) {
return { elements: systemClipboardData.elements };
}
// in-app clipboard is newer than system clipboard
return appClipboardData;
} catch {
// system clipboard doesn't contain excalidraw elements → return plaintext
// unless we set a flag to prefer in-app clipboard because browser didn't
// support storing to system clipboard on copy
return PREFER_APP_CLIPBOARD && appClipboardData.elements
? appClipboardData
: { text: systemClipboard };
}
}
};
export async function copyTextToSystemClipboard(text: string | null) {
export const copyCanvasToClipboardAsPng = async (canvas: HTMLCanvasElement) => {
const blob = await canvasToBlob(canvas);
await navigator.clipboard.write([
new window.ClipboardItem({ "image/png": blob }),
]);
};
export const copyTextToSystemClipboard = async (text: string | null) => {
let copied = false;
if (probablySupportsClipboardWriteText) {
try {
// NOTE: doesn't work on FF on non-HTTPS domains, or when document
// not focused
// not focused
await navigator.clipboard.writeText(text || "");
copied = true;
} catch (error) {
@ -127,14 +172,14 @@ export async function copyTextToSystemClipboard(text: string | null) {
}
// Note that execCommand doesn't allow copying empty strings, so if we're
// clearing clipboard using this API, we must copy at least an empty char
// clearing clipboard using this API, we must copy at least an empty char
if (!copied && !copyTextViaExecCommand(text || " ")) {
throw new Error("couldn't copy");
}
}
};
// adapted from https://github.com/zenorocha/clipboard.js/blob/ce79f170aa655c408b6aab33c9472e8e4fa52e19/src/clipboard-action.js#L48
function copyTextViaExecCommand(text: string) {
const copyTextViaExecCommand = (text: string) => {
const isRTL = document.documentElement.getAttribute("dir") === "rtl";
const textarea = document.createElement("textarea");
@ -168,4 +213,4 @@ function copyTextViaExecCommand(text: string) {
textarea.remove();
return success;
}
};

View File

@ -1,18 +1,18 @@
import oc from "open-color";
const shades = (i: number) => [
oc.red[i],
oc.pink[i],
oc.grape[i],
oc.violet[i],
oc.indigo[i],
oc.blue[i],
oc.cyan[i],
oc.teal[i],
oc.green[i],
oc.lime[i],
oc.yellow[i],
oc.orange[i],
const shades = (index: number) => [
oc.red[index],
oc.pink[index],
oc.grape[index],
oc.violet[index],
oc.indigo[index],
oc.blue[index],
oc.cyan[index],
oc.teal[index],
oc.green[index],
oc.lime[index],
oc.yellow[index],
oc.orange[index],
];
export default {

View File

@ -1,17 +1,24 @@
import React from "react";
import { AppState } from "../types";
import { ExcalidrawElement } from "../element/types";
import { ActionManager } from "../actions/manager";
import { hasBackground, hasStroke, hasText, getTargetElement } from "../scene";
import { t } from "../i18n";
import { SHAPES } from "../shapes";
import { ToolButton } from "./ToolButton";
import { capitalizeString, setCursorForShape } from "../utils";
import Stack from "./Stack";
import useIsMobile from "../is-mobile";
import { getNonDeletedElements } from "../element";
import { ExcalidrawElement } from "../element/types";
import { t } from "../i18n";
import useIsMobile from "../is-mobile";
import {
canChangeSharpness,
canHaveArrowheads,
getTargetElements,
hasBackground,
hasStroke,
hasText,
} from "../scene";
import { SHAPES } from "../shapes";
import { AppState, Zoom } from "../types";
import { capitalizeString, isTransparent, setCursorForShape } from "../utils";
import Stack from "./Stack";
import { ToolButton } from "./ToolButton";
export function SelectedShapeActions({
export const SelectedShapeActions = ({
appState,
elements,
renderAction,
@ -21,35 +28,45 @@ export function SelectedShapeActions({
elements: readonly ExcalidrawElement[];
renderAction: ActionManager["renderAction"];
elementType: ExcalidrawElement["type"];
}) {
const targetElements = getTargetElement(
}) => {
const targetElements = getTargetElements(
getNonDeletedElements(elements),
appState,
);
const isEditing = Boolean(appState.editingElement);
const isMobile = useIsMobile();
const isRTL = document.documentElement.getAttribute("dir") === "rtl";
const showFillIcons =
hasBackground(elementType) ||
targetElements.some(
(element) =>
hasBackground(element.type) && !isTransparent(element.backgroundColor),
);
const showChangeBackgroundIcons =
hasBackground(elementType) ||
targetElements.some((element) => hasBackground(element.type));
return (
<div className="panelColumn">
{renderAction("changeStrokeColor")}
{(hasBackground(elementType) ||
targetElements.some((element) => hasBackground(element.type))) && (
<>
{renderAction("changeBackgroundColor")}
{renderAction("changeFillStyle")}
</>
)}
{showChangeBackgroundIcons && renderAction("changeBackgroundColor")}
{showFillIcons && renderAction("changeFillStyle")}
{(hasStroke(elementType) ||
targetElements.some((element) => hasStroke(element.type))) && (
<>
{renderAction("changeStrokeWidth")}
{renderAction("changeStrokeStyle")}
{renderAction("changeSloppiness")}
</>
)}
{(canChangeSharpness(elementType) ||
targetElements.some((element) => canChangeSharpness(element.type))) && (
<>{renderAction("changeSharpness")}</>
)}
{(hasText(elementType) ||
targetElements.some((element) => hasText(element.type))) && (
<>
@ -61,6 +78,11 @@ export function SelectedShapeActions({
</>
)}
{(canHaveArrowheads(elementType) ||
targetElements.some((element) => canHaveArrowheads(element.type))) && (
<>{renderAction("changeArrowhead")}</>
)}
{renderAction("changeOpacity")}
<fieldset>
@ -72,76 +94,134 @@ export function SelectedShapeActions({
{renderAction("bringForward")}
</div>
</fieldset>
{targetElements.length > 1 && (
<fieldset>
<legend>{t("labels.align")}</legend>
<div className="buttonList">
{
// swap this order for RTL so the button positions always match their action
// (i.e. the leftmost button aligns left)
}
{isRTL ? (
<>
{renderAction("alignRight")}
{renderAction("alignHorizontallyCentered")}
{renderAction("alignLeft")}
</>
) : (
<>
{renderAction("alignLeft")}
{renderAction("alignHorizontallyCentered")}
{renderAction("alignRight")}
</>
)}
{targetElements.length > 2 &&
renderAction("distributeHorizontally")}
<div className="iconRow">
{renderAction("alignTop")}
{renderAction("alignVerticallyCentered")}
{renderAction("alignBottom")}
{targetElements.length > 2 &&
renderAction("distributeVertically")}
</div>
</div>
</fieldset>
)}
{!isMobile && !isEditing && targetElements.length > 0 && (
<fieldset>
<legend>{t("labels.actions")}</legend>
<div className="buttonList">
{renderAction("duplicateSelection")}
{renderAction("deleteSelectedElements")}
{renderAction("group")}
{renderAction("ungroup")}
</div>
</fieldset>
)}
</div>
);
}
};
export function ShapesSwitcher({
const LIBRARY_ICON = (
// fa-th-large
<svg viewBox="0 0 512 512">
<path d="M296 32h192c13.255 0 24 10.745 24 24v160c0 13.255-10.745 24-24 24H296c-13.255 0-24-10.745-24-24V56c0-13.255 10.745-24 24-24zm-80 0H24C10.745 32 0 42.745 0 56v160c0 13.255 10.745 24 24 24h192c13.255 0 24-10.745 24-24V56c0-13.255-10.745-24-24-24zM0 296v160c0 13.255 10.745 24 24 24h192c13.255 0 24-10.745 24-24V296c0-13.255-10.745-24-24-24H24c-13.255 0-24 10.745-24 24zm296 184h192c13.255 0 24-10.745 24-24V296c0-13.255-10.745-24-24-24H296c-13.255 0-24 10.745-24 24v160c0 13.255 10.745 24 24 24z" />
</svg>
);
export const ShapesSwitcher = ({
elementType,
setAppState,
isLibraryOpen,
}: {
elementType: ExcalidrawElement["type"];
setAppState: any;
}) {
return (
<>
{SHAPES.map(({ value, icon, key }, index) => {
const label = t(`toolBar.${value}`);
const shortcut = `${capitalizeString(key)} ${t("shortcutsDialog.or")} ${
index + 1
}`;
return (
<ToolButton
key={value}
type="radio"
icon={icon}
checked={elementType === value}
name="editor-current-shape"
title={`${capitalizeString(label)}${shortcut}`}
keyBindingLabel={`${index + 1}`}
aria-label={capitalizeString(label)}
aria-keyshortcuts={`${key} ${index + 1}`}
data-testid={value}
onChange={() => {
setAppState({
elementType: value,
multiElement: null,
selectedElementIds: {},
});
setCursorForShape(value);
setAppState({});
}}
></ToolButton>
);
})}
</>
);
}
setAppState: React.Component<any, AppState>["setState"];
isLibraryOpen: boolean;
}) => (
<>
{SHAPES.map(({ value, icon, key }, index) => {
const label = t(`toolBar.${value}`);
const letter = typeof key === "string" ? key : key[0];
const shortcut = `${capitalizeString(letter)} ${t("helpDialog.or")} ${
index + 1
}`;
return (
<ToolButton
className="Shape"
key={value}
type="radio"
icon={icon}
checked={elementType === value}
name="editor-current-shape"
title={`${capitalizeString(label)}${shortcut}`}
keyBindingLabel={`${index + 1}`}
aria-label={capitalizeString(label)}
aria-keyshortcuts={shortcut}
data-testid={value}
onChange={() => {
setAppState({
elementType: value,
multiElement: null,
selectedElementIds: {},
});
setCursorForShape(value);
setAppState({});
}}
/>
);
})}
<ToolButton
className="Shape ToolIcon_type_button__library"
type="button"
icon={LIBRARY_ICON}
name="editor-library"
keyBindingLabel="9"
aria-keyshortcuts="9"
title={`${capitalizeString(t("toolBar.library"))} — 9`}
aria-label={capitalizeString(t("toolBar.library"))}
onClick={() => {
setAppState({ isLibraryOpen: !isLibraryOpen });
}}
/>
</>
);
export function ZoomActions({
export const ZoomActions = ({
renderAction,
zoom,
}: {
renderAction: ActionManager["renderAction"];
zoom: number;
}) {
return (
<Stack.Col gap={1}>
<Stack.Row gap={1} align="center">
{renderAction("zoomIn")}
{renderAction("zoomOut")}
{renderAction("resetZoom")}
<div style={{ marginInlineStart: 4 }}>{(zoom * 100).toFixed(0)}%</div>
</Stack.Row>
</Stack.Col>
);
}
zoom: Zoom;
}) => (
<Stack.Col gap={1}>
<Stack.Row gap={1} align="center">
{renderAction("zoomIn")}
{renderAction("zoomOut")}
{renderAction("resetZoom")}
<div style={{ marginInlineStart: 4 }}>
{(zoom.value * 100).toFixed(0)}%
</div>
</Stack.Row>
</Stack.Col>
);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,16 @@
@import "../css/variables.module";
.excalidraw {
.Avatar {
width: 2.5rem;
height: 2.5rem;
border-radius: 1.25rem;
display: flex;
justify-content: center;
align-items: center;
color: $oc-white;
cursor: pointer;
font-size: 0.8rem;
font-weight: 500;
}
}

20
src/components/Avatar.tsx Normal file
View File

@ -0,0 +1,20 @@
import "./Avatar.scss";
import React from "react";
type AvatarProps = {
children: string;
onClick: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
color: string;
border: string;
};
export const Avatar = ({ children, color, border, onClick }: AvatarProps) => (
<div
className="Avatar"
style={{ background: color, border: `1px solid ${border}` }}
onClick={onClick}
>
{children}
</div>
);

View File

@ -0,0 +1,26 @@
import React from "react";
import { ActionManager } from "../actions/manager";
import { AppState } from "../types";
import { DarkModeToggle } from "./DarkModeToggle";
export const BackgroundPickerAndDarkModeToggle = ({
appState,
setAppState,
actionManager,
}: {
actionManager: ActionManager;
appState: AppState;
setAppState: React.Component<any, AppState>["setState"];
}) => (
<div style={{ display: "flex" }}>
{actionManager.renderAction("changeViewBackgroundColor")}
<div style={{ marginInlineStart: "0.25rem" }}>
<DarkModeToggle
value={appState.appearance}
onChange={(appearance) => {
setAppState({ appearance });
}}
/>
</div>
</div>
);

View File

@ -0,0 +1,29 @@
import React from "react";
import clsx from "clsx";
export const ButtonIconCycle = <T extends any>({
options,
value,
onChange,
group,
}: {
options: { value: T; text: string; icon: JSX.Element }[];
value: T | null;
onChange: (value: T) => void;
group: string;
}) => {
const current = options.find((op) => op.value === value);
function cycle() {
const index = options.indexOf(current!);
const next = (index + 1) % options.length;
onChange(options[next].value);
}
return (
<label key={group} className={clsx({ active: current!.value !== null })}>
<input type="button" name={group} onClick={cycle} />
{current!.icon}
</label>
);
};

View File

@ -0,0 +1,33 @@
import React from "react";
import clsx from "clsx";
// TODO: It might be "clever" to add option.icon to the existing component <ButtonSelect />
export const ButtonIconSelect = <T extends Object>({
options,
value,
onChange,
group,
}: {
options: { value: T; text: string; icon: JSX.Element }[];
value: T | null;
onChange: (value: T) => void;
group: string;
}) => (
<div className="buttonList buttonListIcon">
{options.map((option) => (
<label
key={option.text}
className={clsx({ active: value === option.value })}
title={option.text}
>
<input
type="radio"
name={group}
onChange={() => onChange(option.value)}
checked={value === option.value}
/>
{option.icon}
</label>
))}
</div>
);

View File

@ -1,6 +1,7 @@
import React from "react";
import clsx from "clsx";
export function ButtonSelect<T>({
export const ButtonSelect = <T extends Object>({
options,
value,
onChange,
@ -10,23 +11,21 @@ export function ButtonSelect<T>({
value: T | null;
onChange: (value: T) => void;
group: string;
}) {
return (
<div className="buttonList">
{options.map((option) => (
<label
key={option.text}
className={value === option.value ? "active" : ""}
>
<input
type="radio"
name={group}
onChange={() => onChange(option.value)}
checked={value === option.value ? true : false}
/>
{option.text}
</label>
))}
</div>
);
}
}) => (
<div className="buttonList">
{options.map((option) => (
<label
key={option.text}
className={clsx({ active: value === option.value })}
>
<input
type="radio"
name={group}
onChange={() => onChange(option.value)}
checked={value === option.value}
/>
{option.text}
</label>
))}
</div>
);

View File

@ -0,0 +1,30 @@
@import "../css/variables.module";
.excalidraw {
.CollabButton.is-collaborating {
background-color: var(--button-special-active-background-color);
.ToolIcon__icon svg,
.ToolIcon__label {
color: var(--icon-green-fill-color);
}
}
.CollabButton-collaborators {
:root[dir="ltr"] & {
right: -5px;
}
:root[dir="rtl"] & {
left: -5px;
}
min-width: 1em;
position: absolute;
bottom: -5px;
padding: 3px;
border-radius: 50%;
background-color: $oc-green-6;
color: $oc-white;
font-size: 0.7em;
font-family: var(--ui-font);
}
}

View File

@ -0,0 +1,40 @@
import React from "react";
import clsx from "clsx";
import { ToolButton } from "./ToolButton";
import { t } from "../i18n";
import useIsMobile from "../is-mobile";
import { users } from "./icons";
import "./CollabButton.scss";
const CollabButton = ({
isCollaborating,
collaboratorCount,
onClick,
}: {
isCollaborating: boolean;
collaboratorCount: number;
onClick: () => void;
}) => {
return (
<>
<ToolButton
className={clsx("CollabButton", {
"is-collaborating": isCollaborating,
})}
onClick={onClick}
icon={users}
type="button"
title={t("labels.liveCollaboration")}
aria-label={t("labels.liveCollaboration")}
showAriaLabel={useIsMobile()}
>
{collaboratorCount > 0 && (
<div className="CollabButton-collaborators">{collaboratorCount}</div>
)}
</ToolButton>
</>
);
};
export default CollabButton;

View File

@ -1,191 +1,250 @@
@import "open-color/open-color.scss";
@import "../css/variables.module";
.color-picker {
background: $oc-white;
border: 0px solid transparentize($oc-white, 0.75);
box-shadow: transparentize($oc-black, 0.75) 0px 1px 4px;
border-radius: 4px;
position: absolute;
:root[dir="ltr"] & {
left: -5.5px;
.excalidraw {
.color-picker {
background: var(--popup-background-color);
border: 0px solid transparentize($oc-white, 0.75);
box-shadow: transparentize($oc-black, 0.75) 0px 1px 4px;
border-radius: 4px;
position: absolute;
:root[dir="ltr"] & {
left: -5.5px;
}
:root[dir="rtl"] & {
right: -5.5px;
}
}
:root[dir="rtl"] & {
right: -5.5px;
.color-picker-control-container {
display: grid;
grid-template-columns: auto 1fr;
align-items: center;
}
.color-picker-triangle {
width: 0px;
height: 0px;
border-style: solid;
border-width: 0px 9px 10px;
border-color: transparent transparent var(--popup-background-color);
position: absolute;
top: -10px;
:root[dir="ltr"] & {
left: 12px;
}
:root[dir="rtl"] & {
right: 12px;
}
}
.color-picker-triangle-shadow {
border-color: transparent transparent transparentize($oc-black, 0.9);
top: -11px;
}
.color-picker-content {
padding: 0.5rem;
display: grid;
grid-template-columns: repeat(5, auto);
grid-gap: 0.5rem;
border-radius: 4px;
&:focus {
outline: none;
box-shadow: 0 0 0 2px var(--focus-highlight-color);
}
}
.color-picker-content .color-input-container {
grid-column: 1 / span 5;
}
.color-picker-swatch {
position: relative;
height: 1.875rem;
width: 1.875rem;
cursor: pointer;
border-radius: 4px;
margin: 0;
box-sizing: border-box;
border: 1px solid #ddd;
background-color: currentColor !important;
filter: var(--appearance-filter);
&:focus {
/* TODO: only show the border when the color is too light to see as a shadow */
box-shadow: 0 0 4px 1px currentColor;
border-color: var(--select-highlight-color);
}
}
.color-picker-transparent {
border-radius: 4px;
box-shadow: transparentize($oc-black, 0.9) 0px 0px 0px 1px inset;
position: absolute;
top: 0px;
right: 0px;
bottom: 0px;
left: 0px;
}
.color-picker-transparent,
.color-picker-label-swatch {
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==")
left center;
}
.color-picker-hash {
background: var(--input-border-color);
height: 1.875rem;
width: 1.875rem;
:root[dir="ltr"] & {
border-radius: 4px 0px 0px 4px;
}
:root[dir="rtl"] & {
border-radius: 0px 4px 4px 0px;
}
color: var(--input-label-color);
display: flex;
align-items: center;
justify-content: center;
position: relative;
}
.color-input-container:focus-within .color-picker-hash {
box-shadow: 0 0 0 2px var(--focus-highlight-color);
}
.color-input-container:focus-within .color-picker-hash::before,
.color-input-container:focus-within .color-picker-hash::after {
content: "";
width: 1px;
height: 100%;
position: absolute;
top: 0;
}
.color-input-container:focus-within .color-picker-hash::before {
background: var(--input-border-color);
:root[dir="ltr"] & {
right: -1px;
}
:root[dir="rtl"] & {
left: -1px;
}
}
.color-input-container:focus-within .color-picker-hash::after {
background: var(--input-background-color);
:root[dir="ltr"] & {
right: -2px;
}
:root[dir="rtl"] & {
left: -2px;
}
}
.color-input-container {
display: flex;
}
.color-picker-input {
width: 12ch; /* length of `transparent` + 1 */
margin: 0;
font-size: 1rem;
background-color: var(--input-background-color);
color: var(--text-color-primary);
border: 0px;
outline: none;
height: 1.75em;
box-shadow: var(--input-border-color) 0px 0px 0px 1px inset;
:root[dir="ltr"] & {
border-radius: 0px 4px 4px 0px;
}
:root[dir="rtl"] & {
border-radius: 4px 0px 0px 4px;
}
float: left;
padding: 1px;
padding-inline-start: 0.5em;
appearance: none;
}
.color-picker-label-swatch {
height: 1.875rem;
width: 1.875rem;
margin-inline-end: 0.25rem;
border: 1px solid $oc-gray-3;
position: relative;
overflow: hidden;
background-color: transparent !important;
filter: var(--appearance-filter);
&:after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: var(--swatch-color);
}
}
.color-picker-keybinding {
position: absolute;
bottom: 2px;
font-size: 0.7em;
:root[dir="ltr"] & {
right: 2px;
}
:root[dir="rtl"] & {
left: 2px;
}
@media #{$is-mobile-query} {
display: none;
}
}
.color-picker-type-canvasBackground .color-picker-keybinding {
color: #aaa;
}
.color-picker-type-elementBackground .color-picker-keybinding {
color: #fff;
}
.color-picker-swatch[aria-label="transparent"] .color-picker-keybinding {
color: #aaa;
}
.color-picker-type-elementStroke .color-picker-keybinding {
color: #d4d4d4;
}
&.Appearance_dark {
.color-picker-type-elementBackground .color-picker-keybinding {
color: #000;
}
.color-picker-swatch[aria-label="transparent"] .color-picker-keybinding {
color: #000;
}
}
}
.color-picker-control-container {
display: grid;
grid-template-columns: auto 1fr;
align-items: center;
}
.color-picker-triangle {
width: 0px;
height: 0px;
border-style: solid;
border-width: 0px 9px 10px;
border-color: transparent transparent $oc-white;
position: absolute;
top: -10px;
:root[dir="ltr"] & {
left: 12px;
}
:root[dir="rtl"] & {
right: 12px;
}
}
.color-picker-triangle-shadow {
border-color: transparent transparent transparentize($oc-black, 0.9);
top: -11px;
}
.color-picker-content {
padding: 0.5rem;
display: grid;
grid-template-columns: repeat(5, auto);
grid-gap: 0.5rem;
}
.color-picker-content .color-input-container {
grid-column: 1 / span 5;
}
.color-picker-swatch {
position: relative;
height: 1.875rem;
width: 1.875rem;
cursor: pointer;
border-radius: 4px;
margin: 0;
box-sizing: border-box;
border: 1px solid #ddd;
background-color: currentColor !important;
}
.color-picker-swatch:focus {
/* TODO: only show the border when the color is too light to see as a shadow */
box-shadow: 0 0 4px 1px currentColor;
border-color: $oc-blue-5;
}
.color-picker-transparent {
border-radius: 4px;
box-shadow: transparentize($oc-black, 0.9) 0px 0px 0px 1px inset;
position: absolute;
top: 0px;
right: 0px;
bottom: 0px;
left: 0px;
}
.color-picker-transparent,
.color-picker-label-swatch {
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==")
left center;
}
.color-picker-hash {
background: $oc-gray-3;
height: 1.875rem;
width: 1.875rem;
:root[dir="ltr"] & {
border-radius: 4px 0px 0px 4px;
}
:root[dir="rtl"] & {
border-radius: 0px 4px 4px 0px;
}
color: $oc-gray-7;
display: flex;
align-items: center;
justify-content: center;
z-index: 1;
position: relative;
}
.color-input-container:focus-within .color-picker-hash {
box-shadow: 0 0 0 2px $oc-blue-2;
}
.color-input-container:focus-within .color-picker-hash::before,
.color-input-container:focus-within .color-picker-hash::after {
content: "";
width: 1px;
height: 100%;
position: absolute;
top: 0;
}
.color-input-container:focus-within .color-picker-hash::before {
background: $oc-gray-3;
:root[dir="ltr"] & {
right: -1px;
}
:root[dir="rtl"] & {
left: -1px;
}
}
.color-input-container:focus-within .color-picker-hash::after {
background: #fff;
:root[dir="ltr"] & {
right: -2px;
}
:root[dir="rtl"] & {
left: -2px;
}
}
.color-input-container {
display: flex;
}
.color-picker-input {
width: 12ch; /* length of `transparent` + 1 */
margin: 0;
font-size: 1rem;
color: $oc-gray-8;
border: 0px;
outline: none;
height: 1.75em;
box-shadow: $oc-gray-3 0px 0px 0px 1px inset;
:root[dir="ltr"] & {
border-radius: 0px 4px 4px 0px;
}
:root[dir="rtl"] & {
border-radius: 4px 0px 0px 4px;
}
float: left;
padding: 1px;
padding-inline-start: 0.5em;
appearance: none;
}
.color-picker-label-swatch {
height: 1.875rem;
width: 1.875rem;
margin-inline-end: 0.25rem;
border: 1px solid $oc-gray-3;
position: relative;
overflow: hidden;
background-color: transparent !important;
}
.color-picker-label-swatch::after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: var(--swatch-color);
}
.color-picker-keybinding {
position: absolute;
bottom: 2px;
:root[dir="ltr"] & {
right: 2px;
}
:root[dir="rtl"] & {
left: 2px;
}
font-size: 0.7em;
color: #ccc;
}

View File

@ -2,16 +2,16 @@ import React from "react";
import { Popover } from "./Popover";
import "./ColorPicker.scss";
import { KEYS } from "../keys";
import { isArrowKey, KEYS } from "../keys";
import { t, getLanguage } from "../i18n";
import { isWritableElement } from "../utils";
import colors from "../colors";
function isValidColor(color: string) {
const isValidColor = (color: string) => {
const style = new Option().style;
style.color = color;
return !!style.color;
}
};
const getColor = (color: string): string | null => {
if (color === "transparent") {
@ -36,13 +36,14 @@ const keyBindings = [
["a", "s", "d", "f", "g"],
].flat();
const Picker = function ({
const Picker = ({
colors,
color,
onChange,
onClose,
label,
showInput = true,
type,
}: {
colors: string[];
color: string | null;
@ -50,19 +51,21 @@ const Picker = function ({
onClose: () => void;
label: string;
showInput: boolean;
}) {
type: "canvasBackground" | "elementBackground" | "elementStroke";
}) => {
const firstItem = React.useRef<HTMLButtonElement>();
const activeItem = React.useRef<HTMLButtonElement>();
const gallery = React.useRef<HTMLDivElement>();
const colorInput = React.useRef<HTMLInputElement>();
React.useEffect(() => {
// After the component is first mounted
// focus on first input
// After the component is first mounted focus on first input
if (activeItem.current) {
activeItem.current.focus();
} else if (colorInput.current) {
colorInput.current.focus();
} else if (gallery.current) {
gallery.current.focus();
}
}, []);
@ -74,18 +77,11 @@ const Picker = function ({
colorInput.current?.focus();
event.preventDefault();
}
} else {
if (activeElement === colorInput.current) {
firstItem.current?.focus();
event.preventDefault();
}
} else if (activeElement === colorInput.current) {
firstItem.current?.focus();
event.preventDefault();
}
} else if (
event.key === KEYS.ARROW_RIGHT ||
event.key === KEYS.ARROW_LEFT ||
event.key === KEYS.ARROW_UP ||
event.key === KEYS.ARROW_DOWN
) {
} else if (isArrowKey(event.key)) {
const { activeElement } = document;
const isRTL = getLanguage().rtl;
const index = Array.prototype.indexOf.call(
@ -123,7 +119,7 @@ const Picker = function ({
return (
<div
className="color-picker"
className={`color-picker color-picker-type-${type}`}
role="dialog"
aria-modal="true"
aria-label={t("labels.colorPicker")}
@ -138,6 +134,7 @@ const Picker = function ({
gallery.current = el;
}
}}
tabIndex={0}
>
{colors.map((_color, i) => (
<button
@ -235,7 +232,7 @@ const ColorInput = React.forwardRef(
},
);
export function ColorPicker({
export const ColorPicker = ({
type,
color,
onChange,
@ -245,7 +242,7 @@ export function ColorPicker({
color: string | null;
onChange: (color: string) => void;
label: string;
}) {
}) => {
const [isActive, setActive] = React.useState(false);
const pickerButton = React.useRef<HTMLButtonElement>(null);
@ -255,11 +252,7 @@ export function ColorPicker({
<button
className="color-picker-label-swatch"
aria-label={label}
style={
color
? ({ "--swatch-color": color } as React.CSSProperties)
: undefined
}
style={color ? { "--swatch-color": color } : undefined}
onClick={() => setActive(!isActive)}
ref={pickerButton}
/>
@ -290,10 +283,11 @@ export function ColorPicker({
}}
label={label}
showInput={false}
type={type}
/>
</Popover>
) : null}
</React.Suspense>
</div>
);
}
};

View File

@ -1,36 +1,97 @@
@import "open-color/open-color.scss";
@import "../css/variables.module";
.context-menu {
position: relative;
border-radius: 4px;
box-shadow: 0px 3px 10px transparentize($oc-black, 0.8);
padding: 0;
list-style: none;
user-select: none;
margin: -0.25rem 0 0 0.125rem;
padding: 0.25rem 0;
background-color: $oc-gray-1;
border: 1px solid $oc-gray-5;
}
.excalidraw {
.context-menu {
position: relative;
border-radius: 4px;
box-shadow: 0px 3px 10px transparentize($oc-black, 0.8);
padding: 0;
list-style: none;
user-select: none;
margin: -0.25rem 0 0 0.125rem;
padding: 0.5rem 0;
background-color: var(--popup-secondary-background-color);
border: 1px solid var(--button-gray-3);
cursor: default;
}
.context-menu-option {
position: relative;
width: 100%;
min-width: 9.5rem;
margin: 0;
padding: 0.25rem 1rem 0.25rem 1.25rem;
text-align: start;
border-radius: 0;
background-color: transparent;
border: none;
white-space: nowrap;
}
.context-menu button {
color: var(--popup-text-color);
}
.context-menu-option:hover {
color: $oc-white;
background-color: $oc-blue-5;
}
.context-menu-option {
position: relative;
width: 100%;
min-width: 9.5rem;
margin: 0;
padding: 0.25rem 1rem 0.25rem 1.25rem;
text-align: start;
border-radius: 0;
background-color: transparent;
border: none;
white-space: nowrap;
.context-menu-option:focus {
z-index: 1;
display: grid;
grid-template-columns: 1fr 0.2fr;
align-items: center;
&.checkmark::before {
position: absolute;
left: 6px;
margin-bottom: 1px;
content: "\2713";
}
&.dangerous {
.context-menu-option__label {
color: $oc-red-7;
}
}
.context-menu-option__label {
justify-self: start;
margin-inline-end: 20px;
}
.context-menu-option__shortcut {
justify-self: end;
opacity: 0.6;
font-family: inherit;
font-size: 0.7rem;
}
}
.context-menu-option:hover {
color: var(--popup-background-color);
background-color: var(--select-highlight-color);
&.dangerous {
.context-menu-option__label {
color: var(--popup-background-color);
}
background-color: $oc-red-6;
}
}
.context-menu-option:focus {
z-index: 1;
}
@media #{$is-mobile-query} {
.context-menu-option {
display: block;
.context-menu-option__label {
margin-inline-end: 0;
}
.context-menu-option__shortcut {
display: none;
}
}
}
.context-menu-option-separator {
border: none;
border-top: 1px solid $oc-gray-5;
}
}

View File

@ -1,70 +1,111 @@
import React from "react";
import { Popover } from "./Popover";
import { render, unmountComponentAtNode } from "react-dom";
import clsx from "clsx";
import { Popover } from "./Popover";
import { t } from "../i18n";
import "./ContextMenu.scss";
import {
getShortcutFromShortcutName,
ShortcutName,
} from "../actions/shortcuts";
import { Action } from "../actions/types";
import { ActionManager } from "../actions/manager";
import { AppState } from "../types";
type ContextMenuOption = {
label: string;
action(): void;
};
export type ContextMenuOption = "separator" | Action;
type Props = {
type ContextMenuProps = {
options: ContextMenuOption[];
onCloseRequest?(): void;
top: number;
left: number;
actionManager: ActionManager;
appState: Readonly<AppState>;
};
function ContextMenu({ options, onCloseRequest, top, left }: Props) {
const ContextMenu = ({
options,
onCloseRequest,
top,
left,
actionManager,
appState,
}: ContextMenuProps) => {
const isDarkTheme = !!document
.querySelector(".excalidraw")
?.classList.contains("Appearance_dark");
return (
<Popover
onCloseRequest={onCloseRequest}
top={top}
left={left}
fitInViewport={true}
<div
className={clsx("excalidraw", {
"Appearance_dark Appearance_dark-background-none": isDarkTheme,
})}
>
<ul
className="context-menu"
onContextMenu={(event) => event.preventDefault()}
<Popover
onCloseRequest={onCloseRequest}
top={top}
left={left}
fitInViewport={true}
>
{options.map((option, idx) => (
<li key={idx} onClick={onCloseRequest}>
<ContextMenuOption {...option} />
</li>
))}
</ul>
</Popover>
);
}
<ul
className="context-menu"
onContextMenu={(event) => event.preventDefault()}
>
{options.map((option, idx) => {
if (option === "separator") {
return <hr key={idx} className="context-menu-option-separator" />;
}
function ContextMenuOption({ label, action }: ContextMenuOption) {
return (
<button className="context-menu-option" onClick={action}>
{label}
</button>
const actionName = option.name;
const label = option.contextItemLabel
? t(option.contextItemLabel)
: "";
return (
<li key={idx} data-testid={actionName} onClick={onCloseRequest}>
<button
className={clsx("context-menu-option", {
dangerous: actionName === "deleteSelectedElements",
checkmark: option.checked?.(appState),
})}
onClick={() => actionManager.executeAction(option)}
>
<div className="context-menu-option__label">{label}</div>
<kbd className="context-menu-option__shortcut">
{actionName
? getShortcutFromShortcutName(actionName as ShortcutName)
: ""}
</kbd>
</button>
</li>
);
})}
</ul>
</Popover>
</div>
);
}
};
let contextMenuNode: HTMLDivElement;
function getContextMenuNode(): HTMLDivElement {
const getContextMenuNode = (): HTMLDivElement => {
if (contextMenuNode) {
return contextMenuNode;
}
const div = document.createElement("div");
document.body.appendChild(div);
return (contextMenuNode = div);
}
};
type ContextMenuParams = {
options: (ContextMenuOption | false | null | undefined)[];
top: number;
left: number;
top: ContextMenuProps["top"];
left: ContextMenuProps["left"];
actionManager: ContextMenuProps["actionManager"];
appState: Readonly<AppState>;
};
function handleClose() {
const handleClose = () => {
unmountComponentAtNode(getContextMenuNode());
}
};
export default {
push(params: ContextMenuParams) {
@ -81,6 +122,8 @@ export default {
left={params.left}
options={options}
onCloseRequest={handleClose}
actionManager={params.actionManager}
appState={params.appState}
/>,
getContextMenuNode(),
);

View File

@ -0,0 +1,58 @@
import "./ToolIcon.scss";
import React from "react";
import { t } from "../i18n";
export type Appearence = "light" | "dark";
// We chose to use only explicit toggle and not a third option for system value,
// but this could be added in the future.
export const DarkModeToggle = (props: {
value: Appearence;
onChange: (value: Appearence) => void;
}) => {
return (
<label
className={`ToolIcon ToolIcon_type_floating ToolIcon_size_M`}
title={
props.value === "dark" ? t("buttons.lightMode") : t("buttons.darkMode")
}
>
<input
className="ToolIcon_type_checkbox ToolIcon_toggle_opaque"
type="checkbox"
onChange={(event) =>
props.onChange(event.target.checked ? "dark" : "light")
}
checked={props.value === "dark"}
aria-label={
props.value === "dark"
? t("buttons.lightMode")
: t("buttons.darkMode")
}
/>
<div className="ToolIcon__icon">
{props.value === "light" ? ICONS.MOON : ICONS.SUN}
</div>
</label>
);
};
const ICONS = {
SUN: (
<svg width="512" height="512" className="rtl-mirror" viewBox="0 0 512 512">
<path
fill="currentColor"
d="M256 160c-52.9 0-96 43.1-96 96s43.1 96 96 96 96-43.1 96-96-43.1-96-96-96zm246.4 80.5l-94.7-47.3 33.5-100.4c4.5-13.6-8.4-26.5-21.9-21.9l-100.4 33.5-47.4-94.8c-6.4-12.8-24.6-12.8-31 0l-47.3 94.7L92.7 70.8c-13.6-4.5-26.5 8.4-21.9 21.9l33.5 100.4-94.7 47.4c-12.8 6.4-12.8 24.6 0 31l94.7 47.3-33.5 100.5c-4.5 13.6 8.4 26.5 21.9 21.9l100.4-33.5 47.3 94.7c6.4 12.8 24.6 12.8 31 0l47.3-94.7 100.4 33.5c13.6 4.5 26.5-8.4 21.9-21.9l-33.5-100.4 94.7-47.3c13-6.5 13-24.7.2-31.1zm-155.9 106c-49.9 49.9-131.1 49.9-181 0-49.9-49.9-49.9-131.1 0-181 49.9-49.9 131.1-49.9 181 0 49.9 49.9 49.9 131.1 0 181z"
></path>
</svg>
),
MOON: (
<svg width="512" height="512" className="rtl-mirror" viewBox="0 0 512 512">
<path
fill="currentColor"
d="M283.211 512c78.962 0 151.079-35.925 198.857-94.792 7.068-8.708-.639-21.43-11.562-19.35-124.203 23.654-238.262-71.576-238.262-196.954 0-72.222 38.662-138.635 101.498-174.394 9.686-5.512 7.25-20.197-3.756-22.23A258.156 258.156 0 0 0 283.211 0c-141.309 0-256 114.511-256 256 0 141.309 114.511 256 256 256z"
></path>
</svg>
),
};

View File

@ -1,60 +1,74 @@
@import "../css/_variables";
@import "../css/variables.module";
.Dialog__title {
display: grid;
align-items: center;
margin-top: 0;
grid-template-columns: 1fr calc(var(--space-factor) * 7);
grid-gap: var(--metric);
}
.Dialog__titleContent {
flex: 1;
}
.Dialog .Modal__close {
margin: 0;
}
@media #{$media-query} {
.excalidraw {
.Dialog {
--metric: calc(var(--space-factor) * 4);
--inset-left: #{"max(var(--metric), var(--sal))"};
--inset-right: #{"max(var(--metric), var(--sar))"};
user-select: text;
cursor: auto;
}
.Dialog__title {
grid-template-columns: calc(var(--space-factor) * 7) 1fr calc(
var(--space-factor) * 7
);
position: sticky;
top: calc(-1 * var(--metric));
margin: calc(-1 * var(--inset-right));
margin-top: calc(-1 * var(--metric));
margin-bottom: var(--metric);
padding: calc(var(--space-factor) * 2);
padding-left: var(--inset-left);
padding-right: var(--inset-right);
background: white;
font-size: 1.25em;
box-sizing: border-box;
border-bottom: 1px solid $oc-gray-4;
z-index: 1;
}
.Dialog__titleContent {
.Dialog__title {
display: grid;
align-items: center;
margin-top: 0;
grid-template-columns: 1fr calc(var(--space-factor) * 7);
grid-gap: var(--metric);
padding: calc(var(--space-factor) * 2);
text-align: center;
font-variant: small-caps;
font-size: 1.2em;
}
.Dialog .Island {
width: 100vw;
height: 100%;
box-sizing: border-box;
overflow-y: auto;
padding-left: #{"max(calc(var(--padding) * var(--space-factor)), var(--sal))"};
padding-right: #{"max(calc(var(--padding) * var(--space-factor)), var(--sar))"};
padding-bottom: #{"max(calc(var(--padding) * var(--space-factor)), var(--sab))"};
.Dialog__titleContent {
flex: 1;
}
.Dialog .Modal__close {
order: -1;
color: var(--icon-fill-color);
margin: 0;
}
.Dialog__content {
padding: 0 16px 16px;
}
@media #{$is-mobile-query} {
.Dialog {
--metric: calc(var(--space-factor) * 4);
--inset-left: #{"max(var(--metric), var(--sal))"};
--inset-right: #{"max(var(--metric), var(--sar))"};
}
.Dialog__title {
grid-template-columns: calc(var(--space-factor) * 7) 1fr calc(
var(--space-factor) * 7
);
position: sticky;
top: 0;
padding: calc(var(--space-factor) * 2);
background: var(--bg-color-island);
font-size: 1.25em;
box-sizing: border-box;
border-bottom: 1px solid var(--button-gray-2);
z-index: 1;
}
.Dialog__titleContent {
text-align: center;
}
.Dialog .Island {
width: 100vw;
height: 100%;
box-sizing: border-box;
overflow-y: auto;
padding-left: #{"max(calc(var(--padding) * var(--space-factor)), var(--sal))"};
padding-right: #{"max(calc(var(--padding) * var(--space-factor)), var(--sar))"};
padding-bottom: #{"max(calc(var(--padding) * var(--space-factor)), var(--sab))"};
}
.Dialog .Modal__close {
order: -1;
}
}
}

View File

@ -1,39 +1,39 @@
import React, { useEffect, useRef } from "react";
import { Modal } from "./Modal";
import { Island } from "./Island";
import clsx from "clsx";
import React, { useEffect } from "react";
import { useCallbackRefState } from "../hooks/useCallbackRefState";
import { t } from "../i18n";
import useIsMobile from "../is-mobile";
import { back, close } from "./icons";
import { KEYS } from "../keys";
import "./Dialog.scss";
import { back, close } from "./icons";
import { Island } from "./Island";
import { Modal } from "./Modal";
export function Dialog(props: {
export const Dialog = (props: {
children: React.ReactNode;
className?: string;
maxWidth?: number;
small?: boolean;
onCloseRequest(): void;
title: React.ReactNode;
}) {
const islandRef = useRef<HTMLDivElement>(null);
autofocus?: boolean;
}) => {
const [islandNode, setIslandNode] = useCallbackRefState<HTMLDivElement>();
useEffect(() => {
const focusableElements = queryFocusableElements();
if (focusableElements.length > 0) {
// If there's an element other than close, focus it.
(focusableElements[1] || focusableElements[0]).focus();
}
}, []);
useEffect(() => {
if (!islandRef.current) {
if (!islandNode) {
return;
}
function handleKeyDown(event: KeyboardEvent) {
const focusableElements = queryFocusableElements(islandNode);
if (focusableElements.length > 0 && props.autofocus !== false) {
// If there's an element other than close, focus it.
(focusableElements[1] || focusableElements[0]).focus();
}
const handleKeyDown = (event: KeyboardEvent) => {
if (event.key === KEYS.TAB) {
const focusableElements = queryFocusableElements();
const focusableElements = queryFocusableElements(islandNode);
const { activeElement } = document;
const currentIndex = focusableElements.findIndex(
(element) => element === activeElement,
@ -50,30 +50,29 @@ export function Dialog(props: {
event.preventDefault();
}
}
}
};
const node = islandRef.current;
node.addEventListener("keydown", handleKeyDown);
islandNode.addEventListener("keydown", handleKeyDown);
return () => node.removeEventListener("keydown", handleKeyDown);
}, []);
return () => islandNode.removeEventListener("keydown", handleKeyDown);
}, [islandNode, props.autofocus]);
function queryFocusableElements() {
const focusableElements = islandRef.current?.querySelectorAll<HTMLElement>(
const queryFocusableElements = (node: HTMLElement) => {
const focusableElements = node.querySelectorAll<HTMLElement>(
"button, a, input, select, textarea, div[tabindex]",
);
return focusableElements ? Array.from(focusableElements) : [];
}
};
return (
<Modal
className={`${props.className ?? ""} Dialog`}
className={clsx("Dialog", props.className)}
labelledBy="dialog-title"
maxWidth={props.maxWidth}
maxWidth={props.small ? 550 : 800}
onCloseRequest={props.onCloseRequest}
>
<Island padding={4} ref={islandRef}>
<Island ref={setIslandNode}>
<h2 id="dialog-title" className="Dialog__title">
<span className="Dialog__titleContent">{props.title}</span>
<button
@ -84,8 +83,8 @@ export function Dialog(props: {
{useIsMobile() ? back : close}
</button>
</h2>
{props.children}
<div className="Dialog__content">{props.children}</div>
</Island>
</Modal>
);
}
};

View File

@ -3,13 +3,13 @@ import { t } from "../i18n";
import { Dialog } from "./Dialog";
export function ErrorDialog({
export const ErrorDialog = ({
message,
onClose,
}: {
message: string;
onClose?: () => void;
}) {
}) => {
const [modalIsShown, setModalIsShown] = useState(!!message);
const handleClose = React.useCallback(() => {
@ -24,13 +24,20 @@ export function ErrorDialog({
<>
{modalIsShown && (
<Dialog
maxWidth={500}
small
onCloseRequest={handleClose}
title={t("errorDialog.title")}
>
<div>{message}</div>
<div>
{message.split("\n").map((line) => (
<>
{line}
<br />
</>
))}
</div>
</Dialog>
)}
</>
);
}
};

View File

@ -1,57 +1,69 @@
@import "../css/_variables";
@import "../css/variables.module";
.ExportDialog__preview {
--preview-padding: calc(var(--space-factor) * 4);
.excalidraw {
.ExportDialog__preview {
--preview-padding: calc(var(--space-factor) * 4);
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==")
left center;
text-align: center;
padding: var(--preview-padding);
margin-bottom: calc(var(--space-factor) * 3);
}
.ExportDialog__preview canvas {
max-width: calc(100% - var(--preview-padding) * 2);
max-height: 25rem;
}
.ExportDialog__actions {
width: 100%;
display: flex;
grid-gap: calc(var(--space-factor) * 2);
align-items: top;
justify-content: space-between;
}
.ExportDialog__name {
grid-column: project-name;
margin: auto;
}
@media (max-width: 550px) {
.ExportDialog {
display: flex;
flex-direction: column;
}
.ExportDialog__actions {
flex-direction: column;
align-items: center;
}
.ExportDialog__actions > * {
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==")
left center;
text-align: center;
padding: var(--preview-padding);
margin-bottom: calc(var(--space-factor) * 3);
}
}
@media #{$media-query} {
.ExportDialog__preview canvas {
max-height: 30vh;
max-width: calc(100% - var(--preview-padding) * 2);
max-height: 25rem;
}
.ExportDialog__dialog,
.ExportDialog__dialog .Island {
height: 100%;
box-sizing: border-box;
&.Appearance_dark .ExportDialog__preview canvas {
filter: none;
}
.ExportDialog__dialog .Island {
overflow-y: auto;
.ExportDialog__actions {
width: 100%;
display: flex;
grid-gap: calc(var(--space-factor) * 2);
align-items: top;
justify-content: space-between;
}
.ExportDialog__name {
grid-column: project-name;
margin: auto;
.TextInput {
height: calc(1rem - 3px);
}
}
@media #{$is-mobile-query} {
.ExportDialog {
display: flex;
flex-direction: column;
}
.ExportDialog__actions {
flex-direction: column;
align-items: center;
}
.ExportDialog__actions > * {
margin-bottom: calc(var(--space-factor) * 3);
}
.ExportDialog__preview canvas {
max-height: 30vh;
}
.ExportDialog__dialog,
.ExportDialog__dialog .Island {
height: 100%;
box-sizing: border-box;
}
.ExportDialog__dialog .Island {
overflow-y: auto;
}
}
}

View File

@ -1,30 +1,55 @@
import "./ExportDialog.scss";
import React, { useState, useEffect, useRef } from "react";
import { ToolButton } from "./ToolButton";
import { clipboard, exportFile, link } from "./icons";
import { NonDeletedExcalidrawElement } from "../element/types";
import { AppState } from "../types";
import { exportToCanvas } from "../scene/export";
import React, { useEffect, useRef, useState } from "react";
import { render, unmountComponentAtNode } from "react-dom";
import { ActionsManagerInterface } from "../actions/types";
import Stack from "./Stack";
import { t } from "../i18n";
import { probablySupportsClipboardBlob } from "../clipboard";
import { getSelectedElements, isSomeElementSelected } from "../scene";
import { canvasToBlob } from "../data/blob";
import { NonDeletedExcalidrawElement } from "../element/types";
import { CanvasError } from "../errors";
import { t } from "../i18n";
import useIsMobile from "../is-mobile";
import { getSelectedElements, isSomeElementSelected } from "../scene";
import { exportToCanvas, getExportSize } from "../scene/export";
import { AppState } from "../types";
import { Dialog } from "./Dialog";
import "./ExportDialog.scss";
import { clipboard, exportFile, link } from "./icons";
import Stack from "./Stack";
import { ToolButton } from "./ToolButton";
const scales = [1, 2, 3];
const defaultScale = scales.includes(devicePixelRatio) ? devicePixelRatio : 1;
export const ErrorCanvasPreview = () => {
return (
<div>
<h3>{t("canvasError.cannotShowPreview")}</h3>
<p>
<span>{t("canvasError.canvasTooBig")}</span>
</p>
<em>({t("canvasError.canvasTooBigTip")})</em>
</div>
);
};
const renderPreview = (
content: HTMLCanvasElement | Error,
previewNode: HTMLDivElement,
) => {
unmountComponentAtNode(previewNode);
previewNode.innerHTML = "";
if (content instanceof HTMLCanvasElement) {
previewNode.appendChild(content);
} else {
render(<ErrorCanvasPreview />, previewNode);
}
};
export type ExportCB = (
elements: readonly NonDeletedExcalidrawElement[],
scale?: number,
) => void;
function ExportModal({
const ExportModal = ({
elements,
appState,
exportPadding = 10,
@ -41,9 +66,9 @@ function ExportModal({
onExportToPng: ExportCB;
onExportToSvg: ExportCB;
onExportToClipboard: ExportCB;
onExportToBackend: ExportCB;
onExportToBackend?: ExportCB;
onCloseRequest: () => void;
}) {
}) => {
const someElementIsSelected = isSomeElementSelected(elements, appState);
const [scale, setScale] = useState(defaultScale);
const [exportSelected, setExportSelected] = useState(someElementIsSelected);
@ -64,17 +89,32 @@ function ExportModal({
useEffect(() => {
const previewNode = previewRef.current;
const canvas = exportToCanvas(exportedElements, appState, {
exportBackground,
viewBackgroundColor,
exportPadding,
scale,
shouldAddWatermark,
});
previewNode?.appendChild(canvas);
return () => {
previewNode?.removeChild(canvas);
};
if (!previewNode) {
return;
}
try {
const canvas = exportToCanvas(exportedElements, appState, {
exportBackground,
viewBackgroundColor,
exportPadding,
scale,
shouldAddWatermark,
});
// if converting to blob fails, there's some problem that will
// likely prevent preview and export (e.g. canvas too big)
canvasToBlob(canvas)
.then(() => {
renderPreview(canvas, previewNode);
})
.catch((error) => {
console.error(error);
renderPreview(new CanvasError(), previewNode);
});
} catch (error) {
console.error(error);
renderPreview(new CanvasError(), previewNode);
}
}, [
appState,
exportedElements,
@ -87,7 +127,7 @@ function ExportModal({
return (
<div className="ExportDialog">
<div className="ExportDialog__preview" ref={previewRef}></div>
<div className="ExportDialog__preview" ref={previewRef} />
<Stack.Col gap={2} align="center">
<div className="ExportDialog__actions">
<Stack.Row gap={2}>
@ -114,31 +154,47 @@ function ExportModal({
onClick={() => onExportToClipboard(exportedElements, scale)}
/>
)}
<ToolButton
type="button"
icon={link}
title={t("buttons.getShareableLink")}
aria-label={t("buttons.getShareableLink")}
onClick={() => onExportToBackend(exportedElements)}
/>
{onExportToBackend && (
<ToolButton
type="button"
icon={link}
title={t("buttons.getShareableLink")}
aria-label={t("buttons.getShareableLink")}
onClick={() => onExportToBackend(exportedElements)}
/>
)}
</Stack.Row>
<div className="ExportDialog__name">
{actionManager.renderAction("changeProjectName")}
</div>
<Stack.Row gap={2}>
{scales.map((s) => (
<ToolButton
key={s}
size="s"
type="radio"
icon={`x${s}`}
name="export-canvas-scale"
aria-label={`Scale ${s} x`}
id="export-canvas-scale"
checked={s === scale}
onChange={() => setScale(s)}
/>
))}
{scales.map((s) => {
const [width, height] = getExportSize(
exportedElements,
exportPadding,
shouldAddWatermark,
s,
);
const scaleButtonTitle = `${t(
"buttons.scale",
)} ${s}x (${width}x${height})`;
return (
<ToolButton
key={s}
size="s"
type="radio"
icon={`${s}x`}
name="export-canvas-scale"
title={scaleButtonTitle}
aria-label={scaleButtonTitle}
id="export-canvas-scale"
checked={s === scale}
onChange={() => setScale(s)}
/>
);
})}
</Stack.Row>
</div>
{actionManager.renderAction("changeExportBackground")}
@ -156,13 +212,14 @@ function ExportModal({
</label>
</div>
)}
{actionManager.renderAction("changeExportEmbedScene")}
{actionManager.renderAction("changeShouldAddWatermark")}
</Stack.Col>
</div>
);
}
};
export function ExportDialog({
export const ExportDialog = ({
elements,
appState,
exportPadding = 10,
@ -179,8 +236,8 @@ export function ExportDialog({
onExportToPng: ExportCB;
onExportToSvg: ExportCB;
onExportToClipboard: ExportCB;
onExportToBackend: ExportCB;
}) {
onExportToBackend?: ExportCB;
}) => {
const [modalIsShown, setModalIsShown] = useState(false);
const triggerButton = useRef<HTMLButtonElement>(null);
@ -192,7 +249,9 @@ export function ExportDialog({
return (
<>
<ToolButton
onClick={() => setModalIsShown(true)}
onClick={() => {
setModalIsShown(true);
}}
icon={exportFile}
type="button"
aria-label={t("buttons.export")}
@ -201,11 +260,7 @@ export function ExportDialog({
ref={triggerButton}
/>
{modalIsShown && (
<Dialog
maxWidth={800}
onCloseRequest={handleClose}
title={t("buttons.export")}
>
<Dialog onCloseRequest={handleClose} title={t("buttons.export")}>
<ExportModal
elements={elements}
appState={appState}
@ -221,4 +276,4 @@ export function ExportDialog({
)}
</>
);
}
};

View File

@ -1,36 +0,0 @@
.FixedSideContainer {
--margin: 0.25rem;
position: fixed;
pointer-events: none;
}
.FixedSideContainer > * {
pointer-events: all;
}
.FixedSideContainer_side_top {
left: var(--margin);
top: var(--margin);
right: var(--margin);
z-index: 2;
}
.FixedSideContainer_side_top.zen-mode {
right: 42px;
}
/* TODO: if these are used, make sure to implement RTL support
.FixedSideContainer_side_left {
left: var(--margin);
top: var(--margin);
bottom: var(--margin);
z-index: 1;
}
.FixedSideContainer_side_right {
right: var(--margin);
top: var(--margin);
bottom: var(--margin);
z-index: 3;
}
*/

View File

@ -0,0 +1,38 @@
.excalidraw {
.FixedSideContainer {
--margin: 0.25rem;
position: absolute;
pointer-events: none;
}
.FixedSideContainer > * {
pointer-events: all;
}
.FixedSideContainer_side_top {
left: var(--margin);
top: var(--margin);
right: var(--margin);
z-index: 2;
}
.FixedSideContainer_side_top.zen-mode {
right: 42px;
}
}
/* TODO: if these are used, make sure to implement RTL support
.FixedSideContainer_side_left {
left: var(--margin);
top: var(--margin);
bottom: var(--margin);
z-index: 1;
}
.FixedSideContainer_side_right {
right: var(--margin);
top: var(--margin);
bottom: var(--margin);
z-index: 3;
}
*/

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