4shared

On Wednesday, the Gutenberg team released version 8.1.0 of the plugin. The update includes a new block-copying feature, block pattern search, testimonials pattern, and API changes. The new version does not add a lot of major user-facing changes but improves the experience overall.

The update included two dozen bug fixes and nearly as many enhancements. This release feels more like a solid update that addresses many minor items and nit-picks, such as the addition of black and white colors for the default color palette. The ability to paste a document into the post title input, which gets transformed into proper blocks, works great too.

One nice improvement is the ability to transform the HTML block to the Code block and vice versa. File this one under why has this not already been possible?

If you are following along with the Gutenberg plugin, there are some definite improvements to look forward to in this release, particularly around the block patterns feature.

Copy Blocks with Ease

Screenshot of copying a pullquote block in the WordPress editor.
Copying a pullquote block.

Admittedly, this is quickly becoming one of my favorite features of Gutenberg 8.1. The editor toolbar now has a copy button, which allows end-users to copy one or more blocks at the click of a button. It is tucked under the “more rich text controls” dropdown menu.

To use the new copy feature, simply select the block or blocks you want to copy. Then, click the copy button. From that point, the block can be pasted back into the editor.

For theme authors, plugin developers, or anyone who wants to share the code for a block, copying a block also produces the HTML that can be pasted into a text editor. No more switching to the code view of the editor and hunting down the HTML you want to copy. For example, the pullquote copied from the post in the above screenshot produced the following HTML when pasting into my text editor:

<!-- wp:pullquote {"align":"wide"} -->
<figure class="wp-block-pullquote alignwide"><blockquote><p><span class="rtex-highlighter-0">What has the Duke of Devonshire? The only great instance that I have ever known of the enjoyment of wealth was, that of Jamaica Dawkins...</span></p></blockquote></figure>
<!-- /wp:pullquote -->

This should make it easy for developers to copy the code of their custom block patterns.

Testimonials Pattern

Screenshot of the Gutenberg plugin's Testimonials block pattern.
New pattern for testimonials.

The team added to its growing collection of block patterns with the addition of the Testimonials pattern. The new pattern brings the library to eight in total. It is unclear which patterns will launch when the feature lands in WordPress core. It is still under heavy development and is experimental.

The Testimonials pattern is one of the more complex patterns the team has introduced. It is a mix of groups, columns, images, and paragraphs. At points, the blocks are six levels deep.

Overall, it worked well among the various themes I tested it against with custom block styles. Visually, it is not inspiring, at least in comparison to what a good designer can do with a testimonials section, but it is a solid stepping stone on the way to more interesting layouts.

Inserter UI Adds Search and Titles

Screenshot of the block editor inserter with a pattern search box.
Search for block patterns via the inserter section.

Crossing off two out of three big wish list items from my Gutenberg 8.0 post, the team added search functionality and reintroduced the pattern titles below each pattern in the inserter. These are major improvements. The only item left on my list is for the team to introduce a categorization system for patterns.

The search box switches from searching for blocks to patterns once clicking on the patterns tab. The one issue is the search label and placeholder reads “Search for a block” in both instances. Instead, it should read “Search for a pattern” when searching patterns.

With my wish list nearly fulfilled for block patterns, I have one more item to add. I would like to see the team introduce slash commands to insert patterns. Typing /testimonials should provide users the option to insert the new Testimonials pattern without clicking the inserter button.

Developers: Block Patterns API Changes

The Block Patterns API methods of registering and unregistering patterns have changed. In previous versions, developers used the register_pattern() and unregister_pattern() functions. These have been deprecated. Beginning with 8.1.0, developers should update their code to use the register_block_pattern() and unregister_block_pattern() functions.

This API change is welcome. It is needed for clarity. However, this sort of API change, even on an experimental feature, is one of the many things that frustrates developers who are attempting to keep up with the project. It is especially frustrating when the discussion was originally opened when the feature was first merged. Naming things is hard. It is one of the hardest things to do in programming, but good naming schemes can also be the difference between great software and poor software. There should be more careful thought and thorough explanations when these issues pop up in tickets.