-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lexical-playground] 3 Bug Fixes, 1 UX Improvement: All Regarding Excalidraw Node #6666
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
size-limit report 📦
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not really clear why the history-merge tag was added to these updates, can you explain? I think that might not be the desired behavior.
@@ -84,7 +84,6 @@ export class ExcalidrawNode extends DecoratorNode<JSX.Element> { | |||
|
|||
exportJSON(): SerializedExcalidrawNode { | |||
return { | |||
...super.exportJSON(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch!
So the history-merge tags that were added are to prevent having the modal in the undo stack (ref to videos of UX improvement). The rest of the code changes are to handle the bugs. Consider the case: Open modal -> Draw -> Save. I guess there are 2 options for how I can imagine the UX working for undoing and redoing, the first is to count the entire process of opening, drawing and saving as a single action, which is what im proposing. The second option would be 1 undo opens the modal with the current data loaded and then another undo removes the node altogether, and similarly a single redo will open the modal with the data loaded and then another redo will put the image back. However the current process right now is one undo will delete the image without opening the modal, the second undo will actually delete the node and then a redo will show an empty modal with no data loaded in it, which is a bit weird because we didnt see the modal open when undoing, and also its empty. So to summarize the history-merge tags were added to the 3 functions to treat the actions of open modal -> draw -> save, open modal -> draw/dont draw -> discard, edit image -> change/no change -> save, edit image -> change/no change -> discard as single actions. |
I am not particularly familiar with this code but I suspect that this might cause some problems with collab which is the only reason I can think of to have the node's state update while the modal is open. In the single user case I think a better strategy would be to only update the state that the decorator exposes to the editor when the modal closes? |
I just tried excalidraw using collab. It doesn't seem to be even usable because modal opens on both screens. Would having the toolbar open the excalidraw modal, and then only creating the node on save make sense? I think that would solve both problems. |
I think so, at least that's the approach I would take if I was building that node + plug-in |
I have moved the code for opening the modal into the ui folder and decoupled the creation of the node from the opening/editing of the modal. The node is only created on saving the modal. |
Any advice how to fix the failing tests? |
It was the flaky set of tests, all good now. @etrepum happy to merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this out and it the resizing of these nodes does not persist in history, although that is not a regression in this particular PR (maybe the last one though?)
I think this has never worked, I'm planning on fixing this next. |
Description
Bug 1: Excalidraw node being deleted when discarding an empty scene (no elements).
Steps to Reproduce
Current Behaviour:
New Behaviour:
Bug 2: Excalidraw node still being inserted when discarding a non-empty scene.
Steps to Reproduce
Current Behaviour:
New Behaviour:
Video of Bug 1 and 2 (Before Changes)
discard_bug_before.mov
Video of Bug 1 and 2 (After Changes)
discard_bug_after.mov
UX Improvement 1: Do not include the modal in the undo stack
Steps to Reproduce
Current Behaviour:
New Behaviour
Video of UX Improvement 1 (Before Changes)
ux_improvement_before.mov
Video of UX Improvement 1 (After Changes)
ux_improvement_after.mov
Bug 3
Lastly, removed a small bug DecoratorNode doesn't have an exportJSON method.
Future Work