Skip to content
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

Autocompleters: Consider block category #12287

Conversation

tyxla
Copy link
Member

@tyxla tyxla commented Nov 25, 2018

Description

In #9999 we updated the inserter to respect the block categories when searching. This PR applies the update to the block autocompleters, which allows us to use the slash inserter with a block category, revealing all the blocks from that category.

How has this been tested?

  • Start a new post.
  • In a new paragraph block type /CATEGORY where CATEGORY is one of the block categories (common, formatting, 'layout, widgets`, etc.)
  • Verify that all the blocks under that category appear in the list.

Screenshots

Types of changes

  • Now considering category when searching for blocks in slash inserter / block autocompleters.
  • Added tests to verify we consider the category in autocompleters.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.

Copy link
Member

@jorgefilipecosta jorgefilipecosta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 I tested the default configuration and I used filters to register custom categories and in both cases, the tests went well.

@jorgefilipecosta jorgefilipecosta added this to the 4.7 milestone Nov 26, 2018
@youknowriad youknowriad merged commit e02bec8 into WordPress:master Nov 30, 2018
daniloercoli added a commit that referenced this pull request Nov 30, 2018
…rnmobile/danilo-try-to-fix-undo-redo

* 'master' of https://github.com/WordPress/gutenberg:
  Autocompleters: Consider block category (#12287)
  Only init TinyMCE once per instance (#12386)
  RichText: convert HTML formatting whitespace to spaces (#12166)
  Notices: Remove "files" block in package.json (#12438)
  Edit Post: Avoid rendering AdminNotices compatibility component (#12444)
  Correct the docs manifest (#12411)
@tyxla tyxla deleted the update/block-autocompleters-include-category branch November 30, 2018 09:12
daniloercoli added a commit that referenced this pull request Nov 30, 2018
…HEAD

* 'master' of https://github.com/WordPress/gutenberg:
  [RNmobile] Fix problems with undo/redo on Android (#12417)
  Add registry param to withDispatch component (#11851)
  Autocompleters: Consider block category (#12287)
  Only init TinyMCE once per instance (#12386)
  RichText: convert HTML formatting whitespace to spaces (#12166)
  Notices: Remove "files" block in package.json (#12438)
  Edit Post: Avoid rendering AdminNotices compatibility component (#12444)
  Correct the docs manifest (#12411)
@mtias mtias added [Feature] Inserter The main way to insert blocks using the + button in the editing interface Needs Design Feedback Needs general design feedback. labels Dec 6, 2018
@mtias
Copy link
Member

mtias commented Dec 6, 2018

Once concern here is that it is not clear at all what the search is matching for to the user, specially for partial matches. There's already an issue for this regarding aliases of blocks.

cc @jasmussen @alexislloyd

@jasmussen
Copy link
Contributor

Yes, this is tricky, and we've already had some challenges around this with a search for "Image" that also matches a gallery. And because we sort by frequently used, the 2nd time you search for /image and press enter if you just inserted a gallery, you'll get an image.

I think we should start work on #5643 before we expand this search further. Ideally when you type /image and press Enter, you should always get an image. Once we have that in place, we have a good baseline.

In the case of this PR, I get the purpose behind it, but the challenge is the same. I can easily imagine a block existing called "Layout", which would confuse this search even further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Inserter The main way to insert blocks using the + button in the editing interface Needs Design Feedback Needs general design feedback.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants