-
Notifications
You must be signed in to change notification settings - Fork 381
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
Add AMP plugin editor sidebar #5589
Conversation
…b.com/ampproject/amp-wp into feature/3821-block-validation-sidebar
…-validation-sidebar
This is not ready for review, but I un-Drafted it to trigger the zip build. |
@johnwatkins0 the "Lint: JS" job is failing so zip builds won't occur. |
…-validation-sidebar
Plugin builds for 96c1a96 are ready 🛎️!
|
9386754
to
28cd8a3
Compare
Co-authored-by: Pierre Gordon <[email protected]>
Co-authored-by: Pierre Gordon <[email protected]>
…b.com/ampproject/amp-wp into feature/3821-block-validation-sidebar
Co-authored-by: Pierre Gordon <[email protected]>
I think we can handle this better in the follow-up issue to adding filters and updating the design. @jwold is currently working on the visual design for that.
This is indeed problematic, but I'm not sure of the best solution given that the AMP plugin doesn't know what types of styles the theme might be applying to the editor. Similar issues can occur with core styles also. So I think we can probably leave this one alone.
Done in 1d6a0a3
Fixed in b1a6a11 |
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.
This works well so far. The only quirk I found is with the AMP toolbar button, where it can now be used to toggle the error panel in the sidebar. Is that intended? I'd imagine it should only be able to open the error panel.
amp_toolbar_button_click.mp4
Yes, I see what you mean. Updated in 29cf878. The button will only open the error, not close it. |
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.
Nicely done! 👌
…821-block-validation-sidebar * 'develop' of github.com:ampproject/amp-wp: (95 commits) Simplify logic to ensure -1 <= limit_per_type <= PHP_INT_MAX Ensure amp_url_validation_limit_per_type filter returns int Mark URLValidationProvider and ScannableURLProvider as internal Guard against empty post ID causing global post to be returned by get_post() Make RecurringBackgroundTask::schedule_event() final Fix ability for BackgroundTaskDeactivator to unschedule hooks Reduce URLValidationCron frequency to daily Remove obsolete test assertion Make CronBasedBackgroundTask non-Conditional Update service name for SavePostValidationEvent and add to PHPSTORM_META Add missing $args to wp_next_scheduled() call after 1419ef4 Switch to google-github-actions/setup-gcloud action Only run PHPStan if there is a modified PHP file Run composer update Ensure alphabetical order for patches in composer.json Use PHPStan ignore for 'cannot cast array to int' Reorder composer.json fields Update param type for phpstan Remove obsolete amp_is_canonical() examples Reorder composer.json fields ...
Fixed in ec509b8: |
<ErrorTypeIcon type={ type } /> | ||
</div> | ||
{ type && ( | ||
<div className={ `amp-error__error-type-icon amp-error__error-type-icon--${ type?.replace( /_/g, '-' ) }` }> |
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.
Optional chaining is unnecessary here since type &&
ensures it is defined, no?
<div className={ `amp-error__error-type-icon amp-error__error-type-icon--${ type?.replace( /_/g, '-' ) }` }> | |
<div className={ `amp-error__error-type-icon amp-error__error-type-icon--${ type.replace( /_/g, '-' ) }` }> |
@@ -70,15 +69,14 @@ export function Error( { clientId, status, term_id: termId, ...props } ) { | |||
{ __( 'Select block', 'amp' ) } | |||
</Button> | |||
) } | |||
<a | |||
<ExternalLink | |||
href={ detailsUrl.href } | |||
target="_blank" |
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.
Instead of _blank
we may want this to be a consistent name like validated-url-post-${ postId }
so that each of the View Details links will be routed to the same tab.
@@ -100,10 +99,9 @@ export function Sidebar() { | |||
|
|||
<p> | |||
{ reviewLink && ( | |||
<a href={ reviewLink } className="amp-sidebar__review-link" target="_blank" rel="noreferrer"> | |||
<ExternalLink href={ reviewLink } className="amp-sidebar__review-link"> |
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.
Co-authored-by: Pierre Gordon <[email protected]>
Summary
Fixes #3821
Fixes #3673
On the editor screen, this moves all info about validation errors into a new editor sidebar.
Note: The new
BlockSources
PHP class is used to get the plugin or theme name responsible for a block (if the block is registered in PHP). It depends on a filter that was introduced in WP 5.5, though, so in older versions of WP the "Source" line falls back to the registered block name (e.g.,contact-form/form
) similar to how blocks are currently shown on the URL validation screen. Like this:Checklist