-
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
Add block directory to inserter menu #17431
Conversation
Cache search results.
if ( ! asset ) { | ||
return; | ||
} | ||
const existing = document.querySelector( `script[src="${ asset.src }"]` ); |
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.
The biggest challenge here is that it doesn't ensure that all dependencies of the script are loaded. It probably won't be the case on the edit post page though unless someone uses one of the WordPress script handles which are not used on this page.
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.
Ah, great point. Let's think about this some more and address it in a follow-up PR.
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.
Adding an update:
This problem could potentially be addressed here:
From #16524 (comment):
Should we close all those PRs? |
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.
Great work everyone ❤️ |
All these |
Thank you, team. @noisysocks, @talldan: You guys are awesome! I appreciate your final push to merge this big one!
|
@ck-lee great work on this PR 🎉 |
import { DownloadableBlocksPanel } from '@wordpress/block-directory'; | ||
import { useState } from '@wordpress/element'; | ||
|
||
function InserterMenuDownloadableBlocksPanel() { |
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.
@noisysocks and @talldan - it looks like all the code from '@wordpress/block-directory' will still get downloaded even when it's disabled for the user with the GUTENBERG_PHASE
flag. We need to find a way to tree-shake this code for WordPress core.
} | ||
|
||
<div className="block-directory-downloadable-block-header__column"> | ||
<span role="heading" className="block-directory-downloadable-block-header__title" > |
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.
The end-to-end AXE tests require an aria-level
be provided when using role="heading"
https://dequeuniversity.com/rules/axe/3.5/aria-required-attr?application=axe-puppeteer
Normally it's not caught in end-to-end tests, but due to some unexpected circumstances, it's become an issue lately (#22712).
What is the intended level here?
Why can't it just be a semantic heading element, vs. role=
?
See: #22713
Moved over from #16524. Props to @ck-lee for all the hard work on the original PR.
Description
Extend the inserter to show available blocks for download and silently install the block when the block is inserted into the editor
This PR is still a WIP. Can you help guide me with the implementation and avoiding any pitfalls? I'm new to the block editor.
Screenshots
Types of changes
Relevant Links
[design] Main thread
https://make.wordpress.org/design/2019/04/26/block-library-installing-blocks-from-within-gutenberg/
[design] Figma
https://www.figma.com/file/QKhoOKXkBN2mHacqvrtdNuI6/Gutenberg-Block-Library%3A-Installation
[design] Mockup feedback
https://make.wordpress.org/design/2019/06/07/block-library-mockups-prototype
[dev] Block Directory Proposal
https://make.wordpress.org/meta/2019/03/08/the-block-directory-and-a-new-type-of-plugin/
[dev] Block Registration
https://github.com/WordPress/gutenberg/blob/master/docs/rfc/block-registration.md
[dev] Block Registration - assets JSON structure
#13693 (comment)
GitHub Block Directory issues
https://github.com/WordPress/block-directory/issues
GitHub Block Directory project
https://github.com/WordPress/block-directory/projects/1