-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Hide some controls on multi selection of Image blocks #27105
Merged
Merged
Conversation
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
ntsekouras
added
[Type] Bug
An existing feature does not function as intended
[Feature] Block Multi Selection
The ability to select and manipulate multiple blocks
[Block] Image
Affects the Image Block
labels
Nov 19, 2020
Size Change: +80 B (0%) Total Size: 1.19 MB
ℹ️ View Unchanged
|
ntsekouras
force-pushed
the
fix/multiselected-image-controls
branch
from
November 20, 2020 11:02
132c70f
to
1e62df9
Compare
draganescu
approved these changes
Nov 20, 2020
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 and it works as described. It is a good solution for now as it spares the user of unexpected results.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
[Block] Image
Affects the Image Block
[Feature] Block Multi Selection
The ability to select and manipulate multiple blocks
[Type] Bug
An existing feature does not function as intended
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.
Description
Resolves: #26620
Quite recently this PR got merged(#22470) which enables multi select block attribute controls. While this works great in many cases and is very useful, there are other cases, like the above issue, that enables updates that are wrong.
The issue's case is when you multi select
Image
blocks and go to set the link toMedia File
, it updates all images with the first image's source, which is wrong. The same applies forcrop
,replace
andalt
.In general if you change/update an attribute of the first block, the change will be applied to all of them. This is integrated deeply in
setAttributes
function of each block (gutenberg/packages/block-editor/src/components/block-list/block.js
Line 357 in 3d78dd2
This PR for now just hides the controls that don't make sense for multi selection of Image blocks (href, crop, replace, alt).
This is a problem though that might affect other blocks as well. A follow up could be to make this functionality opt-in, as it's been discussed in the PR, or a follow up for handling the display of some of the controls (only the ones that make sense per block) in a more generic way. Any thoughts?