packages/js/email-editor/src/hacks/README.md
We intentionally call these "hacks" because they are workarounds for missing upstream APIs in WordPress/Gutenberg. Our goal is to work upstream with the WordPress and Gutenberg teams to get proper APIs added so we can remove these workarounds.
Each hack below represents functionality that should ideally be supported through official WordPress/Gutenberg APIs.
Purpose: Renders a portal for displaying notices before the visual editor.
Missing Upstream API: There is currently no API to add notices with custom context to the content area in the block editor.
What it does: Creates a DOM portal that inserts a container as the first child of the visual editor, allowing notices to be rendered in a custom location.
Upstream solution needed: An official API for registering custom notice contexts and controlling notice placement within the editor.
Purpose: Conditionally hides the default publish button and adds a custom "Send" button for email posts.
Missing Upstream API: No official way to customize or replace the publish button behavior based on specific post type requirements.
What it does:
Upstream solution needed: An official API for customizing or replacing the publish button, including the ability to register custom save actions for specific post types.
Purpose: Replaces the default "Move to Trash" action with a custom implementation for email posts.
Missing Upstream API: While entity actions can be registered, there's no clean way to customize the built-in trash behavior without unregistering and re-registering.
What it does:
move-to-trash actioncore.registerPostTypeSchema (WP 6.8+) and core.registerPostTypeActions (WP 6.7+) for compatibilityUpstream solution needed: A filter or configuration option to customize built-in entity actions without needing to unregister and re-register them.
Purpose: Adapts template actions for email templates to work around the "Active Templates" feature introduced in WordPress/Gutenberg.
What it does:
wp_template post typeSolution needed: We need to find out how to align the email editor with the Active Templates feature. We should aim to integrate with the Site editor to add support for email templates and that way we could support the template management and new actions introduced in the Active Templates feature.