Skip to content
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

feat(edgeless): support consistent dragging behavior #5613

Merged
merged 3 commits into from
Dec 14, 2023

Conversation

AyushAgrawal-A2
Copy link
Contributor

@AyushAgrawal-A2 AyushAgrawal-A2 commented Dec 7, 2023

closes #5561

Changes:
In edgeless mode,

  • dragging edgeless-note onto another edgeless-note merge the notes.
  • dragging multiple blocks from edgeless-note onto whiteboard move the blocks into a new edgeless-note.
  • dragging single image/bookmark/embed-* block from edgeless-note onto whiteboard creates a top-level edgeless block.
  • dragging top-level edgeless image/bookmark/embed-* block onto edgeless note move the block inside the edgeless note.

Copy link

vercel bot commented Dec 7, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
blocksuite ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 14, 2023 8:57am
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
blocksuite-docs ⬜️ Ignored (Inspect) Visit Preview Dec 14, 2023 8:57am

@AyushAgrawal-A2 AyushAgrawal-A2 marked this pull request as draft December 7, 2023 11:23
@AyushAgrawal-A2 AyushAgrawal-A2 marked this pull request as ready for review December 13, 2023 20:02
@AyushAgrawal-A2 AyushAgrawal-A2 marked this pull request as draft December 13, 2023 20:03
@AyushAgrawal-A2 AyushAgrawal-A2 marked this pull request as ready for review December 13, 2023 21:31
Copy link
Member

@doodlewind doodlewind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work, we should definitely land this!

Two minor issues:

  1. After dragging out an image, you can undo this operation, but unable to redo it back:
Screen.Recording.2023-12-14.at.21.51.31.mov

This usually happens due to unexpected side effect (model mutation) that comes with the undo, which resets the history stack.

  1. After dragging an image inside the note, the first undo/redo pair works fine. But from this moment, it requires 2 undo operations to make actual undo effect:
Screen.Recording.2023-12-14.at.21.56.45.mov

This usually happens when page.captureSync() is called during a series of model operations, which will add one undo step.

By default, the UndoManger merges all operations from the same user during about 500ms (even if these operations are using multiple page.transact calls) into one undo step. Using page.captureSync() is the way to add more undo steps manually. For certain cases (e.g., batch adding images), adding more undo steps allows user to undo each operation one after another.

@doodlewind doodlewind merged commit 9ace300 into toeverything:master Dec 14, 2023
19 checks passed
@AyushAgrawal-A2 AyushAgrawal-A2 deleted the ayush/5561 branch December 14, 2023 14:33
nawbc pushed a commit to deskbtm-publish/blocksuite that referenced this pull request Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
housekeeping needed Contains workarounds that should be refactored notable Major improvement worth emphasizing
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Support consistent dragging behavior in edgeless mode
4 participants