Tag Archives: Gutenberg

Blog Updated to WordPress v5.0.1

Well, I just updated my blog to WordPress 5.0.1 which seems to be some kind of hotfix. (Further reading shows it to be a Security Release.) As always, I backed up my files and database first. I have automatic updates disabled so I can do this beforehand. As I always do, I updated the local copy on my PC before updating my blog here.

At the same time, I noticed that the TinyMCE Advanced plugin I use also had an update to version 4.8.1. It now has a Hybrid Mode where it replaces the normal Paragraph block with a Classic Paragraph block. This allows the use of the classic interface while having access to all the newer Gutenberg block editor features. I’m playing with it now. So far, the update seems to have gone smoothly. 馃檪

Blog Updated to WordPress 5.0

Well, I just updated my blog to the big WordPress 5.0 version which includes the new default editor, Gutenberg. As always, I backed up my files and database first. I have automatic updates disabled so I can do this beforehand. As I always do, I updated the local copy on my PC before updating my blog here.

Installing the update automatically disabled the separate Gutenberg plugin, which I then deleted. The TwentyTwelve theme I use also had an update to version 2.6 to become Gutenberg compatible. This update included editor styles to match how the theme looks on the front-end. There were no real code changes in the theme from the previous version that I had to include in my child theme. Just some tweaks to the style.css were needed (more on this later).

Following are some of my experiences and possible solutions to issues so far.

How to Change Inline Text Color Easier

One of the more annoying issues I’ve had with Gutenberg is not being able to change the color of text in a paragraph easily.  All you can do with the default tools is change the color of a complete paragraph. Luckily, someone has made the Advanced Rich Text Tools for Gutenberg which makes changing the color of words much easier within a paragraph.

Correcting Appearance of Variable Width Table Cells

The Table block currently has some real issues when using variable width table cells. If a couple columns have just one or two words and a third has a long paragraph, it will squash the other cells such that they’ll have one or two characters per line.  There’s an issue concerning this: Min-width needed on table columns 路 Issue #11266 路 WordPress/gutenberg. As I mention there, the following CSS was the cause:

.wp-block-table td, .wp-block-table th {
   padding: .5em;
   border: 1px solid currentColor;
   word-break: break-all;
}

I corrected it by putting the following in my theme’s style.css and my custom editor blocks.css file:

.wp-block-table td, .wp-block-table th {
   word-break: unset;
}

Oh, to load custom editor styles, create a blocks.css file in your child theme’s directory and add the following to the theme’s functions.php:

function mytheme_block_editor_styles() {
    wp_enqueue_style( 'mytheme-block-editor-styles', get_theme_file_uri( '/blocks.css' ), false, '1.0', 'all' );
}

add_action( 'enqueue_block_editor_assets', 'mytheme_block_editor_styles' ,100);

Stop Loading Google Fonts in Editor

So far I have not been able to make it stop loading the fonts from Google when editing a post even though I am specifying a locally hosted font (which it also loads). For now, I have submitted the following support question: Topic: V2.6, Make editor not load Google Fonts | WordPress.org

Anyway, these are my issues so far with WordPress 5.0 and Gutenberg. 馃檪 For those that can’t deal with Gutenberg now, you can install the Classic Editor plugin.

Gutenberg 3.90 Video Embed Test

I am making this test after reading: Topic: Big white space above youtube video since last update | WordPress.org. Below will be a YouTube video block.

This is the next paragraph after the video. With no caption looks like I need to add some bottom padding/margin on the front-end.

On further examination, the reason I don’t see the issue is due to the plugins I use and my Twenty Twelve theme which hasn’t been Gutenbergized yet.聽 Many of the following CSS classes simply aren’t defined on the front-end:

<figure class="wp-block-embed-youtube aligncenter wp-block-embed is-type-video is-provider-youtube wp-has-aspect-ratio wp-embed-aspect-16-9">
   <div class="wp-block-embed__wrapper">
      <iframe src="https://www.youtube.com/embed/UQyEcspdYfY?feature=oembed" allow="autoplay; encrypted-media" allowfullscreen="" width="625" height="352" frameborder="0">
      </iframe>
   </div>
</figure>

Currently, there is a WordPress/Gutenberg GitHub Issue concerning this.

Gutenberg 3.70 Centered Image Test

Update: Gutenberg 3.80 has corrected the centered image issue.

The following should be a centered Image Block

Card I got from my sister for Halloween 2017.

As you can see, it’s not centered.聽 Looks like the following style from Gutenberg is causing the image to move left:

.wp-block-image .aligncenter, .wp-block-image .alignleft, .wp-block-image .alignright, .wp-block-image.is-resized {
   display: table;
   margin: 0;
}

It’s overriding the <figure>’s CSS of:

.aligncenter {
   display: block;
   margin-left: auto;
   margin-right: auto;
}

This is a known issue: Alignment: images cannot be centered on front-end [3.7] 路 Issue #9503 路 WordPress/gutenberg

To work around it for now, you can put the following CSS into your theme’s style.css ( ideally a child theme ) or go the Dashboard -> Appearance -> Customize -> Additional CSS and add it there.

/* Gutenberg Tweaks */
.wp-block-image .aligncenter, .wp-block-image .alignleft, .wp-block-image .alignright, .wp-block-image.is-resized {
   margin: auto;
}

Whenever they update Gutenberg to correct the issue, the above can be removed as it will be redundant.