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

Fix Template Inserter #3020

Merged
merged 7 commits into from
Aug 13, 2019
Merged

Fix Template Inserter #3020

merged 7 commits into from
Aug 13, 2019

Conversation

miina
Copy link
Contributor

@miina miina commented Aug 13, 2019

Fixes #3016.
Closes #2887

Todo:

  • Fix Template style.
  • E2E

@googlebot googlebot added the cla: yes Signed the Google CLA label Aug 13, 2019
@miina miina marked this pull request as ready for review August 13, 2019 14:55
@miina miina changed the title [WIP] Fix Template Inserter Fix Template Inserter Aug 13, 2019
const templateContents = await page.evaluate( () => {
const contents = [];
const previews = document.querySelectorAll( '.block-editor-block-preview .block-editor-inner-blocks.has-overlay' );
previews.forEach( function( preview, index ) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sounds like an ideal use case for Array.prototype.reduce :-)

@swissspidy
Copy link
Collaborator

We might need to add another block deprecation for the quote block:

Content generated by `save` function:

<blockquote class="wp-block-quote has-text-align-center is-style-white"><p>Everyone soon or late comes round Rome</p><cite>Robert Browning</cite></blockquote>

Content retrieved from post body:

<blockquote style="text-align:center" class="wp-block-quote is-style-white"><p>Everyone soon or late comes round Rome</p><cite>Robert Browning</cite></blockquote>

Gutenberg is going away from these text-align inline styles.

@miina
Copy link
Contributor Author

miina commented Aug 13, 2019

Gutenberg is going away from these text-align inline styles.

If that happens then perhaps the deprecation will be implemented upstream instead?

@swissspidy
Copy link
Collaborator

They did: WordPress/gutenberg#16779

Does that mean it's not working? 🤔 Or are we perhaps overriding the core deprecation?

@swissspidy
Copy link
Collaborator

In any case, we can look at that independent from this PR if needed.

@miina
Copy link
Contributor Author

miina commented Aug 13, 2019

Will check if that's an easy fix.

@miina
Copy link
Contributor Author

miina commented Aug 13, 2019

Does that mean it's not working? 🤔 Or are we perhaps overriding the core deprecation?

It means that it was working properly, otherwise, it would have given a block validation error inside the template :)

Updated the template and seems to work OK now (OK meaning without console errors).

@kienstra
Copy link
Contributor

Approved

Hi @miina,
This looks good. The Template Inserter now displays as expected, when using the lastest from the master branch of Gutenberg.

Before

before-inserter-broken

After

template-inserter-works-expected

@miina miina merged commit 794555b into develop Aug 13, 2019
@miina miina deleted the fix/3016-template_inserter branch August 13, 2019 17:51
@westonruter westonruter added this to the v1.2.1 milestone Aug 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Signed the Google CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Template Inserter broken E2E Tests: Template Insertion
5 participants