-
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
Columns Block: Don't show the column count change UI when templateLock
is all
#48691
Conversation
Size Change: +31 B (0%) Total Size: 1.34 MB
ℹ️ View Unchanged
|
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.
Thanks for the ping @t-hamano, this PR's testing nicely for me for the templateLock all
case, while not causing any unrelated issues for the Column(s) blocks 👍
One thing I noticed in testing is that there's another case that might be good to try to handle, which is when blocks are locked via the lock
attribute or via the UI for locking. For example, if I go to lock individual column blocks against removal, but then move up to the parent Columns block, then I can still adjust the slider to remove the column blocks:
columns-lock.mp4
This isn't strictly speaking related to templateLock
, though, and the fix in this PR still looks like a good approach to me, so I don't think this is a blocker.
This LGTM! ✨
Thank you for the review, @andrewserong!
This is a bit of a complicated issue. Because we also need to consider the case where only some columns are locked. For example, only one of the four columns is locked, as shown below:
If the number of columns is reduced, the columns are removed from the back of the list. If I change the number of columns from 4 to 2 in the text control, I would expect the following layout:
In other words, the logic is to delete columns in order from the back, and if a locked column is hit, no more columns are deleted. I will try to resolve this issue in another PR 👍 |
See: #48620 (comment)
What?
This PR hides the column change UI in the sidebar if the
core/columns
block hastemplateLock=all
, i.e., thecore/column
block is not allowed to be inserted.Why?
If
templateLock
isall
, no inner blocks are allowed to be inserted. However, by using the slider to change the number of columns, it is possible to insert columns that are in fact inner blocks. Given the role of templateLock, I think it should not be the intent that the UI can be manipulated.How?
I used
canInsertBlockType()
to not show the column change UI if thecore/columns
block is in a context where it cannot be inserted.Testing Instructions
Use the following HTML to insert a group block with
templateLock=all
set.Confirm that the column count change UI is not displayed when selecting a
core/columns
block in a group block.Screenshots or screencast
Before
After