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

External Media: support editor changes in WordPress 6.5 #36188

Merged
merged 10 commits into from
May 6, 2024

Conversation

jeherve
Copy link
Member

@jeherve jeherve commented Mar 5, 2024

Fixes #36186

Proposed changes:

Add a new conditional to ensure the External Media feature continues to work with WordPress 6.5.

This should also avoid warnings like this one:

select( 'core/edit-post' ).isInserterOpened is deprecated since version 6.5. Please use select( 'core/editor' ).isInserterOpened instead. [index.js:77:9](wp-content/plugins/gutenberg/packages/deprecated/src/index.js)

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

  • No

Does this pull request change what data or activity we track or use?

  • No

Testing instructions:

  • Install the WordPress Beta Tester plugin
  • Go to Posts > Add New
  • Add a new image block
  • Pick one of the external media sources like Pexels
    • You should be able to pick an image from there.
  • Go to Tools > WordPress Beta Tester
  • Switch to Bleeding edge
  • Go to Dashboard > updates and update to a bleeding edge version of WordPress
  • Repeat your external media test to ensure the feature continues to work with WordPress 6.5.
  • Ensure you do not see the warning above when opening the browser's JavaScript console.

@jeherve jeherve added [Status] In Progress [Type] Janitorial [Pri] Normal [Extension] External Media Extend all block editor media tools to support external providers labels Mar 5, 2024
@jeherve jeherve self-assigned this Mar 5, 2024
@github-actions github-actions bot added the [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ label Mar 5, 2024
Copy link
Contributor

github-actions bot commented Mar 5, 2024

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Once your PR is ready for review, check one last time that all required checks appearing at the bottom of this PR are passing or skipped.
Then, add the "[Status] Needs Team Review" label and ask someone from your team review the code. Once reviewed, it can then be merged.
If you need an extra review from someone familiar with the codebase, you can update the labels from "[Status] Needs Team Review" to "[Status] Needs Review", and in that case Jetpack Approvers will do a final review of your PR.


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen daily.
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly. The next release is scheduled for June 4, 2024 (scheduled code freeze on May 27, 2024).

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

Copy link
Contributor

github-actions bot commented Mar 5, 2024

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WordPress.com Simple site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin, and enable the update/external-media-store branch.

  • To test on Simple, run the following command on your sandbox:

    bin/jetpack-downloader test jetpack update/external-media-store
    

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

// @to-do: remove exception when Jetpack requires WordPress 6.5.
// eslint-disable-next-line
// @ts-ignore
select( 'core/editor' )?.isInserterOpened?.() ||
Copy link
Member Author

Choose a reason for hiding this comment

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

This doesn't work, I still get a Uncaught TypeError: o.select(...).isInserterOpened is not a function. I don't understand why. What would be the best approach here?

@jeherve
Copy link
Member Author

jeherve commented Mar 13, 2024

I can't figure out how to get rid of the warning, TypeScript drives me a bit crazy.

@renatoagds Since you worked on #35904, do you think you could take a look? I can't figure out how to get rid of the warning when running WordPress 6.5.

Thank you!

@renatoagds
Copy link
Contributor

@jeherve sorry for the long delay here, just pushed an update, can you check if it's working for you?

@jeherve
Copy link
Member Author

jeherve commented May 6, 2024

@renatoagds Thank you! This works well for me!

@jeherve jeherve added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. [Status] Needs Team Review and removed [Status] In Progress labels May 6, 2024
@jeherve jeherve requested a review from a team May 6, 2024 13:49
@jeherve jeherve enabled auto-merge (squash) May 6, 2024 13:49
Copy link
Contributor

@monsieur-z monsieur-z left a comment

Choose a reason for hiding this comment

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

Works as advertised :shipit:

@jeherve jeherve merged commit ebf9b83 into trunk May 6, 2024
57 checks passed
@jeherve jeherve deleted the update/external-media-store branch May 6, 2024 18:03
@github-actions github-actions bot added this to the jetpack/13.3.2 milestone May 6, 2024
@github-actions github-actions bot removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. [Status] Needs Team Review labels May 6, 2024
pkuliga pushed a commit that referenced this pull request May 9, 2024
* External Media: support editor changes in WordPress 6.5

Fixes #36186

* Avoid build errors

* Try to be more explicit in checking for isInserterOpened

* Another try around TypeScript

* Media Store: Update call to is inserter opened

---------

Co-authored-by: Renato Augusto Gama dos Santos <[email protected]>
@jeherve jeherve modified the milestones: jetpack/13.3.2, jetpack/13.5 May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Extension] External Media Extend all block editor media tools to support external providers [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Pri] Normal [Type] Janitorial
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WP 6.5 compat: unification of the site and post editors
3 participants