Skip to content

Warning when enqueuing styles for a plugin in iframed Full Site Editor #33212

@leeshadle

Description

@leeshadle

Description

There is a warning in the iframed Full Site Editor when enqueueing a stylesheet that isn't associated with a block.

I build a lot of plugins that use block filters only to enhance core blocks, which don't require creating custom blocks.

For plugins, the warning suggests using the block API's style or editorStyle:

Screen Shot 2021-07-05 at 6 17 59 PM

I'm creating this issue b/c I'm concerned that there may not be a way to properly enqueue stylesheets in the iframed editor without being associated with a block.

Step-by-step reproduction instructions

  1. Enqueue stylesheet for a plugin in the Full Site Editor:
function enqueue_editor_styles() {
  // Enqueue editor only styles.
  wp_enqueue_style(
    'my-plugin-block-editor',
    plugin_dir_url( __FILE__ ) . 'build/index.css',
    array(),
    '1.0.0'
  );
}
add_action(  'enqueue_block_editor_assets', 'enqueue_editor_styles'  );
  1. Go to Site Editor
  2. Open browser console to see warning

WordPress information

  • WordPress version: 5.7.2
  • Gutenberg version: 10.9.1
  • Are all plugins except Gutenberg deactivated? No
  • Are you using a default theme (e.g. Twenty Twenty-One)? No

Device information

  • Device: Desktop
  • Operating system: macOS Catalina
  • Browser: Chrome 91.0.4472.114

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Site EditorRelated to the overarching Site Editor (formerly "full site editing")

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions