Reorganize conditionals for block context menu #2390
Merged
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.
The basics
The details
Resolves
Issue #2388 - Comments should be allowed on non-movable/deletable blocks
Proposed Changes
Regardless of deletable state:
Block Factory:
Reason for Changes
Previously, most of the context menu entries required that the block must be movable and deletable in addition to being editable. However, there's no compelling reason for these strict requirements: a block that can be edited should still be able to have a comment even if it can't be moved or deleted.
While making this change, I noticed that the other menu items could have their restrictions similarly loosened. Changing the visual organization of a block's inputs can be considered a "move" operation, so the inline/external toggle and the collapse/expand toggle don't need to be blocked by the deletable or editable flags. Similarly, changing the enabled/disabled state of a block can be considered an "edit" operation and it doesn't need to be blocked by the deletable or movable flags.
With the more permissive flags, existing code such as blockfactory have menu items appear that don't make sense in context. Since blockfactory is used for more than just a demo, I made sure to update the configuration.
Test Coverage
Playground testing:
Tested on:
Additional Information