Commit Graph

592 Commits

Author SHA1 Message Date
David Luzar 954d805cb3
rewrite clipboard handling (#689) 2020-02-04 11:50:18 +01:00
Gasim Gasimzada dab35c9033
Multi Point Lines (based on Multi Point Arrows) (#660)
* Enable multi points in lines

* Stop retrieving arrow points for lines

* Migrate lines to new spec during load

* Clean up and refactor some code

- Normalize shape dimensions during load
- Rename getArrowAbsoluteBounds

* Fix linter issues
2020-02-04 13:45:22 +04:00
Gasim Gasimzada f70bd0081c
Feature: Hint viewer (#666)
* Add Hint viewer

- Add hints for arrows and lines
- Add hints for resizing elements

* Swap priority of multi mode and resize mode in Hint Viewer

* Remove dangling locales from public

* Add shortcut to hide hints

* Change hint texts and show resize hint ONLY during resizing

* Remove hints toggling
2020-02-03 09:52:21 -08:00
rubjo 23d40ae4a5
Added Norwegian Bokmål (#685)
* Added Norwegian Bokmål

* Lint long line
2020-02-03 13:38:07 +01:00
dependabot-preview[bot] a2db55ae2b
Bump react-scripts from 3.3.0 to 3.3.1 (#684)
Bumps [react-scripts](https://github.com/facebook/create-react-app/tree/HEAD/packages/react-scripts) from 3.3.0 to 3.3.1.
- [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@3.3.1/packages/react-scripts)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-03 10:01:08 +01:00
dependabot-preview[bot] f6bddd9300
Bump @types/jest from 25.1.0 to 25.1.1 (#683)
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 25.1.0 to 25.1.1.
- [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>
2020-02-03 09:59:57 +01:00
dependabot-preview[bot] 48900a271b
Bump lint-staged from 10.0.3 to 10.0.7 (#682)
Bumps [lint-staged](https://github.com/okonet/lint-staged) from 10.0.3 to 10.0.7.
- [Release notes](https://github.com/okonet/lint-staged/releases)
- [Commits](https://github.com/okonet/lint-staged/compare/v10.0.3...v10.0.7)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-03 09:59:22 +01:00
dependabot-preview[bot] 0d176caa5b
Bump nanoid from 2.1.10 to 2.1.11 (#681)
Bumps [nanoid](https://github.com/ai/nanoid) from 2.1.10 to 2.1.11.
- [Release notes](https://github.com/ai/nanoid/releases)
- [Changelog](https://github.com/ai/nanoid/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ai/nanoid/compare/2.1.10...2.1.11)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-03 09:58:56 +01:00
Bakhtiiar Muzakparov f955f58bc4
Allow changing opacity with scroll wheel (#662) 2020-02-03 01:48:41 +00:00
Christopher Chedeau 68ca63ec14
Add step for opacity slider (#670)
Instead of freeform, let's only support 10 increments of opacity. Should help keep things consistent
2020-02-02 17:09:50 -08:00
Faustino Kialungila abd04cb870
Load only valid excalidraw json when drag&drop (#678)
* Load only valid excalidraw json when drag&drop

* fix lint error
2020-02-02 16:27:02 -08:00
lissitz 92a0f100b8
Drag and drop JSON exports to canvas loads the scene (#676)
* Drag and drop JSON exports to canvas loads the scene

* remove unneeded onDragOver
2020-02-02 21:02:13 +00:00
Lipis 53994e71e5
Add more ESLint rules and change the formatting scripts (#626)
* Add curly rule in ESLint for consistency

* Fix rules

* More rules

* REturn

* Push

* no else return

* prefer const

* destructing
2020-02-02 18:04:35 +00:00
Faustino Kialungila 814299321e
Add missing locales for scrollBackToContent (#663)
* Add missing locales for scrollToContent

* remove duplicated locales
2020-02-02 14:29:09 +00:00
Faustino Kialungila 92deb033a3
Update logo (#665) 2020-02-02 12:06:19 +01:00
Christopher Chedeau f8a41cee16
Add keybindings for shapes (#648)
* Add keybindings for shapes

I'm not 100% sure about this one. I feel like it's going to help people be a lot more productive to display the key bindings at all time. But it also clutters the UI...

* increase font-size

* fix shape keybindings for non-qwerty keyboards

* tweak position and color

Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-02-01 18:31:28 +01:00
Christopher Chedeau be97bd980e
Add button when scrolled outside of visible area (#643)
With the infinite scroll behavior, it's easy to scroll super far away from where the content is and have a hard time getting back. This PR adds a button to refocus on the center of the scene when no elements are visible anymore.
2020-02-01 17:52:10 +01:00
Faustino Kialungila 7c9e6dd3f1
support undo/redo for azerty keyboards (#630)
* support undo/redo for azerty keyboards

* migrate to event.key

* remove unnecessary shiftKey check

Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-02-01 17:37:22 +01:00
Christopher Chedeau 46791e6da1
Add keybindings for color picker (#647)
* Add keybindings for color picker

This adds the ability to navigate using left/right/bottom/up keys and shows key bindings for all the different colors. This is only optimized for the qwerty keyboard layout, but unfortunately it's not possible to detect other keyboard layouts :(

* add aria-keyshortcuts and keybinding in title

* make focus select color, confirm on enter

Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-02-01 13:56:15 +01:00
Gasim Gasimzada 1e4ce77612
Reintroduce multi-point arrows and add migration for it (#635)
* Revert "Revert "Feature: Multi Point Arrows (#338)" (#634)"

This reverts commit 3d2e59bfed.

* Convert old arrow spec to new one

* Remove unnecessary failchecks and fix context transform issue in retina displays

* Remove old points failcheck from getArrowAbsoluteBounds

* Remove all failchecks for old arrow

* remove the rest of unnecessary checks

* Set default values for the arrow during import

* Add translations

* fix restore using unmigrated elements for state computation

* don't use width/height when migrating from new arrow spec

Co-authored-by: David Luzar <luzar.david@gmail.com>
Co-authored-by: Christopher Chedeau <vjeuxx@gmail.com>
2020-02-01 15:49:18 +04:00
Christopher Chedeau 4ff88ae03d
Fix caret for real! (#653)
Turns out the root cause was the outline. For some reason, doing "transparent" doesn't work but doing "1px solid transparent" does. Don't know why but I'll take it!
2020-02-01 06:07:08 +00:00
Christopher Chedeau 9a76556bea
Fixed wysiwyg carret disappearing on Chrome (#652)
There's a bug where the carret doesn't show up when the text is first focused on Chrome with the previous combination of CSS. I tweaked it and now it seems to work (don't ask me why!).

Unfortunately on Safari, ever since we moved to contentEditable on #274, the carret disappeared the first time. I unsuccessfully tried to repro in a smaller codebase ( https://jsfiddle.net/u2mjs90y/1/ ) but it does work in Safari...

I'm not exactly sure what's going on, there are bunch of issues opened against this bug when googling against all the browsers...
2020-02-01 05:54:33 +00:00
Christopher Chedeau 70db792549
Allow copy pasting inside of wysiwyg element (#651)
We did some hackery to prevent copy pasting when we didn't support multilines. But we do now so we can remove it.

Interestingly, newlines are actually <br /> elements. So we need to tweak the isInputLike logic a bit
2020-02-01 04:06:27 +00:00
Christopher Chedeau f261d6f2fc
Fix font preloading (#649)
Thanks to this stack overflow answer ( https://stackoverflow.com/a/41678350/232122 ) I was able to fix the font preloading!

If we put fonts.css in the public/folder and include it with normal html, we can avoid going through the build pipeline!
2020-02-01 04:06:03 +00:00
Christopher Chedeau e50dc5dbed
Fix wysiwyg text overflow (#650)
By using position: fixed like the rest of the UI components, it will no longer make the body change size and have bad side effects like scrolling.

Fixes #365
2020-02-01 04:05:53 +00:00
Christopher Chedeau 47f6328ae1
Fix ability to use arrow keys to navigate between shapes (#646)
This is the only way to navigate using the keyboard and was prevented by #596. Now it works fine.

Test Plan:
- Click on selection icon
- Use left/right arrow keys to move between tool icons, that works.

- Click on a shape, cmd+c
- Click on the selection icon
- Cmd+v, it pastes correctly
2020-02-01 02:58:16 +00:00
Christopher Chedeau 39674fe2b0
Add outline to button list (#644)
It's unclear otherwise when using the keyboard
2020-02-01 02:57:57 +00:00
Christopher Chedeau 29f1465b81
Fix wrong cursor for selection keyboard shortcut (#645)
Pressing 1 would change the cursor to a + instead of normal cursor
2020-02-01 02:57:44 +00:00
Christopher Chedeau c7eebd42c1
Fix conflict (#641) 2020-01-31 21:51:35 +00:00
Lipis fc341c3763
Better handling of 404 errors when loading from backend (#608) 2020-01-31 21:34:14 +00:00
Christopher Chedeau ead9aab888
Remove enzyme (#640)
The test that was added is not a good test. If we want to test things, we should be testing logic that is error prone such as all the mouse handling logic and state management. Adding a test for something trivial as displaying a list of data is just going to be annoying when we eventually change the UI and the test breaks.

Since this is the only test using enzyme, I also removed enzyme. We can add it back if we want to test a component using it.
2020-01-31 21:32:09 +00:00
Christopher Chedeau e4919e2e6c
Replace i18n by a custom implementation (#638)
There are two problems with the current localization strategy:
- We download the translations on-demand, which means that it does a serial roundtrip for nothing.
- withTranslation helper actually renders the app 3 times on startup, instead of once (I haven't tried to debug it)
2020-01-31 21:06:06 +00:00
Christopher Chedeau 637276301a
Different call of resumeRecording() (#636)
Instead of finding all the places where we want to resume recording, we should do it after every componentDidUpdate(). The idea is that we just want to disable the history for certain setState, for which we call directly before skipHistory.
2020-01-31 21:09:42 +01:00
David Luzar 3d2e59bfed
Revert "Feature: Multi Point Arrows (#338)" (#634)
This reverts commit 16263e942b.
2020-01-31 18:56:55 +01:00
Gasim Gasimzada 16263e942b
Feature: Multi Point Arrows (#338)
* Add points to arrow on double click

* Use line generator instead of path to generate line segments

* Switch color of the circle when it is on an existing point in the segment

* Check point against both ends of the line segment to find collinearity

* Keep drawing the arrow based on mouse position until shape is changed

* Always select the arrow when in multi element mode

* Use curves instead of lines when drawing arrow points

* Add basic collision detection with some debug points

* Use roughjs shape when performing hit testing

* Draw proper handler rectangles for arrows

* Add argument to renderScene in export

* Globally resize all points on the arrow when bounds are resized

* Hide handler rectangles if an arrow has no size

- Allow continuing adding arrows when selected element is deleted

* Add dragging functionality to arrows

* Add SHIFT functionality to two point arrows

- Fix arrow positions when scrolling
- Revert the element back to selection when not in multi select mode

* Clean app state for export (JSON)

* Set curve options manually instead of using global options

- For some reason, this fixed the flickering issue in all shapes when arrows are rendered

* Set proper options for the arrow

* Increaase accuracy of hit testing arrows

- Additionally, skip testing if point is outside the domain of arrow and each curve

* Calculate bounding box of arrow based on roughjs curves

- Remove domain check per curve

* Change bounding box threshold to 10 and remove unnecessary code

* Fix handler rectangles for 2 and multi point arrows

- Fix margins of handler rectangles when using arrows
- Show handler rectangles in endpoints of 2-point arrows

* Remove unnecessary values from app state for export

* Use `resetTransform` instead of "retranslating" canvas space after each element rendering

* Allow resizing 2-point arrows

- Fix position of one of the handler rectangles

* refactor variable initialization

* Refactored to extract out mult-point generation to the abstracted function

* prevent dragging on arrow creation if under threshold

* Finalize selection during multi element mode when ENTER or ESC is clicked

* Set dragging element to null when finalizing

* Remove pathSegmentCircle from code

* Check if element is any "non-value" instead of NULL

* Show two points on any two point arrow and fix visibility of arrows during scroll

* Resume recording when done with drawing

- When deleting a multi select element, revert back to selection element type

* Resize arrow starting points perfectly

* Fix direction of arrow resize based for NW

* Resume recording history when there is more than one arrow

* Set dragging element to NULL when element is not locked

* Blur active element when finalizing

* Disable undo/redo for multielement, editingelement, and resizing element

- Allow undoing parts of the arrow

* Disable element visibility for arrow

* Use points array for arrow bounds when bezier curve shape is not available

Co-authored-by: David Luzar <luzar.david@gmail.com>
Co-authored-by: Preet <833927+pshihn@users.noreply.github.com>
2020-01-31 18:16:33 +01:00
Lipis 9a17abcb34
Cleanup .gitignore (#629) 2020-01-31 13:55:53 +01:00
David Luzar 6886dfdea7
ensure we reset draggingElement when tool locked (#627) 2020-01-30 22:14:40 +01:00
Guillermo Peralta Scura 35750d8d09
Panning with space key (#579)
* Panning with space key

* prevent panning when selecting/dragging & add more checks

* Fix changing current tool via shortcut while panning

* Fix order of statements

* teardown on blur event

* Refactor cursor setting

Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-01-30 17:08:59 -03:00
Robinson Marquez 4ad38e317e
485: Ability to switch to previously loaded ids in UI (#583) 2020-01-30 21:39:37 +02:00
David Luzar bd1c00014b
fix not resuming recording (#614) 2020-01-30 15:39:17 +01:00
David Luzar 023400c3cc
Revert "Fix keyboard shortcut (#587)" (#617)
This reverts commit cc3d71f13c.
2020-01-30 10:40:49 +01:00
Bakhtiiar Muzakparov cc3d71f13c
Fix keyboard shortcut (#587)
* Fix keyboard shortcut

Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-01-29 16:31:49 +00:00
Bakhtiiar Muzakparov 63c685af73
Add russian translation (#612) 2020-01-29 14:00:47 +00:00
Lipis 82717bceda
Remove eslint-plugin-json-format (#609)
* Remove eslint-plugin-json-format

* json
2020-01-29 11:26:40 +01:00
Panayiotis Lipiridis 5418f68cc5 Update deps 2020-01-29 03:05:00 +02:00
Lipis 2dce2ce712
Show labels instead of icons for PNG, SVG (#606) 2020-01-29 02:30:02 +02:00
Lipis a9790c74f5
Wider export dialog (#603) 2020-01-29 02:26:02 +02:00
Lipis ba4fc0f1b3
Minor redesign of Export Dialog (#604) 2020-01-29 02:25:47 +02:00
Preet 97b11b0f53
SVG export (#598)
* first draft of export to SVG. WIP

* enabled text rendeing - which is not quite right atm

* placeholder svg icon

* size the canvas based on the bounding box of elements

* Do not add opacity attributes if default

* render background rect

* Ensure arrows are in the same SVG group

* parse font-size from font

* export web fonts

* use fixed locations for fonts

* Rename export functions

* renamed export file

* oops broke the icon.
2020-01-28 12:25:13 -08:00
Lipis 321e4022b0
Add headers for Netlify (#602) 2020-01-28 21:15:24 +02:00