-
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
Block options: disable mode toggle when block is in warning state #7886
Conversation
Would it make more sense to still show the options, but have them be disabled? |
|
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.
Aside: This pull request includes a few too many unrelated changes that's made it more difficult than it should be to review in tandem.
@@ -21,6 +20,7 @@ $z-layers: ( | |||
'.components-popover__close': 5, | |||
'.editor-block-list__insertion-point': 5, | |||
'.editor-inserter-with-shortcuts': 5, | |||
'.editor-warning': 6, |
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.
Are we increasing the z-index
for the block warning specifically, and if so, will it have negative consequences on any other "EditorWarnings" present in the application? It was meant to be made separate for general reusability, and thus we should be aware of cascading effects on other usage. Alternatively, we could create a separate z-index
for the specific block warning.
@@ -558,8 +559,8 @@ export class BlockListBlock extends Component { | |||
uid={ uid } | |||
/> | |||
) } | |||
{ !! error && <BlockCrashWarning /> } |
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.
Why was this moved?
@aduth this PR is a work in progress and contains the contents of other PRs, specifically #7866 which is handling the changes you commented on. Once the other work is finished I'll remove it from this one so it just contains the relevant code. @SuperGeniusZeb possibly, I'll need to consult with a designer |
86c4de7
to
c0b9f6c
Compare
Rebased all the cruft out and went with the suggestion from @SuperGeniusZeb to disable the item, as shown in the updated screenshot. It should be good to go now. There's a Travis CI e2e failure which seems unrelated to this PR |
c0b9f6c
to
86dc382
Compare
86dc382
to
afb6d22
Compare
Adds a `canEdit` prop to the block settings menu that determines whether the mode toggle menu option is enabled. When a block is in an error state (crashed or invalid content) then the mode toggle is disabled as it has no effect.
afb6d22
to
13dc2e0
Compare
Closing in favour of #9088 |
Description
If you put a block into a warning state the block option 'Edit visually' and 'Edit as HTML' are still available and toggle state, but have no outward effect on the block.
To avoid user confusion this PR disables the mode toggle option when a block is showing a warning. As soon as the warning is cleared the option is restored.
Fixes #7743
How has this been tested?
Additional unit tests have been added to test the mode toggle enable/disable.
Manually test that the 'edit visually' and 'edit as HTML' options are removed from the block 'more options' menu:
</p>
to trigger an invalid block warningwp.blocks.registerBlockType( 'myplugin/mr-crashy', { title: 'Mr. Crashy', category: 'common', icon: 'warning', edit() { throw new Error(); }, save() { return ''; } } );
Mr Crashy
block to a postTypes of changes
This PR changes the behaviour of an existing feature.
Checklist: