WordPress.org

Make WordPress Core

Opened 2 months ago

Closed 6 weeks ago

#53696 closed defect (bug) (fixed)

wp_add_iframed_editor_assets_html() not checking for block editor

Reported by: swissspidy Owned by: peterwilsoncc
Milestone: 5.8.1 Priority: normal
Severity: normal Version: 5.8
Component: Editor Keywords: has-patch commit fixed-major
Focuses: Cc:

Description

wp_add_iframed_editor_assets_html in WP 5.8 adds some inline JavaScript in the admin footer on post.php/post-new.php even if the current screen does not use the block editor.

This JS should not be added if using a different editor.

The function should use WP_Screen::is_block_editor() accordingly.

Attachments (1)

53696.diff (467 bytes) - added by desrosj 2 months ago.

Download all attachments as: .zip

Change History (6)

@desrosj
2 months ago

#1 @desrosj
2 months ago

  • Keywords has-patch added; needs-patch removed

#2 @peterwilsoncc
7 weeks ago

  • Keywords commit added

53696.diff looks good to me, testing notes:

  • Confirmed presence of scripts on post edit page
  • Enabled classic editor, confirmed scripts still present
  • Applied patch
  • Confirmed scripts no longer present on classic editor
  • Disabled classic editor, confirmed scripts present on block editor

All dandy 🌻

#3 @peterwilsoncc
7 weeks ago

  • Owner set to peterwilsoncc
  • Resolution set to fixed
  • Status changed from new to closed

In 51540:

Editor: Prevent block-editor JavaScript loading in other editors.

Add a check to wp_add_iframed_editor_assets_html() confirming the edit post screen is using the block-editor before including block-editor specific JavaScript. For the classic and other editors the function returns early without any output.

Props swissspidy, desrosj.
Fixes #53696.

#4 @peterwilsoncc
7 weeks ago

  • Keywords fixed-major added
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening for merging to the 5.8 branch.

#5 @desrosj
6 weeks ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 51593:

Editor: Prevent block-editor JavaScript loading in other editors.

Add a check to wp_add_iframed_editor_assets_html() confirming the edit post screen is using the block-editor before including block-editor specific JavaScript. For the classic and other editors the function returns early without any output.

Props swissspidy, desrosj, peterwilsoncc.
Merges [51540] to the 5.8 branch.
Fixes #53696.

Note: See TracTickets for help on using tickets.