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 the broken style tag HTML in iframe that renders a pattern #86621

Merged
merged 1 commit into from
Jan 22, 2024

Conversation

okmttdhr
Copy link
Member

@okmttdhr okmttdhr commented Jan 19, 2024

Related to #85489

Proposed Changes

This PR fixes the broken style tag HTML in iframe that renders a pattern.

before after
Image Screenshot 2024-01-19 at 14 41 52
Details

The font styles are safely injected.
Screenshot 2024-01-19 at 14 59 12

old version (__unstableResolvedAssets.styles[n].id was needed, as it's being used)
https://github.com/WordPress/gutenberg/blob/f77958cfc13c02b0c0e6b9b697b43bbcad4ba40b/packages/block-editor/src/components/iframe/index.js#L118

new version
https://github.com/WordPress/gutenberg/blob/33b6e64/packages/block-editor/src/components/iframe/index.js#L117

Testing Instructions

  • Open Calypso Live
  • Go to the Assembler
  • Click any pattern category
  • Inspect the HTML in the iframe of a pattern

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • https://wpcalypso.wordpress.com/devdocs/docs/testing/index.md for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-ajp-p2)?

Copy link

github-actions bot commented Jan 19, 2024

@matticbot
Copy link
Contributor

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug fix/pattern-iframe-html on your sandbox.

@matticbot
Copy link
Contributor

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Sections (~35 bytes removed 📉 [gzipped])

name         parsed_size           gzip_size
import-flow        -51 B  (-0.0%)      -35 B  (-0.0%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Async-loaded Components (~63 bytes removed 📉 [gzipped])

name                                                                         parsed_size           gzip_size
async-load-automattic-global-styles-src-components-global-styles-variations        -51 B  (-0.0%)      -29 B  (-0.0%)
async-load-automattic-design-preview                                               -51 B  (-0.0%)      -34 B  (-0.0%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@okmttdhr okmttdhr marked this pull request as ready for review January 19, 2024 06:03
@okmttdhr okmttdhr requested review from noahtallen and a team January 19, 2024 06:04
@matticbot matticbot added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Jan 19, 2024
@okmttdhr okmttdhr self-assigned this Jan 19, 2024
// Use fake assets to eliminate the compatStyles without the id.
// See https://github.com/WordPress/gutenberg/blob/f77958cfc13c02b0c0e6b9b697b43bbcad4ba40b/packages/block-editor/src/components/iframe/index.js#L127
const settings = {
__unstableResolvedAssets: {
styles: '<style id="" />',
},
};

const settings = {};
Copy link
Member Author

Choose a reason for hiding this comment

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

The Iframe component has been updated, so adding an empty style here is no longer necessary.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

@taipeicoder taipeicoder left a comment

Choose a reason for hiding this comment

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

LGTM 👍

// Use fake assets to eliminate the compatStyles without the id.
// See https://github.com/WordPress/gutenberg/blob/f77958cfc13c02b0c0e6b9b697b43bbcad4ba40b/packages/block-editor/src/components/iframe/index.js#L127
const settings = {
__unstableResolvedAssets: {
styles: '<style id="" />',
},
};

const settings = {};
Copy link
Contributor

Choose a reason for hiding this comment

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

@okmttdhr okmttdhr merged commit a9d53c6 into trunk Jan 22, 2024
23 of 26 checks passed
@okmttdhr okmttdhr deleted the fix/pattern-iframe-html branch January 22, 2024 05:13
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants