-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Try/deleting multi blocks #3194
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
14d2bcd
only pass through potential focus while not in multi-block selection
ephox-mogran 40c6efd
focusing the next block after deleting
ephox-mogran 96beac8
deleting and focusing blocks on BlockDelete button
ephox-mogran cc43e66
adding tests for DELETE_BLOCKS
ephox-mogran File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do we really want a new action. Could we just use a flag?
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.
Or dispatch two actions?
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.
Yes, we shouldn't have two concurrent actions with hard-to-distinguish semantics.
In the new
DELETE_BLOCKS
effect, the removal itself is not conditional on state (only on payload, with the check forblockUids.length
). Therefore, we should keep a single action,REMOVE_BLOCKS
, and add a small effect for it that handles the new focus.Now, the PR deals with two separate things:
The former is a bug fix, the latter a UX improvement. I like it, but it begs the question: if we want to refocus a block after a multi-block deletion, are there any other cases (single-block deletion) where we don't want to refocus a block? Should we prefer a consistent behavior, whether that means always refocusing or never refocusing? cc @jasmussen
If still we want to make a distinction, then our
effects.REMOVE_BLOCKS
could look like: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've generally found flags are much harder to reason about later, and don't scale at all --- but that's my experience. I'm happy to go with the majority.
I incorrectly assumed that for multi-actions, that effects is where they should go. I'm now realising that effects is for more complicated things. I don't think I'd seen many examples of where more than one action was dispatched in a component, so I thought that if you needed to do that, you put it in effects. My mistake.
My rationale for keeping the old behaviour and adding new behaviour is that you never want to enforce focus in an action. You might find that something starts removing blocks asynchronously, and it can not focus grab from where you are. We could do some other logic, like only focus another block if we know for sure the focus was in one of the blocks to be removed (because nothing about the remove semantics enforces that they were selected), but I would strongly advise against always refocusing a block on
remove
unless it's a bit smarter than just "always".In regards to the
actions
,effects
separation, I'd really welcome something fixing it with a commit, and then I can look at the diff and see by example what your preferred approach is.